Tech Junkie Blog - Real World Tutorials, Happy Coding!

Latest Posts

Friday, July 30, 2021

Combinators in CSS is term used to define a style that combines more than one selectors together.

For example let's say you have the following markup

        <div id="combinator-div"><h1>I'll be back.</h1></div>
        <h1>Combinator me</h1>

Let's say you only want to apply the styles for the <h1> tag that's inside the combinator-div, you can use a combinator style which is a combination of the div id and the h1 tag as combination to style a very specific element on the page.  The style would look like the following

#combinator-div h1 {font-family: sans-serif; font-weight: bold; color: green;}

If you run the page with the code then you would get the following output

As you can see only the I'll be back <h1> is styled, the other <h1> is just not cool enough to get styled.

Thursday, July 29, 2021

 In this post we are going to create our first Entity Framework migration and creating an actual database in MySQL. 

In order to do that we need to add a few NuGet packages to our Asp.Net Core project including the Entity Framework Core package.  But, before we do that we want to find out what what version of .NET Core we are running.  Obviously I have it memorized, but for the rest of you, you can type the command dotnet --version to figure out what the version is :)  It's always a good idea to try and match the package version with the .NET Core runtime you have.  It's one of the more annoying thing with Angular and Asp.Net Core, it's changing constantly. So as you can see my version so I should try to install packages that are made for 3.1.x.

The first package we are going to install is the Microsoft.EntityFrameworkCore.  So open the ACMEBank.API project with Visual Studio Code.  Press Ctrl+Shift+P and type NuGet and select

Wednesday, July 28, 2021

 User Data in an instance allows you run commands while your instance boots up.  In the previous posts we just plain vanilla instances so far.  But in this post we are going to install the Apache Httpd service when we create our instance using User Data.

Here are the steps to create an instance with User Data:

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"

2. Click on "Launch Instance"

Tuesday, July 27, 2021

Equality searches are great and efficient when you want exact matches or range of values. However, there will be times when you need to search a text field for not so perfect matches, perhaps a partial match is needed. Certain scenarios requires to search for patterns, such as an email address. That's when the LIKE operator is useful in SQL. The only caveat is that LIKE operators can only work with text fields. Examples: 1. A word/text with a % at the end, searches for all the records that begins with the letters before the percent sign

SELECT ProductName,UnitPrice
FROM Products
WHERE ProductName LIKE 'Chef%'

The query above returns all the records in the Products table that begins with the word "Chef"


Monday, July 26, 2021

 In this post we are going to install the Apache Web Server, which is the most common web server in the world.  With a web server you can serve up web sites or business products on the web.  Therefore it's kind of like giving your Linux system a purpose to exist.

The service you have to install is called httpd and the configuration files are located in the following directories

  • /etc/httpd/conf/httpd.conf
  • /var/www/html/index.html
And the log files are in /var/log/httpd

Here are the steps to install the Apache Web Server:

1. So first let's install the service, you can do this by typing the command dnf install httpd -y

2.  In the /etc/httpd/conf/httpd.conf file you will see that the ServerRoot points to the folder /etc/httpd and it's listening to port 80 because of the line that says Listen 80, you can change the directory for the ServerRoot and Listen properties in the configuration file to change the directory and the port respectively.  Another important setting is the DocumentRoot setting, this property defines your website's homepage or the starting point.  Since the DocumentRoot points to the directory /var/www/html let's navigate to the directory and see if there's an index.html page in the directory

3. If you don't have an index.html page in the directory, t's easy enough to create one.  Just type vi index.html in the directory and paste the following code in the file to get a simple html page.  But for the most part you will have the default Apache index.html page and that's perfectly fine we just want to see that it works at the end of this lesson.

<!DOCTYPE html>
<p>Hello Apache!</p>

4. Now that we have everything in place we want to start the service and enable it so that it starts on boot up with the following commands in order
  1. systemctl start httpd
  2. systemctl enable httpd
5.  To view the web page you typing ifconfig to see the server's IP address

6. To view the web page you can just type in the IP address in the browser's address bar. If you can't view the page, type stopping the firewall with the command systemctl stop firewalld

Friday, July 23, 2021

In this post we are going to use Google Fonts in our HTML markup, using Google Fonts is really easy to do.  All you have to do is go to then select the fonts that you would like to use.  Let's we want to use the Manjari, then All we have to do is click on the + sign next to the font.

Thursday, July 22, 2021

The SUM() function is used to sum up all the values in the specified column.

SELECT SUM(UnitsInStock) AS TotalInventory
FROM Products

The above query gets the total number of units in stock for all products

Wednesday, July 21, 2021

An instance metadata is data about your instance that you can use to configure your instances.  They are divided into categories.  Anyone who have access to the instance can view the metadata, therefore you should not store anything sensitive that could be accessed such as "User Data"

You can get more information here at Amazon's website:

You can access your metadata with this URL

Here are the steps to retrieve your instance data:

 1.  Connect to your AWS Linux instance and type curl

Tuesday, July 20, 2021

 In this post we are going to install MySQL Workbench on Fedora.  MySQL Workbench is a great GUI database management tool for MySQL.  Even though we can do everything we need with MySQL on the terminal it's nice sometime to see the tables and data visually.

Here are the steps to install MySQL Workbench:

1, Go to the yum repository for MySQL at select the Fedora repository, and click "Download"

Monday, July 19, 2021

 Sendmail is the most common Linux mail service, it is lightweight and is used in administrative tasks as well as sending mail.  In this post we are going to install and configure Sendmail and go over how to use it. Sendmail is the mechanism to send mail, it's not the mail server itself.

First let's install the Sendmail service, type dnf install sendmail -y after sendmail is installed you can install another package which will configure sendmail for you, type dnf install sendmail-cf -y to install that package

One it is installed you need to define your smtp relay server in the file /etc/mail/ file in the line that says dnl define(`SMART_HOST', `smtp.your.provider')dnl this is the one service that you need to have some infrastructure in place before you can use it.  Remember to remove the dnl when you specify the smtp server because dnl means comment in the file.

Once you have your smtp relay server defined, you can start the sendmail service with the systemctl restart sendmail command

To send an email you type
mail -s "subject goes here" then press ENTER

message goes after ENTER then press CTRL+D to exit and sendmail


Search This Blog