Monday, March 26, 2018

ASP.Net Core 2 with Postgresql on Linux Part 4: Sync Configuration Differences


In In Part I, I discussed the rationale for porting a ASP.Net Core 2 app to my Linux system replacing SQL Server with Postgresql and place it on Heroku. In Part II, we transferred the SQL Server data to Postgres.

In Part III, I create the ASP.Net MVC Core 2.x app, from which we will proceed, and get Entity Framework Core installed.

Next, in Part IV, I look at the configuration differences between the ASP.Net MVC app that uses SQL Server and the new app, in preparation of porting the old app to use Postgresql.

First, let's look at the existing app's project file and compare that to the one that we have in our new app that use Postgresql. Of course, in order to do that we will need the code from the app using SQL Server. To do that, I cloned my existing Windows based ASP.Net MVC .Net Core project onto my Linux system as I will be reusing a good deal of the code moving forward. Here is what I did (For more information see: https://git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository):


 $mkdir WinCoreProject  
 $cd WinCoreProject  
 $git clone https://myUserName@bitbucket.org/myUserName/myASPNetCoreApp.git  

Now that we have the code from the existing app, let's compare the two project's config files, which are in the root directory of each projects' folder. 

One of my favorite tools for this task is a multi-platform, data comparison utility called Beyond Compare. Comparing the two project files, here is a look at the differences.


Note the text in red in the right side of the view. This shows that the old app's configuration includes three additional settings. The NetCore.MailKit entry is for a MailKit extension for asp.net core that I use to send a confirmation email to users who want to create a user account. Serilog is a logging library with many nice features. In addition, we see the Serilog.Sinks.RollingFile package setting that allows for a daily log file entries.

To sync the two files, let's continue with Beyond Compare. Select the yellow arrows in the right pane to move the text to the config file displayed in the left pane.




Then, to update the myApp.csproj file, select the disk icon to the right of the project file name.


Here is the view of the synced files:


Next, run the dotnet restore command at the command prompt to install the packages:

$dotnet restore   

Note that you can also install the packages at the command prompt in the application's root directory:  
 $dotnet add package NETCore.MailKit

Per the location here, "The dotnet add package command provides a convenient option to add a package reference to a project file. After running the command, there's a compatibility check to ensure the package is compatible with the frameworks in the project. If the check passes, a <PackageReference> element is added to the project file and dotnet restore is run." 

Visual Studio Code, with the C# extension, will also assist you when you update the project file. 


In the next post, Part V, we will start comparing the differences in both the projects' structures and porting the existing project code, starting with the data model layer, to the new project.


Friday, March 23, 2018

ASP.Net Core 2 with Postgresql on Linux Part 3: Create the ASP.Net MVC Core 2.x app and Install Entity Framework Core

In Part I, I discussed the rationale for porting a ASP.Net Core 2 app to my Linux system replacing SQL Server with Postgresql and place it on Heroku. As I thought about it, my first logical step was to port the data from SQL Server to Postgresql. While I think I am proficient at the command prompt, I had to admit that having a GUI based tool would be a help. Having used pgAdmin on a Rails 3.x project, that is where I leaned. In that article I show the steps to installing pgAdmin, a GUI Postgresql client on Ubuntu 16.04. In Part II, we transferred the SQL Server data to Postgres.

In this post, I create the ASP.Net MVC Core 2.x app, from which we will proceed, and get Entity Framework Core installed.

First, I created a new ASP.Net MVC .Net Core C# project in Visual Studio Code (see https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app-xplat/start-mvc for more).

 $mkdir myApp  
 $cd myApp  
 $dotnet new mvc  

I already had the .NET Core 2.0.0 SDK, Visual Studio Code, and the VS Code C# extension on my Ubuntu 16.04 Linux system. See https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app-xplat/start-mvc for more information on these steps.


Then, I issued a dotnet run to build and execute the source code:


Per the URL provided in Visual Studio Code screen above, I browsed to http:/localhost:5000:


OK, so the app will build and load.

Next, I updated the project file in Visual Studio Code (myApp.csproj) to include the following settings to install Entity Framework Core:

 <Project Sdk="Microsoft.NET.Sdk.Web">  
  <PropertyGroup>  
   <TargetFramework>netcoreapp2.0</TargetFramework>  
  </PropertyGroup>  
  <ItemGroup>  
   <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.5" />  
   <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.0.0" />  
  </ItemGroup>  
  <ItemGroup> 
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.2" />  
    <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0" />  
    <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" />  
  </ItemGroup>  
 </Project>  

Then, I ran the dotnet restore command to install the above EF package and tools:

 $dotnet restore  


Now we have a working ASP.Net MVC Core 2.0 app with Entity Framework Core installed.

Next, in Part IV, I look at the configuration differences, in preparation of porting my existing app to use Postgresql.


Tuesday, March 20, 2018

ASP.Net Core 2 with Postgresql on Linux Part 2: Move SQL Server Data to Postgres

In Part I, I discussed  the goal of porting my ASP.Net Core 2 app to my Linux system using  Postgresql as the database and placing it on Heroku. As I thought about it, my first logical step was to port the data from SQL Server to Postgresql.

While I think I am proficient at the command prompt, I had to admit that having a GUI based tool would be a help. Therefore, Part I details the setup of pgAdmin installed on my Ubuntu system.

Here, in Part II we port the existing SQL Server data to Postgres.

First, I looked around for a free tool to take an existing MS SQL database and transfer it to a Postgresql database. However, what I found did not seem to meet my goal. Given the disparity between the Db platforms, the best tool I could find was a Postgresql function entitled convert_mssqlddl2pgsql.sql. Since I had existing MS SQL Create Table scripts already, this seemed the best option.

In short, I loaded the convert_mssqlddl2pgsql script into pgAdmin and added my MS SQL Create Table script (for each existing table, one at a time) as the input parameter (see below), and the output was a Postgres Create Table script.



Here is the SQL for the SQL Server table
 CREATE TABLE [dbo].[myTable](  
   [myID] [int] IDENTITY(1,1) NOT NULL,  
   [FirstValue] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,  
   [SecondValue] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,  
   [ThirdValue] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,  
  CONSTRAINT [PK_MyID] PRIMARY KEY CLUSTERED   
 (  
   [ContactID] ASC  
 )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]  
 ) ON [PRIMARY]  
