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)


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

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 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 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, "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."