GoCN每日新闻(2019-04-10)

GoCN每日新闻(2019-04-10)

1. 用一句话描述Go语言的命令 https://juejin.im/post/5cab0e885188250b251e5152

2. 编写一个多态引擎 https://medium.com/syscall59/writing-a-polymorphic-engine-73ec56a2353e

3. Go编写的现代文本索引库 https://github.com/blevesearch/bleve

4. 缓存慢数据库查询 https://medium.com/@rocketlaunchr.cloud/caching-slow-database-queries-1085d308a0c9

5. 理解Go语言defer关键字的原理 https://draveness.me/golang-defer

粉丝福利 | 第五届 Gopher China大会门票福利第二波 https://mp.weixin.qq.com/s/4q-FpHsKu_t_7St65svT5w

编辑: 周云轩

订阅新闻: http://tinyletter.com/gocn

GoCN归档: https://gocn.vip/question/3255

Windows Remote Desktop Client fails to connect with error code 0x4

When I connect to my Windows 10 machine from my Mac via Microsoft Remote Desktop client v10 or from Windows I’m getting an error: Your session ended because of an error. If this keeps happening, contact your network administrator for assistance. Error code: 0x4


I reported this issue to MS via their Report Issue form on Mac Remote Desktop client and got the following response:

Set this key to a high value, like 10,000 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server

MaxOutstandingConnections

DWORD

Once I followed these recommendations the problem stopped.

https://serverfault.com/questions/959179/windows-remote-desktop-client-fails-to-connect-with-error-code-0x4/959180

Mac Won’t Sleep

On the rare occasion that you go to put a Mac to sleep and, well, it won’t sleep, there’s an easy to way to find out what the holdup is. Though this is a somewhat technical approach, it should give a good starting point to anyone who’s confused as to why something like automatic sleep isn’t taking effect, and hopefully provide a quick resolution to the problem.

pmset -g


$ pmset -g

System-wide power settings:
Currently in use:
 lidwake              1
 autopoweroff         1
 standbydelayhigh     86400
 autopoweroffdelay    28800
 proximitywake        0
 standby              1
 standbydelaylow      10800
 ttyskeepawake        1
 hibernatemode        3
 powernap             0
 gpuswitch            2
 hibernatefile        /var/vm/sleepimage
 highstandbythreshold 50
 displaysleep         2
 sleep                1 (sleep prevented by coreaudiod)
 acwake               0
 halfdim              1
 tcpkeepalive         1
 disksleep            10

You can see

 sleep                1 (sleep prevented by coreaudiod)

sleep is blocked by coreaudiod.

then pmset -g assertions

$ pmset -g assertions

019-03-25 17:23:40 +0800 
Assertion status system-wide:
   BackgroundTask                 0
   ApplePushServiceTask           0
   UserIsActive                   1
   PreventUserIdleDisplaySleep    0
   PreventSystemSleep             0
   ExternalMedia                  0
   PreventUserIdleSystemSleep     1
   NetworkClientActive            0
Listed by owning process:
   pid 174(coreaudiod): [0x0002b01700018c7a] 00:36:20 PreventUserIdleSystemSleep named: “com.apple.audio.AppleHDAEngineOutput:1B,0,1,1:0.context.preventuseridlesleep” 
Created for PID: 9697. 
   pid 119(hidd): [0x0002b7e100099838] 00:00:00 UserIsActive named: “com.apple.iohideventsystem.queue.tickle.4295023489.3” 
Timeout will fire in 120 secs Action=TimeoutActionRelease
No kernel assertions.
Idle sleep preventers: IODisplayWrangler

Now We Know how to cancel the PID . The problem solves