Skip to main content

Yujie's Blog

Take history as a mirror to avoid pasted tragedies; Take others as a mirror to reflect on myself.

About me

About me

I am a master's student in Computer Science (Software Technology Track) at the University of Twente, The Netherlands. I received my Bachelor's degree in Software Engineering from Northwestern Polytechnical University, China.

I want to become a server-side developer and HPC researcher. I am passionate about many areas including, but not limited to, general purpose computing on GPUs (GPGPU), mutation testing, cloud native, containerisation, CI/CD, web development, iOS development, and semantic web. I enjoy the process of researching solutions for software projects, breaking down solutions to work package, and finally solving concrete technical problems. Being well-organized always makes me enthusiastic and energetic. I am currently researching on CUDA and mutation testing (for Master's project), large language model (LLM), iOS development (for a naive music player), and server-side development (for a job).


Yujie LiuLess than 1 minute
Segment Tree 线段树

Segment Tree 线段树

线段树解决的是「区间和」的问题,且该「区间」会被修改

一个区间的例子是对于 nums = [1, 2, 3, 4, 5] 多次求某些区间的和,是不是首先想到了利用「前缀和」。

但是如果 nums 会被修改呢?比如:

  • 把第 i 个元素修改成 x
  • 把第 i 个元素增加 x
  • 把区间 [i, j] 内的元素都增加 x

此时,如果我们再使用「前缀和」,就没那么高效了。因为每一次更新,前缀和数组必须也随之更新,时间复杂度为 O(n)。


Yujie LiuLess than 1 minuteComputer ScienceAlgorithmsLeetcode
大端字节序(Big Endian)和小端字节序(Little Endian)

大端字节序(Big Endian)和小端字节序(Little Endian)

  • 大端字节序(Big Endian):最高有效位存于最低内存地址处,最低有效位存于最高内存处;
  • 小端字节序(Little Endian):最高有效位存于最高内存地址,最低有效位存于最低内存处。

endian

网络字节序

在进行网络传输的时候,先传递哪个字节?也就是说,当接收端收到第一个字节的时候,它将这个字节作为高位字节还是低位字节处理?


Yujie LiuLess than 1 minute
Springboot整合MyBatis

Springboot整合MyBatis

基本使用

  1. 首先引入相关依赖。注意版本2.x是对应springboot 2.0
<!-- Spring Boot Web 依赖 -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>

<!-- Spring Boot Test 依赖 -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-test</artifactId>
    <scope>test</scope>
</dependency>

<!-- Spring Boot Mybatis 依赖 -->
<dependency>
    <groupId>org.mybatis.spring.boot</groupId>
    <artifactId>mybatis-spring-boot-starter</artifactId>
    <version>${mybatis-spring-boot}</version>
</dependency>

<!-- MySQL 连接驱动依赖 -->
<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>${mysql-connector}</version>
</dependency>

<!-- Junit -->
<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.12</version>
</dependency>

Yujie LiuAbout 1 min
线程安全如何实现

线程安全如何实现

线程安全问题的产生本质上是因为多个线程在并发条件下对同一个共享资源的争抢,因此有两种方向来保证线程安全:

  1. 限制线程对资源的并发访问:这个方向的主要方式是加锁(阻塞),volatile(非阻塞)。
  2. 将该资源设置为线程独占的:这个方向主要实现方式是TreadLocal。

Yujie LiuLess than 1 minuteComputer ScienceProgramming LanguageJava
Java 多线程入门

Java 多线程入门

  • 进程,是对运行时程序的封装,是系统进行资源调度和分配的基本单位,实现了操作系统的并发。
  • 线程,是进程的子任务,是 CPU 调度和分派的基本单位,实现了进程内部的并发。

Yujie LiuLess than 1 minuteComputer ScienceProgramming LanguageJava
2
3
4
5
...
10