<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[lucyTheSlayer的博客]]></title><description><![CDATA[一条没用的咸鱼]]></description><link>https://blog.youkuaiyun.com/lucyTheSlayer</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; lucyTheSlayer]]></copyright><item><title><![CDATA[Epoch Based Reclamation 的个人理解]]></title><link>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/121784144</link><guid>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/121784144</guid><author>lucyTheSlayer</author><pubDate>Wed, 08 Dec 2021 13:20:06 +0800</pubDate><description><![CDATA[目录缘起什么是Epoch Based Reclamation为什么要Epoch Based ReclamationEpoch Based Reclamation的原理概述来个小例子后记
缘起
最近在看大佬视频，在用rust实现一个concurrenthashmap的时候，用到了crossbeam中epoch，顿时一阵懵逼，囊碟括咧（这啥玩意啊）？于是便开始启动搜索引擎大发，再整合诸多信息后，有了此偏小记。
什么是Epoch Based Reclamation
大概意思上来说，这是无锁编程模式下的一种内存管理]]></description><category></category></item><item><title><![CDATA[大坑后记: sql事务关于select for update那点事]]></title><link>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/117510886</link><guid>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/117510886</guid><author>lucyTheSlayer</author><pubDate>Thu, 03 Jun 2021 11:08:34 +0800</pubDate><description><![CDATA[1.场景描述

这是开发中的一个项目，有以下场景:对于一条消息M，有若干个接收者(r1, r2, ...)。接收者收到消息后，发送确认消息。服务器从消息M的接收者zho
]]></description><category></category></item><item><title><![CDATA[android webrtc 音频播放设备切换相关 初步小结]]></title><link>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/115716675</link><guid>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/115716675</guid><author>lucyTheSlayer</author><pubDate>Thu, 15 Apr 2021 10:17:29 +0800</pubDate><description><![CDATA[做android webrtc相关应用时，涉及到音频播放设备的切换，经过资料搜索和自己尝试后，初步小结一下，内容有待进一步验证，至少目前效果已达到。

1.音频播放设备

主要有以下四大类型: 扬声器，听筒，耳机，蓝牙耳机。效果设计为，通话中，当用户打开了扬声器，则直接走扬声器播放。当用户关闭了扬声器，则从听筒，耳机，蓝牙耳机中选择其一播放。其中，蓝牙耳机具有最高优先级，即当蓝牙耳机连接时，音频从蓝牙耳机中播放

2.不考虑蓝牙耳机的简单情形

首先，获取audioManager（kotlin代码，下同）.]]></description><category></category></item><item><title><![CDATA[NettyChannelBuilder 自签名证书 overrideAuthority 的使用记录]]></title><link>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/112774858</link><guid>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/112774858</guid><author>lucyTheSlayer</author><pubDate>Mon, 18 Jan 2021 13:34:03 +0800</pubDate><description><![CDATA[背景

在之前的文章中，配置了golang服务端，python客户端的自签名grpc加密通道。在同样配置安卓客户端的情况下，却碰到了问题.


NettyChannelBuilder.forAddress("192.168.50.153", 56651)
            .sslContext(GrpcSslContexts.forClient().trustManager(crt).build()).build()

会报如下异常:

javax.net.ssl.SSLHandshakeExcep]]></description><category></category></item><item><title><![CDATA[用rust手撸一棵磁盘存储B+树]]></title><link>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/109362308</link><guid>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/109362308</guid><author>lucyTheSlayer</author><pubDate>Thu, 29 Oct 2020 16:12:13 +0800</pubDate><description><![CDATA[作为一个多年的老码农，学习新语言那可以说是跟喝水一样简单。什么go，swift，js，dart，都是直接上手撸码，顶多三天就算是七七八八门清了。

直到。。。我遇到了rust。

学rust快有2个月了，但感觉现在连入门都算不上，更没有信心将他用于实际项目。

为了更好的学习rust，从0开始手撸了一个b树:https://github.com/lucyTheSlayer/btree.git

实现了插入与查询。未来计划加入删除、缓存等。



通过手撸b树，对rust语言的掌握和理解可以算是提升了一点点.]]></description><category></category></item><item><title><![CDATA[vue2.0 代码中调用filter]]></title><link>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/108275160</link><guid>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/108275160</guid><author>lucyTheSlayer</author><pubDate>Fri, 28 Aug 2020 10:47:17 +0800</pubDate><description><![CDATA[如定义有以下filter：


Vue.filter('formatPercentage', (v, outputZero) =&gt; {
  if (v === undefined || v === null) {
    return ''
  }
  if (v === 0 &amp;&amp; !outputZero) {
    return ''
  }
  return `${(v * 100).toFixed(2)}%`
})

如果想在js代码中调用，可使用如下方法：


let f =]]></description><category></category></item><item><title><![CDATA[pyqt5 异步请求返回后，ui组件已销毁导致crash的简单解决方法]]></title><link>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/108117691</link><guid>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/108117691</guid><author>lucyTheSlayer</author><pubDate>Thu, 20 Aug 2020 10:23:53 +0800</pubDate><description><![CDATA[pyqt5 异步请求返回后，ui组件已销毁导致crash的简单解决方法场景解决思路
场景
在客户端编写时，涉及到从服务器获取数据， 在主线程同步请求会卡死界面，所以一般都会采用异步的方式，通过背景线程去请求数据，然后通知主线程处理。这种方式有个问题是，很容易导致程序crash。譬如打开一个对话框，开启线程获取数据，由于网络延迟，等到数据返回，回调主线程渲染ui时候，该对话框已经被用户销毁，那这时候，就会抛出:
RuntimeError: wrapped C/C++ object of type XXX ha]]></description><category></category></item><item><title><![CDATA[vue 跳转至相同路由时,强制刷新页面]]></title><link>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/107560723</link><guid>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/107560723</guid><author>lucyTheSlayer</author><pubDate>Fri, 24 Jul 2020 14:39:21 +0800</pubDate><description><![CDATA[速记备查

https://www.zhihu.com/question/49863095/answer/580363087
]]></description><category></category></item><item><title><![CDATA[pyinstaller 打包报错  FileNotFoundError 系统找不到指定的文件 api-ms-win-core-handle-l1-1-0.dll]]></title><link>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/106498935</link><guid>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/106498935</guid><author>lucyTheSlayer</author><pubDate>Tue, 02 Jun 2020 16:19:29 +0800</pubDate><description><![CDATA[pyinstaller作为一个python打包利器，虽然很方便，但坑实在是多。这不，好久没打过包了，今天一打包，又来了新错:


Traceback (most recent call last):
 File "C:\Program Files\Python36\lib\runpy.py", line 193, in _run_module_as_main
  "__main__", mod_spec)
 File "C:\Program Files\Python36\lib\runpy.py",...]]></description><category></category></item><item><title><![CDATA[pyqt股票行情软件性能优化 差点又让python背了锅]]></title><link>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/106328550</link><guid>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/106328550</guid><author>lucyTheSlayer</author><pubDate>Mon, 25 May 2020 12:28:41 +0800</pubDate><description><![CDATA[因为对c++一直处于差不多能看的懂代码，但写的话一头包，所以毅然采用pyqt编写一个股票行情软件。部分窗体截取如下：



等大体上快完工了，跑着跑着突然发现，界面卡顿的一笔。一看cpu，飚到了十几。瞅瞅人家的行情软件，那cpu使用都是稳定的在2以下。

行情一频繁就尿裤，难道是py太拉胯了？

于是立马使用cProfile:


python -m cProfile -s cumulative main.py




1.一号锅：拉胯的setStyleSheet

首先发现setStyleSheet这个.]]></description><category></category></item><item><title><![CDATA[p2p的基石： 快乐udp打洞试验]]></title><link>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/104819305</link><guid>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/104819305</guid><author>lucyTheSlayer</author><pubDate>Thu, 12 Mar 2020 15:26:28 +0800</pubDate><description><![CDATA[因疫情在家办公，远程操作公司电脑。突然想起来试一试很久以前一直想做的试验： udp打洞。毕竟男人鳝变，最爱钻洞。

试验步骤记录如下：

注：家里的电脑记为PC_A，公司电脑记为PC_B

1.利用stun服务，检测两边电脑的NAT类型，并得到两边的内网，外网地址。

这里使用https://github.com/ccding/go-stun这个库。由于go-stun并没有在控制台输出本机udp的...]]></description><category></category></item><item><title><![CDATA[python 中四舍五入的巨坑]]></title><link>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/102910351</link><guid>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/102910351</guid><author>lucyTheSlayer</author><pubDate>Tue, 05 Nov 2019 10:10:35 +0800</pubDate><description><![CDATA[先来个灵魂三问：


print(round(0.5))
print(round(1.5))
print(round(2.5))

一般人肯定以为输出1, 2, 3了,实际跑出来,却是0, 2, 2

有些同学马上说，可以利用格式化字符串呀：


print("%.0f" % 0.5)
print("%.0f" % 1.5)
print("%.0f" % 2.5)

然并卵，仍然是0, 2, 2...]]></description><category></category></item><item><title><![CDATA[grpc 加密传输 golang服务端 python客户端 最简单方法]]></title><link>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/102701000</link><guid>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/102701000</guid><author>lucyTheSlayer</author><pubDate>Wed, 23 Oct 2019 14:52:49 +0800</pubDate><description><![CDATA[场景：golang作为服务端，python作为客户端，grpc的加密传输

试了网上很多的方法，有带ca的有不带的，天花乱坠头都晕了。最烦躁的是网上服务器和客户端都是同一语言的，试了下都不怎么灵光。纠结了不少时间后，终于试出一套最简单的能调通的方案。

本方案不使用ca，因此不够高大上，但对于一般应用的安全需求应该是没问题了。



第一步：生成证书

在安装了openssl的linux系统上，...]]></description><category></category></item><item><title><![CDATA[js 从json字符串反序列化对象，如何恢复其对象方法的小技巧]]></title><link>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/97235069</link><guid>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/97235069</guid><author>lucyTheSlayer</author><pubDate>Thu, 25 Jul 2019 09:31:48 +0800</pubDate><description><![CDATA[应用场景中，有将前端的一些数据保存到后台，在下一次使用的时候取出恢复的操作。对象的字段在这个过程中，是不会产生问题的，但是通过json序列化/反序列化后，对象的方法却不能恢复。

解决这问题最原始的方法，就是重新new个对象，然后把字段依次赋值，但这种耗时耗力无法自适应变更的方法未免也太low了点。

思来想去，记起了很久前看到的关于prototype的文章，便思考了如何能通过prototype完...]]></description><category></category></item><item><title><![CDATA[Android sqlite: Cursor Window is full]]></title><link>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/93713085</link><guid>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/93713085</guid><author>lucyTheSlayer</author><pubDate>Wed, 26 Jun 2019 09:47:42 +0800</pubDate><description><![CDATA[https://stackoverflow.com/questions/35766836/cursorwindow-window-is-full
]]></description><category></category></item><item><title><![CDATA[pyinstaller 打包出现第三方库FileNotFoundError的一般解决方法]]></title><link>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/92795220</link><guid>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/92795220</guid><author>lucyTheSlayer</author><pubDate>Tue, 18 Jun 2019 16:35:23 +0800</pubDate><description><![CDATA[在用pyinstaller打包（-F 选项），如果用到的第三方库含有data文件，而pyinstaller又没有自带该第三方库文件的hook的时候，执行打包后的exe一般会报以下错误


FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\1\\_ME...]]></description><category></category></item><item><title><![CDATA[vs2017 代码标红波浪线但编译通过 解决办法]]></title><link>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/88683838</link><guid>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/88683838</guid><author>lucyTheSlayer</author><pubDate>Wed, 20 Mar 2019 11:23:25 +0800</pubDate><description><![CDATA[在c++代码引用其他类的时候，发现被标下划红色波浪线了，但是编译生成完全没问题。所以肯定是vs脑残了。

网上搜了下，

https://weblog.west-wind.com/posts/2018/Aug/07/Fixing-Visual-Studio-Intellisense-Errors

在此找到了靠谱的解决方案（可能需梯子才能访问）

简述下步骤：

1.关闭vs

2.找到项目根目录...]]></description><category></category></item><item><title><![CDATA[websocket中，使用protobuf的要点总结]]></title><link>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/87978070</link><guid>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/87978070</guid><author>lucyTheSlayer</author><pubDate>Wed, 27 Feb 2019 16:52:53 +0800</pubDate><description><![CDATA[作为一个有逼格的实时动态网站，websocket是必不可少的；对于数据量不大的场景，使用json传递数据便绰绰有余了。然后当你想偷懒，直接这么写的时候，老板就会来敲打你的狗头：“现在数据量变多了，网站怎么不动了啊？”

于是，必须使用protobuf了。

protobuf的简介就不多说了，百度都有。

先是本篇中用到的proto定义，具体意义便不用细究了，只是举个例子而已。


syntax =...]]></description><category></category></item><item><title><![CDATA[golang sql事务rollback写法的思考]]></title><link>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/86694069</link><guid>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/86694069</guid><author>lucyTheSlayer</author><pubDate>Tue, 29 Jan 2019 18:48:47 +0800</pubDate><description><![CDATA[与springmvc什么都封装好了不一样，使用go开发的时候很多轮子都得自己造，但也正因为此，go的开发更为自由灵活。

go比较著名的orm库是gorm，在写带有事务的方法，而碰巧业务逻辑又比较复杂的情况下，一旦出现了error，则事务必须回滚，这样的话，代码中将会有很多的tx.Rollback()这样的臃肿代码。

解决方法之一是使用goto，但是golang中的goto要求变量必须声明在开头...]]></description><category></category></item><item><title><![CDATA[大端序 小端序 之简单记忆法]]></title><link>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/84037434</link><guid>https://blog.youkuaiyun.com/lucyTheSlayer/article/details/84037434</guid><author>lucyTheSlayer</author><pubDate>Tue, 13 Nov 2018 22:24:43 +0800</pubDate><description><![CDATA[如我们有值 i = 0x12345678，

若字节流为(地址从左往右从低到高):

0x78 0x56 0x34 0x12 则为小端序

若字节流为：

0x12 0x34 0x56 0x78 则为大端序

 

那么，记忆方法就很简单了，如果顺着读等于真实值的就是大端序；如果不是就是小端序。

 

另外，一般计算机内存存储数据采用小端序，所以用ollydbg查看数据比较别扭；而根据网上高人评...]]></description><category></category></item></channel></rss>