The other day, I was putting together a sequence of operations to transform one piece of text into another form of that same text. The functions took a text argument, and the result was a slightly tweaked version. Put all those functions together to get the fully transformed result. What could be more natural than to string those pieces of code together with one of Clojure’s threading macros: ‘->’ or ‘->>.
I run a River5 “River of News” on a Raspberry Pi wirelessly connected to my internal home network. Sometimes, the power fluctuates, and the Pi reboots. I want to have River5 restart when the system comes back up. There are lots of ways to restart stuff on Linux. (I am running Raspian GNU/Linux 8.0.) The process manager I use is PM2 – mostly because it knows Nodejs. River5 is written for Node.
It’s been a bit of a slog, but things should be up and running again. The transition was a bit harder than expected. Here are some things you should know: The site is generated by the Hugo static site generator. The site uses a trivial modification of the very pleasant Blackburn theme. There are still some kinks I want to work out, but it is very useful overall. The repository for the site is on GitHub here and is generated from the information in the repository here.
As noted in yesterday’s blog, I’m making a sweep through my previous posts trying to fix links that have broken over the years. This is in preparation for switching to another blogging platform. I find that the rot even creeps into the README.md files in my own code repositories. Many of them refer back to descriptions of the repositories posted to no longer existing versions of the blog. I’ll fix those as soon as I can.
Every once in awhile, I change blogging platforms. Recently I have been working on a switch to Hugo. Whenever I go through this exercise, I religiously check for broken links. There are always plenty. Most of the time, when broken links are found, I can find a replacement. Sometimes not though. Sometimes something is just gone. No new address. No record in the Internet Archive Wayback Machine. Just gone. I know I’m contributing to this myself by changing hosts and blogging platforms.
Since switching from Windows to a Mac in the middle of developing a new wiki, I lost access to the MarkdownPad Markdown editor – it’s Windows only. One of the nice features of MarkdownPad was the ability to insert a timestamp easily. It’s what I used to insert the creation date and the time of the last modification. Since the switch, I’ve been using Sublime Text 3 as my editor for Markdown files.
This is a little note about a function I find myself using frequently in Clojure. User interface code often needs to display a list of things as a comma-separated list, e.g. “a, b, c, d”. If all of the things are strings, you can use the built-in string/join function to build such a string. When you have a sequence of things that are not strings, I suppose you could convert each element to a string and then use string/join.
This is just a little note about one of my favorite datatypes in Clojure. Like most Lisps, Clojure has a very useful group of datatypes built in including some set types. I use sorted-set a lot. Until recently, I hadn’t noticed sorted-set-by, a function that returns a sorted set using a comparator you specify. I found myself needing to create a sorted set of strings where the sorting was case-insensitive. The sorted-set-by function was exactly what I needed.
Recently, I wrote about updating an old program that did the Sign Test. Well, I have lots of old programs that could stand a bit of refreshing. Another of the simple ones calculates the confidence interval around the proportion of successes in a series of Bernoulli trials. I wrote about it way back in 2011. The original was written in Java and Swing many years ago. It is still available in a repository on Bitbucket.