Tech Junkie Blog - Real World Tutorials, Happy Coding!: June 2021

Wednesday, June 30, 2021

 AWS has a very generous free tier account, but there will be times when you forget to clean up your work and are stuck with the bill.  There's a setting in AWS that allows to set the limits on your account so that you won't get charged for resources or get a surprise on your bill.  

Here are the steps to set a billing alarm:

1. First thing you have to do is sign in as the root user

Tuesday, June 29, 2021

 In this post we are going to use the .NET Core CLI to create a web api application for our app.  The first thing to do is create an a folder to hold our files.  Since we are using Linux you want to sudo su into the terminal and create the following folder /opt/app/ACMEBank.  Once that's done cd into it and you are ready to type in the command to create the Web Api.

Here are the steps:

1. What you want to do first is to make sure that you have .NET Core install by typing in dotnet --info, there should be information on your .NET Core install.  If you don't have .NET install you can follow the directions in this post.

Monday, June 28, 2021

 The dig and nslookup commands are useful commands that you can use to lookup information about a network.  The dig command gives you more information about a network.  For example for my network I have a DNS server setup in it, if I wanted to display the DNS information on my server I would simply type dig and I would get the following:

As you can see it gives you a lot of information about the DNS server like the IP that the server resolves to.  However, there are times when you just want something quick and brief on what the IP resolves to. For example you might know the IP address but not the hostname or vice versa and you want to lookup the information on the part that is know that's when nslookup comes in handy.  For example let's say you know the IP address but you don't know the hostname.  You can lookup the hostname by typing nslookup and you would get the hostname that resolves to the IP address

Or you can lookup the IP address with the hostname by typing nslookup

Obviously you can get more information with the dig command but sometimes it's nice to get less information with the nslookup command.  Although it is deprecated and might not be available for your Linux distribution. So if it's not available use the dig command instead.

Friday, June 25, 2021

There are often times when you see the measurement in CSS that looks something like this font-size: 2em; what does that actually mean? Well an em simply means its the multiplier of the font-size of the element. For instance 2em means that it will multiply the font-size of the element by 2x.

Let's say we have a div with a font-size of 15px, and there's a span tag with a font-size of 2em.  The span font-size of the span would be 30px, because the span is part of the div element.

Let's say have the following styles:

