Author Archives: David

Speech Synthesis in ClojureScript

Just like everyone else, it seems, I’ve been following all of the news about voice-activated personal assistants. There are all the commercial offerings like Siri, Alexa, Cortana, and so on, as well as some DIY projects on the web, like this one and this one and this one.

These types of projects typically involve a front end that converts voice to text, some middle piece that interprets the text and obtains some answer or creates an action, ending up with a voice response by the system back to the user. I have some (out-of-date) experience with speech to text, but not the other end of the process: text to speech. So here’s a little investigation into how to do it with ClojureScript. Turns out that it is almost trivial these days.

Continue reading

Hardening an Nginx Server

Besides the site where I host this blog, I have several other sites that I maintain. This is all more of an educational effort for myself than anything really important. That said, I am a neophyte in terms of server security. It’s something I want to do better. What better place to start than by evaluating security settings on some of my “play” sites that use nginx as the server component?

Like I said, I’m no expert, but these are some of the things I have done to my own sites.

Continue reading

ClojureScript with Reagent and figwheel

I have a bit of a love/hate relationship with ClojureScript. On the one hand, it is a Lisp, with all the power it entails. On the other, the development toolchain can be byzantine. With the advent of WebAssembly and ECMAScript6, I have hopes of seeing tail call optimization (allowing true recursion) handled in ClojureScript, if not Clojure itself. And Reagent and figwheel can make web development (not my strong suite) much easier.

Continue reading

River5 on Ubuntu 14.04 LTS with a CloudAtCost VS

River5 is the latest in a series of RSS News Aggretators written by Dave Winer. You can read his announcement here. These notes describe how to set up a River of News on a Virtual Server (VS) purchased or rented from CloudAtCost and freshly imaged with Ubuntu 14.04.

These notes assume that you have done some work in configuring your VS with a user, other than root, that has super user privileges. If you need help doing the initial setup of your VS, look here.

Continue reading

Using Local Java JARS in Clojure Projects

Recently, I’ve been working on a Sudoku game program. Part of the program provides a user with the ability to generate new puzzles of a particular difficulty. Generating a puzzle usually requires two puzzle solvers: one that solves puzzles (slowly) like a human would, the other that solves puzzles (very quickly) like a computer would.

Rather than write my own from scratch, for this part of the development, I wanted to use an existing implementation of the machine-like solver. After a little research (more on this some other time), I found one I liked a lot — the Kudoku solver written in Java from attractive chaos.

But how does one use a local jar file in a Clojure Project? Read on…

Continue reading

Finding Mono-Spaced Fonts in JavaFX

There are many use cases where a mono-spaced (fixed-width) font is useful in programming. Programming editors and creating program listings come to mind. But there doesn’t seem to be a consistent way of obtaining a list of all of the mono-spaced fonts installed in the operating system.

Back in the days of Swing, you usually had to grab a list of font families (e.g. Arial, Times New Roman, etc.) from AWT and then create a BufferedImage to print the font to and check layout widths. In JavaFX, it seems a bit easier. Here’s one way to do it.


* Return a list of all the mono-spaced fonts on the system.
* @return An observable list of all of the mono-spaced fonts on the system.
private ObservableList<String> getMonoFontFamilyNames() {

    // Compare the layout widths of two strings. One string is composed
    // of "thin" characters, the other of "wide" characters. In mono-spaced
    // fonts the widths should be the same.

    final Text thinTxt = new Text("1 l"); // note the space
    final Text thikTxt = new Text("MWX");

    List<String> fontFamilyList = Font.getFamilies();
    List<String> monoFamilyList = new ArrayList<>();

    Font font;

    for (String fontFamilyName : fontFamilyList) {
        font = Font.font(fontFamilyName, FontWeight.NORMAL, FontPosture.REGULAR, 14.0d);
        if (thinTxt.getLayoutBounds().getWidth() == thikTxt.getLayoutBounds().getWidth()) {

    return FXCollections.observableArrayList(monoFamilyList);

It seems a little less complicated in that all of the needed functionality is available right in JavaFX. One thing that hasn’t changed is that it can still be slow. For example, if you want to populate a ComboBox with all of the mono-spaced fonts at the start of program execution, it can add a small but noticeable delay.

In my own case, on Windows, I have about 370 fonts on the system. Twenty-seven of those tested as mono-spaced, including quite a few that I never use, mostly non-English character sets that get installed somehow.

Still, good to know.