Duplicate line in Visual Studio Code

Click File > Preferences > Keyboard Shortcuts: Search for copyLinesDownAction or copyLinesUpAction in your keyboard shortcuts Usually it is SHIFT+ALT + ↓ Update for Ubuntu: It seems that Ubuntu is hiding that shortcut from being seen by VSCode (i.e. it uses it probably by its own). There is an issue about that on GitHub. In order to work in Ubuntu you will have to define your own shortcut, … Read more

Is there a color code for transparent in HTML?

There is not a Transparent color code, but there is an Opacity styling. Check out the documentation about it over at developer.mozilla.org You will probably want to set the color of the element and then apply the opacity to it. You can use some online transparancy generatory which will also give you browser specific stylings. e.g. … Read more

Why use string::iterator rather than index?

The index can only be used for containers that support random access – direct access to a given position. The iterator offers a unified way to access any collection/data structure. The flexibility when refactoring your code is immense.

How do I tokenize a string in C++?

C++ standard library algorithms are pretty universally based around iterators rather than concrete containers. Unfortunately this makes it hard to provide a Java-like split function in the C++ standard library, even though nobody argues that this would be convenient. But what would its return type be? std::vector<std::basic_string<…>>? Maybe, but then we’re forced to perform (potentially redundant and costly) … Read more

Regex how to match an optional character

Use to make the letter optional. {1} is redundant. (Of course you could also write [A-Z]{0,1} which would mean the same, but that’s what the ? is there for.) You could improve your regex to And, since in most regex dialects, \d is the same as [0-9]: But: do you really need 11 separate capturing groups? And if so, why don’t you capture the … Read more

Sum rows in data.frame or matrix

I have a very large dataframe with rows as observations and columns as genetic markers. I would like to create a new column that contains the sum of a select number of columns for each observation using R. If I have 200 columns and 100 rows, I would like a to create a new column … Read more

Categories R