在使用正则前,需要启用系统高级选项的OLE自动化功能,启用过程如下:

exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'Ole Automation Procedures',1
reconfigure

安全起见,使用完后记得关闭该高级功能:

exec sp_configure 'Ole Automation Procedures',0
reconfigure
exec sp_configure 'show advanced options',0
reconfigure

搜索 Function:

ALTER FUNCTION [dbo].[RegexMatch]
(
    @matchstring VARCHAR(4000),
    @pattern VARCHAR(200)
)
RETURNS BIT
AS BEGIN
    DECLARE @handle int, @result bit
    exec sp_oacreate 'vbscript.regexp', @handle output
    exec sp_oasetproperty @handle, 'pattern',@pattern
    exec sp_oasetproperty @handle, 'global', 'true'
    exec sp_oasetproperty @handle, 'ignorecase', 0
    exec sp_oamethod @handle, 'test', @result output,@matchstring
    exec sp_oadestroy @handle
    return @result
END

使用:

select dbo.RegexMatch(N'abc12345',N'\d{5}')

替换Function

CREATE FUNCTION [dbo].[RegReplace]
(
    @matchstring VARCHAR(4000),
    @pattern VARCHAR(200),
    @replace VARCHAR(200)
)
RETURNS VARCHAR(4000)
AS BEGIN
    DECLARE @handle int, @result VARCHAR(4000)
    exec sp_oacreate 'vbscript.regexp', @handle output
    exec sp_oasetproperty @handle, 'pattern',@pattern
    exec sp_oasetproperty @handle, 'global', 1 --全局替换
    exec sp_oasetproperty @handle, 'ignorecase', 1 --忽略大小写
    exec sp_oamethod @handle, 'Replace', @result output,@matchstring,@replace
    exec sp_oadestroy @handle
    return @result
END

使用:

select dbo.RegReplace('hello 123','\d{2}','world')

IOS版本,之前我们的APP没问题,最近IOS升级后,手机直接运行项目在某一个页面总是闪退。
错误信息是
NSInternalInconsistencyException reason: 'Corrupted standard message'
翻各种资料,各种 google 搜索没有找到答案
最后想了一下,那个页面就是多了一个保持屏幕不息屏的功能,于是升级 wakelock 包到最新版本,解决问题:

  wakelock: ^0.6.1+2

记录一下。

Net core 6.0 中,要开启 GcServer 模式,需要通过环境变量的方式。

Windows 系统

直接增加环境变量(用户或系统自己看着办)

DOTNET_gcServer=1

在 Linux 中

如果是直接运行的程序,直接 export DOTNET_gcServer=1 就行
要永久生效,可以将这句加入到 ~/.bashrc (当前用户) 和 /etc/profile (全局) 中。

如果是 service 方式运行的话,上面的方式就不生效了,就需要这样做:

systemctl edit <service>

写入以下内容:

[Service]
Environment="DOTNET_gcServer=1"

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
dpkg -i google-chrome-stable_current_amd64.deb

如果是 root 启动,会无法运行。要修改配置:

vim /opt/google/chrome/google-chrome

找到 exec -a "$0" "$HERE/chrome" "$@" 这一行,在后面增加: --user-data-dir --no-sandbox

在 Kali Linux 安装 Google Chrome 最容易的方法就是使用 gdebi ,它会自动帮你下载所有的依赖包。

sudo apt-get update
sudo apt-get install gdebi
gdebi google-chrome-stable_current_amd64.deb

1,显示内核列表,执行:

cat /boot/grub2/grub.cfg |grep menuentry

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
  menuentry_id_option=""
export menuentry_id_option
menuentry 'CentOS Linux (4.4.110-1.el7.elrepo.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-4.4.110-1.el7.elrepo.x86_64-advanced-c59b9eb7-3a84-43c6-8f1e-29c2ef4ef0e6' {
menuentry 'CentOS Linux (4.4.82-1.el7.elrepo.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-4.4.82-1.el7.elrepo.x86_64-advanced-c59b9eb7-3a84-43c6-8f1e-29c2ef4ef0e6' {
menuentry 'CentOS Linux (3.10.0-693.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-693.el7.x86_64-advanced-c59b9eb7-3a84-43c6-8f1e-29c2ef4ef0e6' {
menuentry 'CentOS Linux (0-rescue-72db9dd831b546f2a155776dc80f6cb4) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-72db9dd831b546f2a155776dc80f6cb4-advanced-c59b9eb7-3a84-43c6-8f1e-29c2ef4ef0e6' {

2,设置默认的启动内核

grub2-set-default "CentOS Linux (3.10.0-693.el7.x86_64) 7 (Core)"

验证是否修改成功,执行:grub2-editenv list

saved_entry=CentOS Linux (3.10.0-693.el7.x86_64) 7 (Core)

3,重启后进行观察
重启成功以后查看下机器的内核是不是该内核,执行:

uname -r

3.10.0-693.el7.x86_64