Vim Syntax

1. Modes Key Mode Description ESC Normal Mode Default mode. Used for navigation and simple editing. i Insert Mode Insert and edit text. : Command Mode Run commands like save, quit, search, etc. 2. Basic Commands Open File vi <file> Quit :q! Insert Text i Save File :w Save and Quit :wq 3. Navigation Enable Line Numbers :set number Jump to Line :<line_number> Example: ...

March 8, 2026 · 2 min · Phong Nguyen

Complexity

References: How to Find the Complexity of an Algorithm 1. Introduction Algorithmic complexity is a measure of the resources and algorithm requires about its input size. The two main types are: Time complexity: number of operations performed by an algorithm Space complexity: the amount of memory consumed 2. Time Complexity The time complexity of an algorithm quantifies the amount of time (operations) taken by an algorithm to run as a function of the length of the input It’s commonly expressed by Big-O notation Hierarchy of Time Complexities (Fastest to Slowest): (O(1)) - Constant: Fastest; performance is independent of input size. (O(\log n)) - Logarithmic: Very fast, typical for binary searches. (O(n)) - Linear: Efficient, grows proportionally to input. (O(n\log n)) - Linearithmic: Common for efficient sorting, like QuickSort. (O(n^{2})) - Quadratic: Acceptable for small input, common in nested loops. (O(2^{n})) or (O(n!)) - Exponential/Factorial: Generally only acceptable for very small inputs. 2.1. Constant Time - (O(1)) It takes the same amount of time regardless[rɪˈɡɑːrd.ləs] of input size. 2.2 Linear Time - (O(n)) [ˈlɪn.i.ɚ] ...

January 27, 2026 · 3 min · Phong Nguyen

UML Syntax Guide

The Unified Modeling Language UML (Unified Modeling Language) is a standard used to create software blueprints. There are two main types of UML diagrams: Structure diagrams: show the static structure of a system, its components at different levels of abstraction and implementation, and how they are related to each other. Behavior diagrams describe the dynamic behavior of a system, representing how objects interact and how the system changes over time. 1. Component Diagrams Component Diagram describes the static implementation view of a system. It shows components, their interfaces, and relationships. It is used in Component-Based Development (CBD) and SOA. Components are reusable, replaceable, and independently deployable. Use this when: Designing system architecture Breaking system into modules/components Showing how components interact … 2. Class Diagrams Class Diagram is UML structure diagram which shows structures of the designed system at the level of classes and interfaces, shows their features, constraints and relationship (associations, generalizations, dependencies,..) Use this when: Designing classes and their structure,include attributes and methods before coding Showing relationships between classes Detailing components at a deeper level … ...

June 10, 2025 · 3 min · Phong Nguyen

Markdown Syntax Guide

Introduction Markdown is a lightweight markup language that use to add formatting elements to plaintext documents. Table of contents 1. Heading: To create heading, add one to six # symbols before your heading. The number of # will determine the size of heading. Syntax # H1 ## H2 ### H3 #### H4 ##### H5 ###### H6 Preview H1 H2 H3 H4 H5 H6 2. Emphasis: You can add emphasis by making text bold or italic. ...

August 9, 2024 · 2 min · Phong Nguyen

English Grammar

This is where I study English grammar on my own every day. It’s a place where I not only improve my language skills but also discover new grammar rules. Step by step, I am working to become more confident in writing and communicating in English. The journey isn’t easy, but I believe that with patience and effort, I will continue to make progress. 1. Tenses Tenses indicate the time of an action or state of being expressed by a verb. ...

October 13, 2024 · 18 min · Phong Nguyen

Eclipse Apache Maven-Tycho

Introducing about Maven and how to use Maven Tycho plugin to build plugins into the SNAPSHOT Refer1 Refer2 Refer3 1. Apache Maven Apache Maven is an powerful build tool primary for Java software projects. It is implemented in Java which makes it platform-independent. 1.1. Setup Env Install maven: https://maven.apache.org/download.cgi Verify: mvn --version Config proxy (ONLY IF NEED): C:\Users${username}.m2\settings.xml or ${maven_home}\apache-maven-3.9.10\conf\settings.xml <settings> <proxies> <proxy> <id>example-proxy</id> <active>true</active> <protocol>http</protocol> <host>proxy.example.com</host> <port>8080</port> <username>proxyuser</username> <password>somepassword</password> <nonProxyHosts>www.google.com|*.example.com</nonProxyHosts> </proxy> </proxies> </settings> 1.2. Concepts Need the pom file defines: identifiers for the project to be build/ properties relevant for build configuration/ plugins which providefunctionality for the build via a build section. /library and project dependencies via the dependencies section Each project have its onw pom file but What is pom file ? https://maven.apache.org/pom.html Example: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> // version of the pom file <groupId>com.vogella.maven.first</groupId> // group id -> maven will build the package: <groupId>:<artifactId>:<version> <artifactId>com.vogella.maven.first</artifactId> // project id <version>1.0-SNAPSHOT</version> // project version <name>com.vogella.maven.first</name> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>11</maven.compiler.source> // java version <maven.compiler.target>11</maven.compiler.target> </properties> </project> A Maven project uses the groupId, artifactId, version (also knows as GAV) and the packaging property to uniquely identify a Maven component. ...

