Top all-time · #1137
Tom Moertel
Personal blog · blog.moertel.com · on HN as tmoertelprogrammingmath
Tom Moertel's personal blog at blog.moertel.com covers programming and math. Since 2007, 63 different Hacker News readers have linked it 130 times, most often “A Great Old-Timey Game-Programming Hack”. It is still writing: the last post was on 2026-08-14, and you can follow it by feed.
Most-linked posts?
- A Great Old-Timey Game-Programming Hack9 people · 13 mentions · first linked 2013-12-16
- A type-based solution to the “strings problem” (2006)7 people · 13 mentions · first linked 2013-04-14
- A type-based solution to the "strings problem"6 people · 6 mentions · first linked 2007-06-09
- /articles/2006/12/15/never-store-passwords-in-a-database6 people · 6 mentions · first linked 2009-05-27
- Coders guide to good coffee4 people · 4 mentions · first linked 2007-12-11
- Recursion to Iteration; or: I wish Python had tail-call elimination3 people · 4 mentions · first linked 2013-05-13
- A Great Old-Timey Game-Programming Hack (2013)3 people · 3 mentions · first linked 2021-09-26
- Recursion to Iteration, Part 4: The Trampoline (2013)3 people · 3 mentions · first linked 2013-06-22
- A Coder’s Guide to Coffee (2002)2 people · 8 mentions · first linked 2013-08-23
- Sampling with SQL2 people · 4 mentions · first linked 2024-10-20
What Hacker News says?
For the particular case of the exponential distribution we can go further. By taking advantage of the theory of Poisson processes, we can take samples using a parallel algorithm. It even has a surprisingly succinct SQL translation: SELECT * FROM Population WHERE weight > 0 ORDER BY -LN(1.0 - RANDOM()) / weight LIMIT 100 -- Sample size. Notice our exponentially distributed random variable on prominent display in the…
Comment linking /posts/2024-08-23-sampling-with-sql.html
on “The Lost Art of Logarithms”Submitted A Great Old-Timey Game-Programming Hack as a story · 571 points
HN discussionTwo notes on the weighted version. First, the straightforward implementation of selecting the top N when ranked by POW(RANDOM(), 1.0 / weight) has stability problems when the weights are very large or very small. Second, the resulting sample does not have the same distribution in expectation as the population from which it was drawn. This is especially so when the overall weight is concentrated in a small number of…
Comment linking /posts/2024-08-23-sampling-with-sql.html
on “Reservoir Sampling”Submitted A Great Old Timey Game Programming Hack (2013) as a story · 252 points
HN discussionThat would be right assuming passwords were always encrypted - and we know that unfortunately even some of the biggest sites have been bitten by not encrypting passwords in their database[1] - but that's not actually the case I was thinking of when I said "brute forced". Here's one possible scenario: let's say that I happened to be a member of a website that unfortunately allows an attacker to hit their login form a…
Comment linking /articles/2006/12/15/never-store-passwords-in-a-database
on “Start ups, please don't force me to log in with Facebook”Submitted The second-order-diff Git trick as a story · 180 points
HN discussionYeah, deducing the incremental computation to work backwards can take some practice. I take completely different approach to explaining how to do it in https://blog.moertel.com/posts/2013-05-14-recursive-to-itera... .
Comment linking /posts/2013-05-14-recursive-to-iterative-2.html
on “Dynamic programming is not black magic”Submitted Sampling with SQL as a story · 178 points
HN discussion> e.g. why would you try to do a mathematical operation between a customer's name and it's account balance? Types like `int`, `float` and `string` are rather impoverished. Much more common mistakes are: - One the numerical side, trying to perform arithmetic with different units of measure ( https://en.wikipedia.org/wiki/Mars_Climate_Orbiter ) or with different representation sizes ( https://en.wikipedia.org/wiki/Clu…
Comment linking /posts/2006-10-18-a-type-based-solution-to-the-strings-problem.html
on “Ending PHP Support, and the Future of Hack”Submitted A Great Old-Timey Game-Programming Hack (2013) as a story · 140 points
HN discussionThis happened repeatedly with 37signals/Rails and Google Web Accelerator: http://blog.moertel.com/posts/2005-10-25-google-web-accelera...
Comment linking /posts/2005-10-25-google-web-accelerator-vs-unsafe-linking-round-two.html
on “The easiest way to keep your web apps accessible: Just use text”Submitted Coders guide to good coffee as a story · 108 points
HN discussionYes, we had this same scenario play out 16 years ago, and it seems that many modern web developers have forgotten its lessons: https://blog.moertel.com/posts/2005-05-06-google-web-acceler...
Comment linking /posts/2005-05-06-google-web-accelerator-offers-web-developers-an-important-opportunity.html
on “Gmail is opening and caching URLs within emails without user intervention (2019)”Submitted A Great Old-Timey Game-Programming Hack (2013) as a story · 97 points
HN discussionFurther reading about the relationship between recursion, iteration, and accumulators: https://blog.moertel.com/posts/2013-05-11-recursive-to-itera... This transformation is one you can apply in your own source as well. An example from that link, the recursive def factorial(n): if n < 2: return 1 return n * factorial(n - 1) can be rewritten iteratively: def factorial1d(n, acc=1): while n > 1: (n, acc) = (n - 1, acc…
Comment linking /posts/2013-05-11-recursive-to-iterative.html
on “Exploring Clang/LLVM optimization on programming horror”Submitted Recursion to Iteration, Part 4: The Trampoline (2013) as a story · 96 points
HN discussionIf you haven't read this already, you might enjoy this article: A Great Old-Timey Game-Programming Hack: http://blog.moertel.com/posts/2013-12-14-great-old-timey-gam...
Comment linking /posts/2013-12-14-great-old-timey-game-programming-hack.html
on “Compromising a Linux desktop using 6502 opcodes on the NES”Submitted A Coder's Guide to Coffee as a story · 75 points
HN discussion> Sorry, but this is bull. If you take any information, even if it's an email and password, data security is either tops on your list or you're abusing your users (even "only a hundred"; one is too many!). There is literally zero middle ground on this: you do it or you shouldn't be building web applications http://blog.moertel.com/articles/2006/12/15/never-store-pass... Needless to say, almost 5 years have passed an…
Comment linking /articles/2006/12/15/never-store-passwords-in-a-database
on “Why must you laugh at my back end?”Submitted How to change symlinks atomically (2005) as a story · 70 points
HN discussionJust my personal take, but when I have to read something carefully, I find it easier to do on paper. For example, I recently wrote an article about taking random samples using SQL. Even though I was writing it for my blog, which is HTML, I proofread the article by rendering it as a PDF doc, printing it out, and reviewing it with a blue pen in hand. What surprised me is that I also found it easier to review the artic…
Comment linking /images/public_html/blog/pix-20240601/sampling-with-sql.pdf
on “Pipe Syntax in SQL”Submitted A coder’s guide to coffee (2002) as a story · 41 points
HN discussionTo bring this into sharper detail, notice that there's the "OverloadedStrings" compiler directive at the top of the file. That means that "hello " and "!" are of type Html, different from String. Strings can only be concatenated with Html after they've been escaped. For more elaboration, see http://blog.moertel.com/posts/2006-10-18-a-type-based-soluti...
Comment linking /posts/2006-10-18-a-type-based-solution-to-the-strings-problem.html
on “What I Wish I Knew When Learning Haskell”Submitted Perl saved my vacation as a story · 34 points
HN discussionIn our brave new information-sharing world, the time to start worrying is when you create something and it isn't plagiarized. A couple of years ago, I wrote a job ad to help the startup I was working at hire programmers. I spent a lot of time getting the words just right to attract the right candidates. And then, shortly after our ad hit the Internet, some other company copied it, nearly verbatim, and started using…
Comment linking /posts/2011-07-10-good-enough-to-steal.html
on “How to properly plagiarize a website”Submitted Recursion to Iteration, Part 4: The Trampoline as a story · 23 points
HN discussionAn alternative to a kettle with temperature control is to use a little math to find dilution ratios. It's quick, easy, and works with any kettle to give water of any temperature. See: http://blog.moertel.com/articles/2005/07/11/math-makes-tea-t...
Comment linking /articles/2005/07/11/math-makes-tea-taste-better
on “Hacker's Guide to Tea”Submitted On the evidence of a single coin toss as a story · 17 points
HN discussionIt was a recurring problem in the Rails world because the reaction from DHH was to tell people the preloaders were "evil" instead of telling people to follow the HTTP specification. http://blog.moertel.com/posts/2005-10-25-google-web-accelera...
Comment linking /posts/2005-10-25-google-web-accelerator-vs-unsafe-linking-round-two.html
on “Instant.page”Submitted Wondrous Oddities: R's function call semantics [2006] as a story · 17 points
HN discussion