• Microsoft,  SQL Server

    A slight issue when one wants to install SQL 2019 Dev, etc The ODBC 17 SQL Driver

    On my way to getting the latest SQL Server installed on one of my Dev PC’s- I ran across the issue of getting prompt for:

    msoledbsql.msi

    What the hell…

    ODBC Driver 17 is what that is about. Apparently, the SQL installed is not smart enough to know that one already has ODBC 17 SQL Driver installed and runs into a major “cannot resolve” the problem. The end result is that one does not get the SQL instance installed…

    But after reading lots of “not really helping” blurbs from the Internet, the Solution is simple… well mostly.

    You have to uninstall the “Microsoft ODBC Driver 17 for SQL Server” – one can find it on windows 10 in the APPS & Features. Uninstall it and redo the SQL install. One should have better luck with moving forward with getting SQL installed…

    ~ScottGeek

  • GitHub

    The GitHub Secret thing

    So you travel along in your or someone’s GitHub repo… and we all know what that looks like. The repo code, actions, etc. But did you know that you can make the GitHub Web UI (page) look like a VS Code File Explorer? Ya… you can. It’s not really supported by GitHub (just to be clear)… but yeah.

    What is magic…

    Normally a GitHub url looks something like https://github.com/<User Name>/<Repo Name> simple enough…
    To see the magic… just do a https://github1s.com/<User Name>/<Repo Name>
    That’s right, add a 1s to the DNS name of github.com… You will get a VS Code “On-Line” view of the repo. How cool is that? 😎

    Look in the GH repo: conwnet/github1s

    ~SG

  • .Net,  Microsoft

    The world of Dotnet Templates

    I have long been using templates for dotnet new and of course Visual Studio. So I’ve started down the road of creating my own templates… or a least trying to understand how to create these,

    Now creating templates for dotnet new and especially for Visual Studio has never been a simple task. But let us try.

    The first matter is understanding where templates live. For the most part these are based on your user for your PC. This found by using a PS command:

    join-path -Path $env:USERPROFILE -ChildPath .templateengine

    This will return C:\Users\<your user name>\.templateengine   And as you guess it, there is a .templateengine directory in your users directory. What does that mean, well simply put, when one does a .dotnet new –install, application templates get installed for your user. These actually live in that directory space. Simple enough.

    When you start developing your own templates, you need to be careful, because the list of templates can get very long. That may or may not be a problem.
    A handy PS script to clear out installed templates and put it back to the original set of templates:

    function Reset-Templates{
        [cmdletbinding()]
        param(
            [string]$templateEngineUserDir = (join-path -Path $env:USERPROFILE -ChildPath .templateengine)
        )
        process{
            'resetting dotnet new templates. folder: "{0}"' -f $templateEngineUserDir | Write-host
            get-childitem -path $templateEngineUserDir -directory | Select-Object -ExpandProperty FullName | remove-item -recurse
            &dotnet new --debug:reinit
        }
    }

    Keep in mind, this clears out all templates you have installed under your user. Use with care. If you have a set of favorite templates… yeap, they will get cleared off too!

    Now, where to start? I would go to Sayed’s GitHub repo @

    It’s a long read, but one can also go over to Channel9 and look for the video series that steps one through the process.

    Another handy resource to search for templates is a web site:

     

    Enjoy
    ~ScottGeek

  • .Net

    The Confusing world of Text.Json and .Net 5

    So one of the base libraries over the years that has been our friend is Newtonsoft.Json – the stuff of legend maybe? Well, if not, certainly anyone whose done .Net and used any kind of Json formatted data certainly knows of Newtonsoft.Json… The “go to Json Serializer”! That is until Microsoft set out to prove to the world they could do it better. Better?

    Like many things in the world of .Net over the years, Microsoft watches these open source libraries… and notices when they become the defacto standard (meaning… Micro either left it out of their core offerings…. or more typical someone did better). Hence Microsoft’s System.Text.Json vs. NewtonSoft.Json.  Oh let the confusion begin!

    Now to Microsoft’s credit they have been working to finally bring System.Text.Json up to speed… but of course they continue to state the their intent is not to bring their Json library up to par with Newtonsoft. And there it is… the two world Json library view… now mostly the complaint I have deals with migrating old code up to using Microsoft’s. It’s a bit of a “rub me the wrong way” kind of careful reading as to which direction to take. Why? Well you get into dependency  issues where Newtonsoft and Microsoft’s library don’t always play well together- that can be a problem when it comes to wanting to use old code (NewtonSoft) in a new app while wanting to take advantage of faster MS .Net 5 serializations….. Yeah, why would one ever want to do that?

    Anyway, I take some time to read a great article @

    Layomi has a great write up of things to consider… especially in the section “Choosing between…” the two different libraries…. It’s a good read.

    ~SG

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

    Dot Net 5 is Here… Check it out.

    Wow… some most excellent videos on what is what in .Net 5! Check it out on

    You can also find these on You Tube… search on .Net 5. The Conf 2020 Days 1-3 will be there…

    ~ScottGeek.

  • Article

    Test a Cloud

    just testing a cloud tag.

  • Other

    DB2 SQL Update on Joined Tables

    From time to time I have to deal with my least favorite subjects like DB2. While DB2 has a functional SQL, it’s dated and has not really kept up with SQL language improvements over the years. But it is all that I have to flow data from the IBM AS400 to the outside world (** it could be worst… like dealing with old COBOL programs).

    So  lets talk about updating column values that involve more that one table. Yeah, joined tables that have to have one or more columns updated.  Why would one need to do this? From time to time one needs to collect batches of rows from more than one table. And in the process of collecting batches one needs to update a “status” and/or date time stamp column to indicate the row was collected. It’s a common pattern in system integrations. When only one table is involved, it’s a simple matter. But when the data collected involves joined tables, then matters get complicated.

    Getting right to it, here’s the general form:

    Update <Table1>
     SET <StatusColumn> = 1 Where
      (Select DISTINCT
        <Table1>.ColumnA,
        <Table1>.ColumnB,
        <Table1>.ColumnC
        From <Table1> <Tabel2>
        Where
         <Table1>.ColumnA = <Table2>.ColumnA1 AND
         <Table1>.ColumnB = <Table2>.ColumnB1 AND
         <Table1>.ColumnC = <Table2>.ColumnC1
       )
    

    The two tables, in our example, have three columns we are Joining on… note this is an implicit join where the actual Join statement is not used.

    This update statement is a normal way to handle updating a column with a join select in the where. But this goes off the rails when it comes to DB2. Meaning it does not work. So how does one fix this?

     

    Update <Table1> 
     SET <StatusColumn> = 1 Where 
      (ColumnA, ColumnB, ColumnB) IN 
       (Select DISTINCT 
         <Table1>.ColumnA, 
         <Table1>.ColumnB, 
         <Table1>.ColumnC 
         From <Table1> <Tabel2> 
         Where 
          <Table1>.ColumnA = <Table2>.ColumnA1 AND
          <Table1>.ColumnB = <Table2>.ColumnB1 AND 
          <Table1>.ColumnC = <Table2>.ColumnC1
        )

    One adds to the Update Where clause a set of columns whose values are IN the Select of the joined tables. Like I said matters get a bit complicated for Joined tables.

    So what happens in the first type of Update in DB2? It does execute, but it updates all rows in the table to the Set value. This happens because, why the Join Select does execute, there’s nothing in DB2 that allows it to be an implicit part of the Update’s Where clause. Yeah, got to love that! What is one really saying there?

    The Where clause of the Update, in DB2, does not allow one to do just a Select… like other SQL implementations. It’s a hidden flaw, because while it looks to execute without an error, it simply does not do the intent. Therefore, one has to explicitly make sure that the Rows selected in the Where clause are part of the Update. Hence, the (columns) IN.

    Yes, as I mentioned, DB2 SQL not amongst my favorite languages to deal with.

    ~SG