Radiation-hardened quine
github.com
github.com
Here are the results up to 23 removals: http://i.imgur.com/PwWN7Z7.png
This reminds me of a work I did as an undergrad which landed in a paper called "Can a Program Reverse-Engineer Itself?". The idea is to take any program/function and make it a quine so you can retrieve its original code even if it has been obfuscated. You can find the paper here: http://pablo.rauzy.name/research.html#imacc11.
They are checking the two instances and rescuing the corrupted one. But how exactly it works is beyond me.
eval eval"[eval||=9,instance_eval||=9].max_by{|s|s.size}#"##"
See the max_by ... size partWe had a few similar tasks on CGSE, e.g.
1) it's still less likely - most of the data is almost certainly characters of content, not sizes;
2) it's unlikely to be robust against flipped bits in pointers in the rope structures (even if implemented as indexes);
and 3) there is no reason to expect it to be limited to one byte (if an addition or deletion happens, "more than one byte" is far more likely than "one byte").
My favorite part: "Ruby I terrible."
http://translate.google.com/translate?sl=auto&tl=en&js=n&pre...
Chinese would also drop the verb in this case, so I'm assuming they might do that in Japanese as well.
Also, the author is a contributor to ruby on github, so I doubt he is negative towards the language.
http://jisho.org/words?jap=%E6%81%90%E3%82%8D%E3%81%97%E3%81...
Japanese also uses a third writing system called kanji, also not an alphabet, whose name literally means "Han [Chinese] characters" in Japanese. Kanji are logographs, where one character represents one entire word or concept rather than sounds.
Most kanji are identical or very similar to modern Chinese characters and are readily intelligible to a Chinese reader, at least in a general sense, though some have diverged a bit.
Grammar is another matter entirely. Japanese is a language isolate, a language that is not related to any other known language. (Someone will reply that it's distantly related to Korean, but this is a fringe theory in linguistics that is not widely accepted.) Chinese and Japanese are not grammatically related at all, and any similarity between their syntaxes is coincidental.
Do any languages have an alphabet according to this definition?
While you're correct that the Japanese writing system is not an alphabet, I feel like your definition here is so vague it almost contradicts your point. After all, each kana character has a much closer correspondence with a particular "sound" than many actual alphabets.
So to clarify, the characters of an alphabet (notionally) correspond to particular phonemes.
When using some strict definition of "related" (e.g. "neither language is a strict descendent of the other"), that may be true, but anybody that's studied both languages has probably noticed that there's an eery similarity between the two, even if it's merely the result of many centuries of cross-pollenization....
My own experience is not so great, I've only studied Korean a bit, but I did study it in Japanese (which I know fairly well), and the similarity made it a lot easier, because so many things corresponded 1-to-1... However Korean friends that are fluent in Japanese constantly rave about how easy it was for them to learn, not just because of the huge amount of shared Chinese-derivative vocabulary (many words are completely identical, with formulaic changes in pronunciation), but because the whole structure of grammar, sentence/conversation-planning, idioms, etc, is so similar that a huge proportion of their Korean instincts pretty much just work as-is in Japanese.
Spoken Japanese and Chinese have little to no relation, except for Chinese words imported into Japanese.
Hiragana, however, is derived from Chinese characters thousands of years ago. The Chinese characters were used in Japanese writing to write words phonetically.
"I didn't really think I'd be able to write this [program], but somehow I was able too. Ruby is scary, isn't it? I wonder if you could write this in another language?"
https://en.wikipedia.org/wiki/Reed–Solomon_error_correction
Or to top that, imagine a computer where the entire memory space, perhaps shared with persistent flash memory, was encoded in this manner, so that even the filesystem was protected against bit flips.
When I was doing Mac repair a few years back, the majority of the PowerMac G5s that came through the doors died premature deaths for two reasons: the ram was in a bad spot which caused the board to bend and crack on insertion, and the ram was non-ECC so it was notoriously difficult to isolate a bad ram chip. It was the most unreliable Mac I ever diagnosed, by perhaps an order of magnitude.
Contrast that with the Mac Pro, which used ECC and was so much more reliable that I don't remember seeing a single Mac Pro fail in the 3 years I was there.
Imagine how stable a Reed–Solomon computer would be..
A while back, after losing some personal photographs to bit rot, I became curious about this and did some experimentation with RS. The biggest drawback I found was that even with a relatively fast processor it is slow compared to typical disk read/write speeds. I concluded that the ZFS approach of RAID + checksums would be preferable.
The downside is that all those checks are slow.
Even if you're not into hardware it's worth a look, lots of cool tips.
$ git clone the_quine
$ cd the_quine
$ ruby the_quine
The program 'ruby' can be found in the following packages:
* ruby1.8
* ruby1.9.1
# shit I don't have ruby
$ sudo apt-get install ruby1.9.1
# 200 bytes/s, terrible
# ... what's going on? Ah finally.
$ touch output
$ ruby rbquine.rb > output
$ diff rbquine.rb output
# nowtWe have a few crashes that I can't figure out (but am putting in the test suite).
how about a real native app with instructions? i'd never expect something as high level and wooly as ruby in systems that will be exposed to radiation. that's just asking for failure imo... how robust is the interpreter for instance?
So yeah, even if you don't go into space or inside a nuclear reactor software can be written to tolerate a lot of harware failures.
this is the primary reason afaik for things like ecc and encasing your hardware in boro-silicate glass...