@ircmaxell's blog: The Power of Technical Debt http://t.co/5VQ4qwwu
@ircmaxell's blog: The Power of Technical Debt http://t.co/5VQ4qwwu
I recently started transitioning all of the websites under my management from Apache to nginx (mainly to ease running my Python webapps via gunicorn, but that is another story).
Since nginx will not directly execute PHP (via either CGI or nginx-managed FastCGI), the first step was to get PHP running at all. I opted to run php-cgi via daemontools; my initial run script was fairly straight forward:
1 2 | #!/usr/bin/env bash exec php-cgi -b 127.0.0.1:9000 |
Couple this with a (relatively) straight forward nginx configuration and the sites will already start responding:
server {
listen 80;
server_name example.com
root /var/www/example.com/httpdocs;
index index.php index.html;
fastcgi_index index.php;
location ~ \.php {
keepalive_timeout 0;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$uri;
fastcgi_pass 127.0.0.1:9000;
}
}
The tricky part came when I wanted to run PHP under the user who owned the various sites. I could have (and perhaps should have) opted to spin up a copy of php-cgi for each user, but I decided to try something a little sneakier; PHP will set its own UID on each request.
I'm writing #PHP for the first time in a few years (for some @Wordpress plugins); I feel a little conflicted about this.
Until very recently, the URLs for individual blog posts on this site looked something like:
http://mikeboers.com/blog/601/friendlier-and-safe-blog-post-urls
The 601 is the ID of this post in the site's database. I have always had two issues with this:
What they would ideally look like is:
http://mikeboers.com/blog/friendlier-and-safe-blog-post-urls
But since I tend to quickly get a new post up and then edit it a dozen times before I am satisfied (including the title) the URL would not be stable, and implementations I have seen in other blog platforms would force the URL to retain the original title of the post, not the current title.
So I have come up with something more flexible that gives me URLs very similar to what I want, but allow for (relatively) safe changes in the title of the post (and therefore the URL).
I just re-read part of this classic CS paper (PDF), and the figure captions at the back stood out to me as being particularly hilarious:
Figure 1: The Ultimate Laptop
The ‘ultimate laptop’ is a computer with a mass of one kilogram and a volume of one liter, operating at the fundamental limits of speed and memory capacity fixed by physics. [...] Although its computational machinery is in fact in a highly specified physical state with zero entropy, while it performs a computation that uses all its resources of energy and memory space it appears to an outside observer to be in a thermal state at approx. \( 10^9 \) degrees Kelvin. The ultimate laptop looks like a small piece of the Big Bang.
Figure 2: Computing at the Black-Hole Limit
The rate at which the components of a computer can communicate is limited by the speed of light. In the ultimate laptop, each bit can flip approx. \( 10^{19} \) times per second, while the time to communicate from one side of the one liter computer to the other is on the order of 10^9 seconds: the ultimate laptop is highly parallel. The computation can be sped up and made more serial by compressing the computer. But no computer can be compressed to smaller than its Schwarzschild radius without becoming a black hole. A one-kilogram computer that has been compressed to the black hole limit of \( R_S = \frac{2Gm}{c^2} = 1.485 \times 10^{−27} \) meters can perform \( 5.4258 \times 10^{50} \) operations per second on its \( I = 4\pi\frac{Gm2}{ln(2hc)} = 3.827 \times 10^{16} \) bits. At the black-hole limit, computation is fully serial: the time it takes to flip a bit and the time it takes a signal to communicate around the horizon of the hole are the same.
After a year to ask the right person, @w00tDude confirmed my theory about "wobbles" (a technical term) seen while lighting The Borgias. Thx!
I've recently been toying with the Gooch et al. (1998) non-photorealistic lighting model. Unfortunately, the nature of the project does not permit me to post any of the "real" results quite yet, but some of the tests have a nice look to them all on their own.
My implementation takes a normal map and colour map, e.g.:


This is the result from those inputs:
