- 博客(56)
- 问答 (6)
- 收藏
- 关注
原创 springboot+VUE的session跨域
VUE const service = axios.create({ baseURL: process.env.VUE_APP_BASE_API, withCredentials: true, // session跨域打开 timeout: 3000}) SpringBoot @Configurationpublic class WebConfig implements WebMvcConfigurer { @Override public void ..
2022-01-06 18:04:18
639
原创 Java springboot之拦截器
拦截器 LoginHandlerInterceptor.javapackage com.example.demo1.component;import org.springframework.web.servlet.HandlerInterceptor;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;/** * @author kog * @创建人: k.
2021-12-30 18:17:12
665
原创 Java Springboot前后端分离,重定向
@ResponseBody@GetMapping("/hello")public ModelAndView testHello() { // 重定向 return new ModelAndView("/");}
2021-12-30 15:46:02
2941
原创 python之websocket
简易的客户端和服务端通信,不包含验证和加密客户端# websocket协议通信import threadingimport timeimport websocketdef when_message(ws, message): print('接收到的消息:' + message)# 当建立连接后,死循环不断输入消息发送给服务器# 这里需要另起一个线程def when_open(ws): def run(): while True:
2021-10-23 11:45:55
6807
原创 Python写入到Excel
import xlsxwriter as xwclass T(): def __init__(self): self.initExcel() def initExcel(self): self.workbook = xw.Workbook("./职位信息.xlsx") # 创建工作簿 self.worksheet1 = self.workbook.add_worksheet("sheet1") # 创建子表 self.
2021-06-22 12:26:56
169
原创 golang的CGO_ENABLED交叉编译(Linux, Windows)
安装mingw-w64 kog@kogdeMacBook-Pro % brew install mingw-w64==> Downloading https://homebrew.bintray.com/bottles/gmp-6.2.1.big_sur.bottle.tar.gz==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/6a44705536f25c4b9f8547d44d129ae3b3657755039..
2021-05-13 14:36:52
15806
10
原创 go正则表达式
package mainimport ( "fmt" "regexp")func main(){ reg := regexp.MustCompile(`正则表达式`) val := reg.FindAllString("需要匹配的字符串", -1) // -1匹配所有 fmt.Println(val)}
2021-05-07 11:42:51
148
原创 SQL重复字段取第一个
SELECT s.* FROM ( SELECT *, row_number() over ( PARTITION BY [重复的字段] ORDER BY [排序字段] ) AS group_idx FROM [表名] ) s WHERE s.group_idx = 1
2021-05-06 15:56:04
897
原创 golang日期字符串的互转
绝不BB 上代码package mainimport ( "fmt" "time")func main() { // 日期转字符串 currentTime := time.Now() fmt.Println("Current Time in String: ", currentTime.String()) fmt.Println("MM-DD-YYYY : ", currentTime.Format("01-02-2006")) fmt.Println("YYYY-MM-DD :
2021-04-29 15:50:00
5210
原创 beego的orm原生SQL查询
这种是我目前看到最简单的写法了(没有之一) 欢迎打脸 func testdata(){ o := orm.NewOrm() var list []orm.Params nums, err := o.Raw("select 1 as 'haha'").Values(&list) if nums == 0 { } fmt.Println(list,err)}
2021-04-27 15:47:05
522
2
原创 Go判断文件是否存在,不存在创建
看代码_, exist := os.Stat("logs")if os.IsNotExist(exist) { os.Mkdir("logs", os.ModePerm)}
2021-04-25 11:45:06
1045
原创 python中input设置超时
暂时没有想到更好的方案 希望大家给点意见import osimport threadingdef input_func(): global val val = input('请输入:\n')val = "默认值"t = threading.Thread(target=input_func)t.start()t.join(3) # 等待3秒print("这个是{}".format(val))os.kill(os.getpid(), 9)...
2021-04-23 16:41:14
1399
原创 element表单正则验证
添加pattern 正则规则写在/的中间 非常简单好用rules: { sship: [ { required: true, message: '请输入IP', trigger: 'blur' }, { required: true, pattern: /^\d{0,3}\.\d{0,3}\.\d{0,3}\.\d{0,3}$/, message: '请检查ip格式',...
2021-04-16 16:33:45
481
1
原创 element走马灯手动切换
template <el-carousel ref="carousel" :autoplay="false" arrow="always" trigger="click" :loop="false" indicator-position="none"> <el-carousel-item v-for="item in 6" :key="item"> <div>第{...
2021-04-13 15:40:30
3393
原创 GO的ssh连接方案
不BB直接看代码 package mainimport ( "fmt" gossh "golang.org/x/crypto/ssh" "net")// 连接信息type Cli struct { user string pwd string addr string client *gossh.Client session *gossh.Session LastResult string}// 连接对象func
2021-04-02 10:54:15
3933
2
原创 GoLand项目导入报红,项目正常运行
setting--> Go Moudules--> 勾上Enable Go modules intergration
2021-01-21 15:47:17
2057
原创 vue-admin-template左侧点击刷新
@/layout/components/Sidebar/Link.vue<template> <!-- eslint-disable vue/require-component-is --> <component v-bind="linkProps(to)"> <slot /> </component></template><script>import { isExternal } from
2021-01-14 16:56:18
393
原创 Golang发起GET POST请求
package mainimport ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" "time")func httpGet() { //func Get(url string) (resp *Response, err error) //url := "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx1.
2020-11-25 20:32:08
246
原创 beego不建立模型,ORM执行SQL
main.gopackage mainimport ( _ "beegoDemo001/routers" "fmt" "github.com/astaxie/beego" "github.com/astaxie/beego/logs" "github.com/astaxie/beego/orm" _ "github.com/go-sql-driver/mysql" "os")//初始化连接数据库func init() { //此处可以读取你的config配置 //u.
2020-10-13 12:29:00
267
转载 Golang操作MySQL
怕原作者删了转载一波(侵删)go get github.com/go-sql-driver/mysqlpackage main; import ( "database/sql" _ "github.com/go-sql-driver/mysql" // 包的初始化,执行包中所有的init()方法 具体参见http://blog.youkuaiyun.com/wanglei9876/article/details/50475864 "fmt") func main() {
2020-10-03 22:31:16
135
原创 小程序圆形进度条
目录结构circle.js/* components/circle/circle.js */Component({ options: { multipleSlots: true // 在组件定义时的选项中启用多slot支持 }, properties: { draw: { //画板元素名称id type: String, value: 'draw' }, per: { //百分比 通过此值转换成step type:.
2020-09-27 21:58:27
1172
3
原创 Go交叉编译,后台启动执行、停止
编译Mac下编译Linux, Windows平台的64位可执行程序:CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build test.goCGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build test.goLinux下编译Mac, Windows平台的64位可执行程序:CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build test.goCGO_ENABLED=0 G
2020-09-27 11:36:24
843
原创 subprocess.Popen杀执行中的线程、子线程、当前进程
不想打字 看案例./mytest.pyfrom time import sleepsleep(1000)print(hello world!!)在执行./mytest.py假设此进程已经卡死command = r'''python ./mytest.py'''cmd = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True
2020-09-24 16:11:34
1068
原创 Golang beego跨域请求及中间件
跨域请求 (推荐抽离)package routersimport ( "github.com/astaxie/beego" "github.com/astaxie/beego/plugins/cors")func init() { //跨域配置 beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{ AllowAllOrigins: true, //AllowOrigins:
2020-09-18 15:35:05
903
原创 go get 报错:dial tcp 34.64.4.113:443: i/o timeout解决方案
切换为国内资源即可go env -w GO111MODULE=on设置环境代理go env -w GOPROXY=https://goproxy.cn,direct
2020-09-16 14:50:55
12822
2
原创 Golang文件写入常用的三种方式
走起 package mainimport ( "bufio" "fmt" "io/ioutil" "os")func writeByte(path, str string) { fileObj, err := os.OpenFile(path, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 132) if err != nil { fmt.Println(err) return } defer func() { err := fil
2020-09-14 14:01:32
2068
原创 flask跨域 blueprint跨域和restful跨域
蓝图的跨域是用了flask-cors库中的CORS, 此方法跨域只处理装饰器式的路由, restful是继承Resource的所以该跨域并不能生效 两种方案根据需求选择方案一(蓝图的跨域直接使用CORS库即可)from flask_cors import CORSapp = Flask(__name__)CORS(app, supports_credentials=True)if __name__ == "__main__": app.run()方案二(restful的跨域使
2020-09-04 12:50:23
941
原创 判断无损连接
很多资料讲解比较抽象下文相对比较通俗易懂,个人理解如有错误欢迎指正当分解ρ只有两组的时候这种情况相对较好判断,有先有公式: R1∩R2→R1-R2或R1∩R2→R2-R1这两个条件满足任何一个都是无损连接都不满足即为有损连接 例如:设有关系模式R(U,V,W,X,Y,Z),其函数依赖集:F={U→V,W→z,Y→U,WY→X},现有下列分解:ρ={UVY,WXYZ}(摘自软考题)R(UVY) ∩ R(WXYZ) 得出Y R1-R2 得出UV R2-R1 得出WXZ 此处注...
2020-08-02 11:11:50
7694
15
原创 Django跨域问题配置
在任意有jQuery的网站上先测试是否存在跨域问题$.ajax({ url:'/xxx/测试接口', type:'get', success:function(res){ console.log(res) }})安装django-cors-headerspip3 install django-cors-headers配置setting.pyINSTALLED_APPS = [ 'django.contrib.admin', .
2020-07-23 14:17:03
130
原创 Mac本.bash_profile不生效
如果不存在创建一个文件 然后source ~/.bash_profile即可不生效创建.zshrc 因为每次打开终端最先加载的是.zshrc(也可以直接在这里配置环境变量,不便于维护) 在.zshrc 添加source ~/.bash_profile
2020-06-30 10:05:13
538
原创 vim cat指定到行
vim指定到行# 在打开文件时,跳转到文件的第n行 vim +n filenamevim +15 ./test.sh# 编辑的过程中跳转到行数 英文状态下冒号行号回车 :n:15cat只能区间读取# 显示文件前面10行cat 文件名 | head -n 10# 显示文件最后10行cat 文件名 | tail -n 10# 从10行开始显示,显示10行以后的所有行cat 文件名 | tail -n +10 # 从10行到50行 此处tail和head不能互换位置c
2020-06-29 09:44:27
402
原创 shell字符串,列表操作等
字符串包含 类似in#!/bin/bashfunction1(){ abcd="1234" } function1 &&a='34'if [[ $abcd == *$a* ]]then echo "包含" else echo "不包含" fiwhoami | grep -qE 'kog2|kog1'$? # 返回为0包含 1或其他不包含占位符/截取字符串/字符串操作a="abcd"b="12.
2020-06-28 16:33:53
2313
原创 小程序API接口集中管理
小程序api使用不多但是每处都定义不方便后期维护于是我们便集中管理 直接在utils文件下新增api.js(定义api接口) https.js(后台请求,域名配置) 目录结构如下api.jsimport { http } from './https';// 接口定义function getApi(params) { http('/project/projectInfos',...
2020-05-08 09:28:57
819
原创 小程序中间证书Apache配置https
小程序苹果能访问 安卓不能访问多半是中间证书的问题 中间证书可以通过第三方网址生成 https://www.myssl.cn/tools/downloadchain.html 首先安装Apache可以参考我的另一篇文章 https://blog.youkuaiyun.com/weixin_42662249/article/details/96483380 先测试Apache正常启动 /Ap...
2020-04-21 17:10:40
612
原创 python线程快速了解
import threadingimport timedef func1(): print('--非守护线程开始--') time.sleep(2) print('--非守护线程结束--')def func2(): print('--守护线程开始--') time.sleep(4) print('--守护线程结束--')if __...
2020-04-10 09:20:47
117
原创 原生JS全屏非F11
var fullscreenfun = function(full){ // 全屏 if (full){ if(document.exitFullScreen){ document.exitFullscreen() } //兼容火狐 if(document.mozCancelFullS...
2020-04-09 18:03:59
172
原创 python名片生成二维码 无线网连接
话不多说上代码# -*- coding:utf-8 -*-# 参考文档:# https://blog.youkuaiyun.com/woshinia/article/details/8896444''' BEGIN:VCARD\n #名片开始 VERSION:3.0\n #版本3.0 FN:%s\n #...
2020-04-01 15:44:13
621
原创 python读取hive数据及部分配置
先配置hadoopetc/hadoop/hdfs-site.xml 添加<!-- web访问hdfs --><property> <name>dfs.webhdfs.enabled</name> <value>true</value> </property>etc/hadoop/core-...
2020-03-12 15:21:30
1244
空空如也
有没有什么网站可以查开源软件各个版本的更新内容的?
2021-08-02
Flask启动报未安装flask的错pycharm中debug模式可以启动怎么解决?
2019-01-19
flask路由分配 路由外定义方法
2018-12-19
python中如何一个程序运行两段代码块
2018-07-28
TA创建的收藏夹 TA关注的收藏夹
TA关注的人