Quines, which are programs that generate their own code as part or all of their output are a neat idea for a programming puzzle. However, do they have any use beyond that?
The only time I ever heard of any practical use for quines is when Ken Thompson used it to hide a Trojan horse in the Unix login program.
The Trojan consisted of something like
if (login == "Trojan") login(); (more probably written in proper C), but something like that would be too obvious in the code. So what he did was to embed it in a quine and hide it in the binaries of the C compiler.
The quine's self replicating properties were enough to ensure that even though there was no trace of this backdoor in any source code, it would effectively compile every time a C compiler would come across a Unix login() function.
I guess clearer explications could come from reading the paper. It's a good paper.
A quine was used to seed Tierra, a digital organism simulator, and life then evolved from it. The quine was used because it guaranteed that the first generation would produce viable offspring.
The evolution led to many interesting results, including parasitic and symbiotic life forms, and even meta-parasites. Might that be considered 'useful'?
After some Googling, the surprising answer is that there is at least some theoretical academic effort to use them to make code self repairing, apparently.
One of my search terms was "genetic programming", if anyone wants to look further - it's the only potentially useful related programming area I could think of.
EDIT - Just found the use of Quines in an English outline of a Mathematical proof (Ron Maimon's answer) of Godel's Theorem.
I've used Quine-like techniques in web pages in the past. Mind you, this was in 1998-99...