June 26, 2025 · 2 min · Phong Nguyen

DSF

Explain how to use the DSF. Refer1 1. Introduction Scenario: Debugger View Fetching Data Context: We want to show variable values in the Variables View as the user steps through the code. 1.1. Asynchronous Req: When the user steps through the program, the debugger needs to fetch variable values from the target (like a remote system). This operation might take a few milliseconds or more, depending on the connection. If we block the UI thread, the UI freezes. Solution: Use an asynchronous method to fetch variable data void getVariableValue(String varName, DataRequestMonitor<String> rm) { // Imagine this takes time (e.g., contacting GDB or a remote debugger) // Simulate async call executor.execute(() -> { String value = remoteFetchValue(varName); // Slow operation rm.setData(value); rm.done(); }); } Why Async? Prevents blocking the UI. Allows the Eclipse debug framework to continue updating other views. 1.2. Synchronous We want to implement a feature like evaluate expression that requires the value immediately. We don’t want to rewrite your entire logic using async callbacks just to get the result of getVariableValue(). ...

May 13, 2025 · 12 min · Phong Nguyen

Java Extension Points - Extensions

Explain how to use the Extension Point and Extensions. Refer1 Refer2 Refer3 1. Introduction Extensions are the central mechanism for contribute behavior to the platform. We used it to contribute functionality to a certain type of API. Extension points define new functions points for the platform that other plug-ins can plug into. E.g. When you want to create modular that can be added or removed at runtime, you can use the OSGi service. These extensions and extension points are defined via the plugin.xml file. ...

February 27, 2025 · 3 min · Phong Nguyen

Java NPE

Some stuffs related to NPE Refer1 Refer2 1. Optional This class will be an container object which may or may not contain a non-null value Examples: // Potential dangers of null String version = computer.getSoundcard().getUSB().getVersion(); // Solution 1: Ugly due to the nested checks, decreasing the readability String version = "UNKNOWN"; if(computer != null){ Soundcard soundcard = computer.getSoundcard(); if(soundcard != null){ USB usb = soundcard.getUSB(); if(usb != null){ version = usb.getVersion(); } } } // Solution 2(JavaSE7): String version = computer?.getSoundcard()?.getUSB()?.getVersion(); String version = computer?.getSoundcard()?.getUSB()?.getVersion() ?: "UNKNOWN"; // Solution 3 (JavaSE8) public class Computer { private Optional<Soundcard> soundcard; public Optional<Soundcard> getSoundcard() { ... } ... } public class Soundcard { private Optional<USB> usb; public Optional<USB> getUSB() { ... } } public class USB{ public String getVersion(){ ... } } String name = computer.flatMap(Computer::getSoundcard) .flatMap(Soundcard::getUSB) .map(USB::getVersion) .orElse("UNKNOWN"); 1.1 Creating Optional objects - Optional.of(var)/ Optional.ofNullable(var) SoundCard soundCard = new SoundCard(); Optional<SoundCard> sc = Optional.of(soundCard); // NPE if soundCard is null Optional<SoundCard> sc = Optional.ofNullable(soundCard); // may hold a null value 1.2. Check presenting - .ifPresent(//) // ugly code SoundCard soundcard = ...; if(soundcard != null){ System.out.println(soundcard); } // solution 1 SoundCard soundcard = ...; if(soundcard != null){ System.out.println(soundcard); } // solution 2 if(soundcard.isPresent()){ System.out.println(soundcard.get()); } 1.3. Default - .orElse/ .orElseThrow // ugly code Soundcard soundcard = maybeSoundcard != null ? maybeSoundcard : new Soundcard("basic_sound_card"); // solution 1 Soundcard soundcard = maybeSoundcard.orElse(new Soundcard("defaut")); // default value Soundcard soundcard = maybeSoundCard.orElseThrow(IllegalStateException::new); // default throw E … ...

February 27, 2025 · 2 min · Phong Nguyen

Java OSGi Service

Explain how to use the OSGi Service Refer1 Refer2 Refer3 Refer4 1. Introduction OSGi Services are essentially Java objects that provide a specific functionality or interface, and other components,plugins can dynamically discover and use these services. Multiple plugins can provide a service implementation for the service interface. Plugins can access the service implementation via the service interface. E.g. When you want to create modular that can be added or removed at runtime, you can use the OSGi service. ...

February 10, 2025 · 6 min · Phong Nguyen