Category: Blog

  • Daily Coping 4 Jan 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 outside. Pick up litter or do something kind for nature.

    There isn’t a lot of litter in my life, as I live in the country. Most people are good about not throwing things out in the neighborhood, though certainly I might find some when hiking a trail.

    However, we are trying to to better by nature. My wife and I watched Kiss the Ground a few weeks ago. It was fascinating to me, and it got us interested in trying to compost and do better with the world. We already have piled up and composted horse manure, which some friends have come to get, but we decided to try and do one better.

    We got a kitchen bin for gathering food scraps, and then bought a basic composter for the yard. We’re starting to use it and capture the waste, trying to reuse it. I don’t know if we’ll get to gardening, but we certainly can use it to spread around and help build better soil.

  • Daily Coping 1 Jan 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 choose to give or receive the gift of kindness.

    I’m giving this week. It’s in my nature, and I still struggle to receive.

    My wife has been boarding horses for a friend that sold her house at the beginning of the pandemic and has struggled to find a new place. She finally did, but they had to rebuild some of the infrastructure from scratch.

    As a part of this, she wanted some slow feeders for the horses. To reduce hay waste (a little) and ensure constant availability for horses (a lot), I build a number of feeders for my wife years ago.

    IMG_20181014_113235

    These are wood, nothing fancy, but they work well and we fill them each day with day that lasts 24+ hours (depending on # of feeders, weather,  and # of horses). This friend of my wife wanted two for her house. You can buy some commercial ones, but they tend not to work as well. My wife turned to me, asking if I would mind.

    It’s work, and I have no shortage of things to fix, but I said yes, as a gift. I got wood before Christmas, and then spent a couple half days assembling these and getting them ready. Sometime in the next week, I’ll drive them up to the new barn.

  • Daily Coping 31 Dec 2020

    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 plan some new acts of kindness to do in 2021.

    As I get older, I do try to spend more time volunteering and helping others more than myself. I’ve had success, my children are adults, and I find less “wants” for myself than I feel the impetus to help others more.

    I also hope more people feel this, perhaps at a younger age than I am.

    In any case, I have a couple things for 2021 that I’d like to do:

    1. Random acts – I saw this in a movie or show recently, but someone was buying a coffee or something small for a stranger once a week. I need to do that, especially if I get the chance to go out again.
    2. DataSaturdays – The demise of PASS means more support for people that might want to run an event, so I need to be prepared to help others again.
    3. Coaching – I have been coaching kids, but they’ve been privileged kids. I’d like to switch to kids that lack some of the support and privileges of the kids I usually deal with. I’m hoping things get moving with sports again and I get the chance to talk to the local Starlings program.
  • Creating an HTML URL from a PowerShell String–#SQLNewBlogger

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

    I wrote about getting a quick archive of SQL Saturday data last week, and while doing that, I had some issues building the HTML needed in PowerShell. I decided to work through this a bit and determine what was wrong.

    My original code looked like this:

    $folder = "E:\Documents\git\SQLSatArchive\SQLSatArchive\SQLSatArchive\ClientApp\public\Assets\PDF"
    $code = ""
    
    $list = Get-ChildItem -Path $folder
    
    ForEach ($File in $list) {
    
    #write-host($File.name)
    
    $code = $code + "<li><a href=$($File.Name)>$($File.BaseName)</a></li>"
    
    }
    
    write-host($code)

    This gave me the code I needed, which I then edited in SSMS to get the proper formatting. However, I knew this needed to work.

    I
    had used single quotes and then added in the slashes, but that didn’t work. This code:

    $folder = "E:\Documents\git\SQLSatArchive\SQLSatArchive\SQLSatArchive\ClientApp\public\Assets\PDF"
    $code = ""
    
    $list = Get-ChildItem -Path $folder
    
    ForEach ($File in $list) {
    
    #write-host($File.name)
    
    $code = $code + '<li><a href="/Assets/PDF/$($File.Name)" >$($File.BaseName)</a></li>'
    
    }
    
    write-host($code)

    produced this type of output:

    <li><a href="/Assets/PDF/$($File.Name)" >$($File.BaseName)</a></li>

    Not exactly top notch HTML.

    I decided that I should look around. I found a post on converting some data to HTML, which wasn’t what I wanted, but it had a clue in there. The double quotes.

    I needed to escape quotes here, as I wanted the double quotes around my string. I changed the line building the string to this:

    $code = $code + "<li><a href=""/Assets/PDF/$($File.Name)"" >$($File.BaseName)</a></li>"

    And I then had what I wanted:

    <li><a href="/Assets/PDF/1019.pdf" >1019</a></li>

    Strings in PoSh can be funny, so a little attention to escaping things and knowing about variables and double quotes is helpful.

    SQLNewBlogger

    This was about 15 minutes of messing with Google and PoSh to solve, but then only about 10 minutes to write up.

    A good example that shows some research, initiative, and investigation in addition to solving a problem.