re is the Data Output from pgAdmin function above:


 create table public.mytable(  
   myid serial not null,  
   firstvalue varchar(50) null,  
   secondvalue varchar(50) null,  
   thirdvalue varchar(50) null,  
  constraint pk_myid primary key   
 (  
   myid  
 )   
 )                  

After running the pgAdmin function for each SQL Server database table and then running the script in pgAdmin to create the Postgres database tables, I made sure that the sequence columns were set accordingly. To do this I ran the following for each table with a serial id column:

 UPDATE public.mytable SET myid=nextval('mytable_myid_seq');  

You can use pgAdmin to check the serial id columns to may sure that the default value property of the column is set to the next available value.



The next step was to get the data from the MS SQL database tables into the newly formed Postgresql tables. What I did was to get a record-by-record text file output of the SQL Server table from a select statement that consisted of the table values.
 'Your first column value here', 'Your second column value here...','and you guest it....your third column here!'  
 'Your first column value here again', 'Your second column value here..yeah...','and your third column here!'  
 'Your first column value here, one more time', 'Your second value','your third column!'  

Now that I had the SQL Server table data into a fixed length format, the next step was to transform it into proper Postgres insert statements.

Mind you, I know that I could have used a SQL select statement within SQL Server to create the Postgres insert statements, but given that I have been a Ruby fan from way back and reading in and parsing files is one of the strengths of Ruby, the next step was a natural evolution, or at least some kind of semi-intelligent design...I used the Ruby script below to produce the Postgres insert scripts.

 file = File.open("myValues.txt", 'r')  
 while !file.eof?  
   line = file.readline  
   puts "INSERT INTO public.tableName(firstColumn, secondColumn, thirdYouGuestItColumn) VALUES ( " + line + ");"  
 end  

The output was the following:

 INSERT INTO public.myTable(  
      firstvalue, secondvalue, thirdvalue)  
      VALUES ('Your first column value here', 'Your second column value here...', 'and you guest it....your third column here!');  
 INSERT INTO public.myTable(  
      firstvalue, secondvalue, thirdvalue)  
      VALUES ('Your first column value here again', 'Your second column value here..yeah...', 'and your third column here!');  
 INSERT INTO public.myTable(  
      firstvalue, secondvalue, thirdvalue)  
      VALUES ('Your first column value here, one more time', 'Your second value', 'your third column!');  

