Tag: syndicated

  • Daily Coping 23 Mar 2023

    Today’s coping tip is to focus your attention on the good things you take for granted.

    My life is great. I used to say perfect, but a few struggles lately have me appreciating it more and understanding that there are things I wish were better.

    I have taken for granted my ability to walk, to use my hands, and to use my mind. Lately I’ve been appreciating those things more as I’ve run into a few friends or friends of friends that aren’t as lucky.

    I had ankle surgery last year, and my wife this year. We struggled to get back to normal, and I’m still not, but I am better than I was. I appreciate my ability to walk on my own and hope to get in a lot of walking and visiting new places while I can.

    My hands work, but a few years ago Rush retired from performing. Alex Lifeson’s hands were one reason. I think about that often as I try to learn new songs on guitar.

    I also have run into a few people who have had health issues affecting their brains. My father was starting to suffer from dementia before he passed. I appreciate my cognition for now.

    I started to add a daily coping tip to the SQL Server Central 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.

  • Converting Types in C#

    I am not a great software developer. I’m OK, and I do know how to use Google and Stack Overflow well. Maybe my best skill is wording searches well? In any case, I’ve had to write a bit of C# lately to build an app for my Zero Downtime talk.

    In no way am I an expert on this stuff, but I learned a few things while working on the client. One of these was how to get to/from various datatypes. Not a complex skill, but since I do it rarely, I decided to do a quick blog.

    Creating Strings

    I actually remembered how to take a number and convert it to a string. The ToString() method works on many  items. In my case, I used some variables as numerics, often a zero or one, but I wanted to display these in a textbox. To do that, I needed something like this:

    txtRandom.Text = num.ToString();

    Easy enough to write, but other items were more complex.

    Strings to Int

    I only had to go the reverse way a few times, but found there was no ToInt32() or similar. I was hoping for one, but a little google query helped me realize this is what I needed?

    cmd.Parameters.Add("@year", SqlDbType.Int).Value = Convert.ToInt32(txtYear.Text);

    In this case, I was adding an integer parameter from a value in a textbox, which was a strong. The Convert class has a ToInt32() method I used.

    String to Date

    In one demo I move to a date as a parameter, again getting a value from a string textbox. This was yet another method. In this case, there is a DateTime class with a Parse() method. I used it as such:

    cmd.Parameters.Add("@start", SqlDbType.DateTime).Value = DateTime.Parse(txtStart.Text);

    This worked great.

    NULLs

    One other item I needed was passing a NULL value to a proc. Part of zero downtime deployments involve staging your changes, and that sometimes means altering which parameters you use and sending in other values. In this case, I found a DBNull class with a value property. I passed null parameter values like this:

    cmd.Parameters.Add("@year", SqlDbType.Int).Value = DBNull.Value;

    More

    There are obviously other conversions, but I’ll learn those as I need them. I know how to phrase a quick question and read through StackOverflow to find code I need and modify it. I’m good at asking questions and listening.

    If you have advice, please leave me a comment. I had some fun doing this, and I’m glad I didn’t need to bother too many people to get this working.

  • Daily Coping 22 Mar 2023

    Today’s coping tip is to appreciate your hands and all the things they do for you.

    I make a living with my hands. I type constantly, which is a big part of the work I do at Redgate. When I have a cut on a finger, as I did recently, it’s hard to type. That makes me much less productive, and lengthens my workday or workweek.

    I also use my hands in job #2. I coach kids in volleyball and I’m regularly hitting balls in the air, which becomes painful or less controlled if my hands have issues. Or my shoulder, but that’s another post. I also take stats on paper and type totals into a spreadsheet, so yeah, hands are important.

    Around the house, hands help me fix things on the ranch or play guitar.

    I really appreciate my health and ability to use my hands to make life better.

    I started to add a daily coping tip to the SQL Server Central 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.

  • Daily Coping 21 Mar 2023

    Today’s coping tip is to listen to a piece of music without doing anything else.

    This is surprisingly hard. I turn something on, but then I look around, think of something else, walk, exercise, drive, etc.

    Travel is a good way to do this, and I’ve learned sometimes that I can take a few minutes to unwind by staring at the world and listening to something in headphones. Hard for a multitasker like me, but it can be refreshing. If I’m not too busy.

    For a trip last week, I got to the airport a bit early. I knew I’d eat on the plane, so I went to the lounge, got a glass of wine, and sat facing a window. I put on a little John Mayer and then sat there just listening.

    Lately a couple songs have been running through my head, so I ran Hey Marie and Slow Dancing in a Burning Room together, just listening. Well, listening and sipping chardonnay.

    I started to add a daily coping tip to the SQL Server Central 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.