highlighter

Sqlserver 报错“参数数据类型 ntext/text 对于 replace 函数的参数 1 无效”的解决方案及原理分析扩展

女生的网名这么多〃 提交于 2020-04-08 18:33:21
原因: 在数据查询中replace函数无法对表table中text/ntext类型的字段colname进行了字符串操作。 解决方法: 将text当作varchar(实际内容长度低于8000字节时)或把ntext当作nvarchar(实际内容长度低于4000字节时)。 但是当text字段内容长度超过8000或ntext字段内容长度超过4000字节时多出的字节会被截断而忽略掉。 这时我们可以使用max类型来解决这个问题。 原报错代码: 1 update tablename set colname= replace (colname, 'oldtext' , 'newtext' );  修改后可执行代码: 1 update tablename set colname= replace ( Cast (colname as varchar (8000)), 'oldtext' , 'newtext' ); 1 update tablename set colname= replace ( Cast (colname as nvarchar(4000)), 'oldtext' , 'newtext' ); 来源: oschina 链接: https://my.oschina.net/u/4418764/blog/3224973

python 字符串、数字转换为bytes和bytes转换为字符串

不问归期 提交于 2020-04-08 17:54:04
最近在搞一个socket,用python向C#服务器发送bytes和从服务器接收bytes,搞了一天基本弄清楚了这些转换关系。 建立一个空的bytes数组: a=bytes(5) print(a)   执行结果: b'\x00\x00\x00\x00\x00'  将int转化为bytes(大端字节序): def intToBytes(value, length): result = [] for i in range(0, length): result.append(value >> (i * 8) & 0xff) result.reverse() result_bytes=bytes(result) return result_bytes print(intToBytes(-95,3))   执行结果: b'\xff\xff\xa1'下 下班了,后面补哈 将字符串转为bytes: 来源: oschina 链接: https://my.oschina.net/u/4295464/blog/3224896

clickhouse安装和入门

我是研究僧i 提交于 2020-04-07 11:54:29
1. 安装 https://clickhouse.tech/#quick-start centos: sudo yum install yum-utils sudo rpm --import https://repo.clickhouse.tech/CLICKHOUSE-KEY.GPG sudo yum-config-manager --add-repo https://repo.clickhouse.tech/rpm/stable/x86_64 sudo yum install clickhouse-server clickhouse-client sudo /etc/init.d/clickhouse-server start clickhouse-client 如果在线安装很慢时,可以先下载得到rpm包,在安装: 启动: sudo /etc/init.d/clickhouse-server start 2. 目录配置 Server config files are located in /etc/clickhouse-server/ . Before going further, please notice the <path> element in config.xml . Path determines the location for data storage, so

spring中aop不生效的几种解决办法

余生长醉 提交于 2020-04-07 11:51:05
先看下这个问题的背景:假设有一个spring应用,开发人员希望自定义一个注解@Log,可以加到指定的方法上,实现自动记录日志(入参、出参、响应耗时这些) package com.cnblogs.yjmyzz.springbootdemo.aspect; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface Log { } 然后再写一个Aspect来解析这个注解,对打了Log注解的方法进行增强处理  package com.cnblogs.yjmyzz.springbootdemo.aspect; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org

搜索的简单使用

两盒软妹~` 提交于 2020-04-07 11:25:14
  这这里主要是存在term与match的查询介绍。 一:term   词条查询不会分析查询条件,只有当词条和查询字符串完全匹配时,才匹配搜索。 1.准备工作   新建索引,然后新建mappings PUT /nba/ { "mappings": { "properties": { "name": { "type": "text" }, "team_name": { "type": "text" }, "position": { "type": "text" }, "play_year": { "type": "long" }, "jerse_no": { "type": "keyword" } } } }   添加三条数据: PUT /nba/_doc/1 { "name": "哈登", "team_name": "⽕箭", "position": "得分后卫", "play_year": 10, "jerse_no": "13" } PUT /nba/_doc/2 { "name": "库⾥", "team_name": "勇⼠", "position": "控球后卫", "play_year": 10, "jerse_no": "30" } PUT /nba/_doc/3 { "name": "詹姆斯", "team_name": "湖⼈", "position": "⼩前锋

使 egg-multipart 同时支持 stream 和 file

∥☆過路亽.° 提交于 2020-04-07 11:21:26
项目中,上传图片是通过 stream,上传excel是通过file 接受的 config.multipart = { // fileSize: '50mb', // 文件大小 fileModeMatch: /^(\/tools\/excel\/import)$/, // '/tools/excel/import'接口使用file模式,其他使用stream模式 fileExtensions: ['.xlsx', '.xls'], } . 来源: oschina 链接: https://my.oschina.net/u/4340062/blog/3222797

spring中aop不生效的几种解决办法

倾然丶 夕夏残阳落幕 提交于 2020-04-07 10:10:11
先看下这个问题的背景:假设有一个spring应用,开发人员希望自定义一个注解@Log,可以加到指定的方法上,实现自动记录日志(入参、出参、响应耗时这些) package com.cnblogs.yjmyzz.springbootdemo.aspect; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface Log { } 然后再写一个Aspect来解析这个注解,对打了Log注解的方法进行增强处理  package com.cnblogs.yjmyzz.springbootdemo.aspect; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org

KubeSpray部署k8s集群

久未见 提交于 2020-04-07 08:59:33
KubeSpray 部署 k8s 集群 Kubespray 是 Kubernetes incubator 中的项目,目标是提供 Production Ready Kubernetes 部署方案,该项目基础是通过 Ansible Playbook 来定义系统与 Kubernetes 集群部署的任务,具有以下几个特点: l 可以部署在 AWS, GCE, Azure, OpenStack 以及裸机上 . l 部署 High Available Kubernetes 集群 . l 可组合性 (Composable) ,可自行选择 Network Plugin (flannel, calico, canal, weave) 来部署 . l 支持多种 Linux distributions(CoreOS, Debian Jessie, Ubuntu 16.04, CentOS/RHEL7). GitHub 地址: https://github.com/kubernetes-sigs/kubespray 一、 环境准备 1 )所以的主机都需要关闭 selinux ,执行的命令如下: setenforce 0 sed -i --follow-symlinks 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux 2

clickhouse安装和入门

前提是你 提交于 2020-04-07 08:16:16
1. 安装 https://clickhouse.tech/#quick-start centos: sudo yum install yum-utils sudo rpm --import https://repo.clickhouse.tech/CLICKHOUSE-KEY.GPG sudo yum-config-manager --add-repo https://repo.clickhouse.tech/rpm/stable/x86_64 sudo yum install clickhouse-server clickhouse-client sudo /etc/init.d/clickhouse-server start clickhouse-client 如果在线安装很慢时,可以先下载得到rpm包,在安装: 启动: sudo /etc/init.d/clickhouse-server start 2. 目录配置 Server config files are located in /etc/clickhouse-server/ . Before going further, please notice the <path> element in config.xml . Path determines the location for data storage, so

使 egg-multipart 同时支持 stream 和 file

安稳与你 提交于 2020-04-07 07:46:52
项目中,上传图片是通过 stream,上传excel是通过file 接受的 config.multipart = { // fileSize: '50mb', // 文件大小 fileModeMatch: /^(\/tools\/excel\/import)$/, // '/tools/excel/import'接口使用file模式,其他使用stream模式 fileExtensions: ['.xlsx', '.xls'], } . 来源: oschina 链接: https://my.oschina.net/u/4302345/blog/3222588