- 博客(91)
- 收藏
- 关注
原创 MySQL一段时间内保留一条数据
1000个device_id, 一个device_id每分钟插入一条数据,向表中插入100w条数据; 使用sql语句把原来1分钟一条的数据,改为10分钟一条;
2022-12-02 14:46:46 650
原创 Not all slots covered! Only 10922 slots are available
Caused by: org.redisson.client.RedisConnectionException: Not all slots covered! Only 10922 slots are available. Set checkSlotsCoverage = false to avoid this check.
2022-07-13 11:43:28 5752 1
原创 常用代码模板(Java)
常用代码模板(JAVA)基础算法一 快速排序void quick_sort(int q[], int l, int r){ if (l >= r) return; int i = l - 1, j = r + 1, x = q[l + r >> 1]; while (i < j) { do i ++ ; while (q[i] < x); do j -- ; while (q[j] > x);
2022-05-03 07:08:34 2691
原创 LeetCode 264. 丑数 II
给你一个整数 n ,请你找出并返回第 n 个 丑数 。丑数 就是只包含质因数2、3 和/或5的正整数。示例 1:输入:n = 10输出:12解释:[1, 2, 3, 4, 5, 6, 8, 9, 10, 12] 是由前 10 个丑数组成的序列。示例 2:输入:n = 1输出:1解释:1 通常被视为丑数。class Solution { public int nthUglyNumber(int n) { int [] dp = new ...
2022-03-26 22:32:34 198
原创 springboot使用Log4j动态改变日志级别
springboot使用Log4j动态改变某一个日志级别,无需重新启动程序:public class PackageLogLevelInfo { @ApiModelProperty(value = "某个包路径日志级别(优先级从高到低依次为:OFF/FATAL/ERROR/WARN/INFO/DEBUG/TRACE/ALL)") private String singleLevel; @ApiModelProperty(value = "需要单独设置日志输出级别的类的全限定名(例:
2021-09-01 15:20:06 1468
原创 揭秘ScheduledThreadPoolExecutor 中ScheduleAtFixedRate迷惑行为
ScheduledThreadPoolExecutor 中ScheduleAtFixedRate参数说明:scheduleAtFixedRate(Runnable command,long initialDelay,long period, TimeUnit unit)第一个command参数是任务实例,第二个initialDelay参数是初始化延迟时间,第三个period参数是间隔时间,第四个unit参数是时间单元。ScheduledThreadPoolExecutor 中Schedu.
2021-08-25 15:27:23 1198
原创 JavaScript知识总结
1. let 与var的区别1.1 let只可以在定义代码块内使用,var可以在代码块外使用for (let i = 0; i < 10; ++i) { }console.log(i) // 会报 Uncaught ReferenceError: i is not definedfor (var i = 0; i < 10; ++i) { }console.log(i) // 不会报错1.2 let定义的变量不可以重复定义,v
2021-08-25 14:40:03 59
转载 苹果奖学金获得者感言
Udacity、Coursera 等 MOOC 网站,让我见识到了内容更丰富,更先进的教育资源。Udacity 上的课程都是计算机课程,我学习了 Full Stack Nanodegree 以及各种课程,学会了用 Python 开发 Web 后端,数据库、Linux、HTML、CSS 等相关知识,增强了自主学习的能力,使我少走了很多弯路。Coursera 上的课程各个门类都有,我参加了面向对象
2016-08-22 15:01:43 310
转载 java获取cpu、内存、硬盘信息
1 下载安装sigar-1.6.4.zip 使用java自带的包获取系统数据,容易找不到包,尤其是内存信息不够准确,所以选择使用sigar获取系统信息。 下载地址:http://sourceforge.net/projects/sigar/files/latest/download?source=files 解压压缩包,将lib下sigar.ja
2016-05-04 22:18:59 479
原创 获取主机名和IP
import java.net.InetAddress;import java.net.UnknownHostException;public class Test{ public static void main(String[] args) { String IP = null; String host =
2016-05-04 21:56:31 421
原创 Home+Work
/*OJ.h*/#ifndef __OJ_H__#define __OJ_H__typedef struct paperInfo{ int costTime; int value; double valuePerTime;}paperInfo;int GetMaxValue(int nPapers, int nRemain, int paper[][2
2015-05-19 16:11:38 653
原创 二叉树遍历
#include #include #include using namespace std;typedef struct biNode{ char data; biNode *lChild; biNode *rChild;};char pre[100];char in[100];void createTree(biNode* &biTree, int preSta
2015-05-17 11:57:30 684
原创 汽水瓶
#include #include #include using namespace std;int main(){int N;while(cin>>N && N != 0){int sum =0;while(N >= 3){sum += N/3;N = N/3 + N%3;}if(N == 2){sum ++;}
2015-05-10 16:49:29 362
原创 密码验证合格程序
#include #include #include using namespace std;//计算字符串中字符的种类int calTypeKinds(string &str){ int count[4]; memset(count , 0 , sizeof(int)*4); for(size_t i = 0; i < str.length(); ++i) { if(s
2015-05-10 10:30:32 640
原创 简单密码破解
#include #include #include using namespace std;int alpha2num(char c){ int num = 0; switch(c) { case '1': num = 1; break; case 'a': case 'b': case 'c': num = 2; break; case 'd':
2015-05-09 18:34:43 3307
原创 大数求和
#include #include #include using namespace std;int main(){ string A, B; cin>>A>>B; vector vecSum; int lenA = A.length(); int lenB = B.length(); int temp; int carry =0; int indexA = len
2015-05-09 18:11:38 766
原创 Fibonacci数列的计算和转换
/************************************************************************//* GetExtFibonacci *//* 输入扩展Fibonacci数列的前2个数字first和second,要得到的数字的序
2015-05-09 17:45:24 739
原创 删除字符串中最少字符
#include #include #include using namespace std;int main(){ string str; cin>>str; int ch[27] ; memset(ch , 0, sizeof(int)*27); for(size_t i = 0; i < str.length(); ++i) { ch[str[i] - 'a'
2015-05-09 17:14:26 462
原创 最大递减数
#include "Degressive.h"#include #include //给出一个非负整数,找到这个非负整数中包含的最大递减数。一个数字的递减数是指相邻的数位从大到小排列的数字。//如: 95345323,递减数有:953,95,53,53,532,32, 那么最大的递减数为953。//如果输入的数字为负数,返回-1。int getMax
2015-05-09 09:32:04 1277
原创 双链表基本操作
#include #include using namespace std;#define null 0#define MAXSIZE 50struct strlnode{ int data; struct strlnode *plast; struct strlnode *pnext;};void create(struct strlnode **p, int x)
2015-05-06 10:41:14 599
原创 可怕的阶乘
#include #include #include #include "oj.h"void CalcNN(int n, char *pOut){ if(0 == n || 1 == n) { pOut[0] = 1; pOut[1] = '\0'; } else { int product[1000] ; memset(product, 0, sizeof(
2015-05-05 16:49:41 816
原创 vs2012 vs2010 opencv2.4.7配置
vs2012 opencv2.4.7配置1、配置(1)、在“视图”中打开“属性管理器”;(2)、在“属性管理器”中双击Demo的项目名称;(3)、在“Demo属性页”->“VC++目录”->“包含目录”中追加下面一行(包括所有分号,勿删VS原始数据):;D:\opencv247\opencv\build\include;D:\opencv247\opencv\build\include
2015-04-27 13:37:13 1508
原创 查找兄弟单词
/****************************************************************************** Copyright (C), 2001-2012, Huawei Tech. Co., Ltd. ******************************************************************
2015-01-12 22:51:00 992
原创 Arrange an Array to Form a Smallest Digit
#include #include #include #include #include "oj.h"using namespace std;bool comp(int iElem1, int iElem2){ string str1; char ch1[100]; memset(ch1, 0, sizeof(char) * 100); itoa(iElem1, ch1,
2015-01-10 15:09:22 1013
原创 删除链表中的重复节点、剩余节点逆序输出
#include #include #include #include #include "oj.h"using namespace std;/*功能: 输入一个不带头节点的单向链表(链表的节点数小于100),删除链表中内容重复的节点(重复的节点全部删除),剩余的节点逆序倒排。 输入: pstrIn: 输入一个不带头节点的单向链表 输出: pstrO
2015-01-10 12:59:40 1085
原创 IP地址判断有效性
#include "IPAddressValid.h"#include #include using namespace std;bool isOnePartValid(const char* cOnePartIPAddr, int len)//判断一个字段是不是合法{ if (NULL == cOnePartIPAddr || len <= 1) {
2015-01-07 14:03:12 1391
原创 删除重复字符串
#include #include "OJ.h"using namespace std;/*Description 给定一个字符串,将字符串中所有和前面重复多余的字符删除,其余字符保留,输出处理后的字符串。需要保证字符出现的先后顺序。Prototype int GetResult(const char *input, char *output)I
2015-01-06 18:11:01 700
原创 修改字符串
#include #include #include #include "oj.h"int ChangeStringOnce(char *pInStr, char *pOutStr){ if (NULL == pInStr || NULL == pOutStr) { return -1; } int iInStrLen =0;
2015-01-06 17:00:49 644
原创 字符串替换
#include #include #include "oj.h"#include using namespace std;/*功能: 输入: 输出: 返回:成功0,其它-1 */int ProcessString( char * strInput,char chSrc,char chDes ,char * strOutput){
2015-01-06 15:07:59 828
原创 删除重复字符
#include #include "OJ.h"using namespace std;/*Description 给定一个字符串,将字符串中所有和前面重复多余的字符删除,其余字符保留,输出处理后的字符串。需要保证字符出现的先后顺序。Prototype int GetResult(const char *input, char *output)I
2015-01-05 16:02:33 678
原创 合唱队
#include using namespace std;int main(){ int N = 0; while(cin>>N) { int *students = new int [N + 1];//students[0]保留不用 memset(students, 1, sizeof(int) * (N +1
2015-01-05 15:38:33 624
原创 计算二进制数的0的个数
#include using namespace std;int calZeroNum(int num){ if (0 == num) { return 0; } int count = 0; while (0 != num) { if (0 == (num & 1)) {
2015-01-05 14:57:16 699
原创 最大公约数
#includeusing namespace std;int gcd(int m, int n){ int temp = 0; if (m < n) { temp = m; m = n; n = temp; } while (0 != m%n) { temp = n;
2015-01-05 11:05:39 610
原创 将字符串中不同字符的个数打印出来
#include #include using namespace std;int main(){ string s; int count =0; int ch[256] ; memset(ch, 0, sizeof(int) * 256); getline(cin, s); int iCur =0; while ('\0' !=
2015-01-05 10:53:37 731
原创 向升序单向链表中插入一个节点
#include "OJ.h"/*功能: 输入一个升序单向链表和一个链表节点,向单向链表中按升序插入这个节点。 输入为空指针的情况视为异常,另外不考虑节点值相等的情况。输入: ListNode* pListHead 单向链表 ListNode* pInsertNode 新插入节点 输出: ListNode* pListHead 单向链表返回: 正常
2015-01-04 16:09:05 1641
原创 整数分隔
#include #include #define MAX 1000000000using namespace std;int main(){ int N =0 ; while (EOF != scanf("%d", &N)) { if (N 1000000) { cout<<"-1"<<endl;
2015-01-04 13:17:14 771
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人