Just as before, I ran the above script in the pgAdmin client. The result was Postgresql tables with data!

In short, these are the steps that took place with each table.

Now that my data is in Postgresql, the next step, to be detailed in Part III, I create the ASP.Net MVC Core 2.x app, from which we will proceed, and get Entity Framework installed.


Thursday, March 15, 2018

ASP.Net Core 2 with Postgresql on Linux Part 1: Installing pgAdmin4 on Ubuntu 16.04

For the last 15 years I have had a personal web-based app that I have used to learn new languages and frameworks. 

Starting with Microsoft's .Net 2.0 framework and then moving from Ruby on Rails 3.x, to MeteorJS, and then to .Net Core 1.x, this app has also been used with MySql, SQL Server, MongoDb, and Postgresql as the data access layer. 

Currently, I have ported the app to ASP.Net Core 2 with SQL Server on the Azure cloud. As I was poking around my github repo I thought why not use my Linux Ubuntu 16.04 laptop and port the current ASP.Net Core 2 app to my Linux with Postgresql and place it on Heroku

As I thought about it, my first logical step was to port the data from SQL Server to Postgresql. While I think I am proficient at the command prompt, I had to admit that having a GUI based tool would be a help. Having used pgAdmin on my Rails 3.x project, that is where I leaned. So, step one, get pgAdmin installed on my Ubuntu system. 

Thanks to the data from https://askubuntu.com/questions/831262/how-to-install-pgadmin-4-in-desktop-mode-on-ubuntu, this was a much easier transition. 

Here is what I did:

Installed pgAdmin4 using Python3.x (I preferred to avoid encoding related issues):
 $sudo apt-get install virtualenv python3-pip libpq-dev python3-dev  
 $cd  
 $virtualenv -p python3 pgadmin4  
 $cd pgadmin4  
 $source bin/activate  
 $pip3 install https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v2.1/pip/pgadmin4-2.1-py2.py3-none-any.whl  
 $gedit lib/python3.x/site-packages/pgadmin4/config_local.py  

Copied this to the config_local.py file:
 import os  
 DATA_DIR = os.path.realpath(os.path.expanduser(u'~/.pgadmin/'))  
 LOG_FILE = os.path.join(DATA_DIR, 'pgadmin4.log')  
 SQLITE_PATH = os.path.join(DATA_DIR, 'pgadmin4.db')  
 SESSION_DB_PATH = os.path.join(DATA_DIR, 'sessions')  
 STORAGE_DIR = os.path.join(DATA_DIR, 'storage')  
 SERVER_MODE = False  

Created the following directories and change the permissions:
 $sudo mkdir "/var/log/pgadmin"  
 $sudo chmod a+wrx "/var/log/pgadmin"  
 $sudo mkdir "/var/lib/pgadmin"  
 $sudo chmod a+wrx "/var/lib/pgadmin"  

Created a file in my /home/mark folder named pgAdmin4.py and copy this to the file (note that your user name will be the folder here):
 #!/bin/bash  
 cd ~/pgadmin4  
 source bin/activate  
 python3 lib/python3.5/site-packages/pgadmin4/pgAdmin4.py  

Made the file executable:
 $chmod +x /home/mark/pgAdmin4.py  

Then, I installed postgres locally. First I created the file /etc/apt/sources.list.d/pgdg.list, and added a line for the repository:
 deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main  

I imported the repository signing key, and update the package lists:
 $wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | \  
  sudo apt-key add -  
 $sudo apt-get update  

Next, I installed PostgreSQL on Ubuntu, using the apt-get (or other apt-driving) command:
 $apt-get install postgresql  

Finally, after the install of postgresql, I created a user and give them permissions:
 $su -s  
 $su - postgres  
 $psql  
 postgres=# CREATE USER yourUser PASSWORD 'userPassword';  
 postgres=# GRANT ALL ON SCHEMA test TO yourUser;  
 postgres=# GRANT ALL ON ALL TABLES IN SCHEMA test TO yourUser;  
 postgres=# \q  

Now, when I run the ./pgAdmin.py command from a terminal and navigate to http://127.0.0.1:5050/browser/ in my web browser, I see the following:

In Part 2, I will detail the process of moving the data from SQL Server to Postgresql.

Thursday, March 08, 2018

Selling Out has been Amazing!


