home | occ24

Old Computer Challenge 2024

This is a Web page not a blog: scroll\page down for more recent additions or use the links below.

Day: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9+ | Finished document!

Previous challenges: 2021 | 2022 | 2023

Friday 12th July 2024: Actually using troff

The old computer challenge (OCC) this year has a 'do it yourself' theme.

The theme of my OCC week this year is using groff to produce a short document as a pdf file for printing. Groff provides a complete typesetting environment, and is very much smaller than LaTeX. Marked up text can be typeset very quickly usually in a single pass. Most unix-like operating systems (Linux, *BSDs) will have a troff system in their repository as the unix man pages are often formatted on the fly using (g)troff.

I'll use the more modern mom macros written by Peter Schaffter, together with the preprocessors eqn, tbl and pic and grap to produce a short guide to using a spreadsheet to explore simple mathematical functions. The guide will be pitched at GCSE Foundation maths level here in the United Kingdom. GCSE Maths exams are taken by most 16 year olds in June and sometimes in November, so we are not looking at anything very advanced.

In a way I'm going outside of my comfort zone by using a command line editor (probably nvi providing vi) and a simple typesetting pipeline. But the guide is about a common GUI application. I shall use Gnumeric on the netbook as I know that Gnumeric runs well on lower end hardware.

Hardware

I have taken a 2008 vintage Samsung NC10 netbook off the shelf for this week. This is not my oldest device: my Thinkpad T42 was manufactured in 2005 and is going strong. But the NC10 is small and light and can be tossed into a day bag very easily. Details from neofetch;

