• .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

  • 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