Copy Multiple Items in Visual Studio 2019

As a developer, I have to copy and paste. A lot! Sometimes I need to copy several items from different locations and then paste them into the same file. This can be very tedious with the traditional Ctrl+C then Ctrl+V process. To help remedy this, I use Comfort Clipboard Pro, a very powerful clipboard manager. I realize for some this may be a bit of overkill or they don’t wish to spend the money on a solution.

Thankfully, Visual Studio 2019 has a feature which can help. Simply copy several items in a row using your preferred method — from the file menu or with a key command. Then place your cursor where you wish for the copied items to be pasted. Next, go to Edit in the file menu and select the Show Clipboard History option (alternately you can press Ctrl+Shift+Insert).

Select Show Clipboard History

This will display a popup list of the things you’ve just copied. Click one of the items in the list.

Displays list of clipboard items

The item you selected will be pasted into your file where your cursor currently sits.

Pasted item from clipboard

That’s it! Quick. Simple. It didn’t require any additional software. And it didn’t cost you anything. Hope that helps!

Copy Visual Studio 2017 configuration settings to Visual Studio 2019

Visual Studio 2019
Visual Studio 2019

Visual Studio 2019 shipped on April 1st. And one of the nice things about it is you can have it installed side-by-side with other version — like Visual Studio 2017. Most developers have spent some time selecting which features of Visual Studio they need installed. A nice addition to the new Visual Studio Installer is you can export your configurations from one version and import into another. So, if you’ve just installed 2019 and wish for it to be configured like your 2017 version, now you can! And it’s pretty straight forward.

Launch the Visual Studio Installer.

Click the Modify button next to your Visual Studio 2017 installation.
This will show you the current configuration. You can just close this modal if you don’t wish to make any changes.
Click the More drop down and then select Export configuration from your 2017 installation.
Choose a location on your system where you wish to save the configuration file.
You will then see all the current settings and give you one last change to make changes. Then click the Export button.
A confirmation message will display when exporting is successful.
Next, click the More drop down for your 2019 installation then click Import configuration.
Locate your configuration file you just exported.
It will display the configuration options which will be imported giving you a chance to make any changes. Then click the Modify button to make any changes to your 2019 installation.

And that’s it! The installer will download and install any needed components based on your older configuration file.

Stop browser from filling in form fields with the autocomplete feature

To be helpful, browsers will cache information you enter in a form field. Then when you comeback and start typing, the same information will pop up near the field so you can click it to have it auto-entered for you. While this is useful, there are times you don’t want this behavior — like a one-time PIN number or CVC code for credit card payment.

Thankfully, there is an easy fix. On either the form itself or the specific fields you wish to stop this behavior, you can add the autocomplete property and set the value to “off“.


On the form itself

<form method="post" action="/form" autocomplete="off">


On just an input field

<form method="post" action="/form">
    <label for="ssn">Social Security Number</label>
    <input type="text" id="ssn" name="ssn" autocomplete="off">

This accomplishes 2 things. It tells the browser not to save the data for use later. And it stops the browser from caching the data in session history.

This will work with most modern browsers….with one exception. Most modern browsers will not comply with the autocomplete=”off” for login fields; whether on the form or a field itself. It has to do with the way browsers handle password saving/creating internally. So just keep that in mind.

Browser compatibility

Data on support for the input-autocomplete-onoff feature across the major browsers from

For more information:

How to check which version of .Net Core you have installed.

Open a command prompt and enter the version command.

dotnet --version
dotnet version

This should return a version number. If you get something like the message below, .Net Core is not installed.

'dotnet' is not recognized as an internal or external command,
operable program or batch file.

You can also issue the info command to get a lot more information about your environment.

dotnet --info
dotnet info

If you want to actually look at the different .Net SDKs which you have installed, they can be found here on a Windows machine:

C:\Program Files\dotnet\sdk

JavaScript — Get the Currently Focused Element

In JavaScript, the currently active element is said to have Focus, which means it’s the element being acted upon. Like a form field in which you are typing is said to have Focus.

You can get the currently focused element with a simple reference on the Dom:

var currentElement = document.activeElement

This will return the element which has focus, or null if there is no focused element. It will let you have access to the whole element. You can get to any properties on that element like the Id or Name. The CodePen below is a simple example of using the document.activeElement


See the Pen Get Focused Element by Chris (@cgreenws) on CodePen.

For more information:

JavaScript — How to use the Set object

JavaScript has an object called Set which will store any type with unique values — this can be a primitive value type (e.g. string, number, boolean, null, undefined, symbol) or even an object reference.

//create a new Set
var setA = new Set();
//use .add() to add types to the set
setA.add(6); // Set is [6]
setA.add(9); // Set is [6,9]

//or create a Set by passing it an iterable object
var setA = new Set([6,9]); // Set is [6,9]

Because a value in a Set may only occur once, it will eliminate duplicates when you add them.

//Eliminates duplicate values on creation
var setB = new Set([6,7,8,9,6,7]); // Set is [6,7,8,9]

//Doesn't add new values if they already exist in the set
var setB = new Set();
setB.add(6)// Set is [6]
setB.add(7)// Set is [6,7]
setB.add(8)// Set is [6,7,8]
setB.add(6)// Set is [6,7,8]
setB.add(9)// Set is [6,7,8,9]
setB.add(7)// Set is [6,7,8,9]

Use the .has() method to check if a value is in the set. It will return a boolean of True or False depending on if it finds the value.

