Key mappings in Visual Studio Code

At a recent conference I was asked how I executed code during my presentation.

Running code during a presentation should be as smooth as possible…so in VS Code I have a couple of custom key mappings set up and I thought I’d write a quick blog detailing what they are and what they do.

This is the first set: –

    {
        "key": "ctrl+/",
        "command": "workbench.action.terminal.focus",
        "when": "!terminalFocus"
    },
    {
        "key": "ctrl+/",
        "command": "workbench.action.focusActiveEditorGroup",
        "when": "terminalFocus"
    }

What this does is allow me to switch from an editor window to the terminal and back again using Ctrl+/

Like this…

The next key mapping I have is…

    {
        "key": "ctrl+;",
        "command": "extension.multiCommand.execute",
        "args": {
            "sequence": [
                "workbench.action.terminal.runSelectedText",
                "workbench.action.focusActiveEditorGroup"
            ]
        }
    }

This requires an extension called multi-command and what it allows me to do is select code in an editor and execute it in the terminal by pressing Ctrl+;

It also allows for multiple lines of code to be highlighed but if nothing is highlighted, it’ll just run whatever is on the existing line. Once the code is executed, it’ll return the cursor to the editor (instead of remaining in the terminal).

Like this…

These key mappings allow me to run through code in presentations nice and smoothly…so the session can focus on the code itself and not me stumbling around trying to run it!

You can set up these key mappings in your install of VS Code by opening the command palette and searching for “Preferences: Open Keyboard Shortcuts (JSON)”. This’ll open a keybindings.json file in the editor.

I’ve dropped my full file into a Gist here.

Thanks for reading!

Looking forward to 2020

2019 was a busy year for me. I presented sessions in over 10 countries, averaging speaking at two conferences per month. I also helped organise Data Relay and attended all five days which is always a fun (yet tiring) experience.

All in all, I thoroughly enjoyed myself last year and I hope 2020 brings more of the same! I do intend on not speaking at as many conferences this year although to be honest I did say that at the start of 2019.

I do want to get back into blogging more often this year. I didn’t publish as often as I wanted to last year and the simple reason for that was….time. So this year I plan on getting some cool stuff out there.

I’m currently writing this in Dublin airport waiting to head over to London to present my Chaos Engineering for SQL Server session at Conf42.com. I’ve been diving into the world of Chaos Engineering recently so hope to get a few posts out about it in the next few months.

I’ll also be continuing to explore running SQL Server in Docker containers and on Kubernetes. There’s so much great stuff happening in those areas that it can be difficult to keep up at times! The two main things I’m looking forward to are running SQL Server Edge on a Raspberry Pi (if they ever give me access to the container image) and WSL 2 going GA.

Another thing I’ve been enjoying is delving into the world of Linux. I’ve been using Ubuntu as my primary OS for a while now but had to refresh my laptop over Christmas in order to install Windows 10 as it’s needed for an upcoming project that I’m working on (can’t say too much about that at the moment but it’s quite exciting!). So I installed Windows 10 and then decided to install Fedora 31 instead of re-installing Ubuntu.

I can’t really say why I went for Fedora. There’s a tonne of distros out there (I seriously looked at Manjaro) but I guess the main reason was that Microsoft has two linux SQL Server 2019 container images, one for Ubuntu and one for Red Hat. Plus I suffer from Shiny Tech Syndrome so wanted to try something new.

I’ve also recently purchased a Pinebook Pro. I needed a backup laptop for when I travel (at least that’s what I’m telling myself) so nabbed one. The price can’t be argued with ($200) and the reviews online are all very positive so am looking forward to getting my hands on it. One of the really cool things is that it will boot from a SD card so I’ll get to try out Manjaro after all! 🙂 I’ll definitely be posting a review about it once I’ve had it for a couple of weeks (in fact that might get wrapped up into a larger post about either my linux experiences so far or my current travel kit…haven’t decided yet).

Finally to mention, I’ve also started helping organise a brand new conference in Ireland, Data Céilí. This conference is run by the team behind SQL Saturday Dublin and the response we’ve had so far as been amazing. We’ll be selecting sessions in the next couple of weeks and then prompting the heck out of it!

I reckon that should be enough projects to keep me occupied for the foreseeable future.

Thanks for reading and I hope 2020 is a blast.

How I became a Data Platform MVP

As I spent last week attending my first MVP Summit in Seattle I thought I’d write this post about how I became an MVP.

