Tag: syndicated

  • Setting DebugPreference for Testing–#SQLNewBlogger

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

    I was working on a PoSh script recently and needed to debug some things. Rather than have Write-Host throughout it, I wanted to log some stuff when I had issues, but not all the time. This post talks about how to do this.

    A Simple Script

    Here’s a simple script that I wrote to investigate this:

    write-host("test")
    Write-Debug("This is a debug message")
    $i = 10
    Write-Debug("I: $i")
    $i += 1
    Write-Debug("I: $i")
    $i += 1
    Write-Host($i)

    In this script, I have a few messages. If I just run this, I get this result:

    ❯ .\debugscript.ps1
    test
    12

    That’s pretty easy to see. However, what if I want my debug messages to print? I can add a –Debug parameter, but that doesn’t affect the script.

    ❯ .\debugscript.ps1 -Debug
    test
    12

    Set $DebugPreference

    Instead, what I need to to is change the debug preference, which is in the $DebugPreference variable. This is in the Preference Variable list, and defaults to SilentlyContinue.

    However, if I set this to Continue, I get the behavior I want.

    ❯ $DebugPreference="Continue"
    ❯ .\debugscript.ps1
    test
    DEBUG: This is a debug message
    DEBUG: I: 10
    DEBUG: I: 11
    12

    If I don’t want to see these, I can set the variable back.

    $DebugPreference="SilentlyContinue"

    Using the variable with write-debug is a quick way to turn debugging on and off in your console.

    SQLNewBlogger

    I had used this before, but had to think about it for a few minutes as I hadn’t done any PowerShell lately. So I decided to add 15 minutes to my work and document this for myself.

    And for the next person that wants to interview me on how I write PoSh. You could do the same thing.

  • Daily Coping 9 Jun 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 take of a photo of something that brings you joy and share it.

    A bit of a bucket list item for me. I went to the Florida Keys last week and got to  see the sunset. A few from the balcony of where we stayed. It was wonderful and fun, and it was neat to see the sunset from here, relaxing away from life.

    20210607_201210

  • Daily Coping 8 Jun 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 re-frame a worry and try to find a helpful way to think about it.

    One of my worries this summer is SQL Saturday and events. The pandemic took a toll on organizers and attendees, with many of them tired of virtual events, along with trepidation about renting space and putting a crowd of people together. I worry about how we restart events.

    However, what I need to do is have empathy that situations are different for many, and that we need to support people in different ways. I also need to remember that many people want to run or attend events, but that patience is needed to get comfortable with the idea of a crowd of people together again.

    It’s helpful to start having conversations and share ideas, get feedback, and understand the challenges people face in us moving forward as a community of free, one-day conferences.

  • T-SQL Tuesday #139–A Hybrid World

    tsqltuesdayIt’s time for T-SQL Tuesday in June 2021, with a new host this time. Ben Wiessman (b | t), who graciously responded to my request to host, and to whom I want to congratulate on an addition to his family.

    In any case, for #139, Ben asks us about hybrid data. He’s a cloud advocate and someone that has been working with Big Data Clusters and Azure Arc. In fact, he’s written books on those topics(Azure Arc-Enabled Data Services Revealed and SQL Server Big Data Clusters), Bid , so I expected a topic related to those.

    Moving to Hybrid

    I haven’t dealt with hybrid in production at all. My work with SQLServerCentral, and much with Redgate and customers, is all either on-premises or in the cloud. All the SSC stuff runs as IaaS, and most of Redgate does. While we have a lot of local workstations and environments for dev, much of the infrastructure is in the cloud, without much hybrid stuff.

    I do see customers that developer locally and deploy in the cloud, which is something I’ve done, but not too often. Most want to do everything in one place. I don’t really consider IaaS as a “hybrid” despite it being in the cloud, because these are just VMs that could be anywhere, and there isn’t any real change if they live in Azure, AWS, or a remote data center my company owns.

    Experimenting in the Cloud

    The exception for me is Spawn. This is Redgate’s research project on hosted cloud databases that you might use for local development. I started working with this when it was early in the lifecycle, and now it’s something that I use regularly.

    Essentially you create a database, and it’s hosted in a container somewhere. You get a connection string back, but the database lives in a cloud service, and this is a hybrid environment.

    It’s an interesting idea, and while I haven’t made any large databases, I do find that the ability to programmatically start a database to be quite fascinating and simple. A few times when I’ve looked to update a demo project, the ease with which I can set up an environment on a new machine is fascinating.

    The team that manages our main demo made a number of changes in 2020. I had scheduled a talk on the platform and realized a week before that the old demo I had was broken. When I contacted them, they gave me these instructions.

    • Update the CLI tool
    • Update my repo from the “demo” branch of the repo
    • Open the folder in VS Code
    • Hit F5

    That’s it and I had a running environment right away. I did a talk on this at ConFoo 2021, and it went well. The ease of getting things running even impressed me, as I hadn’t dealt with the front end side of things as often. Amazing.

    To me, this is where the hybrid cloud gets interesting, when I easily access resources either locally or remotely.