keith@NC10:~/seamonkey$ neofetch
_,met$$$$$gg. keith@NC10
,g$$$$$$$$$$$$$$$P. ----------
,g$$P" """Y$$.". OS: Debian GNU/Linux 11 (bullseye) i686
,$$P' `$$$. Host: NC10
',$$P ,ggs. `$$b: Kernel: 5.10.0-30-686-pae
`d$$' ,$P"' . $$$ Uptime: 1 hour, 35 mins
$$P d$' , $$P Packages: 1628 (dpkg)
$$: $$. - ,d$$' Shell: bash 5.1.4
$$; Y$b._ _,d$P' Resolution: 1024x600
Y$$. `.`"Y$$$$P"' DE: LXDE
`$$b "-.__ WM: Openbox
`Y$$ WM Theme: Clearlooks-3.4
`Y$$. Theme: Clearlooks [GTK2/3]
`$$b. Icons: nuoveXT2 [GTK2/3]
`Y$$b. Terminal: lxterminal
`"Y$b._ Terminal Font: DejaVu Sans Mono 10
`""" CPU: Intel Atom N270 (2) @ 1.600GHz
GPU: Intel Mobile 945GM/GMS/GME, 943/940GML Expre
Memory: 668MiB / 990MiB

With 1 Gb of RAM, this netbook struggles a little with Firefox, so I'm using the i386 Seamonkey binaries downloaded from the Seamonkey project page as browser, Web page editor and when needed a rich text capable email client. I was going to put OpenBSD on the netbook but Debian oldstable Bullseye is running really well so I thought I'd leave it. A new aftermarket battery (5400 mAh) is giving me 5 hours of mobile runtime.

The outline

Below is a very rough outline of the document I shall be trying to write.

Mind map and outline for
        Spreadsheets in Maths

We shall see how far I get during the week! I intend to mock up the spreadsheet and a few X-Y plots as examples using tbl and grap. I like the idea of producing a document from one text file.

13th July: Strategy

I've decided to crank out all the text in a plain text file first before adding the groff/mom markup. By getting the text more or less written I can devise my example spreadsheets and make sure they provide a smooth progression from basic to more powerful spreadsheet features. I did about an hour this moring and got most of section 1 sorted out, so not much computer time today. I have already found a gap in the outline - when to introduce the idea of a cell range as used in a formula like =sum(A1:A9).

The rest of the day: we went to the afternoon performance of a play in a local theatre, and then for a meal in the city. This is the first actual play with actors I have been to for a few years now, well before the pandemic. Very slick scene changes and a clever stage set design on top of some strong comic acting.

14th July: New battery and getting sorted

Got about three hours in and half way through the text for section 3 of the outline. I've been checking through the recipes for each example spreadsheet as I write. I'm noticing differences between Gnumeric and Libreoffice Calc as I go along, so I will probably need to test everything in the Google Apps spreadsheet and the version of MS Excel you can get in Microsoft 365 which we use at work.

keith@NC10:~/Documents/occ24$ cat mem.txt 
total used free shared buff/cache available
Mem: 990 550 178 35 261 273
Swap: 975 54 921

The netbook is chugging along fine and the new after market battery is holding up well after a couple of discharge cycles down to roughly 50% and charging back up again. The output from the free command above was taken with the LX terminal and a couple of tabs running along with Gnumeric and the Seamonkey browser component. Using Firefox puts the OS straight into swap and is noticibly slower.

keith@NC10:~/Documents/occ24$ pstree | wc -l
73
keith@NC10:~/Documents/occ24$ ps aux | wc -l
140

As you can see from the above output, Debian with LXDE is not a very 'light' operating system. Plenty of processes running!

Issues: describing in words the process of replicating a formula down by dragging on the little square in the bottom right hand side of the currently selected cell requires some creative authoring.

Walked out this afternoon around the inner circle to a large park. All very quiet and people do seem to be looking forward to the football here in the UK.

15th July: Wifi in cafes and escapes

The Samsung NC10 netbook on location

Goodish progress on the writing and example spreadsheets, around 3 hours total writing. Finished section 3 now, and only the x-y plot section to draft out.

I'm going to drop sections 5 and 6 from the original outline. In their place will be an extended walk through of making a graph atlas of common functions and then a step by step exploration of trial and improvement to find an optimum solution to a problem (probably the 'tray made from a square of metal with the most volume').

I had to navigate myself around the relative/absolute cell reference issue. Just plonked it in with an explanation of what happens if you don't use absolute references when you are copying the formulas down. I'm sticking with the $ notation for absolute cell references as it is the lowest common denominator among the various spreadsheets people are likely to have. I want to get all the content sorted tomorrow Tuesday so I can start the marking up of the text file.

Silly things like I'm going to have to use a troff escape \[Do] (see man groff_char for lists of lovely escapes) to put the dollar signs in for the absolute referenced formulas because I'm using $$ as the .EQ delimiters for inline maths. Can't use any of the other symbols like ## or @@ as I will need those for the tbl markup. If mocking up the spreadsheet using tbl proves clunky or takes too much time I can fall back to screengrabs. The graphs I can do in Gnumeric and export as eps files if the grap simulations look too clunky.

Took the netbook out today but no luck with wifi - connmand  which is installed with the LXDE desktop works fine at home, but the graphical applet for connecting to random cafe wifi networks just freezes and does that thing where you can see the window underneath within the frame of the applet. Good for the Old Computer Challenge restriction on internet use, but bad for being able to use rsync to my Web space as a simple backup strategy for possibly flaky hardware. As I'm focusing on finishing the troff project, I just removed connmand and installed network-manager. I'll see if that manages better tomorrow.

Out and about: One of the places I tried out the wifi in was a very large and grand bank building, now converted for use as a meeting room building and exhibition space by a local university. Banks along with food markets used to be the places where prices were set and money was concentrated. But now, we can set prices by automatic negotiation. And money is a line in a database file.

16th July: printing and CDs

Grap of a page opening of a small book about birds taken with
      a Web cam mounted on a stand

Finished the text of the handout, so the rest of the week is sorting out the typesetting. My plan is to get the main text marked up with the inline maths equations and then to add the tables, a pic illustration of a typical spreadsheet screen and the pic/grap simulations of the graphs. Plan B is to export graphs from LibreOffice Calc as eps files and insert those. I'd like to get a complete document as a single text file though just because it is in theory possible. I was on the project and completely focused for about 4 hours today. So a lot of screen time but not frittering away on the Internet. My vi skills are slowly improving but I still get blind sided sometimes with moving into some condition where nvi suddenly changes mode.

I'm getting to like LXDE. The basic system seems solid. Some of the little applications don't work very well. The music player LXMusic claims to be able to play a music CD from an actual disk in a USB external CD drive (that isn't part of the OCC challenge, I'm just old). But it crashes when you try. Install Audacious and it works fine.

One thing that did Just Work™was getting printing working. We bought a little HP ML-15 monochrome laser printer during the Pandemic times when I could not get into the office. R needed printing for her job applications as well. We are still on the second toner cartridge. Plugged it into the NC10, ran the Print Settings applet from the LXDE Preferences menu, and typed in my admin password, and it located the correct ppd and everything. Print Settings looks like some kind of front end to CUPS. So I now have 7 sheets of crisp text to read through and totally rewrite tweak and edit slightly before I start the marking up. I can't do final editing or proof reading on screen. I have to have papers I can spread out on the table. Dinosaur me.

Another thing that just worked was plugging in my 'visualiser'. That is a Webcam mounted on a gooseneck stand like a small microphone so you can image a piece of paper or a book. There is some electronics in the base to provide autofocus and contrast control and to set the power level of the small LED ringlight. I have been using this device in online teaching all year. The photo for today is just snapped out of a Collins Pocket Guide to British Birds from the 1960s that my sister bought as a present during the pandemical times. Takes a few seconds in Cheese and a couple of minutes to crop, clean and resize in mtPaint. Anyway a small posse of these Long Tailed Tits descended on the rowan tree out front on the pavement and had a party! Lots of noise and acrobatics. A full on Jenny Odell moment.

17th July: Pean to the mighty Dot (and rules)

Spent half an hour or so early this morning marking up the text with the troff 'requests' as they are called. I'm using nvi providing the vi command on the NC10 as part of the OCC. In vi when in command mode the dot command (i.e. just pressing the full stop key) repeats the last command. So to search through my 430 line text file, locate empty lines and type a .PP request on each line went as follows:

Yes I could have used a global search and replace, but I wanted to see what was being matched and check the insertion each time. I also replaced the few $ signs that were not inline formula delimeters (basically in spreadsheet formulas that have an absolute reference) with \[Do] manually using / to search forward for a pattern like =\$ then just using R to delete the $ and add the extra characters.

My vi is getting more fluid slowly. I use semantic line breaks in the troff file, so I put a line break after each full stop, comma or question mark. I also break long lines where there isn't a 'unit of thought' boundary just for convenience. Using semantic line breaks makes searching for things much easier. It also results in a change you want to make often being writing a replacement line. Groff ignores all my line breaks of course and just adjusts the lines it typesets to fill each paragraph.

Later in the central library (I was meeting R to have a meal in the city) I added the headings and sub-headings. I processed the result using pdfmom -e sp.mom > t.pdf and it looked ok. Tomorrow is a biggie, adding the table markup. I'm reading through Mike Lesk and Lorinder Cherry's Tbl - A Program to Format Tables [pdf] and I'm going to draft out the mark up for the more complex tables on paper first.

In town: As I suspected, network-manager just works with the Library WiFi. However, Seamonkey refused point blank to allow the inevitable page redirect to the terms and conditions page that you have to complete to get Internet access. I had to crank up Firefox instead which worked fine, after warning me about the redirect.

Performance of 2008 netbook: I was able to use Firefox to log in to ebay to leave positive feedback about this new battery that is giving me a solid four hours, and into my google account to try my spreadsheet recipes for the handout in Google Sheets. Ebay was slow but responsive. Google Sheets was very slow but got there in the end - the main issue was the size of the screen being very small for the large number of widgets Sheets wants to display. Top was reporting a load factor of 3.8 or so and showing Firefox taking around 80% on both threads with Google Sheets loaded. (This atom processor is a single core but is identified as 2 processors).

Rules: one of the other participants noted on their blog that this year's OCC rules were more social/psychological than technical. I think I agree - using this 2008 vintage netbook with 1Gb has not been too much of a hardship given the GUI provided by LXDE and using Seamonkey in place of Firefox for most Web browsing. My social rule has been to use the LX terminal full screen with vi to edit the text file. That has kept me off the attention sucking sites and focused on producing a document.

No photos today: I forgot to take the camera.

18th July: Tables and sprouts

Screen grab of a table rendered in xpdf
        and typeset using groff

Sorting out the markup of the first of around five tables took a good chunk of time today. I've found out that the mom macros don't behave in quite the same way as the older macro packages like ms. In particular, the third column when typeset with mom macros does not wrap/justify the text by default.

After some time it dawned on me that the lines in the third column were being set according to the line breaks in the source file, which simply should not happen according to the tbl manual and various other troff resources. I did the only thing possible at that point - I cleaned the kitchen including pulling the cooker out and cleaning behind it.

I realised that my investment in the mom markup was quite small, and some vi magic (and some brute force direct editing) allowed me to switch the mark up to the ms macros. I will get to the bottom of how tbl interacts with mom though, but not in the next few days!

There are a couple of typos in the table. I'll correct those as part of tomorrow morning's getting started ritual.

Brussels Sprouts in a small bowl

The Brussels sprouts above came all the way from Morocco. They cost £1 for the bag. Modern food supply chains worry me.

19th July: Deep in the weeds of troff

And here I am hacking out table markup with equations and all.

screenshot of
      table marked up with tbl showing use of equations in headings

I'll be going into extra time with this project as tomorrow Saturday we are mostly out at a local arts festival. The main things left to do are

In retrospect I should have spent some time at the beginning of the week making a demonstration document with one example of everything. That would have caught the behaviour of the mom macros when using tbl mark up.

A word from our sponsor...

illustration from a photograph of grafitti montage in
        Digbeth

Update later on tomorrow.

20th July: Hacking away at the detail.

Below is the mark up for a bullet list using the ms macros. Straight out of Larry Kollar's Using groff with the -ms Macro Package. The only source I could find for this useful short summary was an obscure mailing list archive, so I took the liberty of uploading the 15 page pdf file here.

.PP
As a concrete example suppose you wanted to be able to work out the
circumference and area of a circle given any (positive!) value of the radius.
You could set up a spreadsheet with some labels and space to type in
the radius like this:
.IP "" 0.125i
.RS
.IP "\[bu]" 0.125i
Put the label "Radius" in cell \fCA1\fR and put the value 12 in cell \fCB1\fR
.IP "\[bu]" 0.125i
Put the labels "Circumference" and "Area" in cells \fCA2\fR and \fCA3\fR
.IP "\[bu]" 0.125i
Put the formula \fC=2*PI()*B1\fR in cell \fCB2\fR
.ip "\[bu]" 0.125i
Put the formula \fC=PI()*B1^2\fR in cell \fCB3\fR
.RE
.LP
See how the cell reference \fCB1\fR in the formulas stands
for the value in \fCB1\fR?
The magic is that changing the value in \fCB1\fR causes the spreadsheet program
to recalculate all the cells that depend on that value.

And it typesets to this...

Bullet list marked up
      using nested IP requests in groff ms macros

I need to spend probably around a day cranking out the markup for tables, mocking up the X-Y plots and then correcting all the typos. But that would be the same if I was using LibreOffice, and once I have my templates in troff mark-up I can just turn out handouts like this.

As an experiment, I put a thread on the OCC forum about what people thought were the outcomes for them of this free-form OCC. Has garnered a few thoughtful replies. As this is actually the end of the week, I'll revert to one of my slightly broken Thinkpads tomorrow if only because 4Gb of RAM is such a better experience than 1Gb of RAM. Using the little NC10 has been fun, and the investment in a new battery was worth doing. It fits in my messenger bag and can be carried around without much back strain. You can't say that for a T60!

21st July and onward!

Day 9 is a distributed day as I had hardly any time in troff today, so will need to catch up over the week ahead.

On the ToDo list:

In a sense, the OCC project has finished as I now know that

Tonight's strange artwork is...

spreadsheet mock up using tbl
      table preprocessor

The \[tmu] and the \[OK] escaped characters now right align within their cell. There does not seem to be any way of making one cell have a thicker border than all the others so as to show the currently active cell. I will live with that for now but if it gets annoying I will try reproducing this in pic as a drawing.

Alas, Debian 12 on the T61 is strangely unstable and prone to freezing solid so I'm putting Slackware 15 on, so plenty of time to read documents (on paper). Not a glitch all week from the NC10 running Debian 11.

22nd July: Electronic graph paper

Here is the result of today's superficial examination of what grap can do.

Graph on reasonable
        looking cartesian axes plotted using grap

Yes, I need to label the axes.

Grap tends to put frames with labels and tick marks around the outside of the graph frame like gnuplot does. I'm fine with that style but in this handout the graphs have to look like the ones in the maths textbook.

I really am just using grap as electronic graph paper more or less positioning each element manually. There are automation facilities including expressions and macros.

23rd July: More graph work in grap

No I understand what grap can do a little more I can actually focus on the content of the later stages of the handout.

graph produced in grap showing
        a quadratic, a straight line and a gradient triangle on axes
        with labels and a grid

This is fun though.

26th July: re-wrote section 4

Bashed in a more detailed set of instructions for building the spreadsheet tables for various equations. Absolute and relative cell references and replicating down. Text is fairly stable now. Will go over the graphs section 5 tomorrow. Been playing with absolute coordinates in pic as well. Much to work with.

Slackware: the nvi in slackware that provides the vi command segfaults when you try to use the ex command history provided by set cedit=^V^[. Tried a work around from 2021 but no dice. So downloaded OpenVi and compiled that. Works fine. Debian nvi has no problems so will compare the build scripts when I get a round tuit.

28th July: spreadsheet mock up in pic

I'm quite pleased with this. Yes the formula in the Input Line is wrong. I changed it from circumference to area and forgot to delete the 2* but it is corrected in the groff mark up now.

mock up of a spreadsheet
        screen using gpic

The GNU version of pic won't left or right align text inside boxes so I just used 'invisible' boxes with approximately the correct width to contain the text in the row and column labels, the input line and the cells. As recommended in the UNIX Text Processing book I planned the illustration out on graph paper. I also mainly used absolute coordinates like a graph grid instead of the 'natural language' approach that the widely available tutorial on pic by ES Raymond emphasises, as does Kernighan's manual.

A detail of the plan below...

detail of plan for pic
        spreadsheet on graph paper

I found this approach strangely satisfying. Brought back memories of getting students to draw a plan of a classroom in school using BBC LOGO.

1st August

Re-drafted three or four sections and added a nice small detail between two instructions...

small diagram of active cell in part of a spreadsheet

The result is shaping up nicely.

11th August

And I have a finished document!

Deliverables:

I'm printing the pdf out and working through it page by page and doing all the activities. I reckon I can squash around 10% of the words out quite easily.


Keith Burnett, 2024