Vim Usage Guide

Vim is an advanced version of the Vi editor that provides more features while including the features of Vi. Vim can be operated with just the keyboard, enabling users to edit text rapidly without using a mouse. This post will summarize the basic usage and commands of Vim. Vim Modes Vim is divided into three main modes. Normal mode: This is the basic mode in which you can edit text or enter commands. Insert mode: This mode allows you to enter text, and you can add or modify text. Visual mode: This mode enables you to select text, and you can copy or delete the selected text. Normal Mode When you launch Vim, it starts in Normal mode by default. You can use the following commands in Normal mode. ...

July 6, 2024 · 3 min · 431 words · In-Jun Hwang

What is DevOps?

Definition of DevOps DevOps is a continuously evolving concept that cannot be confined to a single definition. Initially starting as a collaborative culture that broke down the boundaries between development and operations, it has now evolved into an integrated value delivery system encompassing CI/CD, infrastructure automation, and cultural transformation. The most successful DevOps implementations emerge when these various aspects work harmoniously together. Technical practices (CI/CD, infrastructure automation) are essential components of DevOps. They are indispensable tools that enhance the speed and reliability of value delivery. However, these technical implementations alone cannot realize the full potential of DevOps. True transformation occurs when technology, processes, and culture align with business objectives. ...

June 22, 2024 · 4 min · 662 words · In-Jun Hwang

Useful VSCode Shortcuts Collection

