Diary – 2019 February

Håkon Robbestad Gylterud

This is my public diary.

2019–02–01, Friday

Thinking quite a bit on programming language design these days. While I like pure functional programming languages, such as Haskell, I think there are improvements to be made in how they interact with the rest of the system.

As an aside, I am also experiement with practical implementations of quoting operators, based on the λ-quote calculus I have been working on lately.

2019–02–20, Wednesday

I have been doing some cosmetic changes to my website. Mostly changes in the css, but I also have been experimenting with adding prefetch links to the HTML files. The HTML code on this website adds up to a total of 469K at the moment, so prefetching links should make navigating the page much smoother.

The new logo for my website.
The new logo for my website.

For the sake of readability I use colours very carefully on my site. All text is black, and most backgrounds are white (with tables and code listings with grey background as notable exceptions). However, a five-minute-Inkscape-job produced a bit of colour, in the form of an icon. This now decorates the titles of my pages. The “for all”-symbol () is one of many decorative symbols used in mathematics.

Simple websites

From the start, the idea behind this wabsite was to make it simple and functional. At first my though was: Simplicity and functionality should go hand-in-hand. The assumption being that the designers of HTML and web-browsers should have made it so that the simplest solution is allways functional.

No, actually I didn’t actually think so – because I have seen webpages which are just simple HTML, and they are not functional: by default Firefox renders HTML without any further styling with full screen length lines in a tiny font. So I knew that I would have to put some effort into making a simple yet readable website.

The biggest time-saver when working on this web-site is Pandoc. Writing the page in Markdown instead of HTML saves a lot of time.

Here is something Pandoc’s HTML template contains, which I would not have guessed on my own:

<meta name="viewport" content="width=device-width,
  initial-scale=1.0, user-scalable=yes">

This magic incantation makes my website look normal on smart phones. Without it, the browser on the phone will zoom all the way out, making the text unreadable without zooming in. Why this is the default behaviour escapes my understanding.

In general the HTML generated by Pandoc holds high quality, and is very easy to style using CSS. And when it comes to CSS, a little can go a long way:

While design is some part of functionality, it is not all. For instance, you should have some way of checking that the links on your website actually work. It is easy to mistype a URL, or maybe the link dies after you publish it. I hacked together a mkfile-target for this purpose, which uses curl to check each link:

links-check:QV: `{grep -v '/$' $index | grep '\.html$'}
  if (~ $base '')
     base=`{pwd}
# Get the absolute path for base
  wd=`{pwd}
  cd $base
  base=`{pwd}
  cd $wd
# Get the search and replace string for absolute server links
  ss='s/^\//'`{echo $base | ssam -e 's/\//\\\//g'}^'\//g'
# Iterate through html files and check remote links with curl
  for(i in `{grep -v '/$' $index | grep '\.html$'}) {
     cd $base
     newdir=`{echo $i | ssam -e 'x/[^\/]*$/ d'}
     if (! ~ $newdir '')
        cd $newdir
     for (u in `{ssam -e 'y/href\=\"[^"]*\"/ d' < $base/$i \
               | ssam -e 'x/href=/ d' \
           | ssam -e 'x/\"[^\"]*\"/ y/[^\"]*/ c/\n/' \
           | grep -v '^$' | grep -v '^#' | grep -v '^data:' | grep -o '^[^#]*' \
           | ssam -e $ss } ) {
        if (! test -e $u)
           if (! curl --http1.1 -k -s -r 0-255 -o /dev/null $u) {
              echo $u is invalid in $i
              cd $base
              exit 1}
         }
     cd $base }

The part about --http1.1 in the curl line is just a work-around for some faulty HTTP/2 sites.


  1. The unit em is a relative unit, useful for making the page scalable


Expecting a comment section? Feel free to e-mail me your comments, or otherwise contact me to discuss the content of this site. See my contact info. You can also write your opinion on your own website, and link back here! ☺