Henning's
Homepage



The Blog


ON THIS PAGE

- When a Swede says 'Oi!'
- The cool features and imminent obsolescence of the Nokia N900
- Using Emacs Org Mode for everything (including this blog)
- Why we are Baconian, not Humean, empiricists


When a Swede says 'Oi!'

2023-07-30     [PDF]     [PERMANENT LINK]

This is a public service announcement. Many Swedes, including me, have a reflex reaction when bumping into someone or stepping on someone's foot in a crowd–we say "Oj!" This is pronounced very similar to "Oi!" in British English. In Swedish, "Oj!" is not the most polite apology, but it is the equivalent of "oops" and in the context it's usually short for "Oops, I'm sorry!" It's an acknowledgment that you've bothered someone somehow. If you step on someone's foot in a London subway and exclaim "Oi!", it means pretty much the opposite. (Something like, "What he hell are you doing?") That could easily be the start of some trouble. In short, Swedes are a hazard in crowded spaces on the British isles. I've known this for years, ever since I made this mistake in a London subway decades ago. But reflexes are reflexes–they are not deliberate acts nor easily untrained. So, on my recent trip to Scotland, I did it twice, bumped into someone in the street and said "Oj!", and received some very dark looks from the person I was reflexively trying to (sort of) apologize to. But you can't really stop people in the street and start explaining to them what "Oj!" means in Swedish. There would be no end to the apologies then. Hence this public service announcement. And that is all.

[UP]



The cool features and imminent obsolescence of the Nokia N900

2023-01-27     [PDF]     [PERMANENT LINK]