I have been delving into the world of Docker and Containers on both Linux and Microsoft Windows. I was listening to a podcast that recommended the Youtube video, "Containers aka crazy user space fun" that records Jessie Frazelle's keynote at Linux Conf in Australia. At about 1:50 into the video she stated, "who am I?...I work at Microsoft...selling out has been amazing!" There was laughter from this Linux crowd and she continued on to give a great and informative talk on Linux Containers. Typically, selling out is a bad thing and Jessie Frazelle obviously did not mean it in a negative way. On a side note I love that Microsoft loves Linux and I am sure that has resulted in a great working experience for Jessie. Contrary to the populist view that all corporations are evil, this goes to show that companies can...and some do change.

Monday, February 26, 2018

When All Else Fails... Where's the Manual?

How many times have you purchased a product and it required some sort of assembly? You try to put it together only to find you have extra parts left over. As a last resort, you look for the manual. What about when you have to repair it or modify your purchase? Where is the manual?

Concerning software development, if you have a piece of code...a class, a library, or a database table and no one knows who owns it (a.k.a. who created it, is responsible for maintenance, and/or is the source of knowledge for that machine) and something needs to change, either moving to a new system, new feature added, etc, then you have a problem. What typically ensues is similar to what takes place on a factory floor when a piece of equipment that has been running for some time on a production line with out issue needs fixed or new functionality added. 

First, an inquiry is made to the maintenance team asking who is responsible for its upkeep. However, what is found is the maintenance personnel that once created the machine, did the upkeep, and the addition of new functionality is no longer with the company. Then, the maintenance team will review the equipment manual (think dev team documentation here for this analogy). If there is none (which unfortunately is the common case with software that is produced by many dev teams), the team has to consider a few options.

Should they reverse engineer the machine and create a new one? What about simply making the needed changes to the current piece of equipment and risk breaking it? As you know from experience or can imagine, each option has its pros and cons. Yet, wouldn't it be better to have some documentation available to assist? This is why, in my view, documentation is so important when creating software.

Do yourself and others a favor and document with both informative comments in your code as well as external documentation explaining the business rationale as well as a description of your interfaces and objects. 

Saturday, February 10, 2018

Niall Ferguson, author of The Square and the Tower, on TWiT's Triangulation show

Just listened to Niall Ferguson, author of The Square and the Tower, on TWiT's Triangulation show. Yet another reason that the Humanities in general and History specifically is vital in any well rounded education.


Newport on the Levee and the Old Netscape Browser Logo

I was running across the Purple People Bridge from Cincinnati, OH to Newport, KY and noted the digital sign that they have posted on the KY side of the bridge. I was quickly struck with the realization that the Newport logo reminded me of something familiar yet old. After I moment I remembered. The Newport logo reminded me of the old Netscape web browser logo.





Newport on the Levee Sign
Old Netscape Browser Logo

Friday, February 02, 2018

All is well with your approximate existence, mate.

In my Business Programming class that I teach, I was putting together a demo for the students to show the precision, or lack thereof, of certain numeric datatypes. The language is VB.Net. Here is the comment that I have in the code:

'To check floating point division (with Single, Double, and Decimal datatypes), take the quotient and multiply it with the divisor to get a very close approximation to the numerator.

'Why an approximation? "Squeezing infinitely many real numbers into a finite number of bits requires 'an approximate representation.'" (Emphasis mine)

'See https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html

It was with that thought that I realized, I am not sure that I like that it is an approximation. Yet, we must and do live with approximations all day long. This came to light to me back in 2007 when I started to really keep track of my nutrition. Right away I realized that when recording my intake for each meal and snack the data are not exact but rather a range of values. For example, when you eat an apple (medium 3" diameter (182 g)), is the caloric intake always 95 calories? No. Is it ever? Occasionally. The point is, on most occasions we make decisions based on approximations and not exact amounts. Yet, these estimates are good enough for most of life in time and space. If you are a fan of Crocodile Dundee, remember the exchange between he and Sue when discussing his age?

(SUE) How old are you?
(MICK) Dunno. What year is this?
(SUE) You don't know?
(WALT) Time doesn't mean much up here.The Aborigines don't have calendars.
(MICK) I was raised by the local tribe.I asked one of the tribal elders when I was born, and he said,"In the summertime."


Of course, this did not mean that Crocodile Dundee was not born on a specific day, but rather he didn't know what day that was on a Gregorian calendar. Yet, he lived day-to-day the same as if he had known the exact date. 

Mind you, with computer languages and floating point datatypes, there are safe guards so you can rest assured all is well with your approximate existence.

Wednesday, January 31, 2018

QR Codes Kill Kittens?

This morning I was ruffling through old pics in a Dropbox folder and noted an old QR Code that I created about 5 years ago. At the risk of a young feline death, here it is:



I was curious as to their current amount of use and found that some have declared the QR Code useless, others have stated that QR Codes kill kittens, and a few see hope in Snapchat's SnapCodes to keep the concept going. So, in addition to my Bitmoji SnapCode here:



I also created a custom one:



I must admit that I like the looks of the SnapCode better than the old QR Codes. Also, I would venture that more smartphone users have Snapchat installed than a QR Code scanner app.


Tuesday, January 30, 2018

Take a breath, investigate, and deal with it.

This morning while on my laptop another annoying iTunes dialog popped up about installing the latest update. Mind you, iTunes is a good product and I did have it installed back in the day when loading my iPod Shuffle...but that was then. Still, about once a week I would get a "reminder" asking if I wanted to update my installation. I understand that this is a courtesy but it had long ago become an annoyance. After all, I had uninstalled iTunes! Yet, when it would popup again, I would simply close it each time because it only took a second and I could be on my way. But this morning I realized that I was done with the popups and decided to actually take a few minutes and deal with it. 

After taking about 30 seconds to select Edit | Preferences |Never | OK i realized how cathartic! 

Lesson: When that annoying dialog box pops up again, take a breath, investigate the preferences or go online, and take a few minutes to research the setting that schedules the popup, and be rid of it. Ahhh...closure as well as an assurance it will not bother you again!

Thursday, December 14, 2017

Create and run an ASP.Net Core app in Linux and use Docker to run it on Windows



Preliminaries
I first start with my Ubuntu 16.04 Linux system that has Visual Studio Code (VSC), Docker  and .Net Core installed. My Windows system is running Windows 10 Education version 10.0.16299 with Docker for Windows and .Net Core installed.

From the Ubuntu Linux Desktop
From the command prompt on Ubuntu let’s create a new ASP.Net app.
>dotnet new razor -o demoApp

Here is the output:

 The template "ASP.NET Core Web App" was created successfully.  
 This template contains technologies from parties other than Microsoft, see https://aka.ms/template-3pn for details.  
 Processing post-creation actions...  
 Running 'dotnet restore' on demoApp/demoApp.csproj...  
 Restoring packages for /home/mark/Code/dotnetcore/demoApp/demoApp.csproj...  
 Restore completed in 4.1 sec for /home/mark/Code/dotnetcore/demoApp/demoApp.csproj.  
 Generating MSBuild file /home/mark/Code/dotnetcore/demoApp/obj/demoApp.csproj.nuget.g.props.  
 Generating MSBuild file /home/mark/Code/dotnetcore/demoApp/obj/demoApp.csproj.nuget.g.targets.  
 Restore completed in 18.85 sec for /home/mark/Code/dotnetcore/demoApp/demoApp.csproj.  
 Restore succeeded.  

Then in Visual Studio Code (VSC) I open the new demoApp folder:



Next, I opened the About.cshtml Razor file in VSC and made the following changes:


After that, I ran the
>dotnet run
command from the command prompt and browsed to http://localhost:5000/About in my web browser and noted the changes:




I then issued a Ctrl+C at the command prompt to stop the app.

Now to create a Docker image. First, I added a Dockerfile to the demoApp:


I will refer you here for the anatomy of a Dockerfile and here for information about the aspnetcore-build image specifically.

Next, from the command prompt I did the following:

>docker build --rm -f Dockerfile -t demoapp:v0.1 .

This resulted in the following output:

 Sending build context to Docker daemon 2.981MB  
 Step 1/14 : FROM microsoft/aspnetcore-build AS builder  
 ---> e421e10eaa5d  
 Step 2/14 : WORKDIR /source  
 ---> Using cache  
 ---> fde5241ee8a9  
 Step 3/14 : COPY *.csproj .  
 ---> 6015c9b573b7  
 Step 4/14 : RUN dotnet restore  
 ---> Running in 2b79cd9bcc6a  
 Restoring packages for /source/demoApp.csproj...  
 Restoring packages for /source/demoApp.csproj...  
 Installing Microsoft.VisualStudio.Web.CodeGeneration.Contracts 2.0.0.  
 Installing Microsoft.VisualStudio.Web.CodeGeneration.Tools 2.0.0.  
 ...installing many .Net Core 2.0 packages...  
 Installing Microsoft.AspNetCore.ResponseCompression 2.0.0.  
 Restore completed in 21.68 sec for /source/demoApp.csproj.  
 Generating MSBuild file /source/obj/demoApp.csproj.nuget.g.props.  
 Generating MSBuild file /source/obj/demoApp.csproj.nuget.g.targets.  
 Restore completed in 21.81 sec for /source/demoApp.csproj.  
 Removing intermediate container 2b79cd9bcc6a  
 ---> 42f7988a24dd  
 Step 5/14 : COPY . .  
 ---> da398320c33c  
 Step 6/14 : RUN dotnet publish --output /app/ --configuration Release  
 ---> Running in 1b09f2cbe7e8  
 Microsoft (R) Build Engine version 15.4.8.50001 for .NET Core  
 Copyright (C) Microsoft Corporation. All rights reserved.  
 demoApp -> /source/bin/Release/netcoreapp2.0/demoApp.dll  
 demoApp -> /app/  
 Removing intermediate container 1b09f2cbe7e8  
 ---> 2c855dca70f5  
 Step 7/14 : FROM microsoft/aspnetcore  
 ---> c8edb557c4f6  
 Step 8/14 : LABEL Name=demoApp Version=0.0.1  
 ---> Running in af48e869c1af  
 Removing intermediate container af48e869c1af  
 ---> 0c656950547f  
 Step 9/14 : WORKDIR /app  
 Removing intermediate container 04f38f1e3c62  
 ---> ee6d00cf12e0  
 Step 10/14 : ENV ASPNETCORE_URLS http://*:80  
 ---> Running in 4eaea7dc650a  
 Removing intermediate container 4eaea7dc650a  
 ---> 6cd5424b62b3  
 Step 11/14 : EXPOSE 80  
 ---> Running in 52745eb44fe4  
 Removing intermediate container 52745eb44fe4  
 ---> 9d71c7fc7f35  
 Step 12/14 : COPY --from=builder /app .  
 ---> 8fd885142f6c  
 Step 13/14 : ENTRYPOINT dotnet demoApp.dll  
 ---> Running in f400dcd4dc15  
 Removing intermediate container f400dcd4dc15  
 ---> 6d41a646da3b  
 Step 14/14 : CMD dotnet demoApp.dll  
 ---> Running in 4e2f93567d8f  
 Removing intermediate container 4e2f93567d8f  
 ---> c55c9141abee  
 Successfully built c55c9141abee  
 Successfully tagged demoapp:v0.1  

Then I tagged the image from the command prompt :

>docker tag demoapp:v0.1 m2web/demo:demoapp

I logged into Docker:

>docker login
>Username (m2web): m2web
>Password: myPasswordHere
>Login Succeeded

I pushed the image to my personal docker repository:

>docker push m2web/demo:demoapp

and it successfully pushed to the docker repo.




Let’s test the image locally by running it from the docker repo:

>docker run -d -p 80:80 m2web/demo:demoapp

Next, browse to the About page that is now running on our localhost:



So we have a Docker image of the ASP.Net Core app that we created on Ubuntu Linux. Now to see it running on Windows 10.

From Windows
In Windows with Docker running make sure that you are ready to run Linux containers. To check this select the Docker icon in the system tray.


Right-mouse click the Docker icon and open the menu that you see below. Note that I have the option to Switch to Windows containers. This means that I am now ready to view Linux containers. If the option is to Swith to Linux containers then select that option as we are going to load the image we created on Ubuntu into a container and run it.


Now open Powershell and let’s run the image from the docker repo locally on the Windows system:


As you can see, I already had most of the base images from previous container loads.

Next, browse to the About page, as we did before on the Ubuntu Linux system and see that our image from the Docker Hub repo is now running on our localhost:


Wednesday, December 13, 2017

Removing an Octopus Deploy Project

To remove a project in Octopus Deploy, first navigate to the project page. Then select the Settings button on the left of the page view. Next, select the Delete button in the lower right-hand of the page.



Finally, confirm the deletion.

Monday, December 11, 2017

Bootstrap does not support Amazon Silk

I have an ASP.Net Core app that I often use on various devices as well as my Kindle Fire. The site utilizes Bootstrap for its look and feel to make it responsive to smaller form factors such as mobile devices. When viewing the site in the Amazon Fire's Silk browser l see that the navigation menu is not collapsed and displaying the traditional "hamburger" as a button:

Instead, the full navigation menu is displayed, obscuring the top part of the page. After during some searching, alas the Silk browser is not supported. From http://v4-alpha.getbootstrap.com/getting-started/browsers-devices/, "Generally speaking, Bootstrap supports the latest versions of each major platform’s default browsers. Note that proxy browsers (such as Opera Mini, Opera Mobile’s Turbo mode, UC Browser Mini, Amazon Silk) are not supported."

Thursday, December 07, 2017

.Net Core, IBM Integration Bus, IBM Toolkit, and Docker...Stay tuned!

It has been a while since I have posted and I have moved from doing ASP.Net development to the Enterprise Integration Services team. On the team I have stared to use IBM's Toolkit on IBM's Integration Bus product. Here, I am learning ESQL. I have also stood up a .Net Core 2.0 ASP.Net app and am fiddling with Docker for development and deployment tasks. Therefore, I will have some posts on the above, even if it is just  beginner's level content as I know that there are others just starting these technologies. Stay tuned!

Wednesday, April 12, 2017

Open Source Code: You can borrow bits, but you get to keep and modify the ideas and give back to others.

You may have heard or seen the following quote at your public library, "You can borrow a book, but you get to keep the ideas." I would like to offer a similar thought in that, "You can borrow bits, but you get to keep and modify the ideas and give back to others." In other words, starting with an existing set of code you can learn from its intent as well as reconstruct it to your own. That is what I love about open source code and tools such as github.

Tuesday, January 17, 2017

Deadlines, the Programming Student, and the 3 Factor Assignment Risks


I know that deadlines drive us all. As I have often heard and said, “Deadlines are your friend.” The problem with these scheduled milestones is when you underestimate the task at hand. While I teach a programming class, let's consider a 5-page paper assignment. For some time, there has been a recognized analogy between writing and programming. As a college student at the 300 level you are accustomed to what is required for a paper. Unlike a writing assignment where you already understand the tools that you are using, word processor of some kind, and a use of the written language that you will be using, you are good to wait until the last day to start.

Specifically, within the typical scenario of a last minute effort there are three factors. One, the concepts of the subject of the assignment. This would include a basic understanding of both high and detail level principles about the topic of the paper as well as vocabulary used in the discipline. Next is the tool(s), as I previously stated, that you will use to compose the paper such a laptop, desktop, or tablet device which has some kind of word processing app such as Apache’s Open Office Writer, Microsoft Word, or a cloud based program such as Google Docs. Finally, the written language in which the work will be created. Typically, the student has a good grasp on the tools and language in which to write the paper. The aspect of the topic of the assignment can generally be picked up with a brief time of applied study.

Yet, this is not the case concerning a computer programming class that offers not only a set of novel concepts, but also a new tool as well as a fresh language in which you will express the desired outcomes. If all three aspects are new to the student, novel concepts, tool (Visual Studio), and language (Visual Basic) waiting until the day before or, perish the thought, the day when the assignment is due, this is at best unwise.

As a technologist that has been in the field as long as most of my students have been alive, I know that there are always what one would call “gotchas” when approaching a new endeavor. In short, these are issues that you do not expect or anticipate. In my long experience, for each project or effort, they happen almost each time. Moreover, if what you are working with is a new tool (Visual Studio) and a new language (Visual Basic), these are risks that must be mitigated. And, the part of the mitigation for any risk is to tackle it early. Therefore, do not wait to start your assigned projects on or even near the assignment deadline. The due date for a programming class assignment signifies the date in which you have met all three of the above factors, not just new concepts.



Saturday, January 07, 2017

NKU BIS 305 Students the Norse Tech Bar Says Don't Wait

Per a tweet from the Northern Kentucky University Tech Bar: 
I agree...don't wait!  :-)

Saturday, August 27, 2016

Setting up the VMWare Client for Northern Kentucky University on Linux (Ubuntu 14.04, 16.04 & 18.04)

As I am teaching the Advanced Business Programming (BIS 305) class at NKU this Fall semester and only have one Windows system, I thought it good to get the VMWare client setup on my Linux systems so that I can access the College of Informatics Lab VM and use Visual Studio 2015 in grading assignments, etc. 

For you other Linux users, here are the steps:
First run command below to active the TUN module:

$ sudo /sbin/modprobe tun

Next, install OpenConnect in order to connect to NKU's VPN:

$ sudo apt-get install openconnect
Now let's download and install the linux VMWare Client from the download site which is at the time of this writing at:
https://my.vmware.com/web/vmware/info?slug=desktop_end_user_computing/vmware_horizon_clients/3_0

After downloading the file appropriate for you linux distribution, change into the directory where you downloaded the client bundle file and do the following in that directory from the command prompt substituting the name of the file:

$ sudo sh *filename*.bundle
Also at the time if this writing the 64bit client download was named: VMware-Horizon-Client-4.8.0-8518891.x64.bundle. Accept the default setting as you move through the installation.

Next, to connect to the NKU VPN run:
$ sudo openconnect vpn.nku.edu
Here is what is output to the terminal (again at the time of this writing):
POST https://vpn.nku.edu/
Attempting to connect to server 74.143.180.100:443
SSL negotiation with vpn.nku.edu
Server certificate verify failed: signer not found

 Certificate from VPN server "vpn.nku.edu" failed verification.
Reason: signer not found
Enter 'yes' to accept, 'no' to abort; anything else to view:
From here enter the word: yes
You will see the above again as you will be redirected to another VPN server. Once you press Enter the 2nd time and after answering "yes" the output to the terminal continues as:
Connected to HTTPS on vpn.nku.edu
XML POST enabled
Please enter your username and password.
GROUP: [sslgroup_users|vpn_test]:
From here enter the word and then press Enter: sslgroup_users
The output to the terminal then continues as:
POST https://vpn.nkuedu/
XML POST enabled
Please enter your username and password.
Username: YourUserNameHere
Password: YourPasswordHere
POST https://vpn.nku.edu/
Got CONNECT response: HTTP/1.1 200 OK
CSTP connected. DPD 30, Keepalive 20
RTNETLINK answers: File exists
Connected tun1 as 10.150.128.40, using SSL
Established DTLS connection (using GnuTLS). Ciphersuite (DTLS0.9)-(RSA)-(AES-256-CBC)-(SHA1).
Keep the terminal window open while the VPN session is active. Network resources should now be available. To close the VPN session, press Ctrl+Z in the terminal window. Abruptly killing the terminal window without properly closing out of the VPN session can lead to issues when attempting to reconnect in the future. 

From here you are connected. Now open the VMWare Horizon Client (from a new terminal at the command prompt enter: vmware-view), in the VMWare Horizon Client set the server URL to view.nku.edu, login with your NKU user credentials, and enjoy.

Some information taken from: http://ubuntuhandbook.org/index.php/2014/11/connect-cisco-anyconnect-vpn-ubuntu/

Friday, June 17, 2016

Editing Websphere Generic JVM Argument Settings without Websphere Running

I was working with Websphere 8.5.5 locally on my system as I am in the process of developing a web service that will be deployed to a production Websphere server. In short, I switched the Java SDK to an IBM implementation for both code compilation as well as the Websphere runtime and wanted to add some property settings to the server JVM to accommodate some differences in the IBM SDK from the previous SDK. Here are the steps that I took:

  1. I went to the Administration Console and selected *Servers* 
  2. Expanded *Server Type* and selected *WebSphere application servers * 
  3. Clicked on the name of my server. 
  4. Expanded *Java and Process Management* and selected *Process Definition.* 
  5. Under the *Additional Properties* section, clicked *Java Virtual Machine.* 
  6. Scrolled down and located the textbox for *Generic JVM arguments*. 
  7. It was there that I added the arguments.

I then attempted to restart the server only to note that it kept timing out before it would start. Now I had a dilemma in that in order to remove the JVM arguments that caused the server not to start the server had to start! A quick look into the app server's files I was able to find where the JVM settings are stored and therefore where I could remove the settings in order to allow the server to start.

Going to the  AppServer\profiles\AppSrv01\config\cells\ServerNameHereNode01Cell\nodes\ServerNameHereNode01\servers\server1\server.xml file, there is the genericJvmArguments node with the settings in the jvmEntries node.

After removing the settings, the server started successfully. At least now I can research which JVM setting was the culprit and adjust accordingly without hosing my local Websphere installation.