用于切换Sublime Text 3侧栏的AutoHotkey脚本还是有本机ST设置?(AutoHotkey script for toggling Sublime Text 3 sidebar or is there a native ST setting?)
我正在尝试编写一个AutoHotkey脚本来切换Sublime Text 3的侧边栏。 这是我到目前为止所拥有的:
; Custom Script for Sublime Text 3 ; Map 'F10' key to Control+k, Control+b (open/close sidebar) ; If in Sublime Text #IfWinActive ahk_class PX_WINDOW_CLASS F10:: Send {Ctrl down} SetKeyDelay -1 Send {k down} SetKeyDelay 0 Send {Ctrl down} SetKeyDelay -1 Send {b down} return
到目前为止,我可以切换侧边栏,但脚本不会将其切换回打开状态。
该脚本实际上会在Windows中导致奇怪的键盘功能,因此我不建议按原样进行测试。
我该如何重写它以便正确切换侧边栏?
I'm trying to write an AutoHotkey script for toggling Sublime Text 3's sidebar. Here's what I have so far:
; Custom Script for Sublime Text 3 ; Map 'F10' key to Control+k, Control+b (open/close sidebar) ; If in Sublime Text #IfWinActive ahk_class PX_WINDOW_CLASS F10:: Send {Ctrl down} SetKeyDelay -1 Send {k down} SetKeyDelay 0 Send {Ctrl down} SetKeyDelay -1 Send {b down} return
So far I can toggle the sidebar closed but the script is not toggling it back open.
The script actually causes weird keyboard functionality in Windows so I don't recommend testing it as is.
How can I rewrite this so it toggles the sidebar properly?
原文:https://stackoverflow.com/questions/29839915
最满意答案
浮点运算是不精确的。 当你加上
n
相同的double
s,并将结果除以n
,你并不总是得到你开始的数字。例如,以下内容:
double x = 0.1; double y = x + x + x; System.out.println(y / 3. - x);
版画
1.3877787807814457E-17
我强烈推荐每个计算机科学家应该知道的关于浮点运算的内容 。
Floating-point arithmetic is inexact. When you add up
n
identicaldouble
s, and divide the result byn
, you don't always get the number you started with.For example, the following:
double x = 0.1; double y = x + x + x; System.out.println(y / 3. - x);
prints
1.3877787807814457E-17
I highly recommend What Every Computer Scientist Should Know About Floating-Point Arithmetic.
相关问答
更多-
转换输出太晚了; 计算已经在整数运算中发生。 您需要将输入转换为double : System.out.println((double)completed/(double)total); 请注意,您实际上并不需要转换它们; 只要一个是double ,另一个将被隐式转换。 但是我更喜欢做这两个对称。 Converting the output is too late; the calculation has already taken place in integer arithmetic. You nee ...
-
Java(家庭作业)中的加法,减法,乘法和除法(Addition, Subtraction, Multiplication, & Division with Fractions in Java (Homework))[2022-05-20]
所以只需要开始一件事:一直使用getDenom(),因为在你的代码中有时它是getDenom,有时候会这样说。 对于add()方法:在denoms是不同的情况下,你错了。 你必须做 : denom = this.getDenom() * x.getDenom(); num = this.getNum() * x.getDenom() + x.getNumer() * this.getDenom(); //and check if simplification is possible. return new ... -
因为1和2是整数。 结果是0.如果你把它转换为双,它仍然是0.这个问题就在几天前被问到。 Because 1 and 2 are integers. The result is 0. If you cast that to a double, it's still 0. This question was asked just a couple of days ago.
-
您可以通过以下几种方式映射此功能: public interface MyLibrary extends Library { void examplefunct(Pointer dd); void examplefunct(java.nio.Buffer dd); void examplefunct(double[] dd); } 如果分配com.sun.jna.Memory的实例,则可以使用各种内存访问器函数将双精度写入缓冲区。 如果您使用直接NIO ByteBuffer,则可以 ...
-
Ints和双打分区(Ints and Doubles doing division)[2024-05-03]
以下是相关的部门经营者: public static double operator /(double x, double y) public static int operator /(int x, int y) 有一个从int到double的隐式转换,但不是其他的方式......所以如果你用整数除int ,你将使用整数形式......但是如果两个操作数都是double,它将使用双重形式。 没有必要使两个操作数double - 但是如果您将除数操作数设为double而不是强制转换,那么您的代码至少会更短 ... -
问题是您还使用了double来索引数组。 所以试试这个: public static void selectionSort (double...arr) { int i = 0, j = 0, smallest = 0; double temp = 0.0; for (i = 0; i < arr.length - 1; i++) { smallest = i; for (j = 1; j < arr.length - 1; j++) ...
-
没有办法提前停止,使用整数除法可能会更慢。 例如,在Skylake上: idiv r/m32 L: 26-27 T: 6 divsd xmm, xmm L: 13-14 T: 4 ( 来源 ) 因此,双重分割的速度是原来的两倍,并且具有明显更好的吞吐量。 那是在你考虑额外的乘法和额外的演员之前。 在较旧的μarchs上,32位整数除法通常具有比双除法更低的等待时间数, 但是它们变化更多( 除了用于更多串行),(对于浮点数)圆除数更快但是对于整数除法它的结果更小更快。 这种特征的差异可以使它以任何方式摆动, ...
-
浮点运算是不精确的。 当你加上n相同的double s,并将结果除以n ,你并不总是得到你开始的数字。 例如,以下内容: double x = 0.1; double y = x + x + x; System.out.println(y / 3. - x); 版画 1.3877787807814457E-17 我强烈推荐每个计算机科学家应该知道的关于浮点运算的内容 。 Floating-point arithmetic is inexact. When you add up n identical d ...
-
dividend_Hi只是你2n位红利的上半部分。 因此,假设您的股息为6(110),除数为2(10)。 在这种情况下, n将为3,因为这是表示整数所需的最小位数。 因此,对于2n位的被除数(2n = 6),您只需用零填充左侧(000110)。 int dividend = 6; int divisor = 2; int n1 = Integer.SIZE - Integer.numberOfLeadingZeros(dividend); int n2 = Integer.SIZE - Integer.n ...
-
Java中的快速整数除法(Fast integer division in Java)[2022-03-22]
有一个众所周知的用于快速整数除法的C / C ++ libdivide库,我对Java libdivide4j的这个库进行了改编 。 使用libdivide4j快速划分如下: void reduceArrayFast(long[] data, long denominator){ FastDivision.Magic magic = FastDivision.magicSigned(denominator); for(int i = 0; i < data.length; ++i) ...