Visual Studio Code (VSCode) is a free, open-source code editor developed by Microsoft. VSCode provides users with an efficient coding environment through various features including multi-language support, debugging, Git control, and plugin support. Let’s explore how to increase productivity and use VSCode more efficiently through various shortcuts. General Commands and Shortcuts Ctrl+Shift+P, F1: Opens the command palette where you can execute various commands, such as searching files or changing specific settings. Ctrl+P: Quickly search and open files. You can select from the file list by typing part of the filename. Ctrl+Shift+N: Open a new VSCode window or instance. Useful when working on multiple projects simultaneously. Ctrl+W: Close the current window or instance. Useful for quickly organizing multiple tabs. Ctrl+,: Open user settings to configure various environment settings like themes, font size, and extension settings. Ctrl+K Ctrl+S: Open keyboard shortcut settings to customize shortcuts according to your preferences. Basic Editing Features and Shortcuts Ctrl+X: Cut the current line when no text is selected. Cuts only the selected text when text is selected. Ctrl+C: Copy the current line when no text is selected. Copies only the selected text when text is selected. Alt+↓ / ↑: Move the current line up or down. Useful for rearranging code blocks. Ctrl+Shift+K: Delete the current line. Deletes all selected lines if multiple lines are selected. Ctrl+Enter / Ctrl+Shift+Enter: Insert a new line below/above the current line. Useful for quickly adding new code. Ctrl+Shift+\: Jump to the matching bracket. Helps in understanding nested brackets. Ctrl+] / Ctrl+[: Indent/outdent the current line. Useful for aligning code format. Home / End: Move to the beginning/end of the current line. Ctrl+Home / End: Move to the beginning/end of the file. Ctrl+↑ / ↓: Scroll up/down one line at a time in the current window. Useful for quickly scanning code. Alt+PgUp / PgDn: Scroll up/down one page at a time. Ctrl+Shift+[ / ]: Fold/unfold code regions. Useful for organizing code by hiding specific code blocks. Ctrl+K Ctrl+[ / ]: Fold/unfold all sub-regions. Ctrl+K Ctrl+0 / Ctrl+K Ctrl+J: Fold/unfold all code regions. Ctrl+K Ctrl+C: Add line comment to selected lines. Ctrl+K Ctrl+U: Remove line comment from selected lines. Ctrl+/: Toggle line comment for current line. Ctrl+Shift+A: Toggle block comment for selected block. Alt+Z: Toggle word wrap. Shows long lines wrapped to fit the screen. Rich Language Editing Features and Shortcuts Ctrl+Space, Ctrl+I: Show code completion suggestions while writing code. Ctrl+Shift+Space: Show parameter hints when calling functions. Ctrl+Shift+I: Automatically format the current document. Ctrl+K Ctrl+F: Automatically format the selected portion. F12: Go to definition at cursor position. Ctrl+Shift+F10: Preview definition at cursor position. Ctrl+K F12: Open definition at cursor position in new window. Ctrl+.: Show quick fixes for code errors. Shift+F12: Show references at cursor position. F2: Rename variable or function. Ctrl+K Ctrl+X: Remove trailing whitespace. Ctrl+K M: Change language mode of current file. Multi-cursor and Selection Features Alt+Click: Insert cursor at multiple positions. Shift+Alt+↑ / ↓: Add cursor above/below. Ctrl+U: Undo last cursor operation. Shift+Alt+I: Insert cursor at end of each selected line. Ctrl+L: Select current line. Ctrl+Shift+L: Select all occurrences of current selection. Ctrl+F2: Select all occurrences of current word. Shift+Alt+→ / ←: Expand/shrink selection. Shift+Alt+drag: Column (box) selection. Display Management F11: Toggle full screen mode. Shift+Alt+0: Toggle editor layout between horizontal/vertical. Ctrl+= / -: Zoom in/out. Ctrl+B: Toggle sidebar visibility. Ctrl+Shift+E: Show explorer or move focus to it. Ctrl+Shift+F: Show search panel. Ctrl+Shift+G: Show source control panel. Ctrl+Shift+D: Show debug panel. Ctrl+Shift+X: Show extensions panel. Ctrl+Shift+H: Use find and replace in files. Ctrl+Shift+J: Toggle search details. Ctrl+Shift+C: Open new command prompt or terminal. Ctrl+K Ctrl+H: Show output panel. Ctrl+Shift+V: Open Markdown preview. Ctrl+K V: Open Markdown preview to the side. Ctrl+K Z: Enable Zen mode. Press Esc twice to exit. Search and Replace Features Ctrl+F: Find in current file. Ctrl+H: Replace in current file. F3 / Shift+F3: Find next/previous match. Alt+Enter: Select all occurrences of find match. Ctrl+D: Add next occurrence to selection. Ctrl+K Ctrl+D: Move last selection to next find match. Navigation and Movement Ctrl+T: Show all symbols. Ctrl+G: Go to specific line. Ctrl+P: Go to specific file. Ctrl+Shift+O: Go to symbol. Ctrl+Shift+M: Show problems panel. F8: Go to next error or warning. Shift+F8: Go to previous error or warning. Ctrl+Shift+Tab: Navigate editor group history. Ctrl+Alt+-: Go back. Ctrl+Shift+-: Go forward. Ctrl+M: Toggle tab move focus. Editor Management and Shortcuts Ctrl+W: Close current editor. Ctrl+K F: Close current folder. Ctrl+\: Split editor horizontally. Ctrl+1 / 2 / 3: Focus first, second, third editor group. Ctrl+K Ctrl+← / →: Focus previous/next editor group. Ctrl+Shift+PgUp / PgDn: Move editor left/right. Ctrl+K ← / →: Move active editor group left/up or right/down. File Management and Shortcuts Ctrl+N: Create new file. Ctrl+O: Open file. Ctrl+S: Save file. Ctrl+Shift+S: Save file as. Ctrl+W: Close file. Ctrl+K Ctrl+W: Close all files. Ctrl+Shift+T: Reopen closed editor. Ctrl+K Enter: Keep preview mode editor. Ctrl+Tab: Open next editor. Ctrl+Shift+Tab: Open previous editor. Ctrl+K P: Copy path of active file. Ctrl+K R: Reveal active file in Explorer. Ctrl+K O: Open active file in new window/instance. Debug and Shortcuts F9: Toggle breakpoint. F5: Start/continue debugging. F11 / Shift+F11: Step into/out of code while debugging. F10: Step over code while debugging. Shift+F5: Stop debugging. Ctrl+K Ctrl+I: Show hover information. Integrated Terminal and Shortcuts Ctrl+`: Open integrated terminal. Ctrl+Shift+`: Create new terminal. Ctrl+Shift+C: Copy selected text. Ctrl+Shift+V: Paste selected text. Ctrl+Shift+↑ / ↓: Scroll up/down in terminal. Shift+PgUp / PgDn: Scroll up/down one page at a time. Shift+Home / End: Scroll to top/bottom of terminal. VSCode provides many more shortcuts beyond those introduced above. Let’s practice using VSCode shortcuts to code more efficiently. You can find the complete list of VSCode shortcuts here. ...

June 21, 2024 · 5 min · 943 words · In-Jun Hwang

Understanding the Floyd-Warshall Algorithm

Floyd-Warshall Algorithm The Floyd-Warshall algorithm is an algorithm that finds the shortest paths between all pairs of vertices in a graph. It can be used on graphs with negative weights. It can also be used on graphs with negative cycles. It is implemented using dynamic programming. Recurrence Relation D_{ij} = min(D_{ij}, D_{ik} + D_{kj}) Procedure Initialize a 2D array. Iterate through all the vertices using three nested loops. Update the shortest paths using the recurrence relation. Example Code 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 #include <iostream> #include <vector> using std::cin; using std::cout; using std::min; using std::vector; #define INF 1000000000 int main() { int n, m; cin >> n >> m; vector<vector<int>> graph(n + 1, vector<int>(n + 1, INF)); for (int i = 1; i <= n; i++) { graph[i][i] = 0; } for (int i = 0; i < m; i++) { int a, b, c; cin >> a >> b >> c; graph[a][b] = c; } for (int k = 1; k <= n; k++) { for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { graph[i][j] = min(graph[i][j], graph[i][k] + graph[k][j]); } } } for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { if (graph[i][j] == INF) { cout << "INF "; } else { cout << graph[i][j] << ' '; } } cout << ' '; } return 0; } Advantages It can be used to find the shortest paths between all pairs of vertices. It can be used on graphs with negative weights. Disadvantages It is slower than Dijkstra’s algorithm for finding the shortest path from one vertex to another. It cannot find the shortest paths if the graph contains a negative cycle. Time Complexity The Floyd-Warshall algorithm has a time complexity of O(n^3) where n is the number of vertices.

June 17, 2024 · 2 min · 368 words · In-Jun Hwang

Exploring Bellman-Ford Algorithm

Bellman-Ford Algorithm It is one of the algorithms that find the shortest path. Bellman-Ford algorithm is an algorithm to find the shortest path from the start vertex to all other vertices. It is similar to Dijkstra’s algorithm but can be used even on graphs with negative weights. Order Initialize an array to store the distances from the start vertex to each vertex. Visit the start vertex. Update the distances from the start vertex to other vertices. ...

June 17, 2024 · 3 min · 436 words · In-Jun Hwang