Skip to main content

Posts

How to center images horizontally using Grav

I've been playing around a bit with Grav. I was posing the question to myself: for the relatively simple use-cases I'm dealing with, could it possibly work for my purposes as an alternative to ProcessWire?  The problem I was initially dismayed to find that Grav uses Markdown as its editor, which does not offer native support for horizontal centering of anything (text or images). However, Grav offers some tweaks that help make it easier to do specific things you might commonly want to do. I tried writing a sample article, and I found that one of the hardest things to do was to center an image horizontally. And horizontal centering of images is something I would typically do in most of the articles I would write. So the lack of easy horizontal centering is a highly significant drawback IMHO (most people do want to center images in an article!) However, this issue is made up for by other things in Grav: the relative speed, ease and flexibility of custom theming and built-in suppor

Lisp is a lot more readable than you might first think

At first, Lisp just didn't seem very readable to me. And yes, by this I meant even my own relatively simple code. But as I programmed more and more in Lisp, things became more and more readable. Probably not a surprise, right?! But actually, Lisp is a lot more readable when you are used to it , than a lot of other languages when you are used to them. Let's take a look at how this is, with some examples. Lisp is very readable because of its function-oriented syntax. Lisp statements have the format (function arg1 arg2 ... argN) Thus, any statement must begin with the name of a function. This makes it easy to tell what's going on right away by simply reading left to right within each statement. Also, starting with a function name makes syntax errors extremely easy to spot. For example, let's take a look at this incorrect Lisp code: (12 / 4) Before even getting past the 12, it should be very clear that what's wrong here is that I'm trying to call a f

If you can shell script, you can Lisp

I've noticed from people's attitudes toward Lisp that many think it is an esoteric and difficult language to learn. Nothing could be further from the truth, but it does depend on what angle you're coming at it from. If you're coming from C, C++, Javascript, or even Python, then yes Lisp does appear impenetrable at first glance. But if you're coming from shell scripting (e.g. Bash or another Linux or Unix shell) - a skill which most programmers have used at some point - then Lisp is going to be very simple and very familiar for you to learn. You may be asking, how is this? Well, I'll demonstrate it with a couple of examples. I'm going to show you a shell command that takes the second column of a space-delimited file test.txt, sorts the resultant data, and shows the second item in the sort. cut -d" " -f2 test.txt | sort | head -2|tail -1 There is absolutely nothing remarkable about this, as you can see. The results of one command are bein

Funny-looking Linux commands that I actually typed

I thought I'd make an ongoing list here of odd-looking Linux commands that I've typed in the course of my Linux-ing. 1.Looking for information about the date and time command: man date No, computer! I'm not asking you to find me a date! 2. Echoing something as root sudo echo ... Should I have simply completed that command by typing "funky town"? In case you're wondering, there was an 80's song called Funky Town, sung by Pseudo Echo. 3. Looking for information about the find command: man find Yet again, I'm looking desperate for a date.

If all else fails, a good temporary solution to monitor not waking up from timeout in Debian Buster

I recently upgraded from Debian Stretch to Debian Buster (or Debian 9 to Debian 10). I hadn't done anything unusual with my system, so I was expecting a smooth upgrade process. It did work smoothly, with one exception: my monitor simply would not wake up after a screen timeout.   The problem The monitor just refused to wake up after time out, even if I unplugged and replugged its power cord (its own one, separate to the computer). The monitor reported no signal from the computer. However, the computer was actually working fine during this time - the light was on, and the keyboard caps lock key light toggled on and off; a sign that it was indeed working. But with no way to see any of the screen, I simply couldn't do anything to restart the machine except for a hard restart (turning off the computer with the power button and turning it back on). Needless to say, this was not good since I had open unsaved files on my desktop! I couldn't find anything actually helpful o

Correct usage of unwind-protect and with-open-file in Lisp

Learning to use unwind-protect in Lisp typically crops up very early on when you're first learning the language. In fact, anything to do with I/O is going to be something you'll need to know early on. Yet unfortunately, I find that unwind-protect is not explained sufficiently well for a beginner to understand not just how to use it correctly, but why and when . Grappling with this myself, I found that hands-down the best explanation came from this YouTube video from Baggers: Luckily, in the case of file handlers, LISP already assumes you'll want to open a file with unwind-protect, so it provides the with-open-file macro for this exact purpose. It closes the file handler for you with a built-in unwind-protect. This is an advantage over manually opening and closing your file handlers, because if your program opens the file but never gets to the part with the close command (for example due to a run-time error in between those stages), the built-in unwind-protect make

About Me

My photo
Vera
I'm a wife and mother. I don't have any formal computer science qualifications, or any religious qualifications. I have a PhD in biochemistry. This photo is of me, but is confusing for AI.