Lately I've been a bit obsessed with resurrecting old, discarded devices. It started with my eMachine netbook from 2010. (See my last post!) I think this has been partly motivated by how thin, light, and flimsy modern devices tend to be, both laptops and mobile phones. In comparison, the eMachine feels like it's made of Bakelite. The new battery also makes it somewhat heavy for its size (10.1"), which means it sits safely on my lap when I type.

Almost regardless of the specs of a device, there is a Linux distribution that will run comfortably on it, and anything that can at least serve as an X terminal for my Raspberry Pi is of use to me. (Again see my last post.)

Image of the Nokia N900

Another gadget that I've wanted to use is my Nokia N900 mobile phone from 2009. This won't be a deep technical tour of the N900–I'll just explain some things about it that I've come across while trying to make it do a few things. I'll save the sad news for last.

I like the physical form factor. The N900 has a 3.5" resistive touchscreen. This technology works well with the provided stylus, for example for drawing in the sketch app. It has a simple but functional built-in stand that makes the screen easy to view when the N900 sits on a table. It has an FM transmitter. This is a feature I had never heard of, but some other mobile phones have it as well. With it, you can select a vacant FM frequency, tune your granddad's car radio to this frequency, and listen to music from the N900's media player on the radio. Such a cool solution. The N900's camera is simple compared to modern mobile phones, but it works. The best part of it is however the slide-out physical QWERTY keyboard.

The operating system of the N900 is called Maemo, and was used in a few other Nokia devices. While it hasn't had an update in years, several app repositories are still live, and the package manager works. Getting root access is as easy as installing the rootsh package.

To the casual eye, Maemo looks pretty much like a standard Debian installation. After loading an xterm, bash and most of the usual tools are there, including apt and several programming languages like Perl and Python. With its physical keyboard, the N900 feels like a Linux computer with constant Internet access that fits in your pocket. It's a bit sad that all mobile phones are iPhone-shaped these days.

My N900 is the reason this web site exists. I got it into my head a while back that I wanted my own web site again, and that it should be delivered by my Nokia N900. (Because why not.) Getting a web server up and running on the N900 is easy, although this might be when you discover that Maemo is not a standard Debian installation. Many of the usual command line tools in Maemo are not stand-alone programs, but part of a single executable called BusyBox. BusyBox also includes a tiny http server. BusyBox thus delivered the first version of this web site.

While this was a lot of fun, it wasn't very practical. BusyBox's http server has no problems with CGI scripts, but installing Perl modules proved to be a pain, mostly because Maemo is not current. So I couldn't really do anything with my web site. Hence the upgrade to the Raspberry Pi 4 that's delivering the site when I'm writing this.

It was also a dumb idea for a different reason. What's the point of having that nice physical keyboard if you only use the N900 as a web server? It's the input features that are the cool thing about the N900. Thus, if anything, it should be the computer from which you manage your web site.

It wasn't reasonable for me to get a second mobile subscription just for the N900, which meant that it only had Internet access when a wifi network was available. Moreover, it can't use wifi that requires login with a user name and password, which excludes my workplaces. So it wasn't really very mobile after all, and I stopped trying to use it for anything. This changed when I received a new mobile phone for work, and could move the SIM-card from the iPhone they had provided to the N900. My pocket Linux machine was now fully functional!

The obvious mission was now to set up the N900 as an X terminal for the Raspberry Pi, specifically so I could run my Emacs Org Mode setup on it the same way I do on all my other devices. While this works fine with the Juice SSH app on my Samsung Galaxy S7, it only runs Emacs in a text terminal. The N900 surely is using X for its graphical user interface, and should be able to run Emacs remotely in an X window?

Enter complication #1: Maemo uses something called the "Hildon application framework." Here's some info from Maemo.org:

"Hildon application framework
Hildon application framework introduces a new desktop for handheld devices. It is composed of the following components:

  • Task navigator for starting programs and switching between applications. The task navigator has some novel capabilities build into it, such as its ability to show email headers and browser bookmarks inside the menu.
  • Home provides the idle screen to embed different plugins, such as news feed reader plugin and clock plugin.
  • Status bar provides a plugin interface used to follow device status changes.
  • Control panel provides a framework for running applets used to change user settings. The applets are libraries that provide an interface to change, modify or set configurations.
  • Hildon UI provides additional widgets on top of the GTK+ ones, and theming modifications which make the entire UI match the maemo style.
  • LibOSSO is an additional library containing required and helpful services for maemo applications to better integrate them with the platform."

Okay… Somewhere in this environment there is a chunk of code that makes an additional row of keys, beside those on the physical keyboard, appear on the screen when text can be entered into an N900 app. One of those keys is [TAB]. The N900 will happily start an arbitrary remote X application and put it on its screen, but that application won't get the extra buttons. And it is absolutely impossible to use Org Mode without [TAB]. I don't know how to fix this.

Oh well, text terminal it is. Enter complication #2: I insist on one-click access to my Emacs Org-based note-taking system. Speed is everything in a tool like this. In X, this means creating a desktop shortcut to an xterm instance which in turn launches ssh with parameters to login to the Raspberry Pi (password-less, of course) and run a script on that computer which launches Emacs in the right way. Now, xterm's default behavior in this situation is to run the ssh command and immediately exit. You never get the chance to even see Emacs start. To fix this all you have to do is provide the -hold switch to xterm, to prevent it from closing. Maemo uses a terminal called "osso-xterm." It has no -hold switch. It has no switches, as far as I can tell. (Here's the man page.)

Shockingly, it was starting to look as though the N900 was the only one of my devices that could not be used for my note-taking system. This was until I considered the possibility of remapping the keys on the N900 keyboard. I found documentation for this, and it was actually pretty simple. (I did it by SSH-ing to the N900 from the eMachine, before breakfast, and without being late for work.) With [TAB] mapped to [FUNCTION]+[BACKSPACE], I can use Emacs Org Mode remotely in an X window on the N900, no problem!

Now for the sad news. The Nokia N900 uses 3G. The reception is poor around the Stockholm area and I lose my connection to the Internet occasionally. This could be because 3G is just worse than the 4G network I'm used to. But it could also be because the mobile operators are dismantling their 3G networks. In fact, The Swedish Post and Telecom Authority has determined that the 3G mobile network should be completely shut down by 2025. There is no workaround for this–no tricks to google around for. (A friend contemplated whether there might be some pin-compatible 5G circuits. Yeah, even if there are, that's a bit outside my skill set…) So, my N900 has a limited lifespan after all. Some things can't be resurrected, for reasons of infrastructure. (Unless someone finds a pin-compatible 5G circuit. Please let me know!)

[UP]



Using Emacs Org Mode for everything (including this blog)

2023-01-15     [PDF]     [PERMANENT LINK]

The purpose of this web site has been to give me some suitably-scoped coding tasks to amuse me and pass my time, not to make important information available. This is true in particular of the most recently added feature: this blog. I have dug up some old texts from other forums to put here, just to see if my creation is functional. However, I have also tried to set things up so as to minimize the threshold for writing new things. Ideally, whatever I'm currently working on, it should be a very short practical step to write a blog entry about it. Accordingly, here I'll explain some things about how this blog works, and especially how the tool for creating new blog entries is integrated into my general system for taking notes and producing documents.

Image of the three icons of Onote

1 The search for a good note taking system