var setA = new Set([6,9,3,5,8]);
setA.has(5); // true
setA.has(2); // false

The .delete() method will remove a value from the set. It will return a boolean value if it found the value in the set.

var setA = new Set([6,9,3,5,8]);
setA.has(5); // true
setA.delete(5); // returns true
setA.has(5); // false -- Set is now [6,9,3,8]
setA.delete(5); // returns false

You can also remove ALL the values in the set with the .clear() method.

var setA = new Set([6,9,3,5,8]);
setA.has(5); // true

A Set does not have a Length property but it does has a Size which will tell you how many values are stored in the Set.

var setA = new Set([6,9,3,5,8]);
setA.size; // return 5
setA.length; // returns undefined

To keep the Set similar to the Map object, values are stored as a key/value pair where the key is the same as the value. You can retrieve all the values in a Set using the .entries() method. This will return an Iterator of all entries in a format of [value, value].

var setA = new Set([6,9,3,5,8]);
var myEntries = setA.entries();

You can also just get the keys or values for a Set using the .keys() or .values() methods, respectively. Both return a new Iterator object. Since the value is used as the key in a Set, both methods ultimately return the same result.

var setA = new Set([6,9,3,5,8]);

var setKeys = setA.keys();
// or
var setValues = setA.values();

Because a Set is an iterable object, you can use the .forEach() method to loop over the values in a Set. You can pass a call back function in as a parameter which will get called once for each value in the set. It also has an option argument which can be passed that will be used for the this value for each callback.

var setA = new Set([6,9,3,5,8]);

setA.forEach(function writeValue(value) {

// 6
// 9
// 3
// 5
// 8

// example passing 'a' as the thisArg to the forEach
setA.forEach(function writeValue(value) {
     console.log(value + '---'+ this );
}, 'a');

// 6---a
// 9---a
// 3---a
// 5---a
// 8---a

If you just want to iterate over the values in a Set, you also have the option of using a For loop.

var setA = new Set([6,9,3,5,8]);

for (let item of setA) {
// or 
for (let item of setA.values()) {

// both output
// 6
// 9
// 3
// 5
// 8

You can easily convert from a Set to an array using Array.from() method.

var setA = new Set([6,9,3,5,8]);

var array1 = Array.from(setA); // [6, 9, 3, 5, 8]

//you can also use the Spread Syntax to create the Array of Values
var array2 = [...setA]; // [6, 9, 3, 5, 8]

One neat trick you can use Set for is to de-dupe an Array.

var array1 = [6,9,3,5,8,9,4,2,1,2,2]

var setB = new Set(array1);

var array2 = [...setB] //[6, 9, 3, 5, 8, 4, 2, 1]

// or you can simplify things like so
var array3 = [ Set([6,9,3,5,8,9,4,2,1,2,2])]; 
//[6, 9, 3, 5, 8, 4, 2, 1]

Another is to use Set as a way to break a string apart to it’s individual unique letters.

var myString = 'Hello';

var charSet = new Set(myString); // ["H", "e", "l", "o"]
charSet.size; //4

//just keep in mind that case sensitivity counts
var myString2 = 'HeLlo';

var charSet2 = new Set(myString2); // ["H", "e", "L", "l", "o"]
charSet2.size; //5

There are a couple things to keep in mind. A set can only contain unique values. When you interate over a Set object, it returns the values in insertion order (how they go in is how they come out).

Objects can be a bit confusing at first compared to primitive types. For instance:

var obj = {'a': 1, 'b':2}
var obj2 = {'a': 1, 'b':2}
var mySet = [{'a': 1, 'b':2}, obj, obj2]

// mySet now contains
// [{'a': 1, 'b':2}, {'a': 1, 'b':2}, {'a': 1, 'b':2}]

How do I duplicate a line within Visual Studio Code?

If you want to easily duplicate a line of code in Visual Studio Code, you can do it with a simple keyboard shortcut. Just use the Copy Line Down (Ctrl+Alt+UpArrow) or Copy Line Up commands (Ctrl+Alt+DownArrow) — depending on where you want the new line inserted with respect to your cursor.

VS Code Short Cuts

You can view all the shortcuts like this in Visual Studio Code by going to the preference settings found at

File > Preferences > Keyboard Shortcuts

If you want to easily duplicate a line of code in Visual Studio Code, you can do it with a simple keyboard shortcut. Just use the Copy Line Down (Ctrl+Alt+UpArrow) or Copy Line Up commands (Ctrl+Alt+DownArrow) — depending on where you want the new line inserted with respect to your cursor.

JavaScript — Loop Over an Array with forEach() Method

You can use the forEach() method to loop over an array and execute a function on each element of the array.

var pets = ['dog', 'cat', 'monkey'];

pets.forEach(function(element) {

// expected output: "dog"
// expected output: "cat"
// expected output: "monkey"

For more information:

Electron Error: Not allowed to load local resource

I’ve recently begun playing with Electron (the library that lets you build cross-platform desktop apps with web technologies). And not long into trying to hook up my default HTML page I received this error:

Not allowed to load local resource

I was certain I’d typed the line to load the URL just like the tutorial suggested. I searched around and was having trouble finding out why my app wasn’t working. Finally, in a reply buried in the comments was the answer. I was using single quotes and what I needed was the back tick for my value passed.

I had this


But needed this


It’s an incredibly easy thing to not notice, but because I was dynamically swapping out the ${__dirname} variable, I had to use the back ticks (`) and not the single quote (‘).

Hopefully that will help other Electron beginners experiencing the same issue.