ZhongUncle
Welcome to my blogs' site. If you like, please give a Star in ZhongUncle/zhonguncle.github.io - GitHub
This site is mainly backup my CSDN blogs in Chinese, but also has some notes.
Latest
-
Encoder-Decoder vs. Encoder-only vs. Decoder-only: Comparing the Three Transformer Architectures
2026-09-26 | Research | #Words: 3417
The paper "Attention Is All You Need" introduced the Transformer architecture, built from an encoder and a decoder.
-
How LLMs Learn "Relationships": A word2vec Deep Dive
2026-09-26 | Research | #Words: 4645
The core idea behind how today's LLMs learn "relationships" from data traces all the way back to the classic word2vec.
-
Reading Shannon: Notes on Information Theory
2026-09-17 | Research | #Words: 1386
In physics, entropy measures "disorder" or "chaos." Information theory borrows this idea. But here, "disorder" means something more specific: how surprising a piece of information is. In other words, how random it is.
-
How to Adjust NVIDIA GPU Frequency, Volte and Other Settings on Linux (or Overlocking)
2025-09-09 | UNIX | #Words: 2512
Recently, I wanted to adjust the frequency of my NVIDIA GPU on Linux because I noticed some software (like FaceFusion) doesn't utilize the GPU at its maximum frequency (e.g., a maximum of 2000 MHz, but only 1850 MHz in practice). So I decided to figure out how to tweak settings like frequency. This article will use `nvtop` and `nvidia-smi` for monitoring.
-
How Much Bitrate to Reduce When Converting H264 to HEVC with FFMPEG, and How to Measure Transcoding Loss Using SSIM (Structural Similarity Index)
2025-08-09 | Research | #Words: 1287
Recently, I’ve been organizing some videos and realized I have too many. I wanted to shrink some videos that already needed transcoding. Previously, I increased the bitrate by 10-20% to compensate for transcoding losses, but when converting from H264 to HEVC (or other formats), it might not be necessary to increase the bitrate—you might even be able to reduce it.
-
Introduction to Maximum Likelihood Estimation and How to Automatically Learn Parameters with Code (ML/DL)
2025-07-28 | Research | #Words: 4502
-
Introduction to MLE: How to Automatically Learn Parameters with Code (A Sample of Machine Learning)
2025-07-27 | Research | #Words: 4252
Maximum Likelihood Estimation (MLE), also translated as maximum likelihood estimation, is a method for obtaining the optimal parameters of a model from sample data. For example, MLE can estimate the parameters of a probability density function (PDF). If a set of samples/datasets/statistics (likely) follow a normal distribution, we only need to find the mean and variance (or standard deviation) of the dataset to derive the probability density formula that fits the data.
-
How to Fix Broken sudo: Error 'sudo: /etc/sudo.conf is owned by uid 1000, should be 0'
2025-07-21 | UNIX | #Words: 312
The issue is that the owner and group of files like `/etc/sudo.conf` (and related directories) are no longer `root`. I searched online for solutions and tried many, but none worked—for good reason: I was stuck in a dead loop. Changing permissions with `chown` requires root privileges, which I couldn’t obtain. Worse, I hadn’t set a password for the `root` user.
-
Ubuntu can't access Network: No DNS or APT Failure in Setting
2025-06-30 | UNIX | #Words: 959
For some unknown reason, APT suddenly stopped working: only a few default repositories were accessible, while others showed `ign` (meaning they couldn’t be connected to). I tried several mirrors, but the issue persisted. At this point, Wi-Fi was connected, so I suspected a GPG key problem. However, as I tried to fix it, the network stopped working entirely
-
What’s the Difference Between Private-Use Networks and Link Local? What’s the Relationship Between Peer-to-Peer Wi-Fi and Wi-Fi Direct?
2025-06-28 | UNIX | #Words: 1611
First, this entry is automatically generated by the system kernel. Even if you delete it, it will reappear after a restart. Therefore, I do not recommend modifying the routing table entries. Instead, adjust the subnet mask (or add a new entry, e.g., `169.254.0.0` with a mask of `255.255.255.0`).
-
Mac Suddenly Slow on Local Network (SMB, NFS, SCP, SSH, Ping, etc. Are All Slow)
2025-06-21 | Web | #Words: 1132
Today, SMB suddenly got slow again—only about 8-9 MB/s. It’s well-known that Apple’s SMB is prone to sudden slowdowns. I tried installing NFS, but it was still slow. I was frustrated. I checked other scenarios like `scp`, and they were all slow too—yet my internet download speed was still fast.
-
How to use lstopo to visualize System Topology
2025-06-21 | UNIX | #Words: 892
`lstopo` is an excellent tool for generating intuitive, concise system topology diagrams. This article documents small issues I encountered while using it—it is not a comprehensive manual. For detailed options, refer to the official documentation. Many Linux distributions come with `hwloc` preinstalled. If your system lacks it (e.g., Ubuntu), install it with
-
How to Do SIMD Programming in C++
2025-05-11 | C | #Words: 3884
I previously mentioned planning to abandon ISPC in favor of C++—ISPC evolves too quickly, and its documentation is poor, making it hard to keep up. Additionally, recent C++ standards have added solid support for official SIMD libraries, eliminating the need for third-party tools like ISPC. While ISPC still offers the best performance, I can no longer keep pace with its updates. However, you could pin to a specific ISPC version for development, as CPU instruction set updates are relatively slow.
-
Formatting C/C++ Code in VS Code: Presets, Key-Value Pairs, and .clang-format Configuration
2025-05-07 | C | #Words: 1878
Microsoft’s official C/C++ extension for VS Code offers features like syntax highlighting, library recognition, and—most importantly for this article—code formatting. Code formatting automatically adjusts your code to follow a specific standard, making it easier to read. In many large projects, formatting code to meet project standards is required before submission (though some projects use custom formatters, which we won’t discuss here).
-
How to Set Options and Arguments of Command Line Programs in Xcode via Scheme
2025-03-22 | Swift | #Words: 287
You could test the program in a separate terminal, but this is cumbersome. Instead, you can set options and arguments directly by modifying the Xcode Scheme—this eliminates the need to retype commands (or switch windows and use arrow keys) every time you run the program.
-
Swift Command Line Development on macOS: Fix "Undefined Symbols for Architecture x86_64" Linker Error
2025-03-22 | Swift | #Words: 458
However, given the small size of the core development team, their focus remains on Apple’s Xcode and GUI development. When working outside of Xcode and GUI environments, various odd issues may arise. I plan to publish several blog posts covering these issues in the coming days.
-
Swift Error: "main attribute cannot be used in a module that contains top-level code"
2025-03-22 | Swift | #Words: 264
-
Measure Function Execution Time with C++20 chrono: Simplified Timing (System Clock & Steady Clock)
2025-03-14 | C | #Words: 1119
This method is less universal than the ones in my previous post, but it drastically reduces code volume (*way* less code).
-
Compile & Use ISPC on Ubuntu: Fix Single-Core Issue with LLVM/Clang
2025-03-13 | C | #Words: 914
I’ve been using ISPC on macOS for a while, but it’s limited by the small number of cores/threads. Recently, I wanted to switch to Ubuntu, but the snap-installed ISPC only ran on a single core for some reason. To fix this, I decided to compile ISPC from source—this requires Clang and LLVM. However, Ubuntu has a quirk: many software versions are tied to the system version, and the default installed LLVM/Clang is version 14, which may lack necessary components. I had no choice but to tackle this, and took the opportunity to study their compilation and usage.
-
How to Install Stable Diffusion Web UI & xFormers on Ubuntu (Fix Network & Version Mismatch Issues)
2025-02-14 | Python | #Words: 1534
This is a verified step-by-step guide I compiled after multiple tests. Installing Stable Diffusion Web UI and the corresponding xFormers correctly can be extremely tedious—official and online tutorials are often incomplete or scattered. I figured out the process earlier but forgot to document it, leading to installation failures after reinstalling my system. This time, I’m writing it down so you can get everything up and running in **1 hour max** (or under 10 minutes with fast internet).
-
Access FaceFusion Across Local Network: Fix Gradio Public Link & Port Settings
2025-02-09 | Python | #Words: 380
Sometimes we want to use FaceFusion on other devices within the local area network (LAN), which requires configuring a publicly accessible link and port.
-
Keep Commands Running After Exiting SSH: A Quick Note on `nohup` & Alias
2025-02-09 | UNIX | #Words: 269
It's common to need programs/commands to keep running after exiting SSH, but I always forget how to do it. Since I usually set it up as an **alias** for quick use, I tend to lose track of the details over time and have to look it up again. That’s why I’m writing this note to document it.
-
Ubuntu Add New Mechanical Hard Drive: Fix SMB Remote Access Permission Issue
2025-02-05 | UNIX | #Words: 172
Recently, my hard drive was almost full, so I decided to add a mechanical hard drive. After installing the drive on Ubuntu, I encountered a frustrating problem: SMB remote access showed permission denied, even though local access worked perfectly.
-
Animagine XL V3.1 Complete Guide: Master SD WebUI Parameters & Prompt Writing (Teach You to Fish)
2025-02-03 | Python | #Words: 1502
Yesterday, I spent hours experimenting with Animagine XL V3.1 and realized most tutorials online only give you fish rather than teach you how to fish. Understandably, why share the secrets when you can make money from them? On Xianyu (a Chinese second-hand platform), some people even charge 200 yuan just to deploy Deepseek for others. Still, I want to write this article—it may not be comprehensive, but I’ll try to show you how to find resources or craft your own prompts instead of just copying and pasting.
-
Fix FaceFusion Video Format Error: Incompatible Encoding Solution
2025-02-01 | Python | #Words: 310
This issue stems from incompatible video formats. Many video formats are more complex than they appear—even if two videos share the same container format (e.g., MPEG-4), their underlying encoding or settings may differ significantly.
-
FaceFusion Running Slow? Fix It with NVIDIA cuDNN Installation
2025-02-01 | Python | #Words: 697
It’s another FaceFusion issue! While using it, I noticed it was barely faster than running on CPU. I initially thought this was normal—until I watched others’ demos and realized it should be much quicker.
-
Fix "Symbol Not Found" Error When Installing FaceFusion with Miniconda
2025-01-31 | Python | #Words: 447
I’d been avoiding Miniconda for as long as possible, but I finally couldn’t escape it—using FaceFusion today required Miniconda. Right at the final step of installing FaceFusion, I encountered the following error
-
Get CPU Frequency on Raspbian in Go (No Assembly Required)
2025-01-23 | Go | #Words: 180
This implementation does not use assembly because it is intended for use in Go, which does not support inline assembly—working with assembly in Go would be cumbersome. Additionally, performance is not a critical concern for the project, so we directly retrieve pre-computed values from the kernel via command-line access.
-
What Does the "@" Symbol Do in Python? Explaining Its Two Key Uses in D2L Code
2025-01-22 | Research | #Words: 720
Recently, while going through D2L (Dive into Deep Learning) code, I frequently noticed the "@" symbol appearing at the very top of classes or functions. Although Chapter 2 explains the comment `#@save` (indicating the following function is pre-defined in the package and can be used directly without redefinition), it does not explain the usage of the "@" symbol itself.
-
Why Do We Need to Zero Out Gradients in PyTorch?
2025-01-21 | Research | #Words: 319
While reading a book today, I noticed that gradients are zeroed out at the end of the optimization algorithm. But the book didn’t provide an explanation. After checking, I found many optimizers also include this operation—why is that?
-
Jekyll Not Generating HTML? Fix UTF-8 with BOM Encoding Issue
2025-01-19 | Research | #Words: 195
Today, while translating a blog post, I noticed Jekyll wasn’t generating HTML files as it usually does. After troubleshooting for a while, I found the cause: Jekyll cannot correctly recognize files encoded in **UTF-8 with BOM**.
-
Run Ollama on GPU in Ubuntu: Direct Installation & Docker Deployment Guide
2025-01-18 | Research | #Words: 2335
I’ve been using Ollama on macOS for a while without issues, but recently noticed it was running on the CPU after switching to Ubuntu. At first, I thought it was out of VRAM—on macOS, Ollama automatically falls back to CPU if it runs out of memory. However, I found that Llama3.2 3B only uses 3GB of VRAM, which is far from exceeding limits. I checked the command line options but found no relevant settings, so I did some research.
-
JSON Parsing Issue: Missing Commas Between Objects
2025-01-14 | Research | #Words: 280
When processing the returned JSON today, I encountered the following error: JSONDecodeError: Extra data: line 2 column 1 (char 134)
-
FFmpeg CUDA Hardware-Accelerated Transcoding on Ubuntu
2025-01-14 | Research | #Words: 1484
This article uses an Ubuntu environment. The version of FFmpeg installed directly via APT on Ubuntu supports CUDA acceleration. This demonstration uses this pre-installed version—your experience may vary if you compile FFmpeg yourself or install it from other sources.
-
Dell T5810 Workstation Build for Machine Learning & Gaming: A Budget-Friendly Guide with 3060 12GB or 2080Ti 22GB
2025-01-14 | Research | #Words: 3274
This is mostly a personal note to avoid re-researching solutions to problems I’ve already solved. However, since it took me about 20 days to write this article from start to finish, I can’t remember many details—so I may update it in the future.
-
Fix: Not Implemented Error: Loading a Dataset Cached in a LocalFileSystem is Not Supported
2025-01-05 | Research | #Words: 235
If you check the top of the error message, you’ll find the root cause: the lookup path points to a `.cache/` directory (e.g., `xxxxxxx/.cache/`). This error persists regardless of whether you use an absolute or relative path.
-
Dynamic Programming 2/n: Practicing DP with Concrete Problems (Climbing Stairs, House Robber)
2024-11-05 | Research | #Words: 1534
-
Dynamic Programming 1/n: What Is Dynamic Programming?
2024-10-31 | Research | #Words: 1069
Dynamic Programming (DP for short) is a programming paradigm, not a specific algorithm. It breaks down a large problem into smaller subproblems through recursion—mathematically speaking, it can be expressed as a polynomial. This allows solving problems of different scales with minimal changes to the code (a key advantage of recursion).
-
What is complement graphs, isomorphic graphs, and self-complement graphs?
2024-10-10 | Research | #Words: 539
Many online articles lack clear explanations of complement graphs, isomorphic graphs, and self-complement graphs. Isomorphic graphs have the same points and edges but different positions, with the same degree sequence. Complement graphs share the same vertex set, with edges in one being those not in the other, forming a complete graph when combined.
-
The Quirks of C printf Parameter Handling on macOS: What Happens When printf Uses %d to Print a Floating-Point Number?
2024-07-26 | Research | #Words: 3724
I was extremely curious about why this happens. The `0` on 32-bit systems is easy to understand, but why do we get random numbers on 64-bit systems? You can probably make a rough guess—it’s related to memory addresses (weird random numbers almost always point to address issues.
-
What Is Hamming Code? A Deep Dive into Error Detection and Correction
2024-07-22 | Research | #Words: 2622
I first learned about Hamming codes a few yedars ago when I watched 3Blue1Brown’s video. I then looked into Hamming himself and thought he was brilliant. Later, I was impressed to discover in *The UNIX Hater’s Handbook* that Hamming was actually Brian Kernighan’s (co-author of the C language bible *The C Programming Language*, commonly known as K&R) mentor at Bell Labs and the third Turing Award winner.
-
SMA (3/3) KMP (Knuth–Morris–Pratt) string matching algorithm
2024-07-14 | Research | #Words: 4801
-
SMA (2/3) Finite automaton string matching algorithm
2024-07-12 | Research | #Words: 2160
-
SMA (1/3) Naive and Rabin-Karp
2024-07-12 | Research | #Words: 1911
SMA (String matching algorithms) have always been my weak spot, and I happened to have a need for them recently, so I took the opportunity to catch up. String matching algorithms primarily involve identifying a substring (pattern, which is sometimes translated as pattern in other contexts, hence sometimes called pattern matching) within a larger body of text, such as finding a word in a text editor or a specific sequence in a DNA strand.
-
How to Measure Execution Time with rdtsc and C/C++: Using Inline Assembly and Retrieving CPU TSC Clock Frequency
2024-04-22 | C | #Words: 3758
This article is primarily an experimental exploration and intellectual exercise—a preliminary attempt to study implementations of time measurement and the use of inline assembly and assembly functions in C/C++. Unless you have specific use cases, do not use assembly instructions to implement this functionality. The Further Reading section lists alternative methods that do not require inline assembly.
-
What Are MSRs (Model-Specific Registers)?
2024-04-22 | Research | #Words: 881
MSRs (Model-Specific Registers) are specialized registers designed for various experimental functions, including debugging, program execution tracing, computer performance monitoring, simplified software programming, and power control.
-
High-Precision Time Measurement in C/C++ on Windows: A Guide to QPC (QueryPerformanceCounter)
2024-04-15 | C | #Words: 850
This article only covers native (Microsoft-provided) time measurement functions on Windows. Third-party high-precision time measurement libraries are not discussed here.
-
High-precision time measurement function similar to clock_gettime(CLOCK_MONOTONIC) on Windows
2024-04-15 | C | #Words: 1038
-
How to clone Raspberry Pi system disk to smaller disk/SD card
2024-03-02 | Research | #Words: 2734
How to clone system disk to a smaller hard drive or SD card on Raspberry Pi, including partition, set up and repair boot files.
-
Measuring Function/Feature Execution Time in C/C++: Serial vs. Parallel, and Practical Comparison of Three Methods
2023-11-27 | C | #Words: 1235
This article serves as a complete summary of measuring the execution time of functions or features in C/C++. At the end, we’ll demonstrate a comparison of three methods.
-
Solution: Missing IPv4 Address on Ethernet (eth0) in Raspberry Pi 4B (Raspbian Bookworm)
2023-11-07 | Research | #Words: 922
Raspbian recently upgraded from Bullseye to Bookworm last month, bringing many changes. As of writing this blog, less than 30 days have passed, so there aren’t many reference solutions available—we can only rely on previous versions or figure it out ourselves. In the future, the official team may fix this issue, or new problems may arise. If I encounter any, I’ll write a new article and link it here.
-
Performance Record of Raspberry Pi 4B (CPU, Disk, FFMPEG, CV, llama2)
2023-11-05 | Research | #Words: 1680
This blog shares some reviews and tests of Raspberry Pi 4B. ZhongUncle compares it with Mac mini 2018 i5 in many aspects.
-
Use Raspberry Pi Pico, DHT11, SSD1306 OLED to make thermo-hygrometer
2023-08-28 | MCU | #Words: 8378
Recently, I want to use Raspberry Pi Pico, DHT11 THS and SSD1306 OLED screen to make a thermo-hygrometer. Although the official sample has these two devices, but I encountered a big pit, so I wrote this article to record the whole process. I want this project as a beginning of learning microcontroller.
-
Choose I2C controller, SDA and SCL pins using C/C++ on Raspberry Pi Pico
2023-08-27 | MCU | #Words: 1374
This blog begins with a description of the solution, and record my discovery process and the structure of the Pico I2C code ZhongUncle explored.
-
Modify the default SDA and SCL pins of I2C of Raspi Pico using C/C++
2023-08-26 | MCU | #Words: 254
Pico has two I2C, namely two sets of SDA and SCL. You can see this from the names in the pin diagram. By default, only the first I2C (`I2C0`) is enabled. It means, even if you modify the pin, but not in `I2C0`, it still doesn't work. There are two ways to modify the SDA and SCL default pins of I2C correctly, and also there is a not recommended method (but still a useful method).
-
Guide of developing Tang Nano FPGA on Mac
2023-08-19 | MCU | #Words: 2172
Recently I received a Tang nano 9K FPGA development board as gift, so I wanted to take this opportunity to study FPGA. The official document recommand to use GOWIN IDE to develop GOWIN FPGA, but you need to apply for a license and submit a lot of information. Since it was a gift, So it is not convenient. In addition, IDE is actually not very suitable for learning and putting into production, because IDE hides many details. So I want to find other workflows, just like using any text editor and Clang/LLVM to compile C/C++ programs.
-
How to reset Raspberry Pi Pico (reset peripheral device failed)
2023-08-15 | MCU | #Words: 429
Sometimes you need to reset the Raspberry Pi Pico. One way is to press and hold the BOOTSEL button on the Pico and re-plug USB; another way is connecting the RUN and GND pins with a button, and then press this button and BOOTSEL at the same time button. This puts you into USB mode.
-
APFS file system exploration
2023-08-14 | Research | #Words: 2112
This article aims to provide a low-level explanation of APFS, the file system used by Apple devices. Because I noticed that there was a lack of documentation on how APFS works in details, so I do some research and share my findings.
-
How to use Go to get URL parses, and problems when using it
2023-08-13 | Go | #Words: 476
Using Go to get URL parses is easy, but Go has strict package manage. So recommend you use `goimports` tools or shortcut key Command + S to auto complete the package. Because now use `net/url` or `net/http`, but in future maybe change.
-
Errors and solutions when building Raspberry Pico cross-compilation environment
2023-08-10 | MCU | #Words: 646
This blog lists errors that may be encountered when prepare cross-compilation environment and tool chain (arm-none-eabi-gcc) for Raspberry Pi Pico.
-
How to use the Mac Terminal to develop Raspberry Pi Pico using C/C++
2023-08-09 | MCU | #Words: 2524
The reason for writing this blog is that the official tutorial is outdated. If you follow the official tutorial to configure on Mac now, you will encounter a lot of problems. I dropped into almost pits. Therefore, I record the complete process, as well as the causes and handling methods of various errors. And if I change to new Mac and encounter the same problem in the future, I read this blog to remind how to deal with it.
-
Why hard drive lost much performance via USB?
2023-07-19 | Research | #Words: 2150
In hard disk performance, IOPS is a very important parameter. In terms of speed, this is the most important parameter to pay attention to, rather than the sequential read and write performance or random read and write performance that many people measure.
-
How to install Go Tour tutorial in local
2023-07-12 | Go | #Words: 1020
Surprisingly, Go provides an offline version (available in various languages). After downloading and installing, you can compile and run locally to view the results. You do not need to connect to the Internet to use a remote server, which improves efficiency and performance (details on this will be discussed separately later). There is a section on comparison.
-
How to check disk in hexadecimal by bytes in terminal on Mac or Linux
2023-07-05 | UNIX | #Words: 546
Before start to introduce, something be emphasized: This method does not guarantee to view all hard disks. Some hard disks will display Resource busy due to some reasons, such as Time Machine and built-in hard disks.
-
Mount and unmount external hard drive on Mac by diskutil in Terminal
2023-07-05 | UNIX | #Words: 1284
Recently, when I used macOS to mount an external hard drive, I couldn’t mount it using mount. Many articles didn’t explain the various situations in detail, so I wrote a blog to record it.
-
How to convert BDMV (m2ts) to MKV, MP4 and other formats by ffmpeg
2023-06-23 | Research | #Words: 1431
BDMV is the format used by Blu-ray discs. This format cannot be played using playback software, and a hard disk player, which is a specialized device, must be used. But the most classic ffmpeg can convert it to other formats and maintain the same bit rate and definition, so that it can be viewed easily.
-
How to convert number from some base to other base in Swift
2023-06-12 | Swift | #Words: 323
Finally I found the `String` type has a particularly magical method, like: String(a, radix: 16, uppercase: true)
-
What is the differences between gcc and Clang/LLVM?
2023-06-10 | Research | #Words: 2404
Recently, I found I was not very clear about the difference between GNU GCC and Clang. It affected implementation and learning somethings, so I spent free time in some days to research it carefully.
-
Use gcc to learn C compilation process
2023-06-08 | C | #Words: 2845
Recently, I suddenly discovered something when I was learning about clang/llvm: `gcc` is a collection of tools that includes or calls all tools that convert source code into executable program, not just a simple compiler. This helped me gain a deeper understanding of compilers, so I wrote this article as a record.
-
How to record TikTok's live stream on macOS
2023-05-31 | Research | #Words: 677
Recently, I saw some live broadcasts on Douyin that were really interesting, and I wanted to record them. So I studied how to record these live broadcasts. There are two methods: recording the screen and downloading from the push source.
-
Verify the central limit theorem using C++
2023-05-16 | C | #Words: 2545
I just want to try to see whether is the case. I think the central limit theorem (CLT) and normal distribution are a very magical part of probability theory. I will use dice points as discrete events to calculate the probability of the sum of points. First, Implementing the program to simulate a uniformly distribute. Second, adjusting the probability of non-uniform distribution.
-
What is Union? Where do I need to use it?
2023-05-12 | C | #Words: 967
In C language, there is a variable called union, which is used to store objects of different types and sizes in different situations. This is very similar to a struct: a struct is a collection of one or more variables. The declaration method of union is very simple and exactly the same as struct, as follows
-
Why happened error helper_cuda.h No such file or directory
2023-05-03 | C | #Words: 492
When using nvcc in the command line today, an error helper_cuda.h: No such file or directory appeared. This error message means: During compilation, the helper_cuda.h header file cannot be found (if other xxx.h cannot be found, the following explanations and solutions are also common).
-
What is Typedef in C? How to use? What are the conveniences?
2023-04-26 | C | #Words: 1293
typedef is a special feature in the C language, which is used to create new type names. You also can know from the name type def(ine). typedef is similar to alias program in Unix, which adds another name to an object. typedef also makes multiple names actually correspond to same objext, but the object of typedef operation is a data type. It is to give a nickname to the data type. This nickname usually has the first letter capitalized and is used to indicate that it is not an underlying data type.
-
How to convert an array into a dictionary in Swift
2023-04-22 | Swift | #Words: 570
Sometimes you need to convert array subscripts and elements into a dictionary. For example, if you use array elements to search for subscripts, if you use a function to search, you have to perform a loop search and acquisition every time, which requires a lot of computing performance and memory. At this time, convert the original array into a dictionary, keyword For array elements, it would be more convenient if the value is a subscript serial number, so that the serial number can be easily found through the value of the element, and there is no need to perform a loop search every time.
-
How to install and use Plan 9 on Mac VM Fusion
2023-04-21 | Research | #Words: 2545
I encountered many problems when using VM Fusion to install Plan 9 on Mac. The official documents and some foreign blogs from the past two years were not clear, and even misleading (some situations have changed). So I am writing this article to help others who also encounter the same problem.
-
What is enum in C language detailly
2023-04-19 | C | #Words: 1005
enum is abbreviation of enumerate. It is a type of constant in C language, called enumeration constant. enum provides a convenient way to associate values and names, and it is an alternative to #define. enum can be regarded as a special array, which is a list of constants, but this constant just be integer. So if there are only a few irrelevant and discontinuous constants, just define some constants directly is fine.
-
Idiot Siri
2023-04-05 | Non-Tech | #Words: 77
Today I accidentally discovered that the Siri calculator on iPad has accuracy issues in calculations, such as integer operations. I don’t know what is ignored.
-
How to measure running time of function in Swift/SwiftUI
2023-04-02 | Swift | #Words: 973
Sometimes, Xcode Test cannot meet our need, so we need to write the testing function mannully. The main of testing function is measure time of code. Whether it is testing a CPU/GPU-intensive program or a read-write-intensive program, it is necessary to obtain the running time of the program or function to calculate performance.
-
What I find when using New Bing (GPT-4)
2023-03-16 | Research | #Words: 1123
ZhongUncle records what I find when using New Bing (GPT-4). Today New Bing called Bing Chat and can do more thing, but its mistakes are more often.
-
Simple NN test implemented in Pytorch on laptop and Mac mini 2018
2023-02-17 | Research | #Words: 570
ZhongUncle records some performance of NN and know why bandwidth of gpu is important for Machine Learning.
-
Sony A7R in 2023
2023-02-09 | Research | #Words: 755
I recently borrowed an A7R. This is my first time using a professional camera (not a card camera), and it is full frame tensor. So I spent some time to learn how to use it and how it works under various settings.
-
Why GIF is static image rather than video?
2023-02-03 | Research | #Words: 4222
When I was organizing my disk, I have a question: What is GIFs classified as? Static image files or video files?Because if you put it in a video, GIF is classified as a static image usually and is composed of images; if you put it in an image, it shows animations. Then I have new problem: Why GIFs shows animations, but be classified as static images?
-
How to use Java like script (How to run single Java file like script)
2023-01-10 | Web | #Words: 400
Java supports running a single Java code file like a script on Unix like systems. But at the bottom, it unlikes the real scripts, it still needs to be compiled. You can run it as script under Linux, macOS, WSL and cannot be used under Windows PowerShell or CommandLine.
-
How to install the Java development environment on macOS Terminal
2023-01-10 | Research | #Words: 512
Recently, I need to learn Java. Due to personal habits, I just want to use the terminal for development instead of using an IDE. But I never expected that I would be tricked by the official website once, and the downloaded Java could not be developed normally. So I wrote this article to explain how to configure it. It's very simple, just find the right official website.
-
Introduction to Tree Selection Sorting
2022-12-06 | Research | #Words: 797
Maybe you like me have a question: Why heap sorting using a binary tree, but it is called heap sorting, rather than tree sorting? Because the predecessor of heap sort is called Tree Selection Sorting, it also uses a tree structure, but is slightly simpler. Finally we will talk about why invent heap sorting to replace tree sorting.
-
New Navigation mode in SwiftUI from iOS 16
2022-11-24 | Swift | #Words: 608
From iOS 16, Apple start to deprecate the original `NavigationView` and will gradually phase it out completely in the future. Apple start to use `NavigationStack` and `NavigationSplitView`.
-
How to grant different permissions of Safari Extension
2022-10-25 | Swift | #Words: 823
ZhongUncle will introduce how to grant different permissions of Safari Extension, like types, domains, kinds.The permissions of Safari Extension extensions are roughly divided into the following aspects:
-
How to use R language to draw charts and graphs (line, curves, etc.)
2022-10-10 | Research | #Words: 1857
If you are studying or engaged in data analysis-related, you must have used or been told to use R language. But with so many languages for data analysis, why use R? Because R can output very nice charts for publication. It may not be necessary for blogs, but it is necessary for publications such as papers and books. After all, the charts in most publications are not in color or flashy.
-
Origin, Code, Performance and Differences of QuickSort algorithms(qsort)
2022-10-04 | Research | #Words: 2899
When I was learning quicksort algorithm, I found there are many style of code. I was very curious why. So I went to read Introduction to Algorithms to search for answer. Finally I found the reason be related to the development history of quicksort.
-
How to use the built-in native charts (Charts) in SwiftUI
2022-09-23 | Swift | #Words: 3101
At WWDC2022, Apple provided the chart-related package `Charts` for SwiftUI, so you don’t have to work hard to implement the chart function yourself. The amount of code suddenly changed from four to five hundred lines to a dozen or even a few lines (I still remember that I almost vomited blood trying to write the chart function). So I want to study the built-in chart function carefully, so as to facilitate future development and use
-
How to move installed WSL (Ubuntu) to another drive or location
2022-09-16 | UNIX | #Words: 452
Due to my C drive is almost full, and not empty much after try to clean it, so I plan to move WSL to a new drive.
-
Differences between index storage and hash storage in detail
2022-09-03 | Research | #Words: 456
There are two kinds storage structures in data structures that are easily confused, namely index storage structure* and hash storage structure (hash storage structure) You can find corresponding keyword according to address. It can be understood as a yellow pages. You can find someone's phone number based on name. So index storage is also called direct addressing
-
How to install and use Nginx and PHP7 on Ubuntu server
2022-08-14 | Web | #Words: 1228
Recently I need to study PHP, but I found PHP unlikes scripting languages like Python and JavaScript can be viewed directly in local, PHP needs run on the server. This requires setting up an environment to learn. Although many websites that also provide already built websites, but I think I should learn how to prepare when I learn how to use PHP. Otherwise, when I still don't know how to start by myself. It would be extremely embarrassing.
-
How to product new UI animation after iOS 15 using SwiftUI
2022-08-13 | Swift | #Words: 1375
Starting from iOS 15.0, Apple has abandoned the previous.animation(Animation?) and recommends developers to use .animation(Animation?, value: Equatable) or withAnimation instead.Personally, I feel that although I may not be used to it after the revision, the possibilities and freedom of development are greater.But before talking about the difference between the two, we need to understand UI animation. You can skip this part if you understand it.What is animation.Animation is a process of attribute changes such as various displacements, color changes, size changes, etc.Specific to SwiftUI's View, it is their .offset, .foregroundC
-
How to generate assembly code using Clang
2022-08-13 | Assembly | #Words: 160
Sometimes for learning or debuging, I need to view the assembly code of the program. This is very convenient in many GUI IDEs. For example, in Xcode, just click Product-Perform Action-Assemble File Name, as follows
-
macOS Assembly Guide
2022-08-13 | Assembly | #Words: 2165
Assembly is the “magic” of computers. You can be a fine “warrior” who only uses high-level languages, but if you “enchant” your “weapon” with assembly, your combat effectiveness will increase greatly (of course, there are also risks of “playing with fire and burning yourself”).
-
What is format of man page in Linux and macOS? How to write a man page
2022-07-27 | UNIX | #Words: 576
In Linux and macOS, we often need to use `man xxx` to view the introduction and usage of a program, system call, etc. This interface is called `manual page`, but sometimes it is simply called `manpage`.
-
Jump between Views in SwiftUI (How to jump to other page)
2022-07-17 | Swift | #Words: 1392
ZhongUncle introduces how to jump to other pages and views in SwiftUI. I shows two methods and new method after iOS 16.Since it jumps page by page, so it is not suitable for jumping between some pages
-
Size Directives in Assembly
2022-07-10 | Assembly | #Words: 210
During the assembly, you may need to specify some data size, such as the size of stack. In this case, you need to use the size command (Size Directives).
-
How to get query of URLs in PHP
2022-07-10 | Web | #Words: 232
PHP, like Python, provides the function `parse_url(string $url, int $component = -1)`, which is very convenient.
-
What are the query of URL? How to parse and obtain them?
2022-07-10 | Web | #Words: 460
This article is to introduce the common parameter parts in URLs and how to use common Python, JavaScript, and PHP to parse and obtain parameters. (You can click on the table of contents on the left to jump directly to the part you want to see)
-
How Swift parses URLs
2022-07-08 | Swift | #Words: 133
ZhongUncle introduces how to use Swift to parses URLs.
-
Why Type-C in difference protocols is in difference speed
2022-06-16 | Research | #Words: 2578
Do you wonder why Type-C in difference protocols is in difference speed? I will tell you why the Type-C have different bandwidths under different protocols from pin definitions, protocols, etc.
-
How to get query of URLs in Javascript
2022-06-12 | Web | #Words: 735
It is a little troublesome to get URL parameters with JS, because JS can only get a certain part of the URL, but it cannot be subdivided. If you want to get a certain parameter, you also need to use string interception. So it’s divided into two steps:
-
How Python parses and obtains URL parameters and uses
2022-06-09 | Web | #Words: 461
ZhongUncle will introduce how to parse and obtains the URL parameters in Python, and how to use them
-
How output data in Python
2022-06-03 | Web | #Words: 1565
There are two types of output data formats: formatted output and direct output. For example, the `f` of `printf` function in C language means formatted. Different data types can be printed through conversions such as `%d`. Python also has two types.
-
How to access Windows files in WSL
2022-05-12 | UNIX | #Words: 69
First enter WSL, then enter the root directory `/`, and use `ls` to see a directory named `mnt` (mnt is the abbreviation of mount).
-
How to modify TabView in SwiftUI
2022-03-23 | Swift | #Words: 2953
How to modify TabView in SwiftUI (including properties of tabItem), such as color, position, size, etc.
-
How to delay execution or scheduled automatic operations in SwiftUI
2022-03-14 | Swift | #Words: 1005
In the process of developing software, we not only need to perform operations when the user clicks, but sometimes we also need to automatically perform some operations at regular intervals. For example, the most common opening screen advertisement countdown is closed, as well as some animation effects. There are generally two ways to implement these: one is to use a timer, and the other is to use asynchronous operations.
-
How to use Core Image filter (CIFilter) to process photos in SwiftUI
2022-02-22 | Swift | #Words: 959
Apple provides 14 major categories, a total of 174 image processing methods and some common filters in the Core Image API. The first is how to read this web page, that is to say what information this web page provides, which is very helpful for us when using it. Take the screenshot below as an example to explain how to see it.
-
How to Handle Push Notifications in SwiftUI
2022-02-21 | Swift | #Words: 1081
There are many situations need developers to push notifications, but not many people talk about push notifications in SwiftUI. Here is some relevant content, So I write this blog. On the one hand, I can refer to it in future, on the other hand, I also want to help people in need.
-
SQLite command line usage
2022-02-13 | Research | #Words: 1425
Recently, I plan to use the open source and free SQLite as a database to save money. And due to personal habits, I prefer the command line, so I record how to use SQLite in command line.
-
How to get get JSON by website api and displays content in SwiftUI
2022-02-11 | Swift | #Words: 1390
Obtaining JSON from the website API and displaying the text is a very common usage scenario in development.
-
How to obatin the size of a View in SwiftUI
2022-01-20 | Swift | #Words: 324
ZhongUncle introduce how to obatin the size of a View in SwiftUI. You can get height or width of a View component.
-
How to modify the size of SF Symbol in SwiftUI
2022-01-11 | Swift | #Words: 234
Apple provides many symbols to developers, which improves developer efficiency and unifies the usage of many symbols to avoid misunderstandings. These synbols are called as SF symbols. Apple provides an App for developers to find these symbols, also called SF Symbol, which can be found on the Apple Developer website
-
How to Install (No Compilation or Brew Required) and Use FFmpeg to Convert MKV to MP4 on macOS, Including Hardware Acceleration
2021-12-21 | Research | #Words: 1415
Recently, I needed to convert MKV files to MP4 format. Since Apple's Compressor doesn't support MKV, I decided to use FFmpeg. However, the video files were extremely large, and basic commands were too slow—so I wanted to use hardware acceleration. Due to macOS's uniqueness, the hardware acceleration method provided on the official FFmpeg website doesn't work. After some research, I put together this quick tutorial in hopes of helping others in need.
-
How to call the camera in SwiftUI
2021-12-10 | Swift | #Words: 695
SwiftUI cannot directly call the camera and photo album, it needs to be used together with UIKit.
-
How to get images from the system album in SwiftUI
2021-12-10 | Swift | #Words: 608
I will tell you how to get images or photos from the system album in SwiftUI. SwiftUI cannot obtain the system album content by itself, so it has to rely on UIKit.
-
How to obtain information of device, system and battery in Swift.
2021-04-03 | Swift | #Words: 420
ZhongUncle introduces how to obtain information of device, system and battery in Swift.