For almost as long as I can remember, work has for me consisted mainly in reading things, taking notes, and then turning those notes into a document, for myself or for others to read. I have relied on a number of note taking systems over the years and never been fully satisfied with them. I used Evernote for a long time. Evernote is good, but it doesn't allow me to arbitrarily reorder notes to reflect the disposition of an eventual document. It also had some bugs, especially when it came to printing notes. (They may be fixed by now.) For these reasons I started using Google Docs instead some years ago. While Google Docs is good at what it does, it's mainly a word processor, not a system for taking notes. This has tended to turn my notes into full-fledged documents prematurely, which is not helpful. I have also tried for example Microsoft OneNote and Google Keep. The former lets you rearrange paragraphs, but too arbitrarily for my taste, and the latter is just too simple for my needs. (In particular, there's no way of creating multiple folders for notes.) I even used something called WriterDuet—which is for writing film manuscripts!—while writing one of the chapters for my PhD thesis. It had some useful functions (especially the digital sticky notes) but it costs money and was just overkill for me. Thus, the search continued.

2 Enter the eMachine

Image of the eMachine with Org Mode

A while back I found a "netbook" computer from around 2010 among my old gadgets. This is a tiny laptop with technical specifications that were pretty sad even at launch, especially the intel atom processor and 1 GB or RAM. However, I realized that I loved having a 10.1" device that fits easily in my small everyday bag but has a real, physical keyboard. (Screen keyboards are of course useless for doing any real work.) The build quality is also really good. This eMachine can't run modern MS Windows, but has no problem with a lightweight version of Linux (I use Puppy Linux). I also managed to order a new battery for it, giving it about nine hours of running time rather than three at best, which makes a world of difference for portability.

I've used the text editor Emacs for coding for decades, so it was the obvious choice for taking notes on the eMachine. Emacs is a lightweight application compared to most word processors, so suitable for the eMachine, but also famous for being endlessly extendable with modules. It's also been around forever, so I assumed that someone had written an Emacs extension specifically for taking and working with notes. This all lead to the glorious discovery of Emacs's Org Mode!

3 Emacs Org Mode

Org Mode is a "mode" that adds a lot of functions to the standard text editor, and comes installed with most distributions of Emacs. I can't even begin to describe what functions it has—I don't know most of them. But here are the main features from the perspective of my needs:

  • Operates with plain text. This is very fast and responsive, which matters when jotting down thoughts.
  • Allows simple formatting of text, section headers, lists, etc. using plain-text markup.
  • Has keyboard shortcuts for rearranging and reordering the contents of a note in all kinds of ways. E.g., use the arrow keys for moving a paragraph, a list item, or a whole section up and down within the text, or for changing the level of a section header and all text below it. Incredibly useful for processing and refining your notes on the way to creating a proper document.
  • It's easy to embed images.
  • Has many built-in features for creating and working with tables (and these even have spreadsheet features, as in you can enter equations into cells). These tables remain plain-text constructs.

Two additional features of Org Mode led to it basically taking over my whole workflow:

  • Sections can be collapsed by pressing tab on the section header, and Org files standardly open with all sections collapsed.
  • Org files can be exported to all sorts of formats, and in particular PDF and HTML.

The first point may seem like a small deal but it's been a game changer, because it means that however much stuff a cram into a single note file it never gets cluttered as long as I put things under proper section headers. This means I can keep one file per project regardless of its size. No more accumulating more and more note files in a project folder until I have no idea where I put that useful snippet. I didn't even realize that this was a big problem until Org Mode solved it.

The second point is even more useful than it seems. Org Mode can export your notes to LaTeX and then render it to PDF. Its LaTeX output can be tweaked in every way, globally, for a single document, or for a single section in a document. The same goes, mutatis mutandis, for HTML export. (These are the formats I use.) It can also export a single section of a note file. This, again, looks like a minor feature, but it conspires with the first point above to create something very powerful.

It is now possible, not just to keep all your notes relating to a project in a single Org file—if the project is to culminate in some official documents, these can be part of the same file, located under their own section headings. I have done this for several projects, and it has worked very well. Org Mode is not just for taking and processing notes—it can accommodate the whole process that terminates in a finished report or article.

Wonderful. None of this matters, however, if all of my work is stuck on my eMachine. Every other note taking solution I have used has saved the notes online and made them accessible from all of my devices. This is a crucial feature.

4 A homemade "cloud"

Image of Emacs with Org Mode on Android

This web site is hosted on a Raspberry Pi 4 sitting in my apartment. The Raspberry Pi is running Linux and the X windows system, which means that it's possible to run Emacs on it remotely, from any device that can run a remote X application (Linux and Windows computers in my case) or simply open a remote terminal (Android devices). Thus, my note taking system, and all of my notes, are accessible from everyone of my devices, just like with Evernote and the other apps.

Emacs lives in a Unix-like environment, which means that everything is configurable at basically every level, and everything can be made to work with pretty much everything else. So it wasn't very hard to set things up in just the way I want them. (I call this whole setup "Onote.") Each one of my devices (PCs, tablets, mobile) has three icons on the desktop, for (1) opening a generic note file containing my ToDo list, (2) opening a new note file for a new project, and (3) opening the note file I worked on last. Single-click access is essential—notes must be quick.

5 Creating a blog entry

The editorial interface for this blog is integrated in the note taking system as well. Any section or subsection of a note file can be exported to HTML, in which case it appears immediately on the blog. (New entries can be hidden behind the site "login" before being proofed and made public.) Custom keyboard shortcuts enter the few necessary configuration directives into the file. With only small tweaks to the source, a PDF version of the blog entry can also be generated and published (and I do this for all blog entries).

6 Hallelujah

Oh yes, it is a glorious thing. Hopefully, given that whenever I work on a project, writing a blog post about it is only one new section heading away, I will write more stuff here. (And perhaps stuff more interesting to the general reader than this post!) So, what are the drawbacks of this system? There are none. (Unless you count it running on a Raspberry Pi in my apartment and sitting behind a less-than-professional-quality connection to the Internet, or the fact that arbitrarily changing the layout of a LaTeX document is a pain, or maybe that using any of this depends on a general familiarity with Unix-like environments and a high tolerance for hunting down configuration files and scripting in multiple languages. We're not counting those things today.)

[UP]



Why we are Baconian, not Humean, empiricists

2021-12-29     [PDF]     [PERMANENT LINK]

This entry started life as a Twitter thread.

Philosophical (hot?) take of the season: we (scientists and people in general) are empiricists, but not Humean empirists. A much better fit is Baconian empiricism. Traditional British empiricism is a post-Descartes empiricism, and therefore a skeptical empiricism. Baconian empiricism is pre-Descartes and non-skeptical (but doesn't therefore regard knowledge of the natural world as trivial).

British empiricism inherited a problem from Descartes: how is the world of the mental (experience) connected to the physical world? This is a skeptical setup, much the same as one in neo-Platonism: how can the ideas we actually possess have any relation to Plato's perfect ideas? The answer, incidentally, was the same for St. Augustine as it was for Descartes: a benevolent god guarantees the proper connection.

A stamp with Bacon's face

But the skeptical setup ensures that no solution will be ultimately satisfying, and we see the consequences progressively worsening over the generations of, and following, the British empiricists. Idealism is the most obvious symptom, but rejection of any knowledge at least of unobservables (whatever those are), and of genuine explanation of natural phenomena, are also typical. Kantianism, in turn, is an attempted solution to skeptical empiricism.

Bacon was very much concerned both with skepticism and with the severe difficulties associated with trying to understand nature. I'd say his unfinished treatise on the scientific method, the Novum Organum, was largely addressed to those in power who he thought might succumb to skepticism about knowledge of the natural world. But the skepticism Bacon wanted to rebuff was not of Descartes's kind. It was rather about "the obscurity of nature, the shortness of life, the deceitfulness of the senses, the weakness of the judgment, the difficulty of experiment…" Ars longa, vita brevis.

To Bacon, human cognition was a warped mirror, that will tend to distort our perception of the natural world. But even a warped mirror is part of the natural world and interacts with the rest of it on equal terms. There is a suggested materialism about the mental. Bacon agreed with the skeptics that genuine understanding of nature was impossible, but he conditioned this conclusion on the use of then current ("Aristotelian") methods of investigation. The problems could be alleviated by adopting proper remedies. Thus he famously cataloged a number of sources of error, such as wishful thinking, confirmation bias, and our tendency to apply our favorite theory to every problem. Each of these require a countermeasure in the proper method(s) of science.

Bacon didn't finish his account of this method. We mostly have the tables of inductive reasoning that would produce the "first vintage" of our hypothesis, and a bunch of notes about things we ought to do after that (the "instances with special powers"). But Bacon also said that as our understanding of nature develops over generations of researchers (his solution to the complexity problem), both our concepts ("notions") and our methods are also likely to develop. The bottom line is that to Bacon there is no principled divide between the mental and the physical. Rather, human cognition is a deeply flawed instrument, existing and operating within and as a part of the physical world. Scientific method is for alleviating those flaws.

Bacon was celebrated as one of the founders of modern science up until the mid 19th century, when the tide turned for him. He was criticized for not himself having been an empirical scientist, for having no scientific discoveries to his name, and for his seemingly implausible scientific method (taken to be just the tables).

Hume, on the other hand, has been a favorite of generations of scientists and philosophers, despite the fact that no one can take the skepticism of this kind of empiricism seriously (as in acting according to it). The relevant cautions about empirical knowledge are in their right form in Bacon. Human cognition is part of the natural world, not separate from it, and its flaws can be addressed through improved methods, just as Bacon attempted, and as we continue to do.

[UP]



[NEXT]