Tag: r

61 votes
30 answers
3K views
How to make vim paste from (and copy to) system's clipboard?

Unlike other editors, vim stores copied text in its own clipboard. So, it's very hard for me to copy some

avatar
Carmelina
0 1 0 9
asked 07 September, 2021
53 votes
19 answers
743 views
How do I duplicate a line or selection within Visual Studio Code?

Using Microsoft's Visual Studio Code, how do I duplicate a line of code and then move it up and down? (Si

avatar
Charis
0 1 0 9
asked 07 September, 2021
65 votes
15 answers
547 views
How do I move to end of line in Vim?

I know how to generally move around in command mode, specifically, jumping to lines, etc. But what is the comm

avatar
Trudy
0 1 0 9
asked 07 September, 2021
51 votes
24 answers
828 views
Turning off auto indent when pasting text into vim

I am making the effort to learn Vim. When I paste code into my document from the clipboard, I get extra space

avatar
Mikki
0 1 0 9
asked 07 September, 2021
62 votes
21 answers
2.3K views
How to duplicate a whole line in Vim?

How do I duplicate a whole line in Vim in a similar way to Ctrl+D in IntelliJ IDEA/ Resharper or Ctrl+Alt+↑/

avatar
Thurman
0 1 0 9
asked 07 September, 2021
53 votes
30 answers
408 views
Indent multiple lines quickly in vi

It should be trivial, and it might even be in the help, but I can't figure out how to navigate it. How do

avatar
Wei
0 1 0 9
asked 07 September, 2021
60 votes
5 answers
476 views
How do I calculate a point on a circle’s circumference?

How can the following function be implemented in various languages? Calculate the (x,y) point on the circumfe

avatar
Joseph
0 1 0 9
asked 07 September, 2021
57 votes
1 answers
2.8K views
Rounding BigDecimal to *always* have two decimal places

I'm trying to round BigDecimal values up, to two decimal places. I'm using BigDecimal rounded = va

avatar
Rufus
0 1 0 9
asked 07 September, 2021
53 votes
9 answers
2.8K views
Is log(n!) = Θ(n·log(n))?

I am to show that log(n!) = Θ(n·log(n)). A hint was given that I should show the upper bound with nn and sh

avatar
Santiago
0 1 0 9
asked 07 September, 2021
60 votes
11 answers
2.4K views
How can I round down a number in Javascript?

How can I round down a number in JavaScript? math.round() doesn't work because it rounds it to the neare

avatar
Rufus
0 1 0 9
asked 07 September, 2021
63 votes
6 answers
1.9K views
What is the behavior of integer division?

For example, int result; result = 125/100; or result = 43/100; Will result always be the floor of the

avatar
Hallie
0 1 0 9
asked 07 September, 2021
62 votes
8 answers
1.5K views
How to scale down a range of numbers with a known min and max value

So I am trying to figure out how to take a range of numbers and scale the values down to fit a range. The rea

avatar
Keila
0 1 0 9
asked 07 September, 2021
58 votes
11 answers
506 views
Safest way to convert float to integer in python?

Python's math module contain handy functions like floor & ceil. These functions take a floating point

avatar
Karolyn
0 1 0 9
asked 07 September, 2021
57 votes
21 answers
600 views
Generate a random point within a circle (uniformly)

I need to generate a uniformly random point within a circle of radius R. I realize that by just picking a uni

avatar
Wilber
0 1 0 9
asked 07 September, 2021
48 votes
19 answers
456 views
Mapping two integers to one, in a unique and deterministic way

Imagine two positive integers A and B. I want to combine these two into a single integer C. There can be no

avatar
Benton
0 1 0 9
asked 07 September, 2021
66 votes
26 answers
2.8K views
Too many 'if' statements?

The following code does work how I need it to, but it's ugly, excessive or a number of other things. I&ap

avatar
Stacia
0 1 0 9
asked 07 September, 2021
63 votes
22 answers
1.1K views
How does C compute sin() and other math functions?

I've been poring through .NET disassemblies and the GCC source code, but can't seem to find anywhere

avatar
Thurman
0 1 0 9
asked 07 September, 2021
56 votes
19 answers
646 views
The most efficient way to implement an integer based power function pow(int, int)

What is the most efficient way given to raise an integer to the power of another integer in C? // 2^3 pow(2,3

avatar
Stacia
0 1 0 9
asked 07 September, 2021
61 votes
13 answers
1.2K views
Calculating arithmetic mean (one type of average) in Python

Is there a built-in or standard library method in Python to calculate the arithmetic mean (one type of average

avatar
Juliane
0 1 0 9
asked 07 September, 2021
62 votes
7 answers
941 views
Why is division in Ruby returning an integer instead of decimal value?

For example: 9 / 5 #=> 1 but I expected 1.8. How can I get the correct decimal (non-integer) result? Wh

avatar
Robt
0 1 0 9
asked 07 September, 2021