Archived page · captured 2022-12-10

unsafePerformHack

Blog posts covering programming topics including mod_rewrite experiments, Thue compiler, M++ design, and discussions about asking questions.

Stupid Questions are Good for You

Posted June 23, 2013. The point of this post is that you shouldn't be afraid about asking stupid questions, and that you should never punish anyone for asking them. Because so-called stupid questions teach something to the ones that would answer it.

A lot of the Good Stupid questions come from stuff that the incumbent experts would consider obvious, but that is evidently not obvious to the one asking a question. Instead of rebuking the asker about how they failed to RTFM and do their own research, think of the question itself as a symptom of an underlying problem.

The very best stupid questions are the ones that expose fundamental misunderstandings of important core concepts. In other words, questions that you think are stupid point out things that you haven't made obvious. Stupid questions are information. Learn from that information and use it to make your code/organization/workflows/etc obvious enough that you stop getting stupid questions.

mod_rewrite revisited

Posted May 4, 2011. The basic problem is that for each request, Apache will never return any memory to the system - Apache expects trivial things such as interpreting turing-complete languages to complete quickly and without using more than a smidgeon of memory.

To get around this, I decided to change the run-time system to make a redirect for each step, i.e. sending an error back to the user-agent and tell it to make a completely new request to a different URL instead of making mod_rewrite loop on the Apache side until it's done. Apache allocates the memory for each of these requests separately, and its memory use stays bounded.

Thue mod_rewrite Compiler v2.0

The updated Thue to mod_rewrite compiler now includes all the RTS it needs. The bootstrapping part uses a 'q' to tell a bootstrapped program from an unstarted program instead of checking whether the slash was removed or not.

Testing it out

For obvious reasons I wouldn't want you to test this on my server, but if you want to set this up on your own server, setup should be very easy: set up a virtual host with the provided configuration and enable mod_rewrite.