- 博客(195)
- 收藏
- 关注
原创 Dependency ‘io.spring.platform:platform-bom:Cario-SR7‘ not found
加上后,发现还是不行。检查maven配置也没有问题。idea使用的是2020.3.3版本,更换为2020.1.1版本后,问题解决了。那么必然是idea的问题了。
2023-06-27 09:50:03
655
原创 java.nio.charset.MalformedInputException: Input length = 1
java.nio.charset.MalformedInputException: Input length = 1
2022-12-02 10:26:01
594
原创 Consul Manager解决consul ui权限问题
源码地址consul ui没有访问权限,所有人都可以修改key/value,不安全。所以,发现了Consul Manager这个开源的dashboard可以通过权限管理,还可以为不同的角色设置的不同的权限。
2022-05-28 14:18:37
2461
原创 c# mongodb insert 忽略Null参数入库
using MongoDB.Bson;using MongoDB.Bson.Serialization.Conventions;using MongoDB.Driver;string age = null;var document = new{ name = "添加到mongodb", age = age,};MongoClientSettings settings= MongoClientSettings.FromConnectionString("mongodb://.
2022-05-03 19:46:28
1170
原创 rabbitmq交换器类型
fanout它会把所有发送到该交换器的消息路由到所有与该交换器绑定的队列中direct它会把消息路由到那些BingingKey 和RoutingKey完全匹配的队列中topic和direct类似,比其更灵活,支持通配符匹配
2022-04-18 18:47:18
1939
原创 java执行linux命令
private void exeCommand(String command){ try { String[] cmd = new String[]{"sh","-c",command}; Process process = Runtime.getRuntime().exec(cmd); BufferedInputStream bis = new BufferedInputStream( .
2022-03-16 15:21:21
393
1
原创 go注册到consul
package coreimport ( "log" consulapi "github.com/hashicorp/consul/api")func RegService() { config := consulapi.DefaultConfig() config.Address = "127.0.0.1:8500" //consul地址 reg := consulapi.AgentServiceRegistration{} reg.Name = "ilocal-golang-s.
2022-03-11 17:50:02
519
原创 jestClient增删改查
import com.alibaba.fastjson.JSON;import io.searchbox.client.JestClient;import io.searchbox.client.JestClientFactory;import io.searchbox.client.JestResult;import io.searchbox.client.config.HttpClientConfig;import io.searchbox.core.Bulk;import io.sear.
2022-02-11 15:19:04
1137
原创 jestClient实时操作数据后实时刷新到各分片
Index index = new Index.Builder(user).index(TABLE_NAME).type(TYPE).id(UUIDUtils.getUUID()).refresh(true).build();//refresh设置为true
2022-02-11 15:14:43
411
原创 Gson解析日期字段报错
报错的原因:1.查到的字段值是时间戳,而接收类型是date;2.查到的字段值是时间戳(毫秒),而gson默认转换秒值;可以通过自行对日期进行反序列化,兼容解析各种日期格式:import com.google.gson.JsonDeserializationContext;import com.google.gson.JsonDeserializer;import com.google.gson.JsonElement;import com.google.gson.JsonParseE
2022-02-11 15:10:51
2173
原创 JSON.toJSONString日期类型继续保存成date
JSON.toJSONString(obj);//会将date变成时间戳。JSON.toJSONStringWithDateFormat(obj,"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");//继续保存为时间戳
2022-02-11 15:03:20
4191
2
原创 jest scan cursor all
import org.apache.commons.lang3.StringUtils;import redis.clients.jedis.Jedis;import redis.clients.jedis.ScanParams;import redis.clients.jedis.ScanResult;import redis.clients.jedis.Tuple;import java.util.ArrayList;import java.util.List;public clas.
2022-02-08 11:51:22
226
原创 go操作elasticsearch
package mainimport ( "context" "fmt" "log" "os" "reflect" "github.com/olivere/elastic/v7")var client *elastic.Clientvar host = "http://127.0.0.1:9200/"type Employee struct { FirstName string `json:"first_name"` LastName string `json:".
2022-01-07 19:03:59
268
原创 go操作redis
package mainimport ( "fmt" "github.com/garyburd/redigo/redis")func main() { c, err := redis.Dial("tcp", "localhost:6379") if err != nil { fmt.Println("conn redis failed,", err) defer c.Close() return } fmt.
2022-01-07 18:28:18
1014
原创 go操作mysql
package mainimport ( "fmt" _ "github.com/go-sql-driver/mysql" "github.com/jmoiron/sqlx")type Person struct { Id int `db:"id"` Name string `db:"name"` Age string `db:"age"`}var Db *sqlx.DBfunc init() { databa.
2022-01-07 18:13:28
521
原创 Questdb安装
#拉取镜像docker pull questdb/questdb#后台运行docker run -d -p 9000:9000 questdb/questdb
2022-01-07 17:23:57
1487
原创 .net core 将list<string>转成字符串,并添加引号
List<string> list=new();list.Add("xx1");list.Add("xx2");//第一种var mailStr = "";foreach (var mail in list){ mailStr += "'" + mail.ToString() + "'" + ",";}mailStr = mailStr[0..^1];Console.WriteLine(mailStr);//第二种Console.WriteLine(strin.
2022-01-05 19:18:45
1794
原创 python操作clickhouse
第一种方式import requestsSSL_VERIFY = Falsehost = 'http://127.0.0.1:8123'db = '数据库名称'table = '表名'#插入query_dict = { 'query': "insert into 数据库名称.表名(api,param,create_time,time) values('python-api','参数',now(),11)"}#查询query_dict = { 'query':
2021-12-31 17:21:48
2663
原创 python上传文件
# -*- coding: UTF-8 -*-from flask import Flask,request,Responseapp = Flask(__name__) @app.route('/upload', methods=['GET', 'POST'])def upload_file(): f = request.files['file'] f.save('/temp/{}'.format(f.filename)) return 'success'if __.
2021-12-31 14:25:36
731
原创 python下载文件
from flask import Flask,request,Responseapp = Flask(__name__)@app.route('/', methods=["GET"])def download(): file = request.args.get("file", 0) f = open(file,'r') data = f.read() f.close() return Response(data, content_type='appl.
2021-12-30 20:39:06
392
原创 pyhton请求接口
安装pip install requests请求import requests#GETres = requests.get("http://10.0.20.22:9999/actuator/health")print(res.text)#POSTurl = "api地址"jsonParam = { "pageIndex":1, "pageSize":10}headers={ "Authorization":"MDNlNTQwMjNhOGFmNzdj
2021-12-30 14:11:36
1047
原创 python操作elasticsearch
安装pip install elasticsearch pip install elasticsearch[async] #支持异步插入from elasticsearch import Elasticsearchfrom elasticsearch import AsyncElasticsearchesClient = Elasticsearch(hosts="127.0.0.1",port=9200)esClient.index(index="indexName",doc
2021-12-30 11:32:12
1505
原创 python操作mongodb
安装pip install pymongo插入#!/usr/bin/python3 import pymongomyclient = pymongo.MongoClient('mongodb://账号:密码@ip:27017/')mydb = myclient["dbname"]coll = mydb["collectName"]record={ 'name':'hello', 'age':22}id=coll.insert_one(record)prin
2021-12-30 10:42:32
420
原创 python操作mysql
安装pip install pymysql插入import pymysqlconn = pymysql.connect(host='10.0.20.9',user="root",passwd="GCFSlfyZIvxxs",db="go2global")cursor=conn.cursor()cursor.execute('insert into Person (Name,Age) values (\"{}\",{})'.format('你是谁',33))cursor.close()
2021-12-29 20:20:52
559
原创 python读取文件中的数据
方式1f = open('文件路径','r', encoding="utf-8")data = f.read()f.close()方式2data = os.system('type {}'.format('文件路径'))
2021-12-29 19:17:27
489
原创 python flask提供API
安装flaskpipe install flask编码# -*- coding: UTF-8 -*-from flask import Flask,requestapp = Flask(__name__)@app.route('/get', methods=["GET"])def get(): name= request.args.get("name", 0) return nameif __name__ == '__main__': app
2021-12-29 19:14:54
248
原创 python操作redis
import redisredisClient=redis.StrictRedis(host='127.0.0.1',port=6379,db=0)redisClient.set('hello','world 20211224')redisClient.expire('hello',1000*60)v = redisClient.get('hello')print(v)
2021-12-24 19:22:38
755
原创 jestClient查询count
import io.searchbox.client.JestClient;import io.searchbox.client.JestClientFactory;import io.searchbox.client.config.HttpClientConfig;import io.searchbox.core.Count;import io.searchbox.core.CountResult;import org.elasticsearch.index.query.BoolQueryBu.
2021-12-21 10:49:41
660
原创 .net core api传参方式
1.bodyusing Microsoft.AspNetCore.Mvc;namespace myweb.Controllers{ [Route("api/[controller]/[action]")] [ApiController] public class MyController : ControllerBase { [HttpPost] public object Method1([FromBody] Model mode
2021-12-17 17:27:16
2205
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人