vue封装axios请求工具类
以勇气面对人生的巨大悲恸,用耐心对待生活的小小哀伤。——雨果 首先安装 12345678# axioscnpm i --save axios# 格式化参数插件cnpm i -- save qs# 对象合并插件cnpm i -- save lodash# cookie操作cnpm i -- save vue-cookie 然后我们自己封装一个请求组件 首先创建文件 然后放入我们的代码。。。 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132import ...
使用stream流连接两个list
生命如同寓言,其价值不在于长短,而在于内容—— 塞涅卡 1234567List<Integer> integerList = Arrays.stream(new int[]{1, 2, 3}).boxed().collect(Collectors.toList());List<Integer> collect = Stream.concat(integerList.stream(), integerList.stream()).collect(Collectors.toList());collect.forEach(System.out::print);System.out.println();collect = Stream.of(integerList, integerList).flatMap(List::stream).collect(Collectors.toList());collect.forEach(System.out::print);System.out.println();
Stream流の二维数组List<List>互转
少而好学,如日出之阳;壮而好学,如日中之光;老而好学,如炳烛之明。一一刘向 数组转List<List<Integer>> 1List<List<Integer>> collect = Arrays.stream(array).map(a1 -> Arrays.stream(a1).boxed().collect(Collectors.toList())).collect(Collectors.toList()); List<List<Integer>>转int[][] 1array = collect.stream().map(integers -> integers.stream().mapToInt(value -> value).toArray()).toArray(int[][]::new); 二维数组和List<List<Integer>>之间的转换使用stream的话就非常简单了 12345678910int[][] array = new in...
一个有点好用的工具类
就算人生是出悲剧,我们要有声有色地演这出悲剧,不要失掉了悲剧的壮丽和快慰。――尼采 官网 这是apache官方提供的工具类,功能强大 标准Java库无法提供用于操纵其核心类的足够方法。Apache Commons Lang提供了这些额外的方法。 Lang为java.lang API提供了大量帮助程序实用程序,特别是字符串操作方法,基本数值方法,对象反射,并发,创建和序列化以及系统属性。此外,它包含对java.util.Date的基本增强,以及一系列专用于帮助构建方法的实用程序,例如hashCode,toString和equals。 api 依赖 123456<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 --><dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> &l...
android隐藏软键盘
聪明出于勤奋,天才在于积累。——华罗庚 代码 1234567/** * 隐藏软键盘 在dialog的编辑界面时 */public static void hideSoftKeyboard(Activity activity, View view) { InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);}
qq邮箱发送
宁鸣而死,不默而生。——胡适 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566package com.ruben.utils; /** * @ClassName: SendEmail * @Date: 2020/11/7 0007 19:36 * @Description: */import com.ruben.pojo.EmailDataTransferObject;import javax.mail.*;import javax.mail.internet.InternetAddress;import javax.mail.internet.MimeMessage;import java.util.Properties;/** * @ClassName: SendEmail * @Description: 我还没有写描述 * @Date: 2020/11/7 0007 19:3...
js当前函数获取调用它的函数
教育本质是一棵树摇动另一棵树,一朵云推动另一朵云,一个灵魂唤醒另一个灵魂。——雅斯贝尔斯 转载,原文 当我们在调试的时候,想获取这个函数被哪个函数调用,以方便调试,但是 caller属性被严格模式下被禁用了 我们可以通过 (new Error()).stack.split(“\n”)[2].trim().split(“ “)[1]方法来获取调用当前函数的那个函数名 解释:new Error().stack 表示程序出错位置的栈,[0]表示当前函数,[1]表示上一级函数调用的函数 [2]上上级…. 例子: 123function bb(){cc()} function cc(){console.log((new Error()).stack.split("\n")[2].trim().split(" ")[1])} bb() //打印出bb
spring获取bean的第三种方式
Had I not seen the Sun[我本可以忍受黑暗] I could have borne the shade[如果我不曾见过太阳] But Light a newer Wilderness[然而阳光已使我的荒凉] My Wilderness has made[成为更新的荒凉] ——Emily Dickinson 之前我们引用spring里的bean都是通过@Autowired或者@Resource注解获取 这里可以使用第三种方式 首先写个工具类 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455package com.ruben.utils;/** * @ClassName: SpringContextHolder * @Date: 2020/11/12 0012 20:40 * @Description: */import org.springframework.beans.BeansException;imp...
springbootのmybatis-plus日志打印
只需要在yml中配置 123456789101112131415161718spring: cloud: alicloud: access-key: secret-key: oss: endpoint: bucket: redis: host: localhost port: 6379 datasource: url: jdbc:sqlite:data.db driver-class-name: org.sqlite.JDBC# mybatis的配置mybatis-plus: configuration: log-impl: org.apache.ibatis.logging.stdout.StdOutImpl 配置完成后重启即可
一个无用工具类
富贵不能淫;贫贱不能移;威武不能屈;此之谓大丈夫。——《孟子·滕文公下》 前两天看了点mybatis-plus源码,又看了点手工耿的视频,就有感而发,写下这个工具类 介绍: 平时我们返回给前端返回值就像这样 我们每次都要写这个魔法值key 这样一两个都还好,但久而久之可能会写错 如果我们如果遇到比较长的字段名,可能就要写很长很长,并且没有编译器的提示 所以我照着mybatis-plus源码,顺便用了它一点方法,写了下面这个工具类 这个工具类里就一个方法和一个接口,以及一个测试的主函数,可以通过Lambda表达式获取到它的属性名 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465package com.ruben.utils;/** * @ClassName: FunctionUtils * @Date: 2020/11/9 0009 23:43 * @Description: */im...
