Daily Coping 19 Feb 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 stop and look at something in a new way today.

The world is full of sameness these days. I feel like it’s March 312th, 2020 still in many ways. While I know it’s not, and I do get to do some things outside of my house, most of my world just repeats over and over.

What can I see that’s new? The other day I was leaving to go to the store and I saw the Momma horse out by herself. Baby is getting confident and was walking around, but I stopped for a minute and watched Momma. And took a picture.

w28QeEjeTA-kpcZ0i49fmw

For most of the time she’s been here, about 7 months now, we’ve seen her as part of this foal process. However, she’s her own creature, and I stopped to look at her for a few minutes enjoying her life.

Posted in Blog | Tagged , , | Comments Off on Daily Coping 19 Feb 2021

The Growth of Terabytes

Years ago, fresh out of university, I joined the IEEE. As one of the benefits, I got their magazine, with various articles that might expand my knowledge. In one issue, I remember reading about the challenges of video on demand. At the time, calculating what it would take to store digital movies and broadcast them to each TV seemed like an impossible task. This was in the days if hardwired 10Mbps Ethernet and dial-up Internet.

Not too long ago I had some Internet bandwidth issues, and got some stuttering during video meetings. I run Rainmeter as a skin on my PC, and once I got things working, I was curious what sort of bandwidth I was using. These days, if I’m not doing any streaming of audio/video, my PC seems to need about 1-3kbps to keep Tweetdeck, Outlook, Slack, etc. going. Youtube seems to get bursts to 1.5Mbps every few seconds, but plenty of low < 100kbps times in between. Netflix seems to be a steady 2Mbps to get video.

All of that doesn’t seem to add up to much for my household. Even when 5 of us lived here, with lots of streaming from the kids, our symmetrical 15MBps connection worked fine. I don’t know what our total usage was for the month, but I doubt we used 1TB a month. Actually, if I calculate it out, full use of 15Mbps for a month is about 4TB, so maybe the kids got there?

Apparently, more and more people are getting there. A report shows that 14% of some weighted set of subscribers use over 1TB a month. This is over their broadband connection, and likely leaves out mobile usage. While lots of this usage and bandwidth is transient data, like streaming movies, this also means that some data professionals, and network professionals, need to manage the data that flows.

For many data professionals, this isn’t necessarily a problem, and in some sense, this is good for us. Heavy usage pushes the network staff to increase the speed and capacity of links. That means those of us transferring data (CSVs, backups, etc.), can get our jobs done faster.

So watch more movies, stream more music, and root for the carriers to increase speeds and capacities.

Steve Jones

Listen to the podcast at Libsyn, Stitcher, Spotify, or iTunes.

Posted in Editorial | Tagged | Comments Off on The Growth of Terabytes

Daily Coping 18 Feb 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 moving. Do something physically active, ideally outdoors.

My nephew came into town last night. He turned 18 recently, and he Dad and I got him a ski trip to Colorado. I donated our condo and I’m driving them up in a few hours. I can’t stay, but I do hope to get outside and spend a little time with them on the slopes, even for an hour.

If not, I’m going to try and get back up there early Sunday morning and ski then. Enjoy the outdoors and get moving.

Posted in Blog | Tagged , , | Comments Off on Daily Coping 18 Feb 2021

2020 Advent of Code–Day 2

This series looks at the Advent of Code challenges.

As one of my goals, I’m working through challenges. This post looks at day 2.

Part 1

This problem is really a string processing issue. We get a long string that needs splitting into different parts. We have two numbers, a digit to check, and a password. In this part, we are looking to see if our check digit appears x number of times.

For T-SQL, we can use Substring and charindex to split things. I had code like this:

SELECT
             SUBSTRING(datavalue, 1, CHARINDEX('-', datavalue) - 1) AS lowerbound
           , SUBSTRING(datavalue, CHARINDEX('-', datavalue) + 1, CHARINDEX(' ', datavalue) - CHARINDEX('-', datavalue) - 1) AS upperbound
           , SUBSTRING(datavalue, CHARINDEX(' ', datavalue) + 1, 1)
           , SUBSTRING(datavalue, CHARINDEX(':', datavalue) + 2, 50)
        FROM dbo.Day2 AS d

From here, I can do some counting to determine if we have the correct number of check digits.

For Python and PowerShell, I used split functions. The PowerShell one I did in two routines, one to break the numbers off into $counters, after everything is split.

$values = $line.Split(' ')
$counters = $values.split('-')

From here, I could then break everything up into the 4 parts.

$min = $counters[0]
$max = $counters[1]
$checkvalue = $values[1].Substring(0, $values[1].Length - 1)
$pwd = $values[2]

Now I get a count, and then an IF statement that can clean this up.

if (($count -ge $min) -and ($count -le $max)) { $part1 += 1}
if (($checkvalue -eq $pwd[$min-1]) -ne ($checkvalue -eq $pwd[$max-1])) { $part2 += 1}

This worked right away.

Part 2

In Part 2, rather than counting, we are deciding if the check digit is in the positions specified by the numbers.  The trick here is to check if that substring is equal to the digit. Again, in PoSh, the trick is to see if we have one or the other, which is the requirement.

if (($checkvalue -eq $pwd[$min-1]) -ne ($checkvalue -eq $pwd[$max-1])) { $part2 += 1}

This code looks if the digit matches first, then the second digit matches, and if these are both a 0 or 1, it’s not valid. If only one is valid, we increment the counter.

The python code is very similar.

Posted in Blog | Tagged , , | Comments Off on 2020 Advent of Code–Day 2