Category: Blog

  • Daily Coping 29 May 2020

    I’ve 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.

    Today’s tip is today link your decisions and choices to your purpose in life.

    What’s my purpose in life. I think it’s to be a great partner, help others where I can, and improve my skills in (and outside) of my career for myself. Maybe a bit selfish, but those are what I think.

    For the most part, these things drive my life. I work to have a strong marriage, and often give as much as I can for my wife. One of the reason’s I’ve continued to work with SQLServerCentral and Redgate is that this supports my wife in her self employment. Rather than try to be more like a Brent Ozar, whose had amazing success in his career field, I’d rather do the things that provide stability.

    I do enjoy those things, so it’s not a great sacrifice.

    My mission at SQLServerCentral has always been to help others be better at their jobs. I think about that often as I work through the management of the site. It’s a guiding principle for me, and I think my decisions about the site are with this in mind. I may not always do the best job I can, and I do sometimes beat myself up about that, but I am to help others.

    That’s also a part of why I coach. It’s a way to give back and help others grow up. I may do more volunteering, especially if my schedule continues to be strictly at home, since I do believe in giving back to the world.

    Lastly, I continue to work on improving myself. I exercise and try to take care of my body. I practice guitar. I try different things in the kitchen. I work on different projects around the house, and I’m trying to do a bit more woodworking. None of these things pay a bill or do more than satisfy my soul, but that’s a part of my purpose.

  • Custom Quarantine PoSh Prompt

    Since I’ve been quarantined at home and working in my office, every day is the same. I can’t go to the gym, or coach, or go to the restaurant, or much of anything. As a result, I regularly, forget what day it is.

    Yes, it’s on my phone, but that’s not always open and visible. It’s on my watch, but I have to swing up my wrist and hope it lights up. Or reorient my wrist to see it.

    I have Rainmeter running, which is nice, and I have a summary in the upper corner of my screen, but often I have something covering this.

    2020-05-19 15_04_13-Microsoft Edge

    The time is in the toolbar, but I sometimes hide toolbars to record things. Basically, I forget what day it is and I’m looking for a few hints I can use to make this easier. As I play with PowerShell regularly, I thought it would be good to update my prompt slightly.

    Plus, it would be good PoSh practice.

    Setting a profile. I’ve seen a few posts on customizing the prompt, and they all say I need a function, called prompt, in my profile. I found this article, which gave me a good idea. Put the time in the prompt.

    I then had to figure out how to get to my profie. It turns out “notepad $PROFILE” in a PoSh prompt will get you there. If you don’t have a profile, you’ll see this:

    2020-05-19 14_55_12-Notepad

    Say yes, and then add some code. I had to look up the Format options and experiment a bit to decide how I wanted things to look.

    function prompt {
            $lastResult = Invoke-Expression '$?'
            if (!$lastResult) {
                    Write-Host "Last command exited with error status." -ForegroundColor Red
            }
            Write-Output "${msg}$(
                    # Show time as 12:05PM and day of week
                    Get-Date -Format "dddd HH:mm"
                    # Show current directory
            ) $(Get-Location)> " 
    }

    I saved this and now when I get a new PoSh prompt, I get this:

    2020-05-19 15_01_53-PoSh

    Now I easily know the day and time when I’m working in a PowerShell terminal. This also shows up in my Visual Studio Code terminal as well, since that’s just a PoSh environment.

    SQLNewBlogger

    This was a quick thing I did in about 5 minutes to customize my environment, and help me be more productive. A happy employee works smoother.

    I decided to show off how I did this and spend a quick 10 minutes writing down and documenting what I did.

  • Daily Coping 28 May 2020

    I’ve 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.

    Today’s tip is to recall three things you’ve done that you are really proud of.

    The Snowboarding Investment

    I started snowboarding before I had kids. I got pretty good, and I’ve enjoyed going fast, avoiding breaks, and making the most of the time I have on the slopes. As my kids grew up, we started all of them on skis, and in ski school. Expensive, but it allowed them to learn from someone that wasn’t a parent and it allowed my and my wife to continue to enjoy ourselves. As they learned, we enjoyed them learning to keep up with us.

    For my younger two, they wanted to start snowboarding relatively quickly after learning to keep up with us adults on skis. Rather than do more ski school, I took the time to work each each of them. My son was older, 11 or 12, when he wanted to switch, but taking days to teach him meant I was really on the beginner slopes with him, not having a fun day.

    407428_3246577052191_1422307751_n

    It took the 4-5 days at the end of one season and 2-3 at the beginning of the next to get him to the point where we could progress to a continuous run down Keystone or Copper mountain.

    My daughter started younger, which was harder. She was barely on skis when she say her brother snowboarding and wanted to try.

    10391628_1266488471214_3245615_n

    This was many more days, often family days where I would spend half the day walking alongside her, or holding her balanced and helping her learn how to move down the slopes.

    I had to put aside fun times to invest in them. It’s paid dividends over the years, and I’ve had great times with them on the slopes. I’m really proud of spending the time to teach them and then watching them grow and learn to love sliding down the mountain.

    Ranch Improvements

    We moved to a horse ranch about 15 years ago, and my wife started full time teaching about 10 years ago. As she’s tried to experiment with her skills as a horse whisperer, she’s asked me to help build things to help her better care for horses.

    She gave me the challenge of building slow feeders years ago, and I spent some trying different designs and building her feeders that work well for her purposes. Here is one of the early designs. Hint, plywood doesn’t work well over time.

    1097896_10201736507843332_1419379804_o 

    Some have now been in service over a decade, and I’ve built quite a few more. We have 13 in use and 2 spares now. Recently, she also got the idea that she wanted a horse back scratcher, so I figured out how to do this.

    92938268_10221411947757033_154728138163617792_n

    SQLServerCentral

    It wasn’t my idea. Credit goes to Brian Knight for the idea and helping bring the founders together. Over the years, a lot of the site has grown and evolved because of me. I was the founder that was able to work for the company full time, I started the editorials, and I’ve been the face of the site for many years.

    I remember crossing 1 million posts, 1 million subscribers, publishing books and a magazine, hosting parties at the PASS Summit, and getting the chance to meet many of you in person over the years have been highlights.

    Hearing many of you tell me that the site has helped you in your career, has solved a problem, or inspired you in some way are immensely gratifying to me. I can’t tell you how much I’ve appreciated the kind words and comments from many people over the years.

    I’m grateful to Redgate for allowing me to continue to steward the site as the Editor in Chief, and this has been one of the things I’m most proud of in my career.

  • Using WAITFOR to Test Slow Code–#SQLNewBlogger

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

    One thing I needed to do lately was test how a calling program would respond to slow code. I decided to use a normal query, but add a WAITFOR() to simulate different delay levels. However, I had to look up the syntax for the call and I decided to blog about it.

    WAITFOR DELAY

    The WAITFOR call isn’t a function. I’ve written about that before. Instead, this is listed as a control-of-flow element in the language.

    I have a rough idea of how this works. I use

    WAITFOR DELAY

    as the basic syntax. SQL Prompt helps me here, since looking this up is a pain and slow. I know there is a time element in here, but I always worry I’ll pick the wrong time and then sit for a long time testing.

    The key is this format: hh:mm[[:ss].mss]

    To delay for 2 minutes, I write this:

    WAITFOR DELAY '00:02:00'

     

    That gives me what I need, and using a string variable, I can control this delay programmatically.

    SQLNewBlogger

    This is a good example of learning a piece of code and writing about it. Short, simple, show how this one works in T-SQL. Add the why, show some code, and results. How you use it, and what you learned.

    This was a 10 minute post.