Tag: syndicated

  • Daily Coping 18 May 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 pause your work every hour and stand up to stretch.

    I don’t get into the zone too often, but when I do I’m glad. However, I do bundle together tasks and try to get a number of related items done at once. Switching tasks seems like a good time to pause and stretch, but I don’t do that enough.

    I’m making it a point to do better today. Hopefully from now on, but for today. When I switch tasks today, I’m standing up to do a few yoga stretches and deep breathing. As a backup, I’m setting a repeating 60 minute timer on my desktop to remind me.

    That won’t work past today, as it will get annoying, but for a day, it might help me to think about this more often.

  • 2020 Advent of Code – Day 5

    This series looks at the Advent of Code challenges.

    As one of my goals, I’m working through challenges. This post looks at day 5. I’m going to do this one in Python here, though I did solve it in other languages in my repo.

    Part 1

    This is an interesting problem, and one that’s simpler than it appeared at first. I started down the path of some hash bucket thing, moving to calculate rows before I got to the end and realized this is really a binary problem.

    As a result, after I loaded the data, I started here:

    SELECT 
       (SUBSTRING(d.SeatCode, 1, 1) * 64) +
       (SUBSTRING(d.SeatCode, 2, 1) * 32 ) +
       (SUBSTRING(d.SeatCode, 3, 1) * 16 ) +
       (SUBSTRING(d.SeatCode, 4, 1) * 8 ) +
       (SUBSTRING(d.SeatCode, 5, 1) * 4    ) +
       (SUBSTRING(d.SeatCode, 6, 1) * 2    ) +
       (SUBSTRING(d.SeatCode, 7, 1) * 1    ) AS row,
       (SUBSTRING(d.SeatCode, 8, 1) * 4    )  +
       (SUBSTRING(d.SeatCode, 9, 1) * 2    )  +
       (SUBSTRING(d.SeatCode, 10, 1) * 1    )  AS seat
      FROM dbo.Day5 AS d

    Here you can see I broke this into two binary sections. The first 7 characters get you a row code from 0 to 127. The last 3 values get you a 0 to 7 value. I should have been clued in when I saw the 0s here. In any case, this gets me the two binary values.

    The seat code is the row multiplied by 8 and then adding the seat. I took the above query, wrapped it with a CTE and then ordered by seat codes. This gave me the highest value, which solved the problem.

    WITH cteAirplane( ROW, seat)
    AS
    (SELECT
       (SUBSTRING(d.SeatCode, 1, 1) * 64) +
       (SUBSTRING(d.SeatCode, 2, 1) * 32 ) +
       (SUBSTRING(d.SeatCode, 3, 1) * 16 ) +
       (SUBSTRING(d.SeatCode, 4, 1) * 8 ) +
       (SUBSTRING(d.SeatCode, 5, 1) * 4    ) +
       (SUBSTRING(d.SeatCode, 6, 1) * 2    ) +
       (SUBSTRING(d.SeatCode, 7, 1) * 1    ) AS row,
       (SUBSTRING(d.SeatCode, 8, 1) * 4    )  +
       (SUBSTRING(d.SeatCode, 9, 1) * 2    )  +
       (SUBSTRING(d.SeatCode, 10, 1) * 1    )  AS seat
      FROM dbo.Day5 AS d
      --ORDER BY row desc
      )
      SELECT (row * 8)+seat AS seatID
      FROM cteAirplane
      ORDER BY seatID DESC

    Part 2

    The second part is a different problem. Now I need the seat codes, but I’m looking for a gap here. Meaning a missing seat code.

    I decided to use LAG here. I altered my first CTE to calculate the seat code directly rather than returning the row and seat. Then I added this CTE:

    cteValues (SeatID, diff)
    AS
    (
    SELECT seatid, SeatID - LAG(SeatID,1) OVER (ORDER BY SeatID) AS diff
    FROM cteAirplane
    )

    This CTE found the difference between each subsequent Seat codes using the OVER() clause. My final query was looking for a diff > 1, which returned 1 row. That was the answer.

  • Daily Coping 17 May 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 make sleep a priority tonight.

    I need more sleep. It’s been a long weekend and I’ve been running hard for quite a few days before today. It was fun, but I’m worn out.

    It’s Sunday night. I need some rest before the week, and so I’m making it a point to go to sleep early. I’ll spend a little time with my wife, and then read a bit. She tends to want to watch some TV to unwind, but that typically doesn’t bother me, and after 20-30 minutes of reading, I can roll over and go to sleep.

    My aim is to call it a day by 930p, or 1000p at the latest. Hopefully I make my goal.

  • Career: Talk To References

    As we try to get through these strange times in the world, I am starting to see a bit more career movement in 2021 than I saw for much of 2020. Whether this is companies starting to hire more and get back to work or people getting tired of their routine and looking for new positions, I’m seeing more people changing jobs.

    Networking has been a great way for people to find good jobs, but you might not have someone that can help you for any particular job. Instead, you might lead an employer along by giving them references that you pick. While some employers might not ask for them or look at them, you can emphasize their importance and value in your career during any interviews, which might convince someone to call them.

    Preparation is Key

    In addition to you being ready for an interview, it is helpful to contact your references and help them get prepared.

    Give them a call, catch up on life, and be sure to remind them of things you did well or want them to emphasize in any call. Giving them a thing or two to think about puts those thoughts in their mind. When a potential employer calls a reference, they can be distracted or otherwise occupied. The things you’ve talked with them about will cue them to highlight what you want them to say.

    There is some good advice in this column, and it’s what I’d do if I needed a new job. It’s also similar to discussions I’ve had when someone has asked me to be their reference. We usually spend 5-10 minutes ensuring that we’re on the same page and I am ready to highlight what’s important to them.

    I don’t mis-represent people, but I do want to focus on the things that are helpful to advancing their career. It’s helpful for me to be prepared, as a colleague and friend.

    If I don’t feel someone is qualified, I’ll tell them and let them decide if they still want me to be a reference.

    Every bit of help you can get in a job search is good. There is a lot of competition out there, so keep working on your network and remember to use it when you are seeking new employment.