📝 Notes
93 articlesEnlarging old photos without blur: how much detail enhancement can recover
Scanned old photos blur when enlarged because every new pixel is inferred from neighbours. This note calculates each magnification from pixel count and print size, explains the cost of sharpening, noise reduction and local contrast, and what to expect for portraits, text and graphics.
Calculating the Chinese sexagenary cycle: zodiac years and ganzhi days
Ganzhi years and zodiac signs often disagree because there are two new-year boundaries: the start of spring and Spring Festival. This note verifies the modulo formula year by year, explains why the 60-year cycle repeats, and rechecks the anchor and general formula for ganzhi days.
Days until Chinese New Year: how holiday countdowns are calculated
Lunar holidays move on the Gregorian calendar every year, and the day difference has two conventions: inclusive or exclusive of today. This note uses a seven-year table from 2024 to 2030 to show the range and gaps for Spring Festival, Mid-Autumn and Double Ninth, and explains why the countdown can differ by a day.
Filling a layout with no content: placeholder text that does not look like a template
When a design draft can only be filled with placeholder text, the question is not what to write but how many lines fit. This note gives a way to estimate volume from paragraph and sentence counts, an algorithm for the line-count difference between Chinese and Latin text, and why high-risk spots such as headings and buttons should not use placeholder copy.
How many teams can you form? Permutations versus combinations
Choosing 4 people from 12 for a duty roster gives 495 or 11,880, and the only difference is whether order counts. This note records a swap test for deciding, step-by-step verification of A and C, missed cases in repetition and at-least problems, and the first question to ask when factorials exceed the safe integer limit.
Every combination of two columns: splitting, merging and Cartesian products
Colour times size times material means rows multiply rather than add: 5 colours with 4 sizes gives 20 rows, and adding 3 materials makes 60. This note records the errors in hand-filled tables, how to verify a multi-round Cartesian product, and the off-by-one column trap when splitting text into columns.
Barcodes for inventory labels: choosing between CODE128 and EAN-13
Store-made shelf labels were refused by the shop, so this note lays out the character ranges, check-digit algorithms and bar-width effects on scanning for CODE128, EAN-13 and CODE39, and explains that EAN-13 prefixes must be assigned through GS1 and cannot be invented.
Testing upload limits: generating a file of an exact size
You need to test an upload limit but cannot find a file that is exactly 10 MB. This note works through the byte difference between MB and MiB, why all-zero content compresses to tens of KB, sparse file logical size versus actual usage, and how to generate a test file by byte count.
A 30 MB text file you cannot open or send: split it by line count
Logs and exports tens of megabytes large will not open or send, so this note splits them by line count, by size and by delimiter. It covers where each cut lands, why UTF-8 Chinese characters only break when splitting by bytes, and how line and byte counts verify nothing was lost.
Filenames without paths: batch-extracting from hundreds of lines
A backup log contains hundreds of full paths, but the report only needs filenames. This note covers mis-slicing caused by Windows backslashes versus Unix slashes, UNC paths, trailing slashes and drive letters, plus how to decide on extensions and deduplication.
Quotes and angle brackets breaking the page: HTML entity encoding traps
Double escapes and literal tag text on a page usually mean one encoding layer too many. This note explains which layer escapes what, when to encode versus decode, and gives a table of common entities and their code points.
HTML squeezed onto one line: when to beautify and when to minify
Inherited HTML that is one long line is unreadable, yet beautifying and minifying are not symmetrical operations. This note covers how indent width affects version diffs, what minification discards, and why whitespace in email templates cannot be changed casually.