Category: Blog

  • Daily Coping 26 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 be gentle with someone who you feel inclined to criticize.

    A friend got snagged by an Internet scammer and lost a bit of money. Not a ton, but enough to get angry and feel bad. I had felt this was a suspicious purchase, but I didn’t make myself known early enough. I was mad, too.

    However, I just sympathized, apologized for not sayings something earlier, and listened to them get upset.

    An easy time to chastise them, but better to be supportive.

  • ConFoo–The Future of Database Development in Containers

    I delivered a talk at the ConFoo conference. I’ve never been to this live, and when I submitted last year, I was hoping this would somehow be a live event in Montreal. It didn’t happen, but I joined the virtual event and gave my presentation.

    The deck is here: FutureDBDevelopment_confoo.zip

    No real questions, but lots of interest, which is great.

    If you didn’t stay near the end, I talked a bit about the Spawn.cc project and the journey the research group has taken to learn about Kubernetes and file systems. It’s been fascinating to watch the project evolve. The API used to change almost weekly as it was improved and enhanced.

    A few resources:

  • Daily Coping 25 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 what’s good, even if today is tough.

    Most days haven’t been too tough lately. Colorado is opening up a bit more, I’m able to get out of the house and off the property a touch more. While I don’t see too many more people, a little freedom is nice. Or at least, the illusion of freedom. About the only thing that’s changed is a few more restaurant visits.

    However, I did tweak my back recently. I was trying to do some work outside, strained a bit, and got some lower back pain. It took me a day to get to the doctor, and I was in some pain during the afternoon and night.

    Easy to get upset or angry or have one of any other negative emotions. I stopped and told myself that I was still mostly healthy, this was my fault, it was a minor inconvenience, and things would be better soon.

    I went inside, lay down, played some guitar and read, finding a way to enjoy the day.

  • 2020 Advent of Code–Day 3

    This series looks at the Advent of Code challenges.

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

    Part 1

    Day 3 was tough. The explanation isn’t great, at least, I didn’t get it at first. Essentially you have a map, and then you have some slope. The first part has a slope of right 3, down 1. If you move, assuming the upper left is (1,1), the next spot is 2, 4. That’s if you count going down as positive.

    Here’s the map:

    ..##.......
    #...#...#..
    .#....#..#.
    ..#.#...#.#
    .#...##..#.
    ..#.##.....
    .#.#.#....#
    .#........#
    #.##...#...
    #...##....#
    .#..#...#.#

    If I count each space, then there is a period (.) in this (2,4) space. If it’s a tree, then there is a hash (#) there. We are trying to count trees before we hit bottom.

    The trick I missed is that the map we’ve given repeats. It repeats to the right as often as needed to get to the bottom.

    This is really a coordinate problem, counting each down as we move, and repeating the map. The trick often in a short width here is to do the math to wrap around from the right to left if you run out of room.

    In SQL, I used a loop. I didn’t spend a ton of time, but couldn’t see a good way to avoid this as I need this to be readable, and I need this to keep working through the map. Here’s the code:

    WHILE @currentrow <= @rows
      BEGIN
        SELECT @currentcol += @right
        IF @currentcol > @width
          SELECT @currentcol = @currentcol - @width
        SELECT @currentrow += @down;

       SELECT @trees = @trees + CASE
           WHEN SUBSTRING(dataval, @currentcol, 1) = '#' THEN 1
           ELSE 0
        end
         FROM day3
         WHERE rowkey = @currentrow
      END
    SELECT @trees AS TreeCount

    I move, count the value if there’s as tree, and then continue moving through the next rows. The WHERE clause orients the rows.

    It worked. I go the right answer here.

    Part 2

    In part 2, this changes to checking a number of sloops and then multiplying the results together. In terms of my code, this is really a repetitive way of running the code again. I could have used different variables and checked multiple slopes at once, but I was busy.

    In python, I did something similar. I essentially calculated the next X and Y position, and then looped through the file. Each time the Y matched the current row, I checked for the matching #. If it matched, increment.

    Once I matched the correct Y, I incremented X and Y.