IDEA Maven Speedup

ideaIU-2023.2.1.win\plugins\maven\lib\maven3\conf\settings.xml

  <mirrors>
...
	<mirror>
		<id>aliyunmaven</id>
		<mirrorOf>*</mirrorOf>
		<name>阿里云公共仓库</name>
		<url>https://maven.aliyun.com/repository/public</url>
	</mirror>
...
  </mirrors>
...
  <profiles>
...
	<profile>
	<id>jdk-1.8</id>
	<activation>
		<activeByDefault>true</activeByDefault>
		<jdk>1.8</jdk>
	</activation>
	<properties>
		<maven.compiler.source>1.8</maven.compiler.source>
		<maven.compiler.target>1.8</maven.compiler.target>
		<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
	</properties>
	</profile>
  </profiles>

refer to:
https://blog.csdn.net/baikunlong/article/details/113762152
https://www.bilibili.com/video/BV1kg4y1x7o6?p=49
https://mvnrepository.com

JDB Memo

src/META-INF/MANIFEST.MF

Manifest-Version: 1.0
Main-Class: com.example.TestApp1
Class-Path: lib/lib1.jar lib/lib2.jar
java -agentlib:jdwp=transport=dt_shmem,address=jdbconn,server=y,suspend=y -jar TestApp1.jar
jdb -attach jdbconn
	sourcepath src/TestApp1/src;src/common/src
	stop in com.example.startSocket(java.lang.String, int)
	run
	list
	resume

refer to:
https://blog.csdn.net/dongfang1924/article/details/101613188

OBS Memo

How to make recorded video not stuttering:
1, Update video card driver.
2, System Settings -> Gaming -> Game Mode -> On.
3, System Settings -> System -> Display -> Graphics -> add OBS binary path -> High performance.
4, Make OBS always run as administrator.
5, When OBS is running actively, press Win Key + G -> XBox Game Bar Settings -> Remember this is a game.
6, OBS settings -> output -> streaming -> encoder -> nvenc.
7, Reboot pc after initial setup, don't forget this step.

refer to:
https://github.com/obsproject/obs-studio/releases/

Remove Returns of Text

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
 
#define ENDS_WITH(ch0, ch1) ((unsigned char)line[len - 3] == (ch1) && (unsigned char)line[len - 4] == (ch0))
 
/*
 * for gbk only.
 */
int main()
{
	FILE* fp = fopen("/mnt/hgfs/share/aaa1.txt", "r");
	FILE* fpOut = fopen("/mnt/hgfs/share/aaa2.txt", "w+");
	if (NULL == fp)
		return -1;
 
	char line[1024 * 10] = {0};
	while (NULL != fgets(line, sizeof(line) - 1, fp))
	{
		int len = strlen(line);
		if (0) // (len > 10)
		{
			printf("[%s]\n-1:%x\n-2:%x\n-3:%x\n-4:%x\n-5:%x\n-6:%x\n", 
					line,
					(unsigned int)(unsigned char)line[len - 1],
					(unsigned int)(unsigned char)line[len - 2],
					(unsigned int)(unsigned char)line[len - 3],
					(unsigned int)(unsigned char)line[len - 4],
					(unsigned int)(unsigned char)line[len - 5],
					(unsigned int)(unsigned char)line[len - 6]);
		}
		if (len >= 4)
		{
			do {
				if ((unsigned char)line[len - 1] != 0xa
						|| (unsigned char)line[len - 2] != 0xd)
					break;
				if (ENDS_WITH(0x80, 0x82))
				{
					// period
					break;
				}
 
				if (ENDS_WITH(0x80, 0x9d))
				{
					// double quotation mark
					break;
				}
				line[len - 2] = 0;
			} while (0);
		}
		fputs(line, fpOut);
	}
 
	fclose(fpOut);
	fclose(fp);
	return 1;
}

Unreasonable Input in std sort Lambda Expression

	struct Aa
	{
		int i0;
	};
	std::vector<Aa*> list_;
...
	std::sort(list_.begin(), list_.end(), [this, &end_dates](Aa* l, Aa* r) {
		return l->degree_ - r->degree_;
	});

Before the sort, I promise the members of list_ are all not null, but in the sort lambda expression, when running, we will be caught by a null pointer access SIGSEGV, for example, l is null.

Well, the good shot is,

...
	std::sort(list_.begin(), list_.end(), [this, &end_dates](Aa* l, Aa* r) {
		return l->degree_ > r->degree_;
	});