Category: Blog

  • Daily Coping 19 Feb 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 stop and look at something in a new way today.

    The world is full of sameness these days. I feel like it’s March 312th, 2020 still in many ways. While I know it’s not, and I do get to do some things outside of my house, most of my world just repeats over and over.

    What can I see that’s new? The other day I was leaving to go to the store and I saw the Momma horse out by herself. Baby is getting confident and was walking around, but I stopped for a minute and watched Momma. And took a picture.

    w28QeEjeTA-kpcZ0i49fmw

    For most of the time she’s been here, about 7 months now, we’ve seen her as part of this foal process. However, she’s her own creature, and I stopped to look at her for a few minutes enjoying her life.

  • Daily Coping 18 Feb 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 moving. Do something physically active, ideally outdoors.

    My nephew came into town last night. He turned 18 recently, and he Dad and I got him a ski trip to Colorado. I donated our condo and I’m driving them up in a few hours. I can’t stay, but I do hope to get outside and spend a little time with them on the slopes, even for an hour.

    If not, I’m going to try and get back up there early Sunday morning and ski then. Enjoy the outdoors and get moving.

  • 2020 Advent of Code–Day 2

    This series looks at the Advent of Code challenges.

    As one of my goals, I’m working through challenges. This post looks at day 2.

    Part 1

    This problem is really a string processing issue. We get a long string that needs splitting into different parts. We have two numbers, a digit to check, and a password. In this part, we are looking to see if our check digit appears x number of times.

    For T-SQL, we can use Substring and charindex to split things. I had code like this:

    SELECT
                 SUBSTRING(datavalue, 1, CHARINDEX('-', datavalue) - 1) AS lowerbound
               , SUBSTRING(datavalue, CHARINDEX('-', datavalue) + 1, CHARINDEX(' ', datavalue) - CHARINDEX('-', datavalue) - 1) AS upperbound
               , SUBSTRING(datavalue, CHARINDEX(' ', datavalue) + 1, 1)
               , SUBSTRING(datavalue, CHARINDEX(':', datavalue) + 2, 50)
            FROM dbo.Day2 AS d

    From here, I can do some counting to determine if we have the correct number of check digits.

    For Python and PowerShell, I used split functions. The PowerShell one I did in two routines, one to break the numbers off into $counters, after everything is split.

    $values = $line.Split(' ')
    $counters = $values.split('-')

    From here, I could then break everything up into the 4 parts.

    $min = $counters[0]
    $max = $counters[1]
    $checkvalue = $values[1].Substring(0, $values[1].Length - 1)
    $pwd = $values[2]

    Now I get a count, and then an IF statement that can clean this up.

    if (($count -ge $min) -and ($count -le $max)) { $part1 += 1}
    if (($checkvalue -eq $pwd[$min-1]) -ne ($checkvalue -eq $pwd[$max-1])) { $part2 += 1}

    This worked right away.

    Part 2

    In Part 2, rather than counting, we are deciding if the check digit is in the positions specified by the numbers.  The trick here is to check if that substring is equal to the digit. Again, in PoSh, the trick is to see if we have one or the other, which is the requirement.

    if (($checkvalue -eq $pwd[$min-1]) -ne ($checkvalue -eq $pwd[$max-1])) { $part2 += 1}

    This code looks if the digit matches first, then the second digit matches, and if these are both a 0 or 1, it’s not valid. If only one is valid, we increment the counter.

    The python code is very similar.

  • Announcing the Azure Data Community from Microsoft

    You can see an announcement from Buck Woody (b | t) of Microsoft on Data Exposed. Essentially, Microsoft is providing a number of free resources to help local user groups with their meetings. This is a fantastic way to support the various groups around the world that might not have infrastructure setup after the PASS organization failed.

    The offering from Microsoft includes:

    Community-owned, Microsoft-Empowered is the tagline, and I think that’s a good way to approach things. Microsoft is supporting groups, but not forcing them to run in any particular way. I believe they may ask that some portion of your topics are focused on the Microsoft Data Platform, but you are free to include other data related topics for your members.

    If you are a user group leader, check this out. If you’re a member of a user group, and you think this might help, pass this along to your leadership team.