• Article,  Other,  Site News

    Behind in my posting

    Ya, I’m a little behind… I’ve not posted anything since… gee October!. Really?

     It’s been a busy month and ½… It’s not that there’s not a lot to talk about… Indeed there is. Anyway, I’ve lots of Azure stuff to point out and comment on as I’ve completed a cert class on Azure dev (or so it was called). Then there’s ASP Core 3.x… some new versions of Visual Studio. And I’ve not even written anything on Media stuff… Star Wars… Disney+… the list goes on….

    Well, I’ll be out of the corp life for a couple weeks coming… there will be time to do some catching up.

    ~ScottGeek.

  • .Net,  .Net Core,  Microsoft,  Visual Studio 2019

    Dot Net Hell by any other name?

    Just when I think Dot Net Hell days are coming behind us… I run across the reality of the fact that those that created this in the first place are… well… still doing it?

     

    Take this little gem:

    public static async IAsyncEnumerable<string> GetContent(string[] urls)
    {
    
    }

    Yes, we now have IAsyncEnumerable… or do we.   In my little experiment, I have a .Net 4.8 console app with C#8.0 language stuff turned on. So, I wanted to mess about with the Async Enumerable…. But in my console app that IAsyncEnumerble goes all red line of crap on me.

    So what’s the deal?  Well it’s simple once you do the digging.   .Net 4.8 does not implement .Net Standard 2.1… Yeah, you guessed it… where the Async Enumerable lives!

    So yeah, I could use .Net Core 3.0 which works with C# 8.0 and .Net Standard 2.1. Or here’s a thought why not just do a .Net Standard 2.1 console app? Well, the latest version of VS 2019 does not have a .Net Standard 2.1 template listed… Ummm, I’m sensing something missing there.

    Welcome to the “New” Hell! 

    ~ScottGeek….

  • .Net Core,  Microsoft

    Dotnet Core Templates – The Revisit

    So a while back I penned an article (Dotnet new Magic), but now with the latest VS 2019 and Dotnet Core 3.x release… it’s time to revisit.

    In case we forgot – the command is:

    dotnet new -i “–The Template Reference Name Here–” 

    The list of templates can be found in the old place but also here – Dotnet New Templates

    What ones do I add:

    dotnet new –install “Microsoft.AspNetCore.SpaTemplates”
    dotnet new –install “Microsoft.Azure.WebJobs.ProjectTemplates”
    dotnet new –install “Microsoft.Azure.WebJobs.ItemTemplates”
    dotnet new –install “NUnit3.DotNetNew.Template”
    dotnet new –install “Microsoft.AspNetCore.Blazor.Templates”   **Some of these already exist, but this one adds the webassembly type.
    dotnet new –install “Microsoft.Azure.IoT.Edge.Module”
    dotnet new –install “Microsoft.Azure.IoT.Edge.Function”
    dotnet new –install “RaspberryPi.Template”

     

  • .Net,  Microsoft,  Visual Studio 2019

    Program Challenge using CSV and NetMQ Part 1.

    I did a recent program challenge. The requirements were not too complicated.

    Basically I was given a simple csv formatted file (csv, of course, being a comma delimited text file). The challenge was to take this csv and parse it into a POCO- POCO being Plain Old Class Object. I’m not sure why we need a acronym for that. POCO is just a data structure in the form of a Class Object. But I digress.

    Once the csv is parsed into a Class Object, I was then to make it available in a Request/Response using NetMQ. Now on the surface this might seem a lot to do. But not really. The key, as always, is to break down the problem into the workable bits.

    We start with what we know some tasks:

    A) Input is a csv and it must be read into a Class Object.
    B) Using Request/Response pattern the csv must output using NetMQ (this part relies on getting A done correctly).
    C) The Request and Response should be in two separate applications. Task A will need to expose the Class Object as the Response, this is Application 1. Application 2 will be the Request that will output the Class Object. 

    So let’s look at  the first part of task A.

    Now as much as I like writing yet another file parser- not really- I opted in this case to use one that is already available. It’s call CsvHelper bu Josh Close. It’s available on NuGet of course. The nice thing about this one is it’s simple and it works with POCO’s.  You wire it up based on your class object.

    Let’s start with my POCO (this was given by looking at the csv that just happens to have the first row with column names):

    public class People
    {
        public string Id { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public string City { get; set; }
        public string State { get; set; }
        public string Country { get; set; }
    }

    Now wiring this into the csv parser is a simple matter of having a text reader and creating a new csvreader with the helper:

    static List<People> giveMeData(TextReader textReader)
    {
        var csvReader = new CsvReader(textReader);
        var theData = csvReader.GetRecords<People>();
        return (theData.ToList());
    }

    Here I’ve method that parses the csv and makes a list of People.

    And that’s it for the first part of task A. The second part of task A has to do with exposing this List of People through NetMQ. 

    We will do this in next part of this blog.

     

  • Microsoft,  Visual Studio 2019

    SSIS (SSDT) and Visual Studio 2019 Oh my

    On my way to moving pass… yes! Visual Studio 2012 (VS 2010 Shell!) to VS 2019, I’ve discovered one really annoying thing. SSIS, or as we call now- SSDT projects, really is not mostly ready for Visual Studio 2019?

    But there is a preview extension that seems to “mostly” work. Go to the marketplace or in VS Manage Extensions and look for SQL Server Integration Services Projects – not the Reporting Server or Analysis server- those are there too, but the Integration Services.

    You add this extension and restart VS…. and you are almost there. 😉  Make sure you actually read the “Known Issues” section on the Overview page page for the extension. Make Special note of Item number 6! (as of the version 3.1). And I will quote:

     

    Variable window and SSIS toolbox may not be displayed properly if .NET 4.8 is installed (Windows 10 1903 installs .NET 4.8 by default). To work around this: 1) open Tools->Options window; 2) navigate to Environment->General; 3) uncheck “Optimize rendering for screens with different pixel densities”; 4) restart VS. For more details of this issue, please see: https://developercommunity.visualstudio.com/content/problem/638322/vs-2019-regression-transparent-toolwindowpane-with.html

    Yeaper… all is fine until you start looking or creating a package and discover the black-hole that is the SSIS Toolbox. 

    Oh My Goodness… so sad… Anyway, the tool box does come back after you change the pixel bah bah and restart VS.

    ~ScottGeek

  • ASP.NET Core,  Microsoft

    ASP .Net Core Razor SPA vs. MVC Taghelpers Navigation

    As I mess about with deciding- do I want to do Razor SPA pages or do a full on ASP.Core MVC pages for my latest Web App? I noticed something when- Yes I put both in a solution- it comes to the ASP tag helper for navigation links…

    So here’s the thing. For a regular ASP.Core MVC we see tag helper navigations look like this:

    <a class="nav-link" asp-controller="Home" asp-action="Index">Home</span></a>

    Simple enough… “asp-controller”  has the simple controller name, and  “asp-action” the action within the controller… no problem

    Now consider Razor SPA or just simple razor pages:
     

    <a class="nav-link text-dark btn btn-outline-info" asp-page="/Index" data-toggle="tooltip" data-placement="top" title="Always Takes you back Home">Home</a>
    

    Here we have a “asp-page”.  Ok, I do get it… Razor SPA or Razor Pages do not follow the MVC pattern with a controller etc. But why do they need to be different? Yes I understand MVC came first and it is very understandable to have a clear navigation tag helper. But again, why not just one simple tag helper that sorts out where the page and/or controller is?

    This gets even more complex – mostly- when one considers “Areas”.

    Again very well defined for an MVC pattern. But to use within Razor Pages, you have to muck about with making sure this is available in your Startup.ConfigureServices. Why oh WHY?

    services.AddMvc()
            .AddRazorPagesOptions(options => options.AllowAreas = true);

    Maybe some day this will evaporate, but for now…  no.

    fyi… as this applies to ASP.Net Core 2.2, the doc reference is here:

    Anchor Tag Helper in ASP.NET Core

    Anchor Tag Helper in ASP.NET Core

    Discover the ASP.NET Core Anchor Tag Helper attributes and the role each attribute plays in extending behavior of the HTML anchor tag.

    Source: docs.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/built-in/anchor-tag-helper?view=aspnetcore-2.2

     

    Happy tagging,
    ~SG

     

     

  • Microsoft,  Mobile

    The Getting started with Xamarin and matters Virtual

    The main landing that I can’t ever seem to remember to start with is actually here:

    Installing and Setting Up Xamarin.Android – Xamarin

    Installing and Setting Up Xamarin.Android – Xamarin

    How to install and configure Xamarin.Android to work with Visual Studio.

    Source: docs.microsoft.com/en-us/xamarin/android/get-started/installation/

    The next important part is when you are setting up HAXM (for intel based chips)

    From a cmd window.

    sc query intelhaxm  (and if it is not already installed go here HAXM Release on GitHub

    sc stop intelhaxm – to stop the service
    sc start intelhaxm – to start the service

    You can also use Hyper-V (sometimes I have issue with this method because it likes to mess about with my wifi/lan connections- that’s sometimes not a pretty sight in Windows 10).

  • Microsoft,  Visual Studio 2017,  Visual Studio 2019

    It’s Always the Little stuff

    How many times over the years of using Visual Studio have I’ve added the two lines of code to my console apps (mostly quick simple or testing console apps):

    Console.WriteLine("**Press");
    Console.ReadLine();
    

    I know it’s been there since sometime in Visual Studio 2017 … Yes the setting that removes the need for those two lines of code…

    Tools => Options => Debugging => General… The magic check box labelled:

    ‘Automatically close the console when debugging stops’  

    The simple sweetness of that single setting!  A Millionth of a Penny for every time I had to go back in put those two lines of code in my console apps…

    I humbly submit this as proof positive… that it is the simple things that make the difference! 😎

    ScottGeek

  • .Net Core,  Microsoft

    .Net Core ASP Tag Helpers

    I has to be one of the most useful things added… You got Tag Helps…

    Consider the simplest example…

    <img src="/images/somePng.png" />
    
    

    Not hard and very common. But consider the task of versioning your images for a web page… Enter Tag Helpers

    <img src="/images/somePng.png" asp-append-version = "true"/>

    This gives us a Hash version appended, so if an image changes? Indeed yes the hash value changes and this will trigger a cached page to update the image. 

    Wow, Tag Helpers… very handy.

    ScottGeek