windy path

Johnathan Lin

Server Development Engineer
Study And Practice, Years Of It

Various Locking Mechanisms in Java Concurrency Programming

Introduction: This article aims to introduce the relevant usage of synchronized, ReentrantLock, and Condition in Java. Locking with Synchronized Synchronized can be applied to instance methods, static methods, and code blocks. When used to modify a code block, it can either lock on a specific object or on a class (.class). Synchronized is a Non-Fair Lock The following code utilizes synchronized to lock on a variable accessible by multiple threads, achieving the orderly printing of numbers....

December 4, 2023 · JohnathanLin

How To Split A String In C++?

Preface During a coding interview, I encountered a question that involved two lines of input. Each line contained an unknown number of numbers separated by spaces. The input format was as follows: 12 34 567 888 99 100 358 74 58454 742 4469 88 They did not provide the number of digits in each line in advance. Instead, they required the user to split them themselves. During the coding exam, I didn’t implement this functionality using C++, but instead used the split() method available in Java to handle it....

July 2, 2023 · JohnathanLin

My Self-introduction

Welcome Hello and welcome to WindyPath. I am the owner of this website. My English name is Johnathan. My Chinese nickname is “凌虚” which comes from a Chinese animated film called The Legend of Qin. “凌虚” is the name of a sword that belong to Zhang Liang(张良), a famous strategist in the Warring Period. The name of this website is WindyPath, and its Chinese name is “风萧古道”. The first two characters, “风萧” come from poetry “风萧萧兮易水寒” while the last two characters, “古道” are derived from poetry “古道西风瘦马”....

April 29, 2023 · JohnathanLin

Windows XP Virtual Machine Chinese Version Without Activation Image Download

Click here to download my virtual machine image Download virtual machine image: Link: Fetch Code:374l My VirtualBox version is 6.1 Let me talk about nostalgic For most people, Win95 is their youth, so they create UI component library React95, or create an OS serenity together. But for most Chinese people, when they got PC in 2000-2010, they used Windows XP in their PC. sh1zuku is from China, Taiwan, he created a Windows XP simulator on website: Project Link, Online Demo, and another programmer from Vietnam wrote a Windows 7 Simulator on website Online Demo....

October 2, 2022 · JohnathanLin

Some Usage and features on Java TreeSet

An Example (kotlin) import java.util.TreeSet /** * Define a data class to test TreeSet Collection * Sort by TreeSet * id: player id * score: player score */ data class PlayerScore(var id: Int, var score: Int): Comparable<PlayerScore> { override fun compareTo(other: PlayerScore): Int { return if (score > other.score) { 1 } else if (score < other.score) { -1 } else { 0 } } } fun main() { //create a TreeSet val treeSet: TreeSet<PlayerScore> = TreeSet() //create 3 PlayerScore object,and use 'id101Obj' reference to the first obj //put these objects into the treeset val id101Obj = PlayerScore(101,100) //put in different order treeSet....

June 18, 2022 · JohnathanLin