Author: way0utwest

  • Two Types of Performance Counters

    I had an issue where an instance of SQL Server was only showing the XTP (In Memory) performance counters. None of the other SQL Server counters were available, so I followed the procedure I’d written about previously. Once that was completed, I restarted SQL Server and looked.

    No counters, still.

    Hmmm. It was then I scrolled further and realized that I had the SQL Server Agent counters, but not the database engine ones. I looked closer in the Performance folder for my instance and noticed this:

    2018-05-29 21_30_31-Binn

    There are two .ini files. There are

    • perf-<named instance>sqlcrt.ini
    • perf-SQLAgent<instance>sqlagtctr.ini

    These refer to the counters for the database engine and the Agent subsystem. I had unknowingly copied the Agent file for the lodctr.exe call rather than the other one.

    Lesson learned. I had to re-run the procedure with the engine ini file and restart the instance again.

    If you need to add counters, make sure you load both and run a restart, otherwise you might incur more downtime than you expect.

  • Microsoft and GitHub

    I started using git with GitHub. I thought their hosted service was fantastic, and have seen quite a few companies using private repos for their internal code, including my employer, Redgate. I see companies from Five Thirty Eight to releasing their data to the MuseScore sheet music software to TensorFlow to Programmer’s Proverbs. There are no shortage of useful, inspiring, and helpful repos you can browse. There are also plenty of silly ones, like the

    I have a GitHub folder on all my machines, and that’s become the place where I just stick repos. Some of them go to VSTS, some to Bitbucket, but I still always think of GitHub first when writing code. The others work great, and I’m glad we have choice, but I’ve always been fond of GitHub as a company that opened up a place to share code and data in a way that was somehow more attractive and easier than SoundForce or Codeplex or any other location. Maybe it’s the ease of git, but I really liked the site. The GitHub for Windows, not so much, but I don’t expect everything a company does to be perfect.

    Microsoft is buying the company, and GitHub seems fine with this. As one of the heaviest users of GitHub, Microsoft has been releasing their code on the platform for some time. This seems like there are some synergies here, and this is a great way for Microsoft to continue to open up some of their code and support the development community on all platforms, languages, and environments. Microsoft has said that they’ll keep the open source model, though there is no shortage of concerns and complaints. There are also a fair number of jokes. The Linux Foundation isn’t upset, which should make some people rethink their concerns.

    This is an interesting topic for me, and I brought up concerns over IP with some people inside my company. After all, we compete directly with Microsoft in some places, and we wouldn’t them to copy (and rewrite) our code to add to their products. That could dramatically affect our business, but no one worries about that. Decompilers and our own Reflector could be used to understand how algorithms are implemented, and certainly Microsoft has the resources to do this if they want to. They don’t, and there are other business and legal protections to prevent this.

    In some sense, the actual code really isn’t as important as many of us think. Certainly it’s not in SQL Server where our object is readable by whoever controls the instance. That includes your encrypted code, which can be easily rendered readable. I’ve often thought that the value I provide with my code is that I wrote it, I support it, and I ensure you don’t burn way more time doing those things than necessary.

    I think for the most part GitHub isn’t going to change for me. I’ll still post code out there for demos and presentations and even sharing some code with my kid as he learns to program. It will take time for Microsoft to assimilate parts of the company, but overall, I expect that most of the platform will remain the same for a long time, especially if Microsoft can get more enterprise customers to use it for their systems, especially their database code.

    Steve Jones

  • Better Comments

    I assume most of your comment your code.

    Well, you probably comment code most of the time.

    I’d bet your comments have quite a bit of detail.

    And you do this completely inconsistently.

    That’s what I’d think, or maybe just what I want. Even the best developers I know will not consistently comment code. You can drift through any project on Github and see this. Those projects on GitHub might even be better documented because people know they are public. In most corporate environments I have worked in, I’ll find that when people get busy, or distracted, or even when they’re experimenting to find a solution, and they don’t write detailed comments. Usually only when someone fixes a bug, with a solution found quickly, do I get a really useful comment.

    There are all sorts of ways that people think about commenting their code. I ran across a post from Annette Allen about adding comments. She noted that she has headers in her stored procedures and other comments. However, after a few months, she wasn’t sure that the comments actually helped her. I’ve had that same feeling at times when looking back at comments, both mine and others.

    Do you have a method for choosing the words you use to comment code? Jeff Atwood says to comment on why you did something, not what. I’ve seen that before, especially with version control commit comments. We often can look at code to determine what it does, and if you use a VCS extensively, then you can always see the changes that were made between versions. The comments typically give me some rationale for the work I did. Over time, I find that if I think about how I’d explain my reasoning to myself in the future, I come up with a good comment.

    You might feel differently, and if so, please let me know. Perhaps there are some good ideas you have about choosing comments, and perhaps you have examples. Some might include a bug or Jira number, which I like, but others may hate. These could be comments inline in code or those you use when comimtting to a VCS.

    Share some thoughts today, and if you have any entries for the best code comment, drop them here.

    Steve Jones

    The Voice of the DBA Podcast

    Listen to the MP3 Audio ( 3.1MB) podcast or subscribe to the feed at iTunes and Libsyn.

  • Project Euler

    I like having problems to practice solving in computer science. It can be a fun hobby, and it exercises your mind. I have enjoyed the Advent of Code, though some of those are complex and hard to focus on in my busy life.

    My middle son asked about Project Euler as he finished his first year of college and suggested we try some together. He’s been busy, though I have called him down as I’ve solved one or two. He’s asked I send him my code, which I’m doing in Python as practice. He’s using C++, which is something he’s studying, but he knows some Python.

    These are all math based problems, and most are short in the archives. I’ve been trying to take 5-10 minutes and solve 1 a day. I’ll ping my kid when I’m working, and we might pair program a bit to get a solution.

    Not terribly challenging, but it is a different type of thinking from most data work, and it can be fun. If you want to take a break from other work, maybe experiment with a new language, give Project Euler a try.