It’s not atypical but I want to share how I went from really not having any direction in my career to becoming a DBA; starting to blog and speak at events; and then becoming a Data Platform MVP.

First we must go waaaaaay back to 2011.

I was living in England and had spent the previous 4 years working as a “database developer” and I’ve put that in quotes as really I was a report writer. Crystal Reports to be exact (ugh).

During those 4 years I realised that if I wrote my queries in such a way, they’d run faster. I spent an inordinate amount of time researching why, and discovered SQLServerCentral.com

There was (and still is) a huge amount of people putting information out there, many of whom had a job title of “DBA”. I started researching into exactly what that role was and eventually decided that I wanted to become a SQL Server DBA.

I have to admit, it wasn’t easy. I went for a lot of interviews, and because my experience was limited I got rejected…a lot.

That didn’t dissuade me though, I kept applying and eventually got another interview.

I went, suited and booted, and did the interview.

I didn’t think it went well.

I got asked a question about capacity planning and as I was answering I noticed the expression on the interview’s face. I asked, “that’s not right is it?”

“No it’s not”

(I still maintain that I was right but hey, I’m an arrogant such and such when I want to be)

I died a little inside and wrote it off as another failed interview.

But whoa! A month later I got an offer, I was a SQL Server DBA!

I’ll never forget my first day, I asked, “Where are the other SQL DBAs?”

“We’ll get you on a training course”

Alright, I wasn’t on my own. There were Oracle DBAs there who had been looking after the SQL side of things but I was the only dedicated SQL DBA.

I needed to learn fast. So I went on a course and started reading every technical article I could get my hands on.

Ok, I wasn’t great technically, but I worked hard. One of my favourite memories is going on a course, coming back and being asked how I dealt with the amount of work thrown my way.

There were two people covering for me when I was away and they thought the level of work I had was crazy.

And that’s when I met a certain Rob Sewell (b|t). Rob had originally been hired as an Oracle DBA but because of the level of work I had he was moved over to work with me.

Rob and I worked together for a few months but I then moved onto another role. He carried on and has since become a world renowned DBA and powershell expert (go and check his blog out).

Anyway, whilst working for that company, I started my blog. Literally just to see if I could do it. I mean writing a technical blog is haaaaaaaaaard. Who wants to know what I think?

I persevered, but only published one blog a month and I laboured over each one of those posts. It was painful, writing each post took me a long time.

But I kept at it.

18 months later a recruiter rang me up and asked if I would consider moving to Ireland. There was a good position going with a company that were looking for a DBA.

Now, I’d never been to Ireland but sure, why not? I wasn’t really enjoying the role that I was in so I went for the interview.

I did one technical phone interview and then a Skype interview. To say I was surprised when they offered me the role would be something of an understatement.

I immediately accepted.

Have to say, moving to Ireland wasn’t much fun. I lived in a hotel for two weeks (over Xmas and New Year just to make things worse) but I managed to get a flat just before I got kicked out of the hotel 🙂

My first day working in Ireland still makes me smile. I turned up suited and booted (c’mon I didn’t know the dress code) and sat down next to the Senior DBA.

“So you like Ireland, been here a few times?”

“No, I’ve never been here before in my life”

“And you’ve moved here??”

He must have thought I was nuts (and rightly so) but we ended up working really well together (imho).

During this period I’d managed to keep writing one post a month but I wanted to build more of an online presence. So I started to blog a lot more, I started to write three posts a week.

One editorial (like this post), one technical post, and then a links post of articles that I’ve been reading during the week.

It was difficult but I kept writing, mainly about things I that I was working on or stuff I thought was cool. As I wrote more I became better, much better. Writing one post a month doesn’t really help you improve as you’re not practicing enough. By writing three posts a week I found it easier each time. What used to take days now takes hours.

To my surprise, I found that I developed a style of writing. I’ve had people comment on my style but to be honest, this isn’t something I’ve deliberately tried to do. It’s just come from me writing and writing and writing and writing and writing…(you get the point).

Anyhoo, during this period Rob (remember that guy? 🙂 ) had started speaking and let’s be honest, was (is) pretty good at it. He started to push me into speaking at technical events.

Now public speaking is/was one of my two greatest fears (the other one is butterflies but that’s a separate story).

Eventually I bit the bullet and wrote a lightning talk.

My local UG (Dublin) does a Xmas Extravaganza which involves multiple 5 minute sessions. So I signed up, went, spoke, and won best new Speaker!