div {
  font-size: 15px;

span {
  font-size: 2em;

And with the following HTML markup:

<div>The font-size of the div element. <span>The span font-size</span>.</div>

The output is the following:

Thursday, June 24, 2021

SQL GROUPING allows you to segregate data into groups so that you can work on it separately from the rest of the table records. Let's say you want to get the number of products in a category in the Northwind database Products table. You would write the following query:

 SELECT COUNT(*) NumberOfProductsByCategory
FROM Products

The query above gives you the following results:

Wednesday, June 23, 2021

 So far we have connected to our EC2 instance with the terminal on Linux and Putty on Windows.  There is another option that you can perform and it only requires that you have a browser.  You must have an Amazon Linux Version 2 instance for this to work, at least that's what I think.

On the instances page on the AWS console click on the "Connect" button while the instance is selected

Select "EC2 Instance Connect (browser-based SSH connection)" radio button, and accept the defaults. User name "ec2-user" should be selected for you, then click "Connect"

Tuesday, June 22, 2021

The most important thing for most modern dynamic application these day is choosing a database to store your data.  If you are on a Windows environment then you use SQL Server database that is a fine choice. But if you are on Linux MySQL is a great choice also.  In this post we are going to go through how to install MySQL server on our Fedora development machine.

Here are the steps to install MySQL on Fedora Linux:

1. First we need to add the MySQL repository to our machine by tying in the following command in the terminal

sudo dnf -y install

Monday, June 21, 2021

 The chattr command in Linux is one of the more useful commands that you've probably used but have no idea what it's use is, it just works!  That's probably the most dangerous phrase in IT.  Well just from the command you can tell that controls the file modify attribute of the file.  Well not really I mean how is chattr related to file attributes.  I guess it's change attribute.  It's pretty easy to use + means to add an attribute, - means to remove an attribute, and = means you want to assign an attribute.  You can also add attributes with the -R option to reclusively on a directory.

One of the senario I used often is when I want to make a file immutable, I'll just type chattr +i filename.  For instance if I and setting a DNS server and I don't want the DHCP scripts to change the resolv.conf file every time I restart the NetworkManager.service I would just type chattr +i /etc/resolv.conf to make the file immutable.  If I try to modify the file I would get the following error message saying I can't modify the file.

It's just as easy to make it writable again, it would just be chattr -i /etc/resolv.conf

Friday, June 18, 2021

One descriptor of the font property in CSS is the font-stretch descriptor.  This descriptor widens and narrows a font family that has width-variant faces.

The values for widening and narrowing fonts are the following:

  • normal
  • ultra-condensed
  • extra-condensed
  • condensed
  • semi-condensed
  • semi-expanded
  • expanded
  • extra-expanded
  • ultra-expanded
The way you define a font-stretch is the following

      p.uc {font-family: Verdana; font-stretch: ultra-condensed;}

Thursday, June 17, 2021

In SQL the WHERE clause is the most common join you will see, it relates one or more tables together. For example you want to get the employeeis territory information in the Northwind database but you there are all in different tables.

Wednesday, June 16, 2021

 On the previous post we connect to our EC2 instance using SSH on Linux now I will show you how to connect to the EC2 instance using Putty on Windows

Here are the steps to connect to our EC2 instance on Windows:

1. Download and install Putty from here 

2. Open PuttyGen from the start menu, and select your .pem file and convert it to a .pkk file

Once it's open select "File", then "Load private key", then select your .pem file

Tuesday, June 15, 2021

In this post we going to get our development environment with NodeJS, VSCode and Postman

The Urls are the following, if you are developing in Linux you should install the Linux version.  All these tools are cross platform so you can develop in either Windows, Linux or MacOS:

.NET Core:


Visual Studio Code:


For .NET Core make sure you download the "recommended" version and not the preview version. Also with NodeJS, usually it has LTS status.

Installing .NET Core SDK and NodeJS On Fedora

In order to install .NET Core SDK on Fedora open the terminal and type in the following

sudo dnf install dotnet-sdk-3.1 -y

The -y tells Fedora to skip the y/N prompt and just go on with the install

Once the SDK is installed you can verify the install with the command dotnet --version

Monday, June 14, 2021

 Now that we have a static IP setup for our network.  We want to use it as a DNS server.  Let's go over the steps again for configuring a DNS server and make sure that eveything works with the static IP.  The key is the make it work on reboot.

Before you do anything get the name of you network adaptor and the IP address for it, my network adapter is enp0s3 and my IP address is  Yours will be different

You also want to know the hostname of the server for the configuration, you can find out what the hostname is by typing hostname

If you want to change your hostname you can follow the instructions on this post 

Make sure you have the following information in the /etc/named.conf file

Friday, June 11, 2021

By using @font-face declaration you can use custom fonts in your web pages.  The way this works is that you can host the fonts on your server, and then the user agent will download the font for future renders, for example you can specify the following markup to use a custom font that's not widely available.

    font-family: "Verana";
    src: url("Verana-Regular.otf");

You can get the free fonts here at Arkandis Digital Foundry to play around with custom fonts.
The url can be a local resource within the local server, or a remote resource on the internet.

Thursday, June 10, 2021

Views are virtual tables that you can create that others can use without knowing the complexity of the query, but can be used like a table. Also they can provided an added security by giving developers access to a view instead of the underlying table. Views does not contain data in itself the data stays at the tables that the views are created from. Complex views can degrade performance since they contain no data the query must be processed every time. Let's say a junior developer just came on board and he doesn't really know SQL that well. You can create a view of the more complex views to work with until he gets better with his SQL.

CREATE VIEW EmployeeTerritoriesDescriptions AS
SELECT e.FirstName + ' ' + e.LastName AS Name, t.TerritoryDescription,t.TerritoryID
FROM Employees e
INNER JOIN EmployeeTerritories et ON et.EmployeeID = e.EmployeeID
INNER JOIN Territories t ON t.TerritoryID = et.TerritoryID

The view above queries the employees territories using joins, by creating a view the person using the view does not have to know the underlying table structures that is in the database they can just use the view.

Wednesday, June 9, 2021

Docker is the hottest infrastructure technology to hit the tech world in a long time.  The appeal of Docker is that it allows the infrastructure team to utilize the capacity of the servers to near full capacity.  Docker is a container.  A container is like a micro virtualization minus the operating system.  It only contains enough infrastructure to host an app, without the fat.  Hence the term container is used to describe it.

Tuesday, June 8, 2021

The first thing we want to do is set up the Google Chrome browser on a Linux instance, I've decided to use a virtualized Fedora workstation as my development machine.  You can use Windows if you want, it would be a lot easier.  It doesn't really matter because Asp.Net Core works on Linux as well.  Google Chrome has the best development tools and it also has an extension call Postman.  Although you want to install the standalone version of Postman.  Here are the steps to install Google Chrome on Linux

I wrote a post on how to set Fedora as your development machine here

1. Navigate to the URL

2. Click on "Download Chrome"

Google chrome download page

Monday, June 7, 2021

 In the previous post we configured a DNS server, in this post we are going to assign a static IP to that server so that we don't get a new IP everytime we reboot the server.

First let's check our VirtualBox Adapter IP settings

1. Make sure your VM is set to the Bridge Network setting

Now turn on the VM machine and type ifconfig to the the adapter name

First let's get our network information with the command ifconfig 

Sunday, June 6, 2021

In the previous post we installed MongoDB on a Linux orperating system.  On this post we are going to setup the data folder that MongoDB needs and connect to MongoDB in the command line. 

Here are the steps:

  1.  Create a folder call /data/ then create another folder call db underneath it with the mkdir command, I've already created the folder so I can't do it on the command prompt again.
           But you basically run the following commands
               1.  mkdir /data
                2. mkdir /data/db

    2.  Now we want to start the MongoDB service with the command mongod --dbpath "/data/db"

    You only have to do this once, afterward you can just type mongod and the service should start.           You would need sudo rights to run these commands.

3. Now you can connect to you MongoDB instance with the mongo command

Saturday, June 5, 2021

One of the more useful things are about yum is that it comes with a group install feature.  This basically lets you install groups of packages with one command.  These includes, administration tools, storage, databases, virtualization, and etc.

Friday, June 4, 2021

A big part of web development is dealing with the DOM (Document Object Model) the DOM is organized in a hierarchical order.  You locate an element in the DOM by traversing through the DOM tree.  For instance if you have an ordered list there's a natural hierarchical order to it.

Let's say you have the following markup

  <li>item 1</li>
          <li>sub item 1</li>
          <li>sub item 2</li>
          <li>sub item 3</li>
  <li>item 2</li>
  <li>item 3</li>

Thursday, June 3, 2021

RIGHT JOIN works like the INNER JOIN, it just returns all the records that are on the right side of the = sign on the RIGHT JOIN clause. For example let's say you want to get a record of all customers who orders a certain product.

Wednesday, June 2, 2021

In this blog we are going to start our journey into AWS infrastructure with the creation of an EC2 instance which is probably the most common task you'll ever do. 

 Here are the steps to create an EC2 instance on AWS:

1. Log into AWS and on the "Find Services" search box type EC2 and press enter 

2. You will be taken to EC2 screen, then click on "Instances"
AWS EC2 Dashboard Screen

2. Click on "Launch Instance"

Launch AWS EC2 Instance

Tuesday, June 1, 2021

 In the next month or so I will start a series of blog posts that will take you from scratch on how to deploy an Angular application that makes API calls from an Asp.Net Core web api backend using Entity Framework Core as it's ORM and MySQL as the database.  Most tutorials would end there, but I will take it further and deploy the application on AWS so that it lives on the world wide web.  Since I don't want to start from scratch I will be modernizing the ACME bank application that I've started with AngularJS.  If you are working with AngularJS you know that it's time to update and upgrade because it's at its' last legs and Angular is the future.  Some say the journey is more rewarding than the destination.  I hope, you will join me on this journey.  Thank you, here is a diagram of what's to come

Search This Blog