Minus Seventeen Modulo Five Has Two Different Answers
17 mod 5 is 2 everywhere. −17 mod 5 is −2 in JavaScript, C and Java, and 3 in Python, Ruby and a spreadsheet. Both are right, and the difference is a real bug.
Daniel Okonkwo · 3 min read
22 guides on dev
Regular expressions, cron, hashes, encodings — the small tools a working day is full of. Each guide reads the syntax out loud, then shows the case that breaks the version everyone copies.
Ranked by how many pages of this site link to them, not by traffic.
17 mod 5 is 2 everywhere. −17 mod 5 is −2 in JavaScript, C and Java, and 3 in Python, Ruby and a spreadsheet. Both are right, and the difference is a real bug.
Daniel Okonkwo · 3 min read
A conversion rate is the share of visitors who take a desired action. Here is the simple formula, typical benchmarks, and how to read the number without fooling yourself.
Daniel Okonkwo · 4 min read
Estimate upload time with one formula: file size in bits divided by your upload speed. Learn why upload is usually slower than download and how overhead affects the result.
Daniel Okonkwo · 4 min read
Big O describes how an algorithm's work grows as input grows. Here is what O(1), O(n), O(n squared), and O(log n) mean and why the difference matters.
Daniel Okonkwo · 4 min read
Unicode assigns every character a code point; UTF-8 encodes those code points in one to four bytes. Here is how it works and why it beat the alternatives.
Daniel Okonkwo · 4 min read
What password entropy really measures, why length beats complexity, and how bits of entropy translate into a realistic crack time.
Daniel Okonkwo · 4 min read
A Unix timestamp counts the seconds since January 1, 1970 UTC. Learn why computers use it, how to convert it, and the 2038 problem.
Daniel Okonkwo · 2 min read
PPI and DPI both measure density per inch, but one is about screens and the other about print. Learn how to compute pixel density and what Retina really means.
Daniel Okonkwo · 5 min read
What 1080p, 1440p, and 4K really mean. Learn how resolution counts pixels, why total pixels grow so fast, and how aspect ratio ties width to height.
Daniel Okonkwo · 4 min read
Bitrate is how many bits of data a video or audio stream uses each second. Learn how it sets quality and file size, and the difference between constant and variable bitrate.
Daniel Okonkwo · 4 min read
Estimate any video's file size before you export. Learn the bitrate-times-duration formula, why you divide by 8, and how resolution and frame rate change the result.
Daniel Okonkwo · 5 min read
Estimate how many photos, songs, or hours of video fit on a card by dividing its capacity by the average file size.
Daniel Okonkwo · 4 min read
See how many gigabytes per hour SD, HD, and 4K video use, and how to check a monthly streaming habit against a data cap.
Daniel Okonkwo · 4 min read
Work out the internet speed your home needs by adding up Mbps per video stream, video call, and gamer, with clear examples.
Daniel Okonkwo · 4 min read
Understand how a subnet mask splits an IP address into network and host parts, what /24 means, and how to count usable hosts.
Daniel Okonkwo · 4 min read
Learn how binary place values work and convert binary to decimal and hexadecimal by hand, with clear worked examples.
Daniel Okonkwo · 4 min read
Estimate download time from file size and connection speed. Learn the size ÷ speed formula, the crucial bits-versus-bytes conversion (divide by 8), and why real downloads run slower than the math predicts.
Daniel Okonkwo · 4 min read
The Caesar cipher shifts every letter by a fixed amount. Learn how the shift works, why ROT13 is a special case, how to encode and decode by hand, and why the cipher offers no real security today.
Daniel Okonkwo · 4 min read
Most adults read prose at about 200-250 words per minute. Learn what a normal reading speed is, how to measure yours in a minute, and why comprehension matters more than raw speed.
Daniel Okonkwo · 4 min read
A URL slug is the readable, hyphenated part of a web address that names a page. Learn why slugs are lowercase, how they help SEO, and how to generate one from a title.
Daniel Okonkwo · 3 min read
camelCase, snake_case, PascalCase, and kebab-case explained: what each looks like, where it is the convention, and how to choose one consistently.
Daniel Okonkwo · 3 min read
A practical guide to turning a JSON array of objects into a clean CSV file, including how to flatten nested fields and handle the tricky edge cases.
Daniel Okonkwo · 4 min read