Just a note about some weirdness in my work process and it’s solution.
A few weeks ago, I started noticing some weirdness in trying to use some tools with Leiningen while developing a program in Clojure. When running tools like
lein would fail with an error from
javac about an invalid flag. Initially these flags were for attempts to set the file encoding. And the file encoding kept changing.
Over time, these failures became more frequent. Always about passing an invalid flag to the java compiler. Finally, I was unable to run a REPL, run a program, or build an uberjar.
Long story short, it looks like it was related to the
JAVA_CMD environment variable. That had been set a loooong time ago and in fact pointed to the java compiler, not the VM. Simply removing the variable fixed things. Might have worked just by setting it to
java rather than
javac but I didn’t try it and so far nothing else has broken.
Still don’t know what caused things to get flaky in the first place since this variable was set so long ago.
The Elm language is often cited as an up-and-comer for web front end development. I was attracted to it largely because of the compiler’s friendly and extremely helpful error messages. It’s really attractive in many ways.
But when I started looking at examples, I often found myself thinking things like “Why is this so inconsistent?” or “Why is this syntax so complicated?“. And it finally occurred to me that I’ve been ruined by the way Clojure/ClojureScript/Lisp/Scheme do things. I can’t seem to go back.
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…
If you have been following along for awhile, you may have noted how conflicted I am about writing web apps vs. native apps. I’ve been looking into Meteor, which makes the decision even thornier for me.
I’ve been updating some of my projects to use the newly released Java 8. That includes many Clojure projects. These are just “flow of consciousness” debugging notes.
I like to use programs that can remember what I was doing the last time I was working with them. They should restore the window just as I had it, remember which file(s) I was working with, what preferences I had selected, and so on. Naturally, I want the programs I write to be just as considerate of the user.
For some time, I’ve been fretting over the best way to do this in a Clojure program. Should I provide wrappers around the Java Preferences API? Some other mechanism? Turns out I should just embrace simplicity.
Just a short rant about JavaFX because I’m pissed about it at the moment. I enjoy using it for the most part but it sometimes throws up surprising obstacles in otherwise routine work. The latest for me was an unexpected lack of a spinner control. There are alternatives in some open source projects, but, really? No spinners built in?
This is almost as gob-smacking weird as the lack of dialogs. (Ok, there are some dialogs, like for opening/saving files, but not much in the way of user-programmable dialogs built in.)
And don’t get me started about the odd placement of the run time library. It seems to change with every few releases. Always having to put in some kludgy version-dependent stuff to find the libraries.
Maybe it will all be fixed in version 8.
A couple days ago, I posted a little snippet showing how to load and font from a list of preferred fonts using Clojure and JavaFX. Well, I’ve extended the demo a bit to show how to load both fonts installed on the OS and fonts from a resource file.
Just wanted to pass along a little snippet I have found myself using fairly frequently. CSS has the ability to specify the appropriate font to use in displaying a document. It handles the tag in such a way that it can gracefully degrade from a “preferred” font through a series of less ideal typefaces depending on what’s available on the machine doing the display.
I’ve wanted to look into the Pedestal framework for creating web-based applications in Clojure. However, one of the requirements is Leiningen 2.2.0 or greater. And, as I’ve written before, version 2.2 will not install on my system because of spaces in the path of the user home directory. (“
C:\Users\David Clark” on my system.)
My user profile name is “david”. That’s what I use to sign on with. The fact that my home directory uses “David Clark” is an unfortunate result of how the computer was set up at the factory when I custom ordered it. This has been a periodic pain in the ass ever since I got the system because folks who develop tools primarily on other operating systems, just can’t seem to deal with spaces in file paths. Even after all these years. It’s a kind of snobbery that I just find annoying and trite. Windows exists. Get over it.
Rather than try to fix every program that screws this up, I decided to change my user account and profile to just use “
C:\Users\david” as my home directory. Not so easy.