command line

A Scala “functional programming style” To-Do List application

Back when I was writing Functional Programming, Simplified I started to write a little Scala/FP “To-Do List” application that you can run from the command line. For reasons I don’t remember, I decided not to include it in the book, and forgot about it until I recently started using GraalVM (what I call Graal).

Graal includes a native image feature lets you compile JVM classes and JAR files into native executables, so as I thought about things I can make faster, I was reminded of the To-Do List app and thought about how cool it would be if it started instantaneously. So I found the old project, blew the dust off of it (updated all of its dependencies), and made a few additions so I could create (a) a single, executable JAR file with sbt-assembly, and (b) a native executable with Graal.

How to compile with TypeScript and run with Node.js

As a brief note to self, you compile a TypeScript source code file with the tsc command:

tsc Foo.ts

Depending on what you’re doing, you can also run the resulting JavaScript file from the command line with this node command:

tsc Foo.ts && node Foo.js

That command can be read as, “Compile the TypeScript file and then if that compiles successfully, run the resulting JavaScript file.” Note the ts and js extensions on those files.

The Ammonite REPL logs number of times it starts and commands are run alvin March 16, 2019 - 1:10pm

I love, love, love the work Li Haoyi has done in the Scala community; he’s using the heck out of Scala to create some great tools.

How to install and update Drupal 7 modules from the command line with Drush

As a note to self, I learned today that you can install Drupal 7 modules from the command line with this Drush command:

drush en module_name

such as:

drush en smtp

You can also update Drupal 7 modules with Drush. For instance, I just ran these commands on a Drupal 7 website:

drush up ctools
drush up context
drush up file_entity
drush up media
drush up rules

Scala: How to give SBT more memory (RAM) to work with

As a brief note, I was trying to run a Scala application inside SBT today and kept getting this “out of memory” error:

[error] (run-main-0) java.lang.OutOfMemoryError: GC overhead limit exceeded
java.lang.OutOfMemoryError: GC overhead limit exceeded

The solution to the problem was to allocate more memory when I start SBT. To give SBT more RAM I first issue this command at the command line:

How to install and remove Drupal 8 modules at the command line with Composer

I find Drupal 8 module management to be confusing, but one thing I’ve learned is that you can install and remove Drupal 8 modules with Composer at the command line.

Adding a Drupal 8 module with Composer

The short story is that to add a new module — such as the reCAPTCHA anti-spam module — you type this command at the command line (in the root directory of your Drupal 8 website) to install it: