Tag: syndicated

  • 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.

  • Daily Coping 30 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 bring joy to others. Share something which made you laugh.

    I love comedy, and that is one outing that my wife and I miss. We’ve watched some specials and comedians online, but it’s not the same. I look forward to being able to go back to a live comedy show.

    One thing that I love about the Internet is the incredible creativity of so many people. While I get that there is a lot of things posted that others may not like, and it’s easy to waste lots of time, it’s also nice to take a brief break and be entertained by something.

    There is plenty to be offended by, but one of the cleaner, more entertaining things was brought to my by my daughter. She showed me You Suck at Cooking one night while I was cooking. I finished and then ended up spending about 20 minute watching with her while we ate. Two I enjoyed:

  • Daily Coping 29 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 congratulate someone for an achievement that may go unnoticed.

    This is a double congrats, for someone that I know and don’t get to see often enough. Some of you may also know Glenn Berry, hardware expert and the author of the DMV Diagnostic queries that lots of people use.

    Glenn left his job and struck out on his own this past year and he’s been busy working on a number of things where he’s had some success that I think is worth noting. I have probably left some positive notes on posts, but I’m going to use today as a way to congratulate him for a few things.

    First, his YouTube channel has over 500 subscribers, which is a nice accomplishment in relatively short time.

    Second, he’s been winning awards for his beer. Congrats to him, and hopefully I’ll get the chance to try some of these. I was over at his house last summer, watching him brew beer one day and got to try a few of his creations. Looking forward to doing it again.

  • Requesting an Update for My SQLSaturday.com Bid

    Someone asked about the bid, and I have had no response, so I sent this.

    2020-12-28 18_12_02-FW_ Bid for SQLSaturday.com - Message (HTML)