mapstruct的spring拓展
活着不一定要鲜艳,但一定要有自己的颜色。——张曙光 首先按照惯例放官网: https://mapstruct.org/documentation/spring-extensions/reference/html/ 基本的使用方式之前博客已经写过了我们就不再细表,这里简单放上链接 https://VampireAchao.github.io/2022/03/23/mapstruct/ 在此之前还要配置对应的依赖和插件 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 <properties> <java.version>1.8</java.version> <!-- 编译生成代码插件版本号开始(避免mapstruct和lombok冲突,因此此处指定一个兼容的版本) --> <lombok.version&g...
java泛型指定继承和实现
得到了再失去,总是比从来没有得到更伤人。——《追风筝的人》 我们使用泛型的时候,可以如下限定类型: 123public static class Obj<T extends Obj<T>> {} 那么我们Obj中的泛型就只能指定为继承了Obj的类 1Obj<ObjChild> obj = new Obj<>(); 例如: 12public static class ObjChild extends Obj<ObjChild> {} 我们如果想要限定,既继承了Obj,且实现了Serializable接口的类,就可以使用&符号这么写: 123public static class Obj<T extends Obj<T> & Serializable> {} 我们相应的子类,就需要这么写才符合泛型 12public static class ObjChild extends Obj<ObjChild> ...
多版本python使用pip
“灵感,是天才的女神。她并不步履蹒跚地走过,而是在空中像乌鸦那么警觉地飞过的,她没有什么剽带给诗人抓握,她的头是一团烈火,她溜得快,像那些白里带红的鹤,教猎人见了无可奈何。”——巴尔扎克 我们有时安装了多个版本的python 我本机安装了python2和python3 配置的环境变量中pip install只会安装python2的依赖 如果我要安装3的,可以使用: 1python3 -m pip install [依赖]
python读取oss的psd并上传jpg
死亡,就像是水消失在水中。——博尔赫斯《另一次死亡》 上次说过了psd-tools可以对psd进行处理 今天写一个完整的,oss代码在这: https://VampireAchao.github.io/2022/04/26/python%E5%AF%B9%E6%8E%A5oss%E4%B8%8A%E4%BC%A0%E5%92%8C%E4%B8%8B%E8%BD%BD/ 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253# coding=utf-8import warningsfrom io import BytesIOfrom psd_tools.constants import Resourcewarnings.filterwarnings("ignore", category=Warning)# 读取psd以及图层信息def read_psd_info(psd, hidden_layer_ids): la...
python部分依赖踩坑
今天所做之事勿候明天,自己所做之事勿候他人。——歌德 今天运行脚本时警告: 123DependencyWarning: SOCKS support in urllib3 requires the installation of optional dependencies: specifically, PySocks.For more information, see https://urllib3.readthedocs.io/en/latest/contrib.html#socks-proxies 我的python版本为2.7.17 于是安装对应的模块 1pip install win-inet-pton 发现还有一个警告: 1CryptographyDeprecationWarningPython 2 is no longer supported by the Python core team 于是我先卸载 1pip uninstall cryptography 然后安装适配的版本 1pip install cryptography==2.6 再次运行即可
python对接oss上传和下载
我用尽全力,过着平凡的一生。——毛姆 首先是下载依赖,文档: https://help.aliyun.com/document_detail/85288.html 我这里是windows: 1pip install oss2 代码也是一如既往的简单,毕竟是python嘛 123456789101112131415161718from io import BytesIOimport oss2ACCESS_KEY_ID = ''ACCESS_KEY_SECRET = ''ENDPOINT = 'oss-cn-chengdu.aliyuncs.com'BUCKET_NAME = 'waibi'AUTH = oss2.Auth(ACCESS_KEY_ID, ACCESS_KEY_SECRET)BUCKET = oss2.Bucket(AUTH, ENDPOINT, BUCKET_NAME)def download_file_bytes(file_name): return BUCKET.get_o...
网站档案馆
一个人追求的目标越高,他的才能就发展得越快,对社会就越有益,我确信这也是一个真理。——玛克西姆·高尔基 分享一个网站可以访问网站历年来的档案存档 https://web.archive.org/ 例如2014年的bilibili 非常有意思
thymeleaf和vue快速入门
时间是个常数,但也是个变数。勤奋的人无穷多,懒惰的人无穷少。——字严 今天中午午休抽时间写了个thymeleaf和vue使用elementUI简单入门Demo 仓库地址:https://gitee.com/VampireAchao/simple-thymeleaf-html.git 前端代码如下: 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354<!doctype html><html><head> <title>给胖哥的html页面</title> <!-- 引入样式,从这来的 https://element.eleme.cn/#/zh-CN/component/installation#cdn --> <link href="https://unpkg.com/element-ui/lib/theme-chalk/ind...
drag事件
生活最沉重的负担不是工作,而是无聊。——罗曼·罗兰 首先是MDN:https://developer.mozilla.org/zh-CN/docs/Web/API/HTML_Drag_and_Drop_API 然后是代码: 123456789101112131415161718192021222324252627282930313233343536373839404142<!DOCTYPE html><html> <head> <style> .drop-container{ width: 200px; height: 200px; border: 1px solid red; background: #eee; } .drag-ball{ w...
css实现鼠标划入显示拖动条
古之立大事者,不惟有超世之才,亦必有坚忍不拔之志。——苏轼 代码如下: 1234567891011121314151617181920212223242526272829<!DOCTYPE html><html> <head> <style> .ruben-container{ height: calc(100vh - 70vh); width: calc(100vw - 70vw); overflow-y: auto; } .ruben-container::-webkit-scrollbar { width: 4px; } .ruben-container::-webkit-scrollbar-thumb{ ...
