Tag: syndicated

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

  • Daily Coping 17 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 focus on being kind rather than right.

    There’s a tendency to be right, correct, to do what’s best. That might be true for many people and situations, but it’s certainly something I see technical people doing a lot, sometimes (over) arguing or pushing some point without regard to others’ feelings and the impact you have.

    I appreciate that sometimes the architecture, the code, the approach really matters. It impacts how our systems work, the costs or our company, and more. However, I also think that we can often debate and discuss in a kinder way.

    I’ve been working on trying to move SQL Saturday and events forward in many ways. At Redgate, with partners, with people in the community. I think I’m right to preserve and push the brand, but I recognize that I need to do so positively and not push/press/say I’m right here. I need to be kind and positive.