<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[Rob Dalton]]></title><description><![CDATA[Data Engineer, NLP aficionado, and DevOps enthusiast.]]></description><link>https://robdalton.me/</link><image><url>https://robdalton.me/favicon.png</url><title>Rob Dalton</title><link>https://robdalton.me/</link></image><generator>Ghost 3.8</generator><lastBuildDate>Mon, 16 Feb 2026 14:39:36 GMT</lastBuildDate><atom:link href="https://robdalton.me/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[An Intro to Docker Compose]]></title><description><![CDATA[<h2 id="what-is-docker-compose">What is Docker Compose?</h2><p>Docker Compose is a tool that allows you to configure, build and run multiple containers. It's incredibly useful for building and deploying apps that use multiple services, each with their own container.</p><p>For example, let's say you have an app that uses 3 services:<br>- <code>site</code></p>]]></description><link>https://robdalton.me/an-intro-to-docker-compose/</link><guid isPermaLink="false">5f24926d04cabd48ce3f4330</guid><dc:creator><![CDATA[Robert Dalton]]></dc:creator><pubDate>Fri, 31 Jul 2020 21:51:51 GMT</pubDate><content:encoded><![CDATA[<h2 id="what-is-docker-compose">What is Docker Compose?</h2><p>Docker Compose is a tool that allows you to configure, build and run multiple containers. It's incredibly useful for building and deploying apps that use multiple services, each with their own container.</p><p>For example, let's say you have an app that uses 3 services:<br>- <code>site</code>: An ecommerce site that lets users browse and shop for items.<br>- <code>database</code>: A database that stores user, product, and order information.<br>- <code>notifier</code>: A script that monitors your database and sends email notifications to users when their orders have shipped.</p><p>Your app directory structure would look like this:</p><pre><code>app
├── database
│   └── Dockerfile
│   └── ...
├── notifier
│   └── Dockerfile
│   └── ...
└── site
    └── Dockerfile
    └── ...
</code></pre><p>Normally, you'd have to start 3 containers yourself, either by running <code>docker run</code> for each image or by writing a custom script to launch them all. But with Docker Compose, you can launch all 3 containers with a single file AND configure them to boot.</p><h2 id="how-do-i-use-docker-compose">How do I use Docker Compose?</h2><h3 id="basic-overview">Basic Overview</h3><p>Let's expand on our example above. To use <code>Docker Compose</code> with our app, we add a <code>docker-compose.yml</code> file to the top level of our project directory:</p><pre><code>app
├── docker-compose.yml
├── database
│   └── Dockerfile
│   └── ...
├── notifier
│   └── Dockerfile
│   └── ...
└── site
    └── Dockerfile
    └── ...
</code></pre><p>The contents of our docker <code>docker-compose.yml</code> file would be:</p><pre><code># line below tells docker-compose which version of the docker-compose file format to use
version: "3.8"
services:
    database:
        build: ./database
    notifier
        build: ./notifier
    site:
        build: ./site
</code></pre><p>The lines above define each service and tell Docker compose where to find their build files. To build the images for services, we'd run the command <code>docker-compose build</code> from the top level of the project directory. And to run them, we'd use the command <code>docker-compose up</code>.</p><h2 id="configuration-options">Configuration Options</h2><p>The example <code>docker-compose.yml</code> file above is very basic. But Docker compose allows you to configure your services in all sorts of ways. For example: we could add a few lines to tell <code>docker-compose</code> that the <code>site</code> and <code>notifier</code> services depend on the <code>database</code> service, and that the <code>database</code> service needs to build and run successfully before the others:</p><pre><code>version: "3.8"
services:
    site:
        build: ./app
        depends_on:
            - database
    notifier
        build: ./notifier
        depends_on:
            - database
    db:
        build: ./database
</code></pre><p>Note that each of our services still has their own Dockerfile. This is useful for long, service specific configurations, when a service might have a long and/or complex Dockerfile. However, you could include all of the configuration options for a service in your <code>docker-compose.yml</code> file if you wanted.</p><p>For example - let's assume the <code>database</code> service has 2 files: <code>database/Dockerfile</code> and <code>database/init.sql</code>.</p><pre><code>app
├── docker-compose.yml
├── database
│   └── Dockerfile
│   └── init.sql
├── notifier
│   └── Dockerfile
│   └── ...
└── site
    └── Dockerfile
    └── ...
</code></pre><p>Let's also assume the contents of <code>database/Dockerfile</code> are as follows:</p><pre><code>FROM postgres:13
COPY ./init.sql /docker-entrypoint-initdb.d/init.sql
</code></pre><p>This simply tells Docker which image to use for <code>database</code>, and copies a single file (<code>init.sql</code>) to the container on build. Note that <code>/docker-entrypoint-initdb.d</code> is a special directory on <code>postgres</code> images, and that <code>.sql</code> files in this directory are run when postgres starts.</p><p>We could remove our <code>database/Dockerfile</code> entirely by changing our <code>docker-compose.yml</code> as below:</p><pre><code>version: "3.8"
services:
    site:
        build: ./app
        depends_on:
            - database
    notifier
        build: ./notifier
        depends_on:
            - database
    database:
        image: "postgres:13"
        volumes:
            "./init.sql:/docker-entrypoint-initdb.d/init.sql"
</code></pre><p>This achieves the same effect - Docker Compose now knows which image to use for <code>database</code>, and will copy our <code>init.sql</code> file to the appropriate place in the container (<code>volumes</code> is slightly different than <code>COPY</code>, but I won't get into that here).</p><h2 id="closing-remarks">Closing Remarks</h2><p>Hope that's enough to get you started using Docker compose on your own! If you want to learn more,  I highly recommend reading the <a href="https://docs.docker.com/compose/compose-file/">Docker compose docs</a>.</p>]]></content:encoded></item><item><title><![CDATA[An Intro to Flask]]></title><description><![CDATA[<p>In my last post, I presented a high level overview of what a web application is. In this post, we'll take a look at how how you can use Flask (a python based app framework) to build applications by breaking down a series of examples, culminating with <a href="https://flask.palletsprojects.com/en/1.1.x/tutorial/#tutorial">the app from</a></p>]]></description><link>https://robdalton.me/an-intro-to-flask/</link><guid isPermaLink="false">5f1746e404cabd48ce3f4316</guid><dc:creator><![CDATA[Robert Dalton]]></dc:creator><pubDate>Tue, 21 Jul 2020 19:52:59 GMT</pubDate><content:encoded><![CDATA[<p>In my last post, I presented a high level overview of what a web application is. In this post, we'll take a look at how how you can use Flask (a python based app framework) to build applications by breaking down a series of examples, culminating with <a href="https://flask.palletsprojects.com/en/1.1.x/tutorial/#tutorial">the app from this official flask tutorial</a>. I won't dive deeply into the code for that example here, as the tutorial above already does that. Instead, I will build up to it with two of my own examples, and provide a visual representation of it.</p><p><strong>NOTE: I highly recommend the tutorial if you want a deeper dive into Flask.</strong></p><h2 id="what-is-flask">What is Flask?</h2><p>Flask is a Python based micro-framework for building web applications. It's "micro" simply because it's minimalist, meaning it has fewer built-in features than other frameworks.</p><h2 id="how-is-an-app-constructed-using-flask">How is an app constructed using Flask?</h2><p>Consider a basic app - one that has a single view which simply shows the phrase, "Hello, World!" Using Flask, we can build this app with a single file. This file would be stored in a directory (<code>app</code>) with a single file (<code>app.py</code>):</p><pre><code>app
|- app.py
</code></pre><p>The contents of <code>app.py</code>:</p><pre><code>from flask import Flask

app = Flask(__name__)


@app.route('/')
def hello():
    return 'Hello, World!'
</code></pre><p>The code above defines an application using the <code>Flask</code> object (a class that represents an application). This appication serves a single view, which you can request via the route <code>/</code>. When you request this view, the code attached to this route is executed, and Flask responds with a simple line of text - "Hello, World!"</p><p>To run this app on a Linux or Mac machine, you would run the commands:</p><pre><code>export FLASK_APP=app
export FLASK_ENV=development
flask run
</code></pre><p>Here's what would happen:</p><ol><li>Flask spins up a server on your local computer. This server listens for requests for the domain <a href="http://127.0.0.1:5000">http://127.0.0.1:5000</a>.</li><li>The view for the route <code>/</code> would be returned when you visit the base domain above.</li></ol><h2 id="what-would-a-more-complicated-example-look-like">What would a more complicated example look like?</h2><p>The app above is fairly straightforward. Let's try to visualize what a more complicated example would look like by expanding our app to include two more views: one that returns <code>Foo.</code> and one that returns <code>Bar.</code> We'll add these new views via a <code>Blueprint</code> - an object that enables you to group views. It also allows you to better organize your code by enabling you to break your views out into multiple files.</p><p>Here's a visual representation of our app:</p><figure class="kg-card kg-image-card"><img src="https://docs.google.com/drawings/d/e/2PACX-1vQZ0adeZY8hnijrAoB7tnf6ZMsMhT_sszYDb75-ts_M9F1sfZEbCT9wq-WFOIvromFzmPO0H6_aW3KQ/pub?w=925&amp;h=288" class="kg-image" alt="App Overview"></figure><p>Note our app is a <code>Flask</code> object with 3 views, each defined under a <code>route</code>. Two of our views are grouped via a <code>Blueprint</code>.</p><p>We'll need to organize our files a little differently by changing <code>app.py</code> to <code>__init__.py</code>, and by nesting the <code>app</code> directory in a new directory <code>flask_example</code>:</p><pre><code>flask_example
|- app
    |- __init__.py
    |- foobar.py
</code></pre><p>Our code for running the app will not change. However, we need to execute the commands from the <code>flask_example</code> directory. Why? We do this for namespace reasons - in order for our app file (now <code>__init__.py</code>) to import our blueprint (defined in <code>foobar.py</code>), we need to treat the <code>app</code> directory like a Python module.</p><p>Our code for <code>__init__.py</code> is now:</p><pre><code>from flask import Flask
from . import foobar

app = Flask(__name__)


@app.route('/')
def hello():
    return 'Hello, World!'

app.register_blueprint(foobar.bp)

</code></pre><p>And our code for <code>foobar.py</code> is:</p><pre><code>from flask import Blueprint

bp = Blueprint('foobar', __name__, url_prefix='/foobar')


@bp.route('/foo')
def foo():
    return 'Foo.'


@bp.route('/bar')
def bar():
    return 'Bar.'
</code></pre><h2 id="what-would-a-slightly-more-complicated-example-look-like">What would a slightly more complicated example look like?</h2><p>The example above is great, but what if you wanted your views to use HTML instead of simple text phrases? Great news! You easily do so by using <code>templates</code> - <a href="https://jinja.palletsprojects.com/en/2.11.x/">Jinja</a> files you can use to construct more complex views.</p><p>Let's add a template for each of our views. Please note that I won't get into the specifics of Jinja syntax here, nor will I define the template files. I'll leave that part to you as a creative exercise ;) But if you'd like to learn more, I recommend reading the <a href="https://jinja.palletsprojects.com/en/2.11.x/">Jinja docs</a>.</p><p>Our app will now look like this:</p><figure class="kg-card kg-image-card"><img src="https://docs.google.com/drawings/d/e/2PACX-1vR8_TejnoZd6Y52i98MMPl66RcjPcZbJp6FlboSM-lUBnutT6N9YyNLBM-zt2j9LkRIhz56Y5aOplA9/pub?w=932&amp;h=322" class="kg-image" alt="Flask Example 2"></figure><p>We'll need to add a new directory for our templates:</p><pre><code>flask_example
|- app
    |- __init__.py
    |- foobar.py
    |- templates
        |- index.html
        |- foobar
            |- foo.html
            |- bar.html
</code></pre><p>And by slightly modifying our code for <code>__init__.py</code>:</p><pre><code>from flask import Flask
from . import foobar

app = Flask(__name__)


@app.route('/')
def hello():
    render_template('index.html`)

app.register_blueprint(foobar.bp)
</code></pre><p>And <code>foobar.py</code>:</p><pre><code>from flask import Blueprint

bp = Blueprint('foobar', __name__, url_prefix='/foobar')


@bp.route('/foo')
def foo():
    render_template('foobar/foo.html`)


@bp.route('/bar')
def bar():
    render_template('foobar/bar.html`)
</code></pre><h2 id="what-would-an-even-more-complicated-example-look-like">What would an even MORE complicated example look like?</h2><p>I'll cover one final example: <code>flaskr</code>, a simple blogging app you can build using <a href="https://flask.palletsprojects.com/en/1.1.x/tutorial/#tutorial">an official Flask tutorial</a>. You should be ready to tackle it on your own by now, but I want to give you a visual representation of the app before you start.</p><p>The app has 5 views, split between 2 blueprints:</p><!--kg-card-begin: markdown--><ul>
<li><code>blog</code>
<ul>
<li><code>/</code>: The site index. If a user is logged in, shows their posts. If not, shows login options.</li>
<li><code>/create</code>: Allows a logged in user to create and save a new blog post.</li>
<li><code>/update</code>: Allows a logged in user to edit an existing blog post.</li>
</ul>
</li>
<li><code>auth</code>
<ul>
<li><code>/register</code>: Allows a user to create an account with a username and password.</li>
<li><code>/login</code>: Allows a user to login to an existing account.</li>
</ul>
</li>
</ul>
<!--kg-card-end: markdown--><p>Note that this app also has an additional component: a mySQL database with two tables: <code>user</code> (which stores user data) and <code>post</code> (which stores post data).</p><p>With that, here's a visual overview:</p><figure class="kg-card kg-image-card"><img src="https://docs.google.com/drawings/d/e/2PACX-1vR1o9TtVTsl7jJ4W59l8jM_Q-ix5-1j0Cg9HwYbdvPJMKL-1Rp62T1viwfspQpS8Jmp38J_h0lWH8jn/pub?w=959&amp;h=851" class="kg-image" alt="flaskr Visualization"></figure><h2 id="closing-remarks">Closing Remarks</h2><p>Hope you found this helpful! I know that writing this and creating the visualizations above really helped cement the Flask fundamentals for me. The next posts in this series will cover some additional backend basics, in no particular order: logging, testing and algorithm design.</p>]]></content:encoded></item><item><title><![CDATA[An Intro to Web Apps]]></title><description><![CDATA[<p>A quick note: this post is designed for true beginners - those who have little to no knowledge of software and web development. That disclaimer aside - let's dive in!</p><h2 id="what-is-a-web-application">What is a Web Application?</h2><p>A Web Application is a software application that is accessed and used via the internet,</p>]]></description><link>https://robdalton.me/an-intro-to-web-apps/</link><guid isPermaLink="false">5f10b45204cabd48ce3f42a0</guid><dc:creator><![CDATA[Robert Dalton]]></dc:creator><pubDate>Thu, 16 Jul 2020 20:30:24 GMT</pubDate><content:encoded><![CDATA[<p>A quick note: this post is designed for true beginners - those who have little to no knowledge of software and web development. That disclaimer aside - let's dive in!</p><h2 id="what-is-a-web-application">What is a Web Application?</h2><p>A Web Application is a software application that is accessed and used via the internet, typically via a web browser. However, before we dive into what a Web Application is, we must first answer two prerequisite questions:</p><h3 id="how-does-the-internet-work">How does the Internet Work?</h3><p>The internet is simply a network of computers that can communicate with each other. Computers communicate over the internet via the "<strong>Client-Server Model</strong>", in which a one computer (the "client") asks another computer (the "server") for some data via a request. The server then replies to this request with a response.</p><p>The specifics behind how internet communications work and are structured are vast and complex, and I won't dive into them here. For now, the model above is enough for our purposes.</p><h3 id="what-is-a-software-application">What is a Software Application?</h3><p>A software application, or app, is a program that enable users to view and manipulate data. At a high level, you can use the "<strong>Model/View/Controller (MVC)"</strong> framework to visualize the basic structure of most apps:</p><!--kg-card-begin: html--><br><!--kg-card-end: html--><figure class="kg-card kg-image-card"><img src="https://docs.google.com/drawings/d/e/2PACX-1vQoTSD97ZvEfk880D82vn8D0Xcck-cazG7R2lnEMbIvYcGdRrV7-ecQ35BS8XT_RmD6UL-T-8pTv6E4/pub?w=625&amp;h=449" class="kg-image" alt="Model View Controller"></figure><!--kg-card-begin: html--><br><!--kg-card-end: html--><p>In this framework, you can think of an app as consisting of 3 components, controlled by a <strong>user</strong>. The components are:</p><ul><li><strong>Model</strong>: A model that represents and stores data.</li><li><strong>View:</strong> A view of the data model, which is shown to the user.</li><li><strong>Controller</strong>: A component that the user uses to manipulate the data model.</li></ul><p>Let's bring all of these concepts together and via an example you're likely familiar with: FaceBook. The data that represents your profile is an example of a <strong>model</strong>. It might be represented in a table like this:</p><!--kg-card-begin: html--><table>
    <tr style="font-weight:bold; height: 1.5em;">
        <td style="border: solid #ccc 1px;">Name</td>
        <td style="border: solid #ccc 1px;">Birthday</td>
        <td style="border: solid #ccc 1px;">Hometown</td>
        <td style="border: solid #ccc 1px;">...</td>
    </tr>
    <tr>
        <td style="border: solid #ccc 1px;">John Doe&nbsp;&nbsp;&nbsp;&nbsp;</td>
        <td style="border: solid #ccc 1px;">3/14/1998&nbsp;&nbsp;&nbsp;&nbsp;</td>
        <td style="border: solid #ccc 1px;">Norfolk, VA&nbsp;&nbsp;&nbsp;&nbsp;</td>
        <td style="border: solid #ccc 1px;">...&nbsp;&nbsp;&nbsp;&nbsp;</td>
    </tr>
</table><!--kg-card-end: html--><p>A <strong>view</strong> of this model would be your profile page. And a <strong>controller</strong> that manipulates this model would be one of FaceBook's servers.</p><h2 id="how-does-a-web-application-work">How does a Web Application Work?</h2><p>While the MVC framework is useful for visualizing the purpose and function of software applications, it isn't quite accurate for web applications. Most basic web applications actually consist of these 3 components: a <em>frontend</em>, a <em>backend</em>, and a <em>database</em>.</p><ul><li><em><strong>Frontend</strong></em>: Renders and displays views.</li><li><em><strong>Backend</strong></em>: Controls data and builds views.</li><li><em><strong>Database</strong></em>: Stores models.</li></ul><p>You, as a user, interact with the app via a view, which is shown to you via a web browser on some client (laptop, phone, etc.). Whenever you want a new view, the following happens:</p><ol><li>Your browser (aka the frontend) makes a request for a view.</li><li>The request is sent to a server running the app.</li><li>The server forwards this request to the backend component.</li><li>The backend uses the database to manipulate and retrieve data from the model.</li><li>The backend uses this data to construct the view.</li><li>The server sends the view to the client as the response.</li><li>Your browser renders the view and displays it.</li></ol><!--kg-card-begin: html--><br><!--kg-card-end: html--><figure class="kg-card kg-image-card"><img src="https://docs.google.com/drawings/d/e/2PACX-1vSQsGBmPi5ODzIrES75i02p7JTrPl_4FqJkLuop6yxslZGR0q5zEwRo1kCgtzxpbzV1n7D7PV2V-mB9/pub?w=764&amp;h=457" class="kg-image" alt="FBDB"></figure><!--kg-card-begin: html--><br><!--kg-card-end: html--><p>Please note - this is only one way to conceptualize the architecture of a basic web app. In reality, most apps rely on multiple backend components, and the frontend for some apps performs some controller functions.</p><h2 id="an-example-facebook">An Example: FaceBook</h2><p>Let's return to our FaceBook example. FaceBook is a web app that stores, and allows you to view, data from you and your friends.</p><p>It uses a PHP and C++ based backend with a MySQL database. <em>NOTE: This isn't strictly true. FaceBook is hugely complex with dozens of components. This is my best guess at their core components based on what I could find on the interwebs.</em></p><p>Your profile page is an example of a view: it is a representation of the data model that represents your profile. When you open up FaceBook and go to your profile page, this is what happens:</p><ol><li>Your browser makes sends a request to facebook.com.</li><li>This request is forwarded to a server running a PHP backend.</li><li>The backend accesses the model representing your profile via the MySql database, and retrieves your profile information.</li><li>The backend uses this information to construct a view of your profile.</li><li>The server sends this view back to your browser via a response.</li><li>Your browser renders the view as your profile page.</li></ol><h2 id="closing-remarks">Closing Remarks</h2><p>That's it! Hope it was helpful. While Web Applications are much more complicated than the simple overview I've provided here, I hope that this is at least enough to get you started on whatever projects or learning journey you have planned.</p><p>Next, we'll be diving into how you can use <a href="https://flask.palletsprojects.com/en/1.1.x/">Flask</a> to construct and manage basic web apps.</p>]]></content:encoded></item><item><title><![CDATA[An Intro to Ignorance]]></title><description><![CDATA[<p>	Have you ever heard of the Dunning-Kruger effect? It's a well-known phenomenon in Psychology in which individuals with limited experience or knowledge in a domain overestimate their level of expertise. It is often visualized as a curve:</p><figure class="kg-card kg-image-card"><img src="https://upload.wikimedia.org/wikipedia/commons/4/46/Dunning%E2%80%93Kruger_Effect_01.svg" class="kg-image" alt="Dunning-Kruger Curve"></figure><p>	In other words: as you learn more about a domain, the more you</p>]]></description><link>https://robdalton.me/an-intro-to-ignorance/</link><guid isPermaLink="false">5f08be6504cabd48ce3f428c</guid><dc:creator><![CDATA[Robert Dalton]]></dc:creator><pubDate>Fri, 10 Jul 2020 19:17:30 GMT</pubDate><content:encoded><![CDATA[<p>	Have you ever heard of the Dunning-Kruger effect? It's a well-known phenomenon in Psychology in which individuals with limited experience or knowledge in a domain overestimate their level of expertise. It is often visualized as a curve:</p><figure class="kg-card kg-image-card"><img src="https://upload.wikimedia.org/wikipedia/commons/4/46/Dunning%E2%80%93Kruger_Effect_01.svg" class="kg-image" alt="Dunning-Kruger Curve"></figure><p>	In other words: as you learn more about a domain, the more you realize how little you actually know about it.</p><p>	I write about this effect because I've realized that I am a victim of it. A friend recently approached me and asked for help building a web application. As I've helped build and deploy production level apps, I confidently agreed and set about writing a tech spec and architecting a solution. However, my engineering knowledge is largely self-taught and piecemeal, and the more I've worked on his app the more I've realized the gaps in my understanding.</p><p>	Thus, I find myself on the left end of the curve above. Which, as a naturally ambitious learner, I find to be unacceptable. To rectify this, I've decided to revisit the basics by writing a series of introductory posts intended for beginners.</p><p>	Over the next few weeks, we'll start with an overview of what a web application is, how you can use Flask and react.js to build one, and how you can use AWS to deploy one at scale.</p><p>	Excited to get started!</p>]]></content:encoded></item><item><title><![CDATA[An Introduction to Docker]]></title><description><![CDATA[<p>I've been learning about Docker for use in my personal and professional projects. Though I've used it before, I've always had a vague understanding of what's actually going on behind the scenes. And so I decided to go back to the basics and build a better high-level understanding before diving</p>]]></description><link>https://robdalton.me/an-introduction-to-docker/</link><guid isPermaLink="false">5e9df91004cabd48ce3f413d</guid><dc:creator><![CDATA[Robert Dalton]]></dc:creator><pubDate>Mon, 20 Apr 2020 21:51:32 GMT</pubDate><content:encoded><![CDATA[<p>I've been learning about Docker for use in my personal and professional projects. Though I've used it before, I've always had a vague understanding of what's actually going on behind the scenes. And so I decided to go back to the basics and build a better high-level understanding before diving into the weeds. Let's dive in:</p><h3 id="what-is-docker">What is Docker?</h3><p>Docker is a tool for creating and running containers.</p><h3 id="what-is-a-container">What is a container?</h3><p>A container is a unit of software that packages up code and all its dependencies (code, system tools, system libraries and settings). When a container is running, you can consider it to be an isolated environment (separate from your local machine, or host) in which your code can run.</p><p>A container is similar to a virtual machine, but instead of requiring a separate operating system and a hypervisor program to divy up the host's resources between the host and the virtual machine, a container uses the host's operating system kernel and shares resources with it.</p><p>I won't go into the details here. But there are a multitude of blog posts on this topic, <a href="https://www.backblaze.com/blog/vm-vs-containers/">such as this one.</a></p><p>The bottom line: containers are isolated environments in which you can package code and run it. And they require fewer resources than virtual machines do.</p><h3 id="how-does-docker-work">How does Docker work?</h3><p>So, how do you use docker to create a container? And what happens when you do?</p><p>Docker containers are built using images. An image is a blueprint for a container - it's a set of dependencies and configuration options that are installed on your image when it's created. </p><p><em>Note that Docker images live on Dockerhub - a repository for both user-generated and officially maintained Docker images.</em></p><p>When you create and run a container using Docker, you need to tell Docker several things:</p><ol><li>What image to use for your container.</li><li>Where the files for your container will live on your local machine/host.</li><li>Any additional files (aside from the image files) to copy to your container.</li><li>Any commands you want run on the container after it starts.</li></ol><p>You can specify these items via the command line, or you can specify them in a special file a Dockerfile. </p><p>Here's an example Dockerfile:</p><pre><code># Use the official image as a parent image.
FROM node:current-slim

# Set the working directory.
WORKDIR /usr/src/app

# Copy the file from your host to your current location.
COPY package.json .

# Run the command inside your image filesystem.
RUN npm install

# Inform Docker that the container is listening on the specified port at runtime.
EXPOSE 8080

# Run the specified command within the container.
CMD [ "npm", "start" ]

# Copy the rest of your app's source code from your host to your image filesystem.
COPY . .</code></pre><h2 id="visual-example">Visual Example</h2><p>Let's say you have an app you want to run in a container. Let's also assume you have a project directory with some source code for the app and a Dockerfile with the instructions on how to setup your container. When you use the command <code>docker run</code> , Docker will do the following:</p><ol><li>Fetch the image files from Dockerhub.</li><li>Create a working directory for your container - space on your host that contains the root filesystem for your container.</li><li>Install the dependencies for your app and start your container.</li><li>Copy your app's source code to the container's working directory.</li></ol><p>Here's a visual example:</p><!--kg-card-begin: html--><iframe src="https://docs.google.com/presentation/d/e/2PACX-1vRM-CqaqFO4CZmdpjB5VuAd1AYOYVoPbNHZaHwj76ZSoHe2NaqyTE6AP-HKidpzxn6ZhwzWrEcLvAoI/embed?start=true&loop=true&delayms=1000" frameborder="0" width="960" height="569" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true"></iframe><!--kg-card-end: html--><h2 id="conclusion">Conclusion</h2><p>That's all for now! Hope this helped you get an idea of how Docker works. The best resource to read for this is likely the <a href="https://docs.docker.com/get-started/">official Docker orientation</a>, but I wanted to write my own verison to get the ideas down in my mind.</p>]]></content:encoded></item><item><title><![CDATA[The Importance of External Backups]]></title><description><![CDATA[<p>Six months ago, I lost my wallet. I arrived home after grabbing coffee with a friend, walked through the front door, and emptied my pockets to find I was missing an important leather rectangle.</p><p>I immediately cancelled all of my credit and debit cards. I ordered new ones, updated my</p>]]></description><link>https://robdalton.me/the-importance-of-fine-print/</link><guid isPermaLink="false">5e598dfa04cabd48ce3f4076</guid><dc:creator><![CDATA[Robert Dalton]]></dc:creator><pubDate>Mon, 02 Mar 2020 18:45:40 GMT</pubDate><content:encoded><![CDATA[<p>Six months ago, I lost my wallet. I arrived home after grabbing coffee with a friend, walked through the front door, and emptied my pockets to find I was missing an important leather rectangle.</p><p>I immediately cancelled all of my credit and debit cards. I ordered new ones, updated my autopay information for the important subscription services (Water, Electricity, Netlix, Spotify, etc), and was confident I'd solved the problem. However, there was an important item I'd missed.</p><p>I'd forgotten to update my payment information for this site. And after a few months of missed payments, Digital Ocean shut down my droplets and deleted all of their contents AND all of their backups.</p><p>All of the beautiful content I'd created from 2017-2019 was deleted. Now, all that I have left of the posts I'd written is this <a href="https://web.archive.org/web/20180830050810/https://robdalton.me/">woefully inadequate snapshot</a> from the Wayback Machine.</p><p>This has served as a harsh reminder of the importance of multiple backups. While I'm disappointed, I'm choosing to look on the bright side: better to learn this lesson with my blog than with an employer or client's resources. Learning from your mistakes is an important part of software engineering, and I'm going to take what I can from this lesson and keep writing new posts. And also store multiple backups for redundancy.</p>]]></content:encoded></item><item><title><![CDATA[Learn Design in 15 Minutes]]></title><description><![CDATA[<!--kg-card-begin: markdown--><p>Everyone appreciates good design. It's the reason we are drawn to great works of art, such as Michelangelo's David or Picasso's Starry Night. It's the reason our eyes are captivated by beautiful machines, such as the 1959 Corvette Stingray Concept Car. And it's the reason Apple's products have captured the</p>]]></description><link>https://robdalton.me/learn-design-in-15-minutes/</link><guid isPermaLink="false">5e598dd204cabd48ce3f4071</guid><dc:creator><![CDATA[Robert Dalton]]></dc:creator><pubDate>Tue, 06 Dec 2016 23:38:49 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><p>Everyone appreciates good design. It's the reason we are drawn to great works of art, such as Michelangelo's David or Picasso's Starry Night. It's the reason our eyes are captivated by beautiful machines, such as the 1959 Corvette Stingray Concept Car. And it's the reason Apple's products have captured the public's attention and dominated its competitors' products for over a decade.</p>
<p>I can't tell you how to do any of that. I learned everything I know about design from a textbook I checked out from the library, and my meagre portfolio contains a very small number of amateurish websites and documents. However, I do think that my limited experience has helped me come a long way. I want to share what I've learned with you because I believe the world is a better place with more designers in it, and because I think you'll be impressed with how much better your work can be with a few basic design tips.</p>
<p>In this post I'll cover 5 tips and show you how to use them to design and style a web page. But, before we move on, we need to consider two important questions:</p>
<p><strong>What is design?</strong> Design is the method by which an object fulfills its function. For example, this web page is an object. Its function is to communicate information to users. Its design - the way in which it communicates information- consists of everything from the code that runs the backend to the layout and colors of the text on the page.</p>
<p><strong>What is good design?</strong> Good design is effective use of an object's medium. A medium is the material or materials an object is made of. This web page's medium is its server, your browser, and my writing. I like to think it exhibits good design - its backend code is clean and fast, and the information on the page is, hopefully, laid out and written in a way that makes it easy to understand.</p>
<p>That's it! Let's move on to those tips.</p>
<h2 id="5tipsfordesigningawebpage">5 tips for Designing a Web Page</h2>
<p>Consider the embedded page below. It's not well designed - it's hard to read and it isn't easy to look at. We're going to take a few steps to improve it.</p>
<iframe style="min-height: 420px; width: 82.5%; border: solid #eee 1px; margin: 3.67rem auto; display: block;" src="https://robdalton.me/assets/other/learn_design_examples/example_1.html"></iframe>
<h2 id="1usewhitespace">1. Use whitespace</h2>
<p>Whitespace is the easiest tool to use. You can use it to separate the elements of a page, which helps clarify the structure of the information you're presenting.</p>
<p>For example, it's now much more clear that the short strip of text at the top of the page is the title.</p>
<iframe style="min-height: 420px; width: 82.5%; border: solid #eee 1px; margin: 3.67rem auto; display: block;" src="https://robdalton.me/assets/other/learn_design_examples/example_2.html"></iframe>
<h2 id="2useproportions">2. Use proportions</h2>
<p>Proportions - the ratios of the sizes of the elements on your page - are a fantastic tool. You can use them to balance the elements of a page, highlight important information, and more clearly separate information. You should ensure that the size and spacing of your elements have some sort of proportional relationship.</p>
<p>What do I mean by a proportional relationship? Just that the size of one or more elements on your page has some sort of scalar relationship to the size of one or more separate elements. For example, the page title's text size is now 3 times the text size of the main content. The spacing between the bottom of the page title and the first paragraph is also about 3 times as great as the distance between the first paragraph and the second paragraph. The text content is now constrained to be 5/6 the width of the entire page.</p>
<p>Playing around with the proportions on the elements of a page can make the page much easier to read and much more aesthetically pleasing. For reference - the most  common proportions used in web design are 1/3, 1/4, 1/6, 1/8, and 1/12.</p>
<iframe style="min-height: 420px; width: 82.5%; border: solid #eee 1px; margin: 3.67rem auto; display: block;" src="https://robdalton.me/assets/other/learn_design_examples/example_3.html"></iframe>
<h2 id="3useanappropriatefont">3. Use an appropriate font</h2>
<p>Fonts are an easy way to improve a page's design. Broadly speaking, there are two types of fonts: Serif fonts (those with accented strokes, such as Times New Roman) and Sans-Serif fonts (those without accented strokes, such as Helvetica). Serif fonts were designed specifically for printed information, and so they're best used on paper. Sans-serif fonts are usually easier to read on screens and are typically best for web design. If serif fonts are used on a web page, it's usually for short text such as titles and section headers.</p>
<p>You can vary the weight and size of fonts to separate information as well. For example - bold text usually indicates importance.</p>
<p>In the example below I've used two different fonts - Aleo for the page title, and Lato for the main content. I've used a serif font for the page title to further differentiate the page title from the main content.</p>
<iframe style="min-height: 420px; width: 82.5%; border: solid #eee 1px; margin: 3.67rem auto; display: block;" src="https://robdalton.me/assets/other/learn_design_examples/example_4.html"></iframe>
<h2 id="4uselikeorcomplementarycolorsandcontrastthem">4. Use like or complementary colors and contrast them</h2>
<p>Colors provide yet another way to separate or highlight information. The effective use of color is also a hugely complex topic - there is much debate on which types of colors you should use for the various types of websites. Because of that, I won't give you any tips on what colors to use in your work. However, I will tell you that when deciding on what colors to use on your site, make sure that they are like or complimentary.</p>
<p>What do I mean by like or complimentary? Well, it turns out that colors can have scalar relationships as well - web colors are determined using the rgb scale - a 3 channel scale in which the Red, Green, and Blue channels can each range from 0 to 255. As a result, you can consider a single color to be a point in a 3 dimensional coordinate system. When selecting a set of colors for a site, you generally want to select colors (points) that are separated by proportional amounts of distance. Like colors are colors whose RGB values share similar proportions (for example - rgb(30,30,30) is like rgb(120,120,120) - both are shades of gray). Complementary colors are colors that are relatively far from one another in one or more dimensions (for example - orange, rgb(255,116,0) is complementary to teal, rgb(0,153,153)).</p>
<p>Thankfully there are tools that can perform distance calculations for you and give you sets of colors you can choose from. My personal favorite is <a href="http://paletton.com/#uid=1000u0kllllaFw0g0qFqFg0w0aF">Paletton.</a></p>
<iframe style="min-height: 420px; width: 82.5%; border: solid #eee 1px; margin: 3.67rem auto; display: block;" src="https://robdalton.me/assets/other/learn_design_examples/example_5.html"></iframe>
<h2 id="5contentisking">5. Content is king</h2>
<p>Finally, the most important design aspect of a web page is its content. The actual information you're presenting is vastly more important than the way in which you present it. Consider the example below: it's much more visually appealing than our original example. However, the information doesn't actually tell you anything about Design. Since the function of the page is to communicate a basic description of design to the reader, the page below is pretty terrible.</p>
<iframe style="min-height: 420px; width: 82.5%; border: solid #eee 1px; margin: 3.67rem auto; display: block;" src="https://robdalton.me/assets/other/learn_design_examples/example_6.html"></iframe>
<h2 id="conclusion">Conclusion</h2>
<p>That's all! I hope the tips above help you improve your work. If not, then I've designed this post poorly.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[2 Potential Problems Securing a Ghost blog Using SSL and Nginx]]></title><description><![CDATA[<!--kg-card-begin: markdown--><p>This blog is hosted on Digital Ocean using the droplet image<em>Ubuntu Ghost 0.8.0 on 14.04</em> It uses nginx and an SSL certificate issued by Let's Encrypt to encrypt its data. While setting up the blog was easy (I just used Digital Ocean's dashboard to deploy the</p>]]></description><link>https://robdalton.me/2-potential-problems-securing-a-ghost-blog-using-ssl-and-nginx-2/</link><guid isPermaLink="false">5e598dd204cabd48ce3f406f</guid><dc:creator><![CDATA[Robert Dalton]]></dc:creator><pubDate>Fri, 17 Jun 2016 21:12:27 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><p>This blog is hosted on Digital Ocean using the droplet image<em>Ubuntu Ghost 0.8.0 on 14.04</em> It uses nginx and an SSL certificate issued by Let's Encrypt to encrypt its data. While setting up the blog was easy (I just used Digital Ocean's dashboard to deploy the image mentioned above), installing the SSL certificate took a little more effort.</p>
<p>Thankfully, I found 2 excellent blog posts that explain how to do so:</p>
<ul>
<li>
<p><a href="https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-14-04">How To Secure Nginx with Let's Encrypt on Ubuntu 14.04</a>, by Mitchell Anicas</p>
</li>
<li>
<p><a href="https://www.markuskofler.net/ssl-support-for-your-ghost-blog/">SSL support for your ghost blog</a>, by Marcus Kofler</p>
</li>
</ul>
<p>These posts explain the process better than I can, so I won't repeat how to install a certificate here. However, I will share the solutions to 2 issues that cost me more time than I'm willing to admit.</p>
<h2 id="1editingthewrongnginxsitefile">1. Editing the Wrong Nginx Site File</h2>
<p>You'll have to change the nginx configuration file for your site in order to ensure requests for your site are handled using the appropriate protocols.</p>
<p>The nginx config file for your site is in 2 places: <code>/etc/nginx/sites-enabled/yoursite</code>and <code>/etc/nginx/sites-available/</code>. I recommend editing the file in <code>sites-enabled</code>. The file in <code>sites-available</code> will be automatically updated with any changes you make.</p>
<p>The <code>sites-enabled</code> directory should have at least 2 files: <code>default</code> and <code>ghost</code>. Edit <code>ghost</code> - your droplet treats your ghost installation as a site named ghost. This is why the directory that contains your site files is located at <code>/var/www/ghost</code>.</p>
<p>Editing <code>defualt</code> will not work. Nginx will only use <code>default</code> if the <code>ghost</code> file does not exist.</p>
<h2 id="2notrestoringghostspermissionsafterarestart">2. Not Restoring Ghost's Permissions After a Restart</h2>
<p>If you stop or restart Ghost during this process, your site may break and return the error code 502 - Bad Gateway.</p>
<p>This is because Ghost's permissions have been reset, and it no longer has permission to access itself. You can resolve this by navigating to <code>/var/www</code> and running this command:</p>
<pre>chown -R ghost:ghost *</pre>
<p>That's it! I hope this post has helped save you some time.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item></channel></rss>