Author: way0utwest

  • Daily Coping 16 Apr 2021

    I started to add a daily coping tip to the SQLServerCentral newsletter and to the Community Circle, which is helping me deal with the issues in the world. I’m adding my responses for each day here. All my coping tips are under this tag. 

    Today’s tip is to spend as much time as possible outdoors today.

    It’s a work day for me, so not a lot of time outside. However, it is spring and there are things to do after a long winter. I took advantage of the flexible work time today to do some yard work. Taking a few minutes to spread some grass seed. Move a sprinkler here and there, move some dirt around to clean up the areas that eroded over the winter.

    It was a good day for a bike ride as well. My wife and I went out, with our new dog stroller, and enjoyed a bit of the longer spring day.

  • Always Retry

    When multiple people connect to a SQL Server database and attempt to query or update rows, blocking occurs. This is normal, and we expect a certain amount of this, usually very short lived. If it’s not, then having tools that monitor your database and can quickly let you know which connection to kill is important.

    There are also issues like network hiccups and deadlocks, which can cause a transaction to fail and roll back. In these cases, the application should retry a query, often quickly, without bothering the user. This isn’t something that most developers code into their applications, though they should. However, is this something that lots and lots of developers ought to learn and re-implement over and over?

    Microsoft has released a preview of a configurable retry logic in the SqlClinet driver for .NET (others coming soon). With this enhancement, developers can tell the driver how to react with some types of connectivity errors and perhaps resubmit the query. There are various options you can read about, and you ought to carefully test and you decide to use before you deploy them to production.

    To me, this is long overdue. Software ought to work for us and make our work easier, including easier for software developers. Often I’ve heard many vendors point to the configuration options and flexibility of their software, tool, or framework, while placing the burden on developers to write a lot of the code to actually take advantage of the tool. Whenever possible, we ought to make the preferred choice, the best practice, the most common code an easy choice by making it easy to add to a system. Give people flexibility when they need it, but make it easy for them to see the benefits of your software quickly.

    Steve Jones

  • Daily Coping 15 Apr 2021

    I started to add a daily coping tip to the SQLServerCentral newsletter and to the Community Circle, which is helping me deal with the issues in the world. I’m adding my responses for each day here. All my coping tips are under this tag. 

    Today’s tip is to get natural light early in the day. Dim the lights in the evening.

    Like many of you, I work indoors for most of my job. While I do have a window, I can get distracted on the computer and not look outside. I do try and take some breaks, and may go outside, but likely not enough.

    A few days before this post, I went to get my first COVID vaccine. I was up early, outside in the car for a few hours as we drove and waited. I came back to work, but I made it a point to get up a couple times and take a 10 minute break outside. walking around a bit and enjoying the day.

    Evening was good, as I tried to take it easy, so we lowered some lights, and my wife and I read a bit and chatted in bed.

  • The PowerShell Basics If Statement–#SQLNewBlogger

    Another post for me that is simple and hopefully serves as an example for people trying to get blogging as #SQLNewBloggers.

    This is a fairly simple construct, but I keep looking up the syntax if I haven’t written anything for a couple of weeks, which does happen. I’m hoping this quick post will help me remember the structure.

    Parenthesis and Braces

    The general structure is simple. It’s like this:

    if ($a -eq 1) {
    # do something  
    }

    This structure has the test expression inside the parenthesis and then any statements to execute, one or more, inside braces. Fairly simple, as long as you remember the –eq, –gt, –lt, etc.

    If you have an ELSE, then you add that next with the braces again.

    if ($a -eq 1) {
    # do something  
    }
    else {
    # do something else
    }

    That is easy to remember, as long as you use one language. I’ve been working more with Python, which is where I think I get confused.

    SQLNewBlogger

    This was about the 5th or 6th time I looked up the syntax, so I stopped and wrote this. It took only about 10 minutes to do this, no need to do more than mock up code, but show how this works.