configure

How to control/configure vim colors

vim colors FAQ: Can you provide details on how to control/configure colors in the vim editor (vim color settings)?

When using vim syntax highlighting, a common complaint is that the default color scheme is a little too bold. In this article I'll try to demonstrate how you can change the colors in vim to be a little more pleasing, or at least be more in your control.

How to configure an Android project to use Java 8 alvin March 9, 2019 - 1:37pm

As a quick note today, if you need to configure an Android project to use Java 8, I found that adding this setting to the app-level build.gradle file worked:

compileOptions {
    sourceCompatibility = '1.8'
    targetCompatibility = '1.8'
}

You can also use this syntax:

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

That setting goes inside the android setting in the build.gradle file, as shown here:

Using Jenkins with Scala, ScalaTest, SBT, and Git alvin February 19, 2019 - 7:58pm

I’ve used Jenkins before, but hadn’t used it in a while, so when I got it running with Scala, SBT, ScalaTest, and Git, I made some notes about how to configure it. You can get Jenkins going with Docker, but I just got Jenkins running by starting its WAR file like this:

java -jar jenkins.war

Jenkins with Scala, SBT, ScalaTest, and Git

My notes on getting everything up and running are a little cryptic, but if you have a little experience with Jenkins I hope they’ll make sense. Here they are:

How do I generate a secret key (application key) with Play Framework 2.6? alvin April 4, 2018 - 2:22pm

Play Framework FAQ: How do I generate a secret key (application key) with Play Framework 2.6?

Answer: Use the playGenerateSecret command in the SBT shell. Here’s an example:

$ sbt

[Scrupal6] $ playGenerateSecret
[info] Generated new secret: TozWYjreCna1QlVBGqfK4D/C6wZyQOm9gm<9;D_KO@]n
[success] Total time: 0 s, completed Apr 4, 2018 2:21:57 PM
How to use a Maven repository library with SBT alvin July 10, 2017 - 6:34pm

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 18.17, “Using a Maven Repository Library with SBT.”

Problem

When working on a Scala project built with SBT, you want to use a Java library that’s in a Maven repository, but the library doesn’t include information about how to use it with Scala and SBT.

SBT: How to get started using the Build.scala file (instead of build.sbt) alvin July 10, 2017 - 4:49pm

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 18.16, “Using Build.scala Instead of build.sbt.”

Problem

In an SBT project, you want to use the project/Build.scala file instead of build.sbt to define your Scala project, or you need some examples of how to use Build.scala to solve build problems that can’t be handled in build.sbt.

Notes on how to configure HTTPS/SSL with Nginx (on a Linode Ubuntu server)

Table of Contents1 - Summary2 - New Linode Server3 - Update Everything4 - Ubuntu Firewall5 - Add a New User6 - Disabling Root Login (sshd_config)7 - Limit Login Attempts (sshd_config)8 - Install Nginx and MySQL9 - Adjust Firewall10 - Nginx Configuration11 - Installing Java on Ubuntu12 - NOT what I used: Let’s Encrypt on Ubuntu 16.0413 - (1) Create a cert (openssl)14 - (2) Create a strong Diffie-Hellman group15 - (3) Configure Nginx to Use SSL16 - Adjust the Nginx Configuration to Use SSL17 - (Alternative Configuration) Allow Both HTTP and HTTPS Traffic18 - Adjust the Firewall19 - Enable the Changes in Nginx20 - Test in Browser21 - Nginx "default_server"22 - Can change to a permanent redirect (301)23 - More Security: Preventing Information Disclosure24 - More Security: Fail2Ban25 - Restricting Access by IP Address26 - See also

Without any introduction or discussion, here are the notes I made while learning how to get HTTPS working with Nginx. These are just for me, but if something helps you, cool.

How to turn off (disable) Akka logging

Using Akka logging is a great thing, until you need to turn it off. In short, to disable Akka logging, you need to create a file named application.conf in your SBT src/main/resources folder, and set the loglevel to “OFF” in that file, like this:

Nginx configuration: How to drop the query string on a rewrite

As a quick note, if you need to drop the query string when configuring an Nginx rewrite request, this syntax works:

rewrite ^/foo/bar.*$  /bar?  permanent;

The key is to use the ? character at the end of the URL/URI you are redirecting users to. That drops the query string, so the user will be redirected to the exact /bar URI.

For more information, see the Nginx rewrite module page.

Handling trailing slash characters with Nginx 301 redirects

As a quick Nginx configuration example, if you need to configure a 301 Redirect with Nginx, and you also need to account for trailing slash characters in the original URL, I can confirm that this solution works for me:

rewrite /foo/bar/baz/?$  /foo/bar/baz.html permanent;

This Nginx configuration line will forward both of these URIs to the new URI: