自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

酹江月的博客

为中华之崛起而读书

  • 博客(144)
  • 资源 (15)
  • 问答 (4)
  • 收藏
  • 关注

原创 快速排序(quicksort)算法-C++实现

#include <iostream>#include <vector>using namespace std;int partition(vector<int> &arr, int low, int high) { int pivot = arr[low]; int i = low + 1, j = high; while (true) { while (i < high && arr[i.

2021-08-31 11:34:40 479

原创 C++逐行读取文本文件(模板)

#include <vector>#include <iostream>#include <string>#include <fstream>using namespace std;int main() { ifstream infile; infile.open("/home/jcglqmoyx/projects/cpp-projects/test/P1.cpp", ios::in); if (!infile.is_o.

2021-08-31 11:33:56 568

原创 三路快排-C++实现

#include <vector>#include <iostream>using namespace std;void quicksort(vector<int> &arr, int low, int high) { if (low >= high) return; int pivot = arr[low]; int i = low + 1, lt = low, gt = high; while (i <=.

2021-08-31 11:33:28 348

原创 最大公约数(GCD)算法与最小公倍数(LCM)算法-C++实现

int gcd(int m, int n) { return m % n == 0 ? n : gcd(n, m % n);}int lcm(int a, int b) { return a * b / gcd(a, b);}

2021-08-31 11:32:50 300

原创 堆排序-C++实现

#include <vector>#include <iostream>using namespace std;void sink(vector<int> &arr, int i, int &end) { int t = i; if (i * 2 + 1 <= end && arr[i * 2 + 1] > arr[t]) t = i * 2 + 1; if (i * 2 + 2 <= .

2021-08-31 11:32:11 159

原创 在Ubuntu上为软件安装桌面快捷方式

本文以在Ubuntu上为Sublime Text 3创建桌面快捷方式为例。进入/usr/share/applications目录,新建sublime_text.desktop(需要使用管理员身份新建)。cd /usr/share/applicationssudo gedit sublime_text.desktop在sublime_text.desktop中添加如下内容:[Desktop Entry]Version=1.0Type=ApplicationName=Sublime Te

2021-08-31 11:31:18 305

转载 常见英文咒语与低俗词汇一览表(应避免使用)

最近实现一种英文词汇过滤机制,但是找不到应避免使用的词汇列表,于是在Bing上搜索了一下,得到以下结果,仅供开发人员参考。转自:List of Swear Words, Bad Words, & Curse Wordsanusarsearseholeassass-hatass-jabberass-pirateassbagassbanditassbangerassbiteassclownasscockasscrackerassesassfaceassfucka

2021-08-31 11:30:26 10805

原创 我的Ubuntu装机配置

新装机要安装的软件:可以用命令行安装的软件或者软件包sudo apt install openjdk-8-jdk openjdk-11-jdk openjdk-11-source golang nodejs npm python3-pip php clang-12 clang mysql-client mysql-server nginx tomcat9* vim vim-gtk vim-youcompletemegit maven cmake make ffmpeg autoconf libglu

2021-08-31 11:29:00 270

原创 C++使用sscanf方便地读取数据

力扣class Solution {public: int get(string s) { int h, m; sscanf(s.c_str(), "%d:%d", &h, &m); return h * 60 + m; } int numberOfRounds(string startTime, string finishTime) { int x = get(startTime), y =

2021-08-31 11:26:32 392

原创 Ubuntu 20.04设置开机自启动

Ubuntu 20.04的服务管理是基于systemd的,因此设置服务自启动最推荐的方法是创建一个systemd服务文件,配置好要执行的服务。过程如下:创建我们需要开机自启动的脚本,例如test.sh,其内容如下:#!/bin/bashcd ~/touch 11111111111.txt注意,开头一定要加上:#!/bin/bash2. 在/etc/systemd/user目录下创建一个systemd服务文件, 命名为user-defined.service, 内容如下:[U

2021-08-31 11:25:36 2534 4

原创 希尔排序 代码

这个排序方法看起来简单,实现起来还是很麻烦的。写法一 public static void sort(int[] arr) { int n = arr.length; for (int gap = n / 2; gap > 0; gap /= 2) { for (int i = gap; i < n; i++) { for (int j = i; j >= gap; j -= gap)

2020-12-02 12:40:28 347

原创 解决JetBrains系列Git push失败问题

最近在使用JetBrains系列IDE执行Git push操作时,经常遇到push失败问题,报错信息如下:Push failedInvocation failed Server returned invalid Response. java.lang.RuntimeException: Invocation failed Server returned invalid Response. a...

2020-04-26 10:50:41 1209

原创 LeetCode-136. Single Number

Given anon-emptyarray of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without us...

2020-04-01 16:43:06 257

原创 Java判断回文字符串

public class Palindrome { public static boolean isPalindrome(String s) { int len = s.length(); for (int i = 0; i < len / 2; i++) if (s.charAt(i) != s.charAt(len - i...

2020-03-30 12:01:15 358

转载 The result of division and remainder for negative integers in Java

In Java programming, th quotient a / brounds toward 0; the remainder a % b is defined such that (a / b) * b + a % b is always equal to a. For example, -14 / 3 and 14 / -3 are both -4, but -14 % 3 is...

2020-03-27 22:46:59 217

原创 Binary Search in Java

Recursive version:int recursiveBinarySearch(int[] arr, int key, int low, int high) { if (low > high) return -1; int mid = low + (high - low) / 2; if (arr[mid] == key) ret...

2020-03-20 19:56:43 208

原创 Evaluating the square root of a number

double sqrt(double n) { if (n < 0) return Double.NaN; double err = 1e-15, t = n; while (Math.abs(t - n / t) > t * err) { t = (t + n / t) / 2; } ...

2020-03-20 17:56:23 252

原创 Greatest Common Divisor

int gcd(int p, int q) { if (p % q == 0) return q; int r = p % q; return gcd(q, r);}

2020-03-20 01:20:26 253

转载 LeetCode-1114. Print in Order

Description:Suppose we have a class:public class Foo { public void first() { print("first"); } public void second() { print("second"); } public void third() { print("third"); }}The same...

2020-03-18 21:23:29 247

转载 LeetCode-206. Reverse Linked List

Reverse a singly linked list.Example:Input: 1->2->3->4->5->NULLOutput: 5->4->3->2->1->NULLSolution:/** * Definition for singly-linked list. * public class ...

2020-03-18 14:24:05 219

原创 Java concurrency demo

import java.util.Arrays;import java.util.concurrent.locks.Condition;import java.util.concurrent.locks.Lock;import java.util.concurrent.locks.ReentrantLock;public class Bank { private final d...

2020-03-17 21:38:39 217

原创 【Java】粗略统计txt文本中单词的个数

import java.util.HashSet;import java.util.Scanner;import java.util.Set;public class ReadText { public static void main(String[] args) { Set<String> words = new HashSet<>()...

2020-03-10 22:40:46 650

转载 LeetCode 696. Count Binary Substrings

Description:Give a strings, count the number of non-empty (contiguous) substrings that have the same number of 0's and 1's, and all the 0's and all the 1's in these substrings are grouped consecutiv...

2020-03-08 16:56:27 225

原创 Ubuntu 安装搜狗拼音输入法

1. 下载搜狗拼音Linux版。2. 打开终端,执行sudo apt updatesudo apt upgradesudo apt-get install -f3. 进入到输入法安装包所在目录,执行sudo dpkg -i sogoupinyin_2.3.1.0112_amd64.deb(即安装包名)如果报出error,试一下sudo apt --fix-brok...

2020-02-04 10:26:13 340

转载 常用位运算操作

1. 判断一个整数是否为偶数(Java)boolean isEven (int n) { return (n & 1) == 0;}// 下面的代码用来判断一个整数是否为奇数boolean isOdd (int n) { return (n & 1) == 1;}应用:统计一个int型数组中偶数的和:int sumOfEvenValues(...

2020-01-01 22:40:58 354

原创 判断平年和闰年

判断平年(common year)和闰年(leap year)的计算方法很简答:1. 如果年份是整百年份,用年份除以400,没有余数即为闰年,有余数即为平年。2. 如果年份不是整百年份,用年份除以4,没有余数即为闰年,有余数即为平年。说明:2096年和2104年都是闰年,但2100年是平年。所以“四年一润”的说法是不对的,正确说法应该是:“四年一闰,百年不闰,四百年再闰”。判断某一...

2019-12-29 18:59:58 14820

原创 (Java) 求一个数组中最大的三个数 和 最小的两个数

public int maximumProduct(int[] nums) { if (nums.length < 3) return 0; // 开始 int min1 = Integer.MAX_VALUE; int min2 = Integer.MAX_VALUE; int ...

2019-12-24 19:31:25 822

原创 Swap Salary-LeetCode_No.627

Description :Given a tablesalary, such as the one below, that has m=male and f=female values. Swap all f and m values (i.e., change all f values to m and vice versa) with asingle update statement...

2019-11-28 11:31:21 208

原创 Nth Highest Salary-LeetCode_No.177

Write a SQL query to get thenth highest salary from theEmployeetable.+----+--------+| Id | Salary |+----+--------+| 1 | 100 || 2 | 200 || 3 | 300 |+----+--------+For example...

2019-11-28 00:57:49 208

原创 Duplicate Emails-LeetCode_No.182

Description: Write a SQL query to find all duplicate emails in a table namePerson.+----+---------+| Id | Email |+----+---------+| 1 | [email protected] || 2 | [email protected] || 3 | [email protected] |+----+------...

2019-11-28 00:14:10 201

原创 Determine whether an integer is a palindrome using Java

class Solution { public boolean isPalindrome(int x) { if (x < 0 || (x % 10 == 0 && x != 0)) { return false; } int revertedNumber = 0; while...

2019-11-23 03:17:39 256

原创 Calculating the n-th Number of Fibonacci Sequence Using Java

import java.math.BigInteger;public class Test { public static void main(String[] args) { System.out.println(f(BigInteger.valueOf(5))); System.out.println(f(BigInteger.valueOf(6)...

2019-11-20 13:08:06 263

原创 Using MySQL keyword as a field name yields an exception

2019-11-12 22:01:42 DEBUG [http-nio-8080-exec-5] org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator - Translating SQLException with SQL state '42000', error code '1064', message [Yo...

2019-11-12 22:12:00 243

转载 SpringMVC freemarker 中 Could not resolve view with name 'XXX.ftl' in servlet with name 'SpringMVC'

原因为freemarker本身配置了templateLoaderPath而在viewResolver中不需要配置prefix,且路径前缀必须配置在templateLoaderPath中。路径配置错误导致以上错误信息。

2019-10-22 23:50:45 463

原创 配置FreeMarker时IDEA提示cannot resolve property 'templateLoaderPath'

原因: 缺少spring-context-support.jar依赖。

2019-10-21 23:46:55 2316

原创 MySQL在指定字段后添加一个新字段

ALTER TABLE jc_wechat_user_tag ADD tagid VARCHAR(5) NOT NULL COMMENT "标签所对应的tagid, 创建用户标签后, 由微信公众平台返回" AFTER wechat_id;

2019-10-09 11:37:10 2518

原创 META-INF/MANIFEST.MF file not found in unnamed.war

AddMANIFEST.MFtoYOUR_PROJECT_NAME/web/src/main/webapp/META-INF/folder with the simple content:Manifest-Version: 1.0Or you can generate it usingIntelliJ Artifacts Configuring

2019-09-30 10:02:53 2010

原创 Java获取音频播放时长

1. 获取.amr音频文件播放时长import java.io.File;import java.io.IOException;import java.io.RandomAccessFile; public class AmrFileTimeLengthSample { public static long getAmrDuration(File file) throws IOEx...

2019-09-23 15:56:47 1660

原创 JS实现阿拉伯数字转韩文

function convertHangul(number) { var han1 = ["영", "일", "이", "삼", "사", "오", "육", "칠", "팔", "구"]; var han2 = ["", "십", "백", "천"]; var han3 = ["", "만", "억", "조", "경"]; var result = "";...

2019-09-23 00:45:26 333

原创 微信公众号开发-素材管理-调用接口返回结果一览表

上传永久素材返回结果 图片 视频 音频 缩略图 media_id media_id media_id media_id url url 获取单个素材返回结果 图片 视频 音频 缩略图 图片 title 音频 (无此类型,必...

2019-09-21 18:31:44 631

1亿以内的质数(共5761455个数).txt_1亿以内素数的个数

1亿以内的质数(共5761455个数).txt

2021-01-15

jdk1.8__centos7.zip

CentOS7中使用的JDK1.8,因为购买的服务中没有需要自己安装,但是官网下载速度太慢,搬运到这里,提高速度,方便大家使用。

2020-02-20

微信公众号接口调用次数清零需要的jar文件

微信公众号开发中调用API次数达到上限后, 需要请求一下微信公众号接口, 将调用次数清零。请参照我的博客https://blog.csdn.net/qq_40723748/article/details/101056168,其中需要的jar都在这里。

2019-09-20

使用说明.rar

jeecms v9系统使用说明,包涵美工篇,为官方发布的文档,方便用户使用以及尽心二次开发。

2019-09-03

最新MySQL连接jar包

最新MySQL连接jar包(mysql-connector-java-8.0.16.jar)

2019-07-11

Windows文件搜索

超好用的Windows文件搜索软件,速度很快,占用系统资源极低!

2018-12-20

100万以内的素数表

100万以内的素数表

2018-12-12

喵喵咪鼠标自动点击器1.0(Win 64位)

一款很好用的Windows版(64位)鼠标自动点击器, 录制工具与取色功能强大. 附加定时关机功能. 本软件为免费软件, 未经许可, 严禁用于商业用途. 使用说明详见我的博客《喵喵咪鼠标自动点击器1.0(Win 64位)使用说明》

2018-10-17

Java应用定制工厂

Java应用定制工厂(JCB,Java Customization Builder)是一个针对Java轻量级桌面应用进行精简优化的小工具,使用它可以精简你的jar包,并自动生成一个精简的JRE,也可以使用它生成一个Exe启动引导程序,并且能够对你的Java应用自动做Pack200和Unpack200处理。使用本工具定制的Java桌面应用通常不会超过10M(包含JRE),SWT客户端程序相对于Swing客户端程序更小,一般不会超过5M。

2018-10-11

在任意软件窗口中获取插入符号的位置_软件及源码

全局获取脱字符(即插入符号)的位置的Demo程序, 及代码. 十分强大

2018-09-27

Java贪吃蛇源码

Java贪吃蛇小游戏的源代码, 欢迎大家互相交流,技术,共同进步

2018-02-01

Java 扫雷游戏源码

Java扫雷小游戏源码,欢迎互相交流与讨论技术问题. 欢迎加入Java自学群314181464

2018-02-01

斯坦福大学公开课讲义集

Programming Methodology 讲义集, 老师为麦兰 萨哈米,很风趣幽默

2018-02-01

Java英文单词

Java英文单词释义,Java单词解释,Java中英文对照,Java常见词汇的中英文对照

2018-01-28

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除