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

Monday, November 27, 2017

Since CSS does not live in an island no technology does.  It has to interact with it's neighbor HTML on a regular basis.  In the HTML world there's the block-level elements and then there's the inline-level elements.  Most developers could care less what the meanings of these words mean.  For the designers, it's okay they are just trying to make things look pretty cut them some slack :)

First let's look at block elements:

Block elements are needs to stand on it's own, meaning there's no elements at either sides.  They generate a break on the top of bottom of itself.

Here is an example:

The <h1> and <p> tags are block elements.  Even if you write the code <h1>This is H1<h1><p>This is a paragraph tag!</p> in one line next to each other without any breaks.  The resulting respresentation of those tags in the browser would look like this.


Tuesday, August 1, 2017

In this blog post I am going to show how to connect to your Azure subscription in Visual Studio 2015.  As a developer it's nice to have the Azure subscription integrated into Visual Studio so that you don't have to log into the Azure portal every time you want to interact with Azure.

Follow the steps below to connect to your Microsoft Azure subscription in Visual Studio:

1.  Open Tools → Connect to Server
2.  On the top of the "Server Explorer" connections list right click on "Azure" and select "Connect to Microsoft Azure Subscription"

Tuesday, July 25, 2017

In this blog post we are going to get the Azure subscription in Powershell using the secure certificate method.

Follow the steps below to get the Azure subscription:

1.  Open Powershell as an Administrator
2. Type Get-AzurePublishSettingsFile once you type the command into the Powershell command line it will pop-up the Azure authentication prompt.  Authenticate into Azure and save the publish file settings into a place that you will remember.

Tuesday, July 18, 2017

In this blog post we are going to download and install the Azure Module for PowerShell.  This will allow you to interact with your Azure account through PowerShell.

Follow the steps below to download and install the Azure Module for PowerShell:

1. Go to https://azure.microsoft.com/en-us/downloads/ , scroll down until you see the "PowerShell" section and click on the "Windows install" under the section

Tuesday, July 11, 2017

In this post I will show how to download the automation scripts that Azure provides when you create a new virtual machine in Azure.  This is great for PowerShell scripting or if you want to interact with your VM in Visual Studio.  You don't have to start from scratch.

Here are the steps to get the automation scripts for your VM in Azure:

1. Log into the Azure portal at https://portal.azure.com
2. Click on "Virtual Machines"

Tuesday, July 4, 2017

In this blog we are going to deploy a Windows Server 2016 Datacenter Virtual Machine in Microsoft's Azure Portal.


Follow the steps below to create a Windows Server Virtual Machine:

1. Log into https://portal.azure.com
2. Select "Virtual Machines"

Tuesday, June 27, 2017

In the previous blog we deployed a full stack Ubuntu Server in Azure.  In this blog we are going to connect the server using a tool call Putty.  You can download Putty at https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html .

Follow the steps below to connect to your Ubuntu Server in Azure:

1.  Log into the Azure Portal at https://portal.azure.com
2.  Click on "Virtual Machines"

Tuesday, June 20, 2017

People often get confused when they work with Azure because there are two versions of Azure.  Most people call it the classic mode and the new portal Azure or the more official term is ASM vs ARM.  In this post we will create a CentOS Linux virtual machine in the new Azure portal.

Follow the steps below create a new Azure portal:

1. Go to the URL : https://portal.azure.com
2. Log in with your Azure credentials
3.  Click on "Virtual Machines" make sure it doesn't say classic on the link

Wednesday, June 14, 2017

Don't have money to buy Winzip?  If you are looking for a good file achiver or extractor look no further than 7-Zip.  It archives and extract most of the file formats and the best part of the value proposition for this great application is that it's free!  And if you act now, you will get it for free!  So hurry while supplies last! It's still free!  Anyways I haven't had any problems with the application.  Even though it's free it's high quality.  So head over to the official website at http://7-zip.org/download.html and download the version for your OS.

Tuesday, June 13, 2017

