Brad Lucas

Programming, Clojure and other interests

Run A Local Amazon Linux 2 Instance

November 10, 2018

Amazon Linux 2 is available as virtual machine images for development on-premises. If you are using Amazon Linux 2 EC2 instances it is a compelling idea to have a local version of the same for testing and development.

But how? The follow details a path to running Amazon Linux 2 locally in a VirtualBox VM.

VirtualBox

Before continuing it's assumed that you've worked with VirtualBox before. To continue realize that Virtual Box creates a virtual machine inside a named directory and uses an associated virtual disk image. This disk image as you can imagine is the virtual machine's hard disk.

Continue reading →

Updating Your Pip Requirements File

November 9, 2018

While revisiting an old Python project you may come to realize that your requirements.txt file contains out of date versions. You could go through and research each library and get it's latest version number but may be discouraged if there too many.

The following is a technique to update the entire file without having to take too much time.

This technique is good if your goal to to update each library to it's most recent first.

Step 1 Change the == to >= for each entry

Continue reading →

List Globally Installed Packages With npm

November 3, 2018

You may have installed npm packages globally. To find out try the following command.

$ npm list -g --depth 0
Continue reading →

Learning Ring Next Steps

May 22, 2018

Previously, I wrote about Clojure and Ring in an introductory post where a small debugging application called Echo was developed. If you haven't looked at that post and are looking for an introduction to Ring I suggest you do and then come back here.

For this post, I've created another sample application called ring-next which contains routines to demonstrate a number of concepts in Ring. These are:

  • Middleware
  • Responses
  • Parameters
  • Cookies
  • File Uploads
  • Routes
Continue reading →

Learning Ring And Building Echo

May 18, 2018

When you come to Clojure and want to build a web app you'll discover Ring almost immediately. Even if you use another library you are likely to find Ring in use.

What is Ring?

As stated in the Ring repository, it is a library that abstracts the details of HTTP into a simple API. It does this by turning HTTP requests into Clojure maps which can be inspected and modified by a handler which returns an HTTP response. The handlers are Clojure functions that you create. You are also responsible for creating the response. Ring connects your handler with the underlying web server and is responsible for taking the requests and calling your handler with the request map.

If you've had experience with Java Servlets you'll notice a pattern here but will quickly see how much simpler this is here.

Continue reading →