I was so chuffed I decided to write a 60 minute session and submit to every single event that I could.

The first one was SQL Saturday Iceland. Great for me! If I messed up, no-one I knew would be there to see 🙂

I freaked out the entire day, but when my session came, I had practiced so much that it was just automatic. Ok, I was nervous (and it definitely showed) but I got through it.

Goal complete! I was a technical speaker! YEEEEEEEEEEEEEESSSSSSSSSSSSSS!

SQL Saturday Iceland is also were I met Alex Yates (b|t) for the first time. Alex is an accomplished speaker, and a few months later when I met him in Dublin he asked if I wanted to do a joint session with him. I was very flattered but completely terrified.

I didn’t want to screw up and let him down (still don’t) but despite my nerves, I said yes.

Which turned out to be a great decision.

Over the next few months I presented at multiple events, got a bit more confidence (although I still freak out for about 10 minutes before a session), and started improving. SQL Saturdays at Cambridge, Holland, Denmark, all came and went.

Then SQL Relay kicked off.

5 days, 5 locations, 5 events. It’s nuts.

I was speaking at 4 of these. 2 on my own and 2 with Alex.

The second presentation with Alex has to be the most fun I’ve had presenting. The session went smoothly (apart from the fact that neither of us can use zoom-it) and we bounced off each other well.

The third session was on my own, in a cinema in Birmingham. Now, presenting is a lot different with a cinema screen. It absolutely rocks! I didn’t have to worry about using zoom-it so flowed through the slides and absolutely nailed my demos. It’s still by far the best session that I’ve ever presented.

Anyway after SQL Relay I went home and relaxed. I’d done a lot of events in the autumn so took November and December off (mainly because I’d started a new job and had to move apartments).

So there’s me relaxing, heading to Britain to see a friend to go and see a rugby game and whilst I’m in the airport, I get an email.

Congratulations Data Platform MVP

I was blown away.

I knew I’d been nominated but really didn’t think that MS would pick me. And to be honest, I still don’t really think it’s sunk in but I will admit, I was a little excited on the plane over to the UK (to see a mate who couldn’t have cared less 🙂 ).

So as I said at the start, it’s not an atypical story of how to become an MVP. I blogged, spoke a lot and was lucky enough to not only be nominated but be selected as well.

What’s great is that now I have access to a whole load of new resources which means that becoming an MVP wasn’t the end goal for me, if anything I’m just getting started.

I still have so much to learn, and I hope that never stops.

Thank you for reading.

The two types of IT worker

Last week I published this post about something a colleague noticed when playing around with a SQL Server instance running on Linux. Fairly innocuous and I was chuffed when I saw that the guys over at BrentOzar.com had linked to it in their weekly newsletter.

As the day wore on, the post attracted a couple of *ahem* interesting comments about how Linux works. A couple were helpful and a couple were, well not so helpful.

I’m not going into the overall tone of the comments as William Durkin (b|t) pretty but sums it up here but it did remind me of something I used to think when I first started out learning my trade as a SQL Server DBA.

I firmly believe that there are two types of IT worker, which become apparent when they/we are asked for help. One will respond along the lines of “I can’t possibly explain to you now, it’s rather complicated” whereas the second group will say something like “Ah it’s not too hard. Here, let me show you”.

I’ve always tried to be of the latter type, in fact it’s why I started writing this blog. I admit there have been times when I’ve been busy that I haven’t been able to show a colleague what they were asking about, but I’ve always tried to make that up as soon as I possibly could.

My advice? Drop the ones that you meet who fall into the first group and cultivate relationships with members of the second. The only other thing to think about is, which group do you fall into?

Thanks for reading!

Query shortcuts in SQL Server Management Studio

Tired of typing out the same queries day after day? Well query shortcuts in SSMS are for you!

Following on from my last post Changing connection colours in SSMS I thought I’d write another quick about this cool but also often unused feature in SSMS.

These shortcuts allow you to run pre-determined queries by assigning a hot key within SSMS. To do this in SSMS go to Tools > Options > Environment > Keyboard

queryshortcuts2

From there you can set the query to the hot key you want to use. Nice and easy!

In nearly all of the instances of SQL Server that I look after, I’ve installed Adam Machanic’s excellent sp_whoisactive. By adding the above shortcut into SSMS I can run it quickly and easily in any instance that I’ve connected to. It’s really handy and I’d definitely recommend you install it and set a query shortcut up for it.

Thanks for reading!