In this blog post we are going to deploy a Linux virtual machine in Azure.  Most of the steps takes place in the Azure portal.  To get to the Azure portal type in the browser this address https://manage.windowsazure.com

Follow the steps below to create a Linux virtual machine in Azure:

1.  Type into the browser https://manage.windowsazure.com/
2.  Log into Azure with your Azure credentials
3.  On the left hand side of the portal click on the "Virtual Machines" link

Tuesday, June 6, 2017

In the previous blog post we created an Azure cloud service.  Now we are going to create a private virtual Azure network.  The importance of this is that when you create a virtual machine in Azure you will use this virtual network to connect to your virtual machine.

Tuesday, May 30, 2017

The first thing you want to do in Azure is to create a new "Cloud Service" which is a deployment service your resources will be deployed in such as a virtual machine or a web site.

Follow the steps below to create a new Azure "Cloud Service":

1.  Once you are logged into the Azure Portal click on the "Coud Services" on left hand side

Wednesday, April 19, 2017

In this post we will be installing the RoboMongo user interface for MongoDB.  The advantage of a GUI is that you can see the documents in MongoDB visually also there is a validate future that is quite useful when you make changes to the data.

Here are the steps to install RoboMongo:

1.  Go to https://robomongo.org/download and click on the "Download" button

Monday, April 17, 2017

The previous blog post we setup our application to work with Heroku locally.  In this post we will deploy our application to the live Heroku platform.

Here are the steps to deploy our application to Heroku:

1.  First we need to check in our code into a local Git repository to add our code to Git is easy first type git init

Thursday, April 13, 2017

In this blog post we will setup our AngularJS SPA application for Heroku and testing it locally to make sure we got all our ducks in a row if you need a refresher for how to setup Heroku you can visit this post.  By deploying to Heroku we can access our application online making our application live.

Here are the steps to deploying the AngularJS shopping application to Heroku:

1.  Find out the node and npm version you have installed on your machine by typing in the following command

node --version
npm --version

Tuesday, April 11, 2017

In the previous blog we setup the folder structure to use the Jade view engine just to make sure Express is working correctly.  In this blog post we are going to tell Express to serve file static files as well in our app folder.  In the previous part when we browse to http://localhost:3000 we get the "Express" index page.  Using a view engine is a preference that some people have, but I feel more comfortable developing in HTML.

Friday, April 7, 2017

Heroku is a service provider that you can use to host your Node application quickly.  In this blog post I will how you how to install Heroku on a Windows machine.

Here are the steps to setup Heroku on a Windows machine:

1.  Go to heroku.com and sign up for a free account, follow the instruction on the page
2.  Download the Heroku toolbelt from the Heroku website at http://toolbelt.heroku.com

Thursday, April 6, 2017

In this post we will add Tag Helpers support for our application.  Tag Helpers are programmable attributes that you can use throughout the application.

Follow the steps below to enable tag helpers:

1.  Right-click on the "Views" folder and create a "View Imports" file

Tuesday, April 4, 2017

Now that we have express installed let's do a little clean up and organization by creating some folders that we need.  First of all create the models and controllers folder inside the app folder your folder should look like the following

Monday, April 3, 2017

In this post we will create the Category Repository to retrieve information from the database about the the different categories in the NorthwindCafe database.

Here are the steps to create the Category repository class in the NorthwindCafe application:

1.  Create the ICategoryRepository interface for dependency injection, create a file call ICategoryRepository.cs in the "Models" folder with the following code


using System.Collections.Generic;

namespace NorthwindCafe.Web.Models
{
    public interface ICategoryRepository
    {
        IEnumerable GetAllCategories();
        Category GetCategory(int Id);

    }
}


Thursday, March 30, 2017

In our AngularJS SPA application we will be using the Express web server to serve up our web application.  In the previous blog post we installed the Express-generator globally.  Now we can install Express in the root folder of our SPA application.

Here are the steps to create an Express application:

1.  Open the command line prompt at the root folder of the SPA application

Wednesday, March 29, 2017

Logging is a good service to add as the application gets more complicated.  It will allow us to see what the error is when things goes wrong.

To add logging to our ASP.NET Core application follow the steps below:

1.  Open the Startup.cs file and add the logging service to the ConfigureServices method with the line

services.AddLogging();

So your ConfigureServices method should look like the following


        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc();
            var connectionString = Startup.Configuration["Data:NorthwindContextConnection"];
            services.AddDbContext(options => options.UseSqlServer(connectionString));

            services.AddLogging();
        }


Thursday, March 23, 2017

In order to install the Express web server on the fly on your machine you need to install the Express generator.  Fortunately with NodeJS it is as easy as typing in a command in the command line.  This step used to install Express globally so that it will be easy for development.

Here are the steps to install Express generator globally:

1.  Open up the command line and type in the following command
     npm install -g express-generator

   

Wednesday, March 22, 2017

In the previous blog we created the NorthwindCafe database with Entity Framework Core.  Now we are going to seed the database so that we can work with the data.

Here are the steps to seed the NorthwindCafe database:

1.  Create a file call DBInitializer in the NorthwindCafe.Web folder, in the file type in the following code


using System.Linq;

namespace NorthwindCafe.Web.Models
{
    public class DbInitializer
    {
        public static void Initialize(NorthwindContext context)
        {
            context.Database.EnsureCreated();

            if(context.Categories.Any())
            {
                return;
            }

            var categories = new Category[]
            {
               new Category {Name = "Coffee", Description="Coffee", Products = new Product[] { new Product { Name = "Dark Roast", Description = "Dark Roast", Price = 2.0M } } },
               new Category {Name = "Tea", Description="Tea", Products = new Product[] { new Product { Name = "Chai", Description = "Chai", Price = 1.5M } } },
               new Category {Name = "Pastry", Description="Pastry", Products = new Product[] { new Product { Name = "Cupcake", Description = "Cupcake", Price = 1.25M } } },
               new Category {Name = "Food", Description = "Food", Products = new Product[] { new Product  { Name = "Hamburger", Description = "Hamburger", Price = 5.0M } } }
            };

            foreach (var c in categories)
            {
                context.Categories.Add(c);

            }

            context.SaveChanges();
        }
    }
}


Thursday, March 16, 2017

In the previous blog post we created a configuration file for our MongoDB database in this post we will install MongoDB as a Windows service so that we don't have to start the service in the command line every time we want to use it to save development time.

Here are the steps to install MongoDB:

1.  Open the command prompt as an "Administrator"

2.  Change the mongo-db-config.conf file to use absolute paths.  You can get the instructions on how to create a MongoDB configuration file in this blog post

            dbpath = C:\techjunkie\mongodb\db
            logpath = C:\techjunkie\mongodb\mongo-db-server.log
            verbose = vvvvv

if the folder dpath folder does not exists in Windows create the folder "db" inside the "mongodb" folder, else the service start will fail

Thursday, March 9, 2017

In the previous blog post be installed mongoDB now, we are going to create a configuration file for mongoDB to use during startup.

In this configuration file we will specify the following:

  • location of the data files
  • log file path
  • the verbosity of the log file

Here are the steps:

  1. Create a folder in your operating systems
  2. create a file call mongo-db-config.config in the folder
  3. Type in the following lines of configuration settings
            dbpath = /techjunkie/mongodb/db
            logpath = /techjunkie/mongodb/mongo-db-server.log
            verbose = vvvvv
         
           dbpath : specifies the path of the data files
           logpath : specifies the path of the log file
           verbose: specifies how verbose we want out log files to be, in this we want our log files to be very verbose we want to log everything.  The settings is from v to vvvvv  going from least to most verbose

Thursday, March 2, 2017

Now that we have our AngularJS environment set up we need a database.  We are going to use MongoDB as a database.  MongoDB is a NoSQL database which is a perfect fit for JavaScript centric applications that we are building.  To install MongDB go to https://www.mongodb.com/download-center?jmp=nav#community to make sure you are installing the "Community Edition" of MongoDB.  On the "Community Server" tab select the operating system that you will be installing MongoDB in, then click on the "Download button.

Search This Blog