2024年4月15日月曜日

windows上で、.netでThread.Sleep(1)を実行すると停止誤差がやたらでかいときがある

10ミリ秒を超えてくる場合がある。

原因は単純でタイマーの解像度がおおよそ15.6ミリ秒だから。

 

 powercfg /energy

でタイマー精度を確認するわかる。

javaとかはたぶんVMでやってるからそんなに誤差でないんじゃないかな。知らんけど。

 timeBeginPeriodで最小解像度を変えればいいんだけど、

"バージョン 2004 Windows 10より前のバージョンでは、この関数はグローバル Windows 設定に影響します "

とか書いてあるから、実行するwindowsのバージョンによってはtimeBeginPeriodを使うのはアブないかもね。

 

2024年4月2日火曜日

Raspberry Pi OS (12.5)でvimのvisualモードがうざい

普段はvimなのでvimを入れたのだが、visualモードになってしまってめんどくさかった 

.vmrcに set mouse= を設定しても効かなかった 

どうやら

 /usr/share/vim/vim90/defaults.vim

 の設定が効いているっぽいので、こっちの設定をコメントアウトしてやったわ 

具体的には

 77 " In many terminal emulators the mouse works just fine.  By enabling it you
 78 " can position the cursor, Visually select and scroll with the mouse.
 79 " Only xterm can grab the mouse events when using the shift key, for other
 80 " terminals use ":", select text and press Esc.
 81 if has('mouse')
 82 if &term =~ 'xterm'
 83    set mouse=a
 84   else
 85     set mouse=nvi
 86   endif
 87 endif
 
 77 " In many terminal emulators the mouse works just fine.  By enabling it you
 78 " can position the cursor, Visually select and scroll with the mouse.
 79 " Only xterm can grab the mouse events when using the shift key, for other
 80 " terminals use ":", select text and press Esc.
 81 " if has('mouse')
 82 "  if &term =~ 'xterm'
 83 "    set mouse=a
 84 "  else
 85 "    set mouse=nvi
 86 "  endif
 87 " endif
とコメントアウト