DISCOVERY

May 28th, 2019

Haskell Part VI: Functors

Haskell

Java

Functional Programming

Right now I'm learning Haskell, a functional programming language. In my last few Haskell articles I've discussed basic aspects of the language. Now I've begun digging into advanced functional programming concepts. This article discusses functors, a generic way to map functions over objects.

Functor Basics

A common pattern in programming is looping through a collection of values and applying a transformation to each. For example, a programmer might loop through a list of integers and increment each value. The imperative approach to this transformation sets up a for loop and iterates over each list index. The functional approach uses the map higher-order function. map accepts two arguments - a collection to iterate over and a function. The function is applied to each item in the collection.

DISCOVERY

May 20th, 2019

Orchestrating Containers with Kubernetes Part II: Single Node Cluster

Kubernetes

Docker

+3 More

In my previous Kubernetes article, I went over the concepts of container orchestration and the architecture of a Kubernetes cluster. In this article, I'm building a single node Kubernetes cluster that runs a Node.js application.

The Node.js application is the same one I used in my article on Containerization. The Kubernetes cluster environment is very similar to my Docker playground. The single node Kubernetes cluster is created with a CloudFormation template wrapped in Terraform. It installs Docker, kubeadm, kubectl, kubelet, and kubernetes-cni. You can check out the infrastructure code on GitHub.

DISCOVERY

May 13th, 2019

Orchestrating Containers with Kubernetes Part I: Concepts

Kubernetes

Docker

+3 More

I recently wrote a series of articles on Docker and containerized applications. In those articles I worked with a single Docker container at a time. Each container was mapped to a port on its host machines IP, making it accessible from the browser. In my case, the host machine was an EC2 instance.

While the single container approach works, it has a number of limitations and drawbacks. First off, a single container isn't scalable. As web traffic to an application increases, the load becomes too much for a single container to handle. Secondly, there isn't a zero-downtime approach to release a new version of an application. The container running the old version has to stop and a container with the new version has to start in its place. While both these limitations are deal breakers in themselves, the worst part about the single container approach is that its a single point of failure. If the container stops or the application crashes, the entire website goes down. This makes deploying a production application on a single container inadequate.

DISCOVERY

May 12th, 2019

Delegate Objects in C#

C#

Java

Java 8

C# has an object called a delegate which is similar to lambda functions and functional interfaces in Java. A delegate object has a single role - calling a method. This article explores delegates and compares them to similar language constructs in C# and Java.

Delegate Basics

DISCOVERY

April 28th, 2019

Docker Part III: Containerizing an Application

Docker

Bash

+4 More

In my previous two Docker articles, I explored container environment basics and created a playground to run Docker on AWS. In this article, I'm creating a containerized application that is publicly accessible from the internet.

Containerizing a Node.js Application

DISCOVERY

April 8th, 2019

Docker Part II - Building a Playground Environment

Docker

CloudFormation

+5 More

In my previous post about Docker, I explored the basic concepts of Docker containers. In this post, I'm creating a Docker playground environment on AWS with Terraform and CloudFormation. The playground consists of an EC2 instance with Docker installed. It's accessible from the internet to facilitate containerized web applications. To start I'll discuss why I used Terraform and CloudFormation to build the playground. Then I'll take a deep dive into the infrastructure code.

Terraform & CloudFormation for IaC

DISCOVERY

April 1st, 2019

Docker Part I - Basic Concepts

Docker

Container

Virtual Machine

When I worked on my first website saintsxctf.com during my senior year of college, it was a huge revelation that I could pay a company to host my website on their servers. The most surprising part for me was how they were hosting it. The web server was a virtual private server, which is a virtual machine (VM) sold as a service1. The VM ran a Debian Linux distribution. This means I wasn't paying for an entire bare metal server, instead provided a software program which acts like a physical server. In fact, there were likely many other virtual private servers running on the same hardware as mine.

The adaptation of virtual machines was a major milestone in software development history. Instead of needing a single physical server for each application, a single server could run a program called a hypervisor which would create one or many virtual machines. Virtual machines scaled as needed to match business needs. Eventually companies didn't need to invest in physical servers as cloud providers started offering VM IaaS (Infrastructure as a Service). An example of a VM IaaS is EC2 (Elastic Compute Cloud) on AWS.

DISCOVERY

March 15th, 2019

Exploring PowerShell Scripting

PowerShell

Bash

+2 More

Over the summer I wrote an article about Batch scripting and just a few weeks ago wrote a follow up on Bash scripting. Today I'm exploring PowerShell scripting on Windows. I've used PowerShell at work recently for automating the deployment of .NET applications. The rest of this article looks at basic features of PowerShell and how it compares to Bash and Batch.

What is a PowerShell Script?

DISCOVERY

March 12th, 2019

Angular: Default vs. OnPush Change Detection

Angular

React

+2 More

In the last few months I've written articles about lifecyles in React and Angular. Certain lifecycles in React and Angular are triggered by their respective change detection mechanisms. In React the change detection mechanism is triggered whenever a components state changes or the properties passed from a parent component change. In Angular the change detection mechanism is triggered whenever a DOM event occurs or values used in the component template are mutated (along with async code returning, timeouts completing, etc.).

Angular also allows developers to change the change detection strategy on a per-component basis. This post explores the two change detection strategies - Default and OnPush.

DISCOVERY

February 22nd, 2019

Exploring Bash Scripting

Bash

Batch

Command Line Scripting

Back in the summer I wrote an article about Batch scripting on Windows. In today's article, I'm looking at Bash scripting. I've used Bash quite a bit recently. At work I've used Bash scripts to automate the conversion of Subversion repositories to Git. In my personal work I've used Bash scripts to assist setting up AWS infrastructure. The rest of this article explores basic Bash features and how they compare to Batch.

What is a Bash Script?

DISCOVERY

February 3rd, 2019

Variance with C# Generics

C#

Object Oriented Programming

+2 More

Variance amongst generics in programming languages is a topic that interests me. Generics in Java are always invariant, however C# isn't as restrictive, making it fun to explore. Since variance is an advanced topic, this article starts with the basic concepts of variance. Once the basics are understood, I'll explain variance in C# generics.

Concepts

DISCOVERY

January 24th, 2019

CSS Grid Backwards Compatibility

CSS

CSS Grid

HTML

When I created my personal website, I wanted to use all the latest technologies. I created a modern front-end with React.js, Webpack, Sass, and the latest JavaScript. When it came to stylesheets, I used the latest features that ease website layout creation. One of these features is CSS Grid. I wrote an article about CSS Grid over the summer, explaining how it simplifies complex CSS layouts. As with all new web technologies, an issue with CSS Grid is that older browsers don't support it. This article looks at some of the workarounds to make CSS Grid backwards compatible to older browsers.

I took three components from my website and simplified them to show how they work on older browsers. All modern browsers (Chrome, Edge, Firefox, Opera, Safari) implement feature queries, which check if certain stylesheet features are available in the browser environment1,2. Feature queries are created with the @supports CSS rule.