text:
Crash (i.e. cause the interpreter to stop working and force close) Python
I would like to see who can make Python have a fatal crash with the most creative code. This means that when the program runs, Windows for example, will take over and pop up with something like “IDLE has stopped working”, or Linux will do whatever Linux does when a program crashes.
Rules:

This must be made in Python 2.7 or above (So old bugs aren't exploited that have been fixed in future versions of Python).
The definition of "crash" is "make IDLE or Python exit in an unintended way." This does not mean "make IDLE or Python halt and give a traceback". This also means exit, sys.quit, abort etc are not valid answers. For example, this will not be accepted:
import sys
try:
     print c # Crashes Here, as c is not defined.
 except NameError, SyntaxError:
     print "Oh No!"
     sys.exit()

Making Python stop responding is not accepted.
The code must be explained on what it does to crash. A link to a bug report is fine.

The most upvoted answer after 10 days wins!
Begin!!
EDIT:
May I make it clear that the objective is not to make Python just halt executing the program with a traceback. The objective is to make Python completely crash or stop working. This means that if this task is successfully accomplished, Windows would give this (I'm not crashing Word here, it's just an example of what should happen for a different program):

or this:

The tag [tag:code-challenge] requires an objective winning criterion. I think most creative isn't objective enough...

Ok - Ill change it to as short as possible, like most other challenges.. Creative is quite ambiguous actually...

@GeorgeH If creative is what you were looking for, [tag:popularity-contest] works perfectly. I personally feel that this would be best as a popularity contest. In the future, you can run your question through the sandbox where these kinks can be worked out before posting.

And its a lot clearer this time too (Does this question have the most edits  ever now!!)

@People with High Rep, my prnt in the question is intentional.

prnt doesn't make Python crash, it makes it raise a SyntaxError. So the comment in your example code is wrong.

Fixed now. Fixed print and changed it to C

I'm voting to close this question as off-topic because this question asks for malicious code.

Should have been a code-golfing contest ;) - I guess the creativity is the statement the code makes: "I just don't know what's happening here..."
Copy and paste the following character in IDLE running on Windows:

The crash has something to do with the character being encoded as UTF-16 by Windows and the unsuccessful conversion to a UTF-8 character by IDLE...
Edit: python bug #13153

I'm not sure if this is really a valid answer. The question says "when the program runs". But here the program is never really run. IDLE crashes when you merely paste the ``, before you can even run it.

Yeah, I have to agree with @Sebastian. In a Python program you start with a text file and run the Python interpreter on it, but it shouldn't matter how you make the text file.

Um... http://puu.sh/7eVar.png

It works on Mac too!

ctypes abuse:
import ctypes;ctypes.string_at(1)

This casts 1 to an address and dereferences it. On any sane system (i.e. one on which 0x00000001 is not a mapped address), this will segfault instantly.

On my machine, this doesn't seem to crash the interpreter. A traceback with a WindowsError error is displayed.

@Dhara: Ah, that would be ctypes' structured exception handler catching the crash. I am certain you can crash Python with ctypes in Windows in some other way, but perhaps not in so few characters.

60
import sys
sys.setrecursionlimit(1<<30)
f=lambda f:f(f)
f(f)

Not my own idea. Copied from the Python Wiki here.
This causes an infinite recursion, and is not stopped by the interpreter because we changed the recursion limit.

Thanks - this is a great answer, but for the wrong question! The objective has not been clarified in the question. Thanks for your answer though.

@George H Sorry I'm not using a Windows machine now, but isn't a segmentation fault that causes the python interpreter to dump core enough? http://i.imgur.com/5gSGBpr.png

signal abuse (non-Windows only):
import os;os.kill(0,4)

On most systems (on which SIGILL = 4) this will kill Python with an "illegal instruction" error.
Or you can kill the program using the killer alarm clock:
import signal;signal.alarm(1)

After one second, Python dies with the cryptic message "Alarm clock".

Other single character signal codes that work include 1, 3, 5, 6, 8 and 9.

In Python 3.3:
exec(type((lambda:0).__code__)(0,1,0,0,0,b'',(),(),(),'','',1,b''))

In Python 2.7 code objects are slightly different:
exec type((lambda:0).func_code)(0,1,0,0,'Q',(),(),(),'','',0,'')

Yes, you can pass any old rubbish to the byte code interpreter and it executes it (Python issue #17187).

Shorter (Python 2.x): exec type((lambda:0).func_code)(0,1,0,0,'Q',(),(),(),'','',0,'')

Thanks! And in Python 3 we can use .__code__.

Recursive iterators use the C stack, not the Python stack (issue #14010 and issue #14507):
i=''
for _ in range(9**6):i=filter(int,i)
del i

This doesn't crash Python 2.7.11 on my Mac, but it does crash Python 3.5.1.

One easy way to crash the interpreter is to trick it into deallocating None:
import ctypes, sys
(ctypes.c_char*4).from_address(id(None))[:] = '\0'*4

As a bonus, here's a clever way to segfault Python 2:
import ctypes, struct, sys
inner = ()
outer = (inner,)
c_outer = (ctypes.c_char * sys.getsizeof(outer)).from_address(id(outer))
inner_index = c_outer[:].find(struct.pack('P', id(inner)))
c_outer[inner_index:inner_index+struct.calcsize('P')] = struct.pack('P', id(outer))
print outer

What exactly this does is left as an exercise to the reader.

First one: set refcount of None to zero, causing it to be deallocated hilariously. Second one: construct and print a self-referencing tuple.

Someone thought they could prevent new FlagsType objects from being created by setting FlagsType.tp_new = NULL, but they forgot to remove the method (issue #13204):
import sys
t=type(sys.flags)
t.__new__(t)

(sys.version_info has the same bug.)

Use of alloca in ctypes module (issue #13096):
from ctypes import *
POINTER('a'*9**8)

One possible way which crashes my Python with MemoryError:
x=[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]

This doesnt work for me - it just makes Python halt with a MemoryError. It needs to be closed by the OS.

Huh. The error happens at a surprisingly shallow depth.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Determining part of speech of most words
Write a program to output the part of speech of any word inputted to it.  I doubt that anyone could get a perfect algorithm, so I will give the code a batch of words in order to ascertain what algorithm is the best.
Weighted Scoring:
+10pts for each word identified correctly: http://www.englishclub.com/grammar/parts-of-speech_1.htm (out of 100 randomly selected words)
-1pt for each byte
+5pts for each upvote on your answer
Rules:
no using external resources (unless they are counted in the size)
UPDATE: Due to the need for a standardized word list for testing purposes, I will be using the list provided in the response to this question. http://www-personal.umich.edu/~jlawler/wordlist  It seems to be a fairly complete list, and will make this a challenge more than a guessing game.

"+style points (tie-breakers, mostly.)" How are these determined? "no golfscript or other languages designed for code golf." Why not?

and they are gone.  now that I think of it, the chance of a tie is so astronomically small that it is irrelevant.  As to golfscript,

What's wrong with GolfScript? How do you determine "languages designed for code golf"?

Why block GolfScript &c.?

There is always the sandbox for your future questions: http://meta.codegolf.stackexchange.com/questions/954/proposed-questions-sandbox-mark-viii?cb=1

fine, use golfscript...  I was just hoping to have answers that resemble program code more than machine code...  Evidently, people around here love their golfscript just as much as I don't.

Seems good now, although somebody will probably find some way to abuse it.

"(out of 10 randomly selected words)": Randomly selected from what set?

His scoring is alright, the answer with the most point wins.

@SampritiPanda Oh, sorry, somehow I got confused.

I believe this is near impossible: http://programmers.stackexchange.com/a/133789/115106

Don't lose points for incorrectly identifying it so always printing 'verb' should give a decent score

Does the target language need to be English? Certain "more logically structured" languages, such as German, would be quite a bit easier.

@primo, German, or especially Latin, would be easier.  It is called a challenge for a reason.

@DavidCarraher, I will pull them from the English language.  Probably from some news articles, as those cannot be predicted as easily as other things.

@StackTracer It may be better to use 1000 randomly selected words, granting one point each, rather than 10 words each worth 100.

@SampritiPanda, an exact, perfect solution is more or less impossible.  a "best-guess" type scenario (not perfect) seems quite possible.

@primo, good idea.  Increase Sample Size.  And so it is done.

Should it be case sensitive and use punctuation? In that case, interjections would be pretty simple to find

This isn't a spec: it's an invitation to write a mind-reading program.

You really need to add the list of test words to the spec. Prior knowledge of the test cases is not problematic if they are sufficiently diverse to thoroughly cover the problem domain. Moreover, you really need to decide what kind of challenge this is. A popularity contest is decided by upvotes, not by a scoring system you dictate. If you're dictating a scoring system that includes upvotes as part of the formula, it is still not a popularity contest.

Mathematica
Mathematica has a native database of words (called up by the simple command WordData ) that includes, among other properties, the parts of speech.  Without this database, it would be impossible for me to answer the question.
The word list from here was downloaded.
Once stored, it is called up as follows:
words = Import["wordlist.txt", "Table"];
Length[words]

69905

Forty words are randomly chosen from the list:
list = Flatten@RandomSample[words, 40]

{"mealtime", "deride", "cricketground", "torpedinidae", "rosefish",
  "akron", "sloppy", "deaden", "assaultive", "mick",
  "unperceptiveness", "skeg", "pad", "mane", "carvel-built",
  "night-stop", "monarchy", "corking", "backlog", "scaphopoda",
  "bagman", "phrthe", "wholesome", "proprietress", "hortus",
  "unreliable", "farthermost", "fearfulness", "malposed", "stoke",
  "affiche", "lunatic", "holcus", "devoutness", "macaque", "zenithal",
  "poetry", "precipitate", "agoraphobic", "snapper"}

The following asks Mathematica to return the parts of speech for the list of 40 words.
The parts of 31 words are identified. 9 words are not recognized.
(s = Select[Flatten@{{#}, WordData[#, "PartsOfSpeech"]} & /@
     list, ! MatchQ[#, {_, WordData[_, _]}] &]) // TableForm
Length[s]

Seems like cheating, using an internal dictionary..

I agree. But it is essentially impossible to determine the part of speech of a word by raw computing power. Some sort of database is required.

"no using external resources (unless they are counted in the size)" What's your score? -1,000,000?

It was't an external resource. And the word list did not contain information about parts of speech.  It was used because the OP did not provide words to use as test cases.

This is currently the best solution.  I do admit that I was hoping for something less cheaty than a database lookup, but there is no rule against it.  I could see a way to do it based on word structure, but that gets rather fuzzy due to the nature of english.

I understand your misgivings about the approach. I share them. The only alternative I see to a database-lookup is to create one's own database. That is a challenge that few people are skilled and motivated enough to undertake.

This compares unfavorably with the "always return verb" approach.  A heuristic's the way to go for this.  (I'd post "always return verb" as an answer, but the question's closed.)

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Implement the game of life in 3D
The challenge is to find the shortest implementation of the game of life in 3D (example). These are the rules:
Cells (in this case, cubes) with only 1 or less neighbours die, as if by lonliness.
If exactly 5 cells surround an empty cell, they breed and fill it.
If a cell has 8 or more neighbours, it dies from overcrowding.
Make it at least a 10x10x10, where the layers are outputted individually like this:
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 X 0 0 X 0 0 0 0 0
0 0 X X X 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0

Of course, a graphic 3D simulation is also accepted
The starting position may be hardcoded but it must work if it is changed to any starting position. It must be able to calculate any amount of generations, and the user must be able to manually ask for the next generation.
Shortest code in characters wins!
I made my own implementation of this for any (cube) size: http://jensrenders.site88.net/life3D.htm
You can use this to test, and you can base your code on mine, although I didn't comment it.

Implied the code-golf tag from your statement find the shortest implementation. Please check if it is what you want. You should also give some details about how to input, how many cycles, animated yes/no, ... because it is essential for code-golf to have a robust specification.

@Howard I added some more specifications, and yes, forgot the code-golf tag ;) thanks for that.

@PeterTaylor Yes exactly 5, i'll edit it.

I would add specifics about the output format (e.g. each cell must be separated by a space as in your example, one newline between each grid layer of the output, living and dead cells must be represented by different characters, and those must be visible characters.) Also, bear in mind that if framed as code-golf, you are unlikely to get graphic simulations.

Did you really mean to forbid all loopholes discussed in that meta thread, or only those meeting the (dis)approval criteria (+5 score, at least twice as many upvotes as downvotes)? Because I'm sure I could totally think of some pretty interesting "loopholes" to discuss... ;-)

Can we get a test case please? Maybe using a smaller size, like 4x4x4, if you don't want to post 2kB of data inline.

I appreciate the online implementation, but I can't get it to work :-(

@Tobia I should say I only tested in google chrome...
And you have to change the 0's by X's (capital X)

Link is down... :/

I'd like to see a popcon version of this challenge.

Mathematica - 120 bytes
g=CellularAutomaton[{(l=Flatten@#;c=l[[14]];n=Total@Drop[l,{14}];Which[n<2||n>7,0,n==5||c==1,1,0<1,0])&,{},{1,1,1}},##]&

Certainly not a contender for the win, but that was not my intention. Also, this could probably be golfed down significantly by just figuring out the rule number. I just really wanted to write a visualisation (although I'm actually sure there are already tons out there). So here we go):
animateGol3d[size_, i_, n_] :=
  ListAnimate[
    Graphics3D[
      Cuboid /@ Position[#, 1],
      PlotRange -> {{0, size}, {0, size}, {0, size}} + 1
    ] & /@ g[i, n]
  ];

And after experimenting with a bunch of initial conditions, I got things like the following:

And here is one with a grid size of 20x20x20. This took a few seconds to simulate and render:

By the way, this assumes periodic boundary conditions.

Are those really entering a equilibrium state, or it's just the animation stopping? If the former, you gave me some neat ideas...

@Kroltan It's been a while, but I'm pretty sure they were reaching equilibrium.

Nice, thanks. Individual slices of the equilibrium look very room-map-y for say, a rougelike game.

APL, 46
It took me some time, but I got it down to 46 chars:
{(5=m)∨⍵∧3>|5.5-m←⊃+/,i∘.⌽i∘.⊖(i←2-⍳3)⌽[2]¨⊂⍵}

This is a function that takes a boolean 3D matrix of any size and computes the next generation, according to the given rules. Boundary conditions were not specified, so I chose to wrap around the other side, as in toroidal space.
Explanation
{                           ⊂⍵}   Take the argument matrix and enclose it in a scalar
               (i←2-⍳3)           Prepare an array with values -1 0 1 and call it i
                       ⌽[2]¨      Shift the matrix along the 2nd dim. by each of -1 0 1
           i∘.⊖                   Then for each result do the same along the 1st dimension
       i∘.⌽                       And for each result again along the 3rd dimension
 m←⊃+/,                           Sum element-wise all 27 shifted matrices and call it m

The intermediate result m is a matrix with the same shape as the original matrix, which counts for each element how many cells are alive in its 3×3×3 neighbourhood, including itself. Then:
           |5.5-m   For each element (x) in m, take its distance from 5.5
       ⍵∧3>         If that distance is <3 (which means 3≤x≤8) and the original cell was 1,
 (5=m)∨             or if the element of m is 5, then the next generation cell will be 1.

Example
Define a random 4×4×4 matrix with about 1/3 cells = 1 and compute its 1st and 2nd generation. The ⊂[2 3] at the front is just a trick to print the planes horizontally instead of vertically:
      ⊂[2 3] m←1=?4 4 4⍴3
 1 0 0 0  1 0 1 0  1 0 1 0  0 0 0 1
 1 1 0 0  0 0 0 0  0 0 0 1  1 0 1 0
 0 0 0 0  0 1 0 0  0 0 0 0  0 0 1 0
 1 1 0 0  0 0 0 1  1 0 0 1  0 0 1 0
      ⊂[2 3] {(5=m)∨⍵∧3>|5.5-m←⊃+/,i∘.⌽i∘.⊖(i←2-⍳3)⌽[2]¨⊂⍵} m
 0 0 0 0  0 0 1 0  1 0 1 0  0 0 0 0
 1 0 0 0  0 0 1 0  0 0 0 0  1 0 1 0
 0 0 0 0  0 1 0 0  0 0 0 0  0 0 1 0
 1 1 0 0  0 0 0 0  1 0 0 0  0 0 1 0
      ⊂[2 3] {(5=m)∨⍵∧3>|5.5-m←⊃+/,i∘.⌽i∘.⊖(i←2-⍳3)⌽[2]¨⊂⍵}⍣2⊢ m
 0 0 1 0  1 0 1 0  1 0 1 0  0 0 0 0
 1 0 1 0  0 0 1 1  0 0 0 0  1 0 1 0
 1 0 0 0  1 1 0 0  0 0 1 0  1 0 1 0
 1 1 1 0  1 0 0 1  1 0 1 0  0 0 1 0

+1 Very nice answer! and indeed, boundaries were not specified so wrap around is allowed.

J - 42 char
We are assuming a toroidal board (wraps around) in all three dimensions. J's automatic display of results appears to follow the output spec, using 1 for live cells and 0 for dead. This code works on boards of any width, length, and height (can be 10x10x10, 4x5x6, and so on).
(((1&<*<&8)@-*]+.5=-)~[:+/(,{3#<i:1)|.&><)

An explanation follows:

,{3#<i:1 - Subexpression of the list of offsets for the cell and all its neighbours.

<i:1 - The list of integers between 1 and -1 inclusive.
,{3# - Make three copies of the list (3#), and take the Cartesian product (,{).

(,{3#<i:1)|.&>< - For each set of 3D offsets, shift the array. At a cost of 3 characters, you can change |.&> to |.!.0&> to not have wrap-around.
[:+/ - Sum the all the shifted boards together.
((1&<*<&8)@-*]+.5=-)~ - The long outer verb was a hook so it receives the board on the left and the right, and the side on the right we've been shifting and summing. The ~ swaps this around for this inner verb.

5=- - 1 in each cell that the sum-of-shifted-boards minus the original board (i.e. the neighbour count) equals 5, and 0 in all others.
]+. - Logical OR the above with the original board.
(1&<*<&8) - 1 if the number being compared between 1 and 8 exclusive, 0 otherwise.
(1&<*<&8)@-* - Compare (as above) the neighbour count, and multiply (i.e. logical AND when the domain is only 1 or 0) the logical OR result by this.

Usage is as with the APL, just apply the function to the initial board for each step. J has a functional-power operator ^: to make this easy.
   life =: (((1&<*<&8)@-*]+.5=-)~[:+/(,{3#<i:1)|.&><)  NB. for convenience
   board =: 1 = ?. 4 4 4 $ 4  NB. "random" 4x4x4 board with approx 1/4 ones
   <"2 board  NB. we box each 2D plane for easier viewing
+-------+-------+-------+-------+
|0 0 0 0|1 1 0 0|0 1 0 0|0 0 1 0|
|0 1 0 0|0 0 0 0|0 0 0 1|1 0 0 0|
|0 0 0 0|0 0 1 0|0 1 0 0|0 0 0 1|
|1 1 0 0|1 0 0 0|0 0 0 1|0 1 1 0|
+-------+-------+-------+-------+
   <"2 life board
+-------+-------+-------+-------+
|0 0 0 0|0 1 0 1|0 1 0 0|0 0 1 0|
|1 1 1 1|0 0 0 0|0 0 0 1|1 1 0 0|
|0 0 0 0|0 0 1 1|0 1 0 0|0 0 0 1|
|1 0 0 0|1 0 0 1|0 0 0 1|0 1 1 1|
+-------+-------+-------+-------+
   <"2 life^:2 board  NB. two steps
+-------+-------+-------+-------+
|0 0 0 0|0 1 0 0|0 1 0 0|0 0 0 0|
|0 1 0 0|0 0 0 0|0 0 0 1|0 1 0 0|
|0 0 0 0|0 0 0 0|0 1 0 0|0 0 0 0|
|0 0 0 0|0 0 0 1|0 0 0 0|0 1 1 1|
+-------+-------+-------+-------+
   <"2 life^:3 board  NB. etc
+-------+-------+-------+-------+
|0 1 0 0|1 1 1 0|0 1 0 0|0 1 0 0|
|0 1 0 0|1 0 1 0|1 0 1 0|1 1 1 0|
|1 0 0 0|0 0 0 0|0 1 0 0|0 1 0 0|
|0 0 1 0|0 0 0 0|0 1 0 0|0 1 1 0|
+-------+-------+-------+-------+

I say "random" because the ?. primitive gives reproducible random results by using a fixed seed every time. ? is the true RNG.

Curse J and its foul |. verb!! Good job.


text:
Parallel projected voxel terrain generator
Your job is to generate a heightmap and show it as a parallel projected, voxel landscape. The rules are the following:

The (heightmap of the) landscape has to be randomly generated
You also have to describe how the algorithm you are using works, so everyone can learn something new here
You have to also either generate an image or display the generated landscape on the screen
The resulting image has to be paralell projected (so not perspective), and it can only contain voxels (so it has to be made out of small boxes)
This is a popularity contest, so you might want to add some additional features to your program to get more upvotes.
The winner is the most upvoted valid answer 7 days after the last valid submission. All valid submissions need to follow the rules, including the description of the used algorithm. You can add additional features which do not follow some of the rules (like adding a perspective mode), but in this case they have to be optional features (e.g. when turning them off the result should follow all of the rules)
My submission doesn't count as valid.

An example result image is the following:

Image taken from here
If you need some algorithms check here

Minecraft esque rendered cubes does not equal voxels. Also is true isometric projection required, or is the the word used loosely as is common in games http://en.wikipedia.org/wiki/Video_games_with_isometric_graphics

@shiona: The description of the topic was changed a few days ago to say paralell projected, so anything non-perspective should count. As for voxels: I think minecraftesqe cubes are valid in terms of being voxels: they can be considered huge pixels on a large 3D grid.

No, Minecraftesque cubes are not voxels, because voxels are not cubes, just like how pixels are not squares. http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.79.9093

I agree with @Pseudonym sort of. I think it is valid though if you want them to be cubes. It does eliminate pretty much every other voxel rasterization technique though.

Python2 3D Function Plotter Voxel Edition
This is my entry in this competition:
import math
import random
import Image

terrain=""
randA=(random.random()*4+5)
randB=(random.random()*4+10)
randC=(random.random()*4+1)
randD=(random.random()*4+1)
im = Image.new("RGBA", (1248, 1000), "black")
tile=[Image.open("voxel/1.png"),Image.open("voxel/2.png"),Image.open("voxel/3.png"),Image.open("voxel/4.png"),Image.open("voxel/5.png"),Image.open("voxel/6.png"),Image.open("voxel/7.png"),Image.open("voxel/8.png"),Image.open("voxel/9.png")]

for y in range (-40,40):
        for x in range (-10, 10):
                val=int(1+abs(4+2.5*(math.sin(1/randA*x+randC)+math.sin(1/randB*y+randD))))
                if (val<9):
                        terrain+=str(val)
                else:
                        terrain+="9"
print terrain

for i in range (0,80*20):
        if((i/20)%2==0):
                shift=0
        else:
                shift=-32
        im.paste(tile[int(terrain[i])-1],((i%20)*64+shift,((i/20)*16-(32*(int(terrain[i])-1)))-32),tile[int(terrain[i])-1])

im.show()

As clearly stated in the title it works as a 3D function plotter, but since this competition requires the terrain to be randomly generated it this random sine function 1.5*(math.sin(1/randA*x+randC)+math.sin(1/randB*y+randD)) That depends on 4 random variables. This creates terrains like this:

We can ofcourse replace this random function by any 2 variable function, for example sin(sqrt((x/2)²+(y/2)²))*3 gives this terrain:

and -x*y*e^(-x^2-y^2) gives this:

(the plots on the right are computed by wolfram alpha)
And while we're at it, Riemann zeta along the critical strip:

For the people who aren't familiar with it, as you can see these pools of water (wich represent the zero's of the function) all lie on a straight line (real part = 0.5). If you can prove this, you will get $1000000! See this link.
I hope you like it!

Hi Jens, nice plots! I was wondering where you got the voxel images from ?

I don't exactly remember where, I did a gogle images search and edited with paint

C#, WPF
I have experimented with a random walk, which works better than I had anticipated. I start somewhere on the map, walk to a random adjacent tile and increment its height value, then move to the next and so on. This is repeated thousands of times and eventually leads to a height map like this (100 x 100):

Then, I "discretize" the map, reduce the number of values to the given height levels and assign terrain/color based on that height:

More similar archipelago-like terrains:

Increased number of random steps and height levels to get more mountainous terrain:

Code
Features: Recreate terrain with a button. Show 3D terrain and 2D map. Zooming (mouse wheel) and 3D scrolling (arrow keys). But it's not very performant - after all, this is written purely in WPF, not DirectX or OpenGL.
MainWindow.xaml:
<Window x:Class="VoxelTerrainGenerator.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Voxel Terrain Generator" Width="550" Height="280" KeyUp="Window_KeyUp">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>

        <Viewport3D x:Name="ViewPort" MouseWheel="ViewPort_MouseWheel">
            <Viewport3D.Camera>
                <OrthographicCamera x:Name="Camera" Position="-100,-100,150" LookDirection="1,1,-1" UpDirection="0,0,1" Width="150" />
                <!--<PerspectiveCamera x:Name="Camera" Position="-100,-100,150" LookDirection="1,1,-1" UpDirection="0,0,1" />-->
            </Viewport3D.Camera>
        </Viewport3D>

        <Grid Grid.Column="1" Margin="10">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>

            <Image Grid.Row="0" x:Name="TopViewImage"/>
            <Button Grid.Row="1" Margin="0 10 0 0" Click="Button_Click" Content="Generate Terrain" />
        </Grid>
    </Grid>
</Window>

MainWindow.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Input;
using System.Drawing;
using System.Drawing.Imaging;
using System.Windows.Media.Media3D;

namespace VoxelTerrainGenerator
{
    public partial class MainWindow : Window
    {
        const int RandomSteps = 20000;
        const int MapLengthX = 100;
        const int MapLengthY = 100;
        const int MaxX = MapLengthX - 1;
        const int MaxY = MapLengthY - 1;
        const bool ForceIntoBounds = true;
        readonly Random Random = new Random();

        readonly List<Color> ColorsByHeight = new List<Color>
        {
            Color.FromArgb(0, 0, 50),
            Color.FromArgb(170, 170, 20),
            Color.FromArgb(0, 150, 0),
            Color.FromArgb(0, 140, 0),
            Color.FromArgb(0, 130, 0),
            Color.FromArgb(0, 120, 0),
            Color.FromArgb(0, 110, 0),
            Color.FromArgb(100, 100, 100),
        };

        public MainWindow()
        {
            InitializeComponent();
            TopViewImage.Width = MapLengthX;
            TopViewImage.Height = MapLengthY;
        }

        public int[,] CreateRandomHeightMap()
        {
            var map = new int[MapLengthX, MapLengthY];

            int x = MapLengthX/2;
            int y = MapLengthY/2;

            for (int i = 0; i < RandomSteps; i++)
            {
                x += Random.Next(-1, 2);
                y += Random.Next(-1, 2);

                if (ForceIntoBounds)
                {
                    if (x < 0) x = 0;
                    if (x > MaxX) x = MaxX;
                    if (y < 0) y = 0;
                    if (y > MaxY) y = MaxY;
                }

                if (x >= 0 && x < MapLengthX && y >= 0 && y < MapLengthY)
                {
                    map[x, y]++;
                }
            }

            return map;
        }

        public int[,] Normalized(int[,] map, int newMax)
        {
            int max = map.Cast<int>().Max();
            float f = (float)newMax / (float)max;

            int[,] newMap = new int[MapLengthX, MapLengthY];
            for (int x = 0; x < MapLengthX; x++)
            {
                for (int y = 0; y < MapLengthY; y++)
                {
                    newMap[x, y] = (int)(map[x, y] * f);
                }
            }
            return newMap;
        }

        public Bitmap ToBitmap(int[,] map)
        {
            var bitmap = new Bitmap(MapLengthX, MapLengthY);
            for (int x = 0; x < MapLengthX; x++)
            {
                for (int y = 0; y < MapLengthY; y++)
                {
                    int height = map[x, y];
                    if (height > 255)
                    {
                        height = 255;
                    }
                    var color = Color.FromArgb(255, height, height, height);
                    bitmap.SetPixel(x, y, color);
                }
            }
            return bitmap;
        }

        public Bitmap ToColorcodedBitmap(int[,] map)
        {
            int maxHeight = ColorsByHeight.Count-1;
            var bitmap = new Bitmap(MapLengthX, MapLengthY);
            for (int x = 0; x < MapLengthX; x++)
            {
                for (int y = 0; y < MapLengthY; y++)
                {
                    int height = map[x, y];
                    if (height > maxHeight)
                    {
                        height = maxHeight;
                    }
                    bitmap.SetPixel(x, y, ColorsByHeight[height]);
                }
            }
            return bitmap;
        }

        private void ShowTopView(int[,] map)
        {
            using (var memory = new System.IO.MemoryStream())
            {
                ToColorcodedBitmap(map).Save(memory, ImageFormat.Png);
                memory.Position = 0;
                var bitmapImage = new System.Windows.Media.Imaging.BitmapImage();
                bitmapImage.BeginInit();
                bitmapImage.StreamSource = memory;
                bitmapImage.CacheOption = System.Windows.Media.Imaging.BitmapCacheOption.OnLoad;
                bitmapImage.EndInit();
                TopViewImage.Source = bitmapImage;
            }
        }

        private void Show3DView(int[,] map)
        {
            ViewPort.Children.Clear();

            var light1 = new AmbientLight(System.Windows.Media.Color.FromArgb(255, 75, 75, 75));
            var lightElement1 = new ModelUIElement3D();
            lightElement1.Model = light1;
            ViewPort.Children.Add(lightElement1);

            var light2 = new DirectionalLight(
                System.Windows.Media.Color.FromArgb(255, 200, 200, 200),
                new Vector3D(0, 1, -0.1));
            var lightElement2 = new ModelUIElement3D();
            lightElement2.Model = light2;
            ViewPort.Children.Add(lightElement2);

            for (int x = 0; x < MapLengthX; x++)
            {
                for (int y = 0; y < MapLengthY; y++)
                {
                    int height = map[x, MapLengthY-y-1];
                    for (int h = 0; h <= height; h++)
                    {
                        Color color = ColorsByHeight[h];
                        if (height > 0 && h == 0)
                        {
                            // No water under sand
                            color = ColorsByHeight[1];
                        }

                        ViewPort.Children.Add(CreateCube(x, y, h, 1,
                            System.Windows.Media.Color.FromArgb(255, color.R, color.G, color.B)));
                    }
                }
            }
        }

        private ModelVisual3D CreateCube(int x, int y, int z, int length,
            System.Windows.Media.Color color)
        {
            List<Point3D> positions = new List<Point3D>()
            {
                new Point3D(x, y, z),
                new Point3D(x + length, y, z),
                new Point3D(x + length, y + length, z),
                new Point3D(x, y + length, z),
                new Point3D(x, y, z + length),
                new Point3D(x + length, y, z + length),
                new Point3D(x + length, y + length, z + length),
                new Point3D(x, y + length, z + length),
            };

            List<List<int>> quads = new List<List<int>>
            {
                new List<int> {3,2,1,0},
                new List<int> {0,1,5,4},
                new List<int> {2,6,5,1},
                new List<int> {3,7,6,2},
                new List<int> {3,0,4,7},
                new List<int> {4,5,6,7},
            };

            double halfLength = (double)length / 2.0;
            Point3D cubeCenter = new Point3D(x + halfLength, y + halfLength, z + halfLength);
            var mesh = new MeshGeometry3D();
            foreach (List<int> quad in quads)
            {
                int indexOffset = mesh.Positions.Count;
                mesh.Positions.Add(positions[quad[0]]);
                mesh.Positions.Add(positions[quad[1]]);
                mesh.Positions.Add(positions[quad[2]]);
                mesh.Positions.Add(positions[quad[3]]);

                mesh.TriangleIndices.Add(indexOffset);
                mesh.TriangleIndices.Add(indexOffset+1);
                mesh.TriangleIndices.Add(indexOffset+2);
                mesh.TriangleIndices.Add(indexOffset+2);
                mesh.TriangleIndices.Add(indexOffset+3);
                mesh.TriangleIndices.Add(indexOffset);

                double centroidX = quad.Select(v => mesh.Positions[v].X).Sum() / 4.0;
                double centroidY = quad.Select(v => mesh.Positions[v].Y).Sum() / 4.0;
                double centroidZ = quad.Select(v => mesh.Positions[v].Z).Sum() / 4.0;
                Vector3D normal = new Vector3D(
                    centroidX - cubeCenter.X,
                    centroidY - cubeCenter.Y,
                    centroidZ - cubeCenter.Z);
                for (int i = 0; i < 4; i++)
                {
                    mesh.Normals.Add(normal);
                }
            }

            Material material = new DiffuseMaterial(new System.Windows.Media.SolidColorBrush(color));
            GeometryModel3D model = new GeometryModel3D(mesh, material);
            ModelVisual3D visual = new ModelVisual3D();
            visual.Content = model;
            return visual;
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            int[,] map = CreateRandomHeightMap();
            int[,] normalizedMap = (Normalized(map, ColorsByHeight.Count-1));

            ShowTopView(normalizedMap);
            Show3DView(normalizedMap);

            ToBitmap(Normalized(map, 255)).Save("heightmap-original.png");
            ToBitmap(Normalized(normalizedMap, 255)).Save("heightmap.png");
            ToColorcodedBitmap(normalizedMap).Save("terrainmap.png");
        }

        private void ViewPort_MouseWheel(object sender, MouseWheelEventArgs e)
        {
            // Zoom in or out
            Camera.Width -= (double)e.Delta / 100;
        }

        private void Window_KeyUp(object sender, KeyEventArgs e)
        {
            // Scrolling by moving the 3D camera
            double x = 0;
            double y = 0;
            if (e.Key == Key.Left)
            {
                x = +10;
                y = -10;
            }
            else if (e.Key == Key.Up)
            {
                x = -10;
                y = -10;
            }
            else if (e.Key == Key.Right)
            {
                x = -10;
                y = +10;
            }
            else if (e.Key == Key.Down)
            {
                x = +10;
                y = +10;
            }

            Point3D cameraPosition = new Point3D(
                Camera.Position.X + x,
                Camera.Position.Y + y,
                Camera.Position.Z);
            Camera.Position = cameraPosition;
        }
    }
}

Neat, but it might look better when you 'discretize' to include more buckets. Maybe only one or two more groupings? (Not necessary by any means! Still +1 from me.)

@Gaffi I have added more results, including more mountainous ones

JavaScript and Crafty.JS, to be much improved
Here's a sample output:

And here's the code (full webpage):
<!DOCTYPE html>
<html>
<head>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
    <script type="text/javascript" src="http://craftyjs.com/release/0.4.2/crafty-min.js"></script>
    <script type="text/javascript">

    $(document).ready(function() {
        Crafty.init();

        var tilesize = 20
        Crafty.sprite(20, "sprite.png#UPDATE", {
            grass1: [0,0,1,3],
            grass2: [1,0,1,3],
            grass3: [2,0,1,3],
            stone1: [3,0,1,3],
            stone2: [4,0,1,3]
        });

        genTerrainInit()
        while(1) {
            try { stepTerrainGen() }
            catch(e) { break }
        }

        iso = Crafty.isometric.init(20);
        var z = 0;
        for(var i = tdata.length - 1; i >= 0; i--) {
            for(var y = 0; y < tdata[i].length; y++) {
                var which = Math.max(0, Math.round(tdata[i][y]))
                var tile = Crafty.e("2D, DOM, "+["grass1", "grass2", "grass3", "stone1", "stone2"][which])
                .attr('z',i+1 * y+1)

                iso.place(i,y,0, tile);
            }
        }

        Crafty.addEvent(this, Crafty.stage.elem, "mousedown", function(e) {
            if(e.button > 1) return;
            var base = {x: e.clientX, y: e.clientY};

            function scroll(e) {
                var dx = base.x - e.clientX,
                    dy = base.y - e.clientY;
                    base = {x: e.clientX, y: e.clientY};
                Crafty.viewport.x -= dx;
                Crafty.viewport.y -= dy;
            };

            Crafty.addEvent(this, Crafty.stage.elem, "mousemove", scroll);
            Crafty.addEvent(this, Crafty.stage.elem, "mouseup", function() {
                Crafty.removeEvent(this, Crafty.stage.elem, "mousemove", scroll);
            });
        });
    });

    function genTerrainInit() {
        //Variables
        size = Math.pow(2, 6) + 1; //MUST be a power of 2 plus 1!
        initHeight = 2;
        rndRange = 4;
        smoothSpeed = 0.5; // lower is faster

        tdata = new Array(size);
        toAverage = new Array(size);
        for (var i = 0; i < size; i ++) {
            tdata[i] = new Array(size);
            toAverage[i] = new Array(size);
            for (var i2 = 0; i2 < size; i2 ++) {
                tdata[i][i2] = null;
                toAverage[i][i2] = false;
            }
        }

        //Generate corners
        tdata[0][0] = initHeight;
        tdata[size-1][0] = initHeight;
        tdata[0][size-1] = initHeight;
        tdata[size-1][size-1] = initHeight;
    }

    function stepTerrainGen() {
        //The square step - for each square, take the center point and set it to the average of its corners plus a random amount
        oldi = 0;
        for (var i = 1; i < size; i ++) {
            if (tdata[0][i] != null) {
                oldi2 = 0;
                for (var i2 = 1; i2 < size; i2 ++) {
                    if (tdata[i2][i] != null) {
                        pointDistance = (i - oldi)/2;
                        tdata[(oldi2 + i2)/2][(oldi + i)/2] =
                            ((tdata[oldi2][oldi] + tdata[i2][oldi] + tdata[oldi2][i] + tdata[i2][i])/4) // average of 4 corners
                            + Math.random() * rndRange - (rndRange/2.0);                                // plus a random amount

                        // Now mark the squares for the diamond step
                        toAverage[(oldi2 + i2)/2][oldi] = true;
                        toAverage[oldi2][(oldi + i)/2] = true;
                        toAverage[(oldi2 + i2)/2][i] = true;
                        toAverage[i2][(oldi + i)/2] = true;
                        oldi2 = i2;
                    }
                }
                oldi = i;
            }
        }

        //The diamond step - same as the square step but with newly formed diamonds
        for (var i = 0; i < size; i ++) {
            for (var i2 = 0; i2 < size; i2 ++) {
                if (toAverage[i][i2]) {
                    diamondArray = [];
                    if (i-pointDistance >= 0) diamondArray = diamondArray.concat(tdata[i-pointDistance][i2]);
                    if (i+pointDistance < size) diamondArray = diamondArray.concat(tdata[i+pointDistance][i2]);
                    if (i2-pointDistance >= 0) diamondArray = diamondArray.concat(tdata[i][i2-pointDistance]);
                    if (i2+pointDistance < size) diamondArray = diamondArray.concat(tdata[i][i2+pointDistance]);
                    addedPoints = 0;
                    for (var i3 = 0; i3 < diamondArray.length; i3 ++) addedPoints += diamondArray[i3];
                    tdata[i][i2] = addedPoints/diamondArray.length + Math.floor(Math.random() * rndRange - (rndRange/2.0));
                }
            }
        }
        rndRange *= smoothSpeed;
        resetToAverage();
    }

    function resetToAverage() {
        for (var i = 0; i < size; i ++) {
            for (var i2 = 0; i2 < size; i2 ++) {
                toAverage[i][i2] = false;
            }
        }
    }

    </script>
    <title>Iso</title>
    <style>
    body, html { margin:0; padding: 0; overflow:hidden }
    </style>
</head>
<body>
</body>
</html>

Here is sprite.png:

Now, I have a few things to say.

Don't judge me for that terrible code! :P I wrote it many years ago when I was a terrible programming. In fact, it's from the old days of the website I had that I didn't even remember I had! http://oddllama.cu.cc/terrain/
I kind of sort of copied lots of code from the Crafty.JS Isometric demo. :P
Explanation will come soon! I have to go to sleep now since it's late here. (That's also why the sprite is so terrible!)

Basically, it's really unpolished and it will be vastly improved later!
It uses the same diamond-square algorithm mentioned in the OP's answer.

Can we borrow those sprites for use in other languages?

@PyRulez Well, I, uh, kind of stole them (and edited them) from the Crafty.JS site, so I have no idea :P maybe I should have mentioned that

Ruby + RMagick
I'm using the Diamond-Square algorithm to generate the heightmap.
The algorithm in short:

Use a wrapping array matrix, with a size of 2^n
Wrapping means that any index outside of the bounds wrap around, e.g. if the array's size is 4 [0,0] == [4,0] == [0,4] == [4,4]. Also [-2,0] == [2,0], etc.
Set [0,0] to a random color
Follow the steps shown in the image.

Note, that since the array wraps around, when you have to index something outside of the bounds, you can use the data from the other side of the array.
Also note, that in the very first step the four corners mean exactly the same value (as [0,0] == [4,0] == [0,4] == [4,4])
To calculate the value of the black dot, you have to average the four points surrounding it
As this will result in a boring, gray image, you have to add a random number to this value at each step. It is preferred that this random value spans the whole range at the first iteration, but decreases over time when you are addressing smaller and smaller subsets of the array. The less this randomness decreases over time, the more noisy the image will be.
After I'm done I'm simply assigning a color for each height value.

Code:
generate.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'bundler/setup'
Bundler.require(:default)

class Numeric
  def clamp min, max
    [[self, max].min, min].max
  end
end

class WrappedArray
  def initialize(size)
    @size = size
    @points = Array.new(size){Array.new(SIZE)}
  end
  def [](y,x)
    @points[(@size+y) % @size][(@size+x) % @size]
  end
  def []=(y,x,value)
    @points[(@size+y) % @size][(@size+x) % @size] = value.clamp(0,@size*@size-1)
  end
end

SIZE = 256
MAXHEIGHT = 256*256

points = WrappedArray.new(SIZE)

points[0,0] = 0

s = SIZE
d = []
sq = []
r = MAXHEIGHT
while s>1
  (0...SIZE).step(s) do |x|
    (0...SIZE).step(s) do |y|
      d << [y,x]
    end
  end
  while !d.empty?
    y,x = *d.shift
    mx = x+s/2
    my = y+s/2

    points[my,mx]  = (points[y,x]   + points[y,x+s]      + points[y+s,x] + points[y+s,x+s])/4 + rand(r)-r/2
    sq << [my,x]
    sq << [my,x+s]
    sq << [y,mx]
    sq << [y+s,mx]
  end
  while !sq.empty?
    y,x = *sq.shift
    points[y,x]    = (points[y-s/2,x] + points[y+s/2,x] + points[y,x-s/2] + points[y,x+s/2])/4 + rand(r)-r/2
  end
  s = s / 2
  r = r * 2 / 3
end

def get_color(height)
  val = height.to_f/MAXHEIGHT*3-1
  r = 0
  g = 0
  b = 0
  if val<=-0.25
    Magick::Pixel.new(0,0,128*256)
  elsif val<=0
    Magick::Pixel.new(0,0,255*256)
  elsif val<=0.0625
    Magick::Pixel.new(0,128*256,255*256)
  elsif val<=0.1250
    Magick::Pixel.new(240*256,240*256,64*256)
  elsif val<=0.3750
    Magick::Pixel.new(32*256,160*256,0)
  elsif val<=0.7500
    Magick::Pixel.new(224*256,224*256,0)
  else
    Magick::Pixel.new(128*256,128*256,128*256)
  end
end

canvas = Magick::ImageList.new
canvas.new_image(SIZE+1, SIZE+1)
0.upto(SIZE) do |y|
  0.upto(SIZE) do |x|
    canvas.pixel_color(x,y,get_color(points[y,x]))
  end
end
canvas.write('result.png')

Gemfile
source "https://rubygems.org"
gem 'rmagick'

Note: The Imagemagick I'm using is 16bit
Result image:

Note: this image is a top-down, isometric representation, where the size of one voxel is exactly one pixel, so it's valid according to the rules (except one: that my answer is not considered valid)

Is the quality of your one-pixel top-down isometric solution meant as an indicator of the seriousness with which you wish people to approach your question?

I don't think top down counts as isometric? http://en.wikipedia.org/wiki/Isometric_projection

@JonathanVanMatre: In the question I showed the desired result. In the answer I showed the minimum you should do for the answer to be valid. As this is a popularity-contest you can choose what you want to do, but of course you should thrive to do the desired result.

@mattnewport: good point, I was mistakenly using it for all kinds of paralell projections. Fixed.

Java (using @fejesjoco's color-image as base algorithm)
After playing a bit around with the FullRGB color images from @fejesjoco i noticed that they could be used as a base for interesting cliffy voxel landscapes.
Instead of reimplementing the algorithm i used his code as a external executable (download it from http://joco.name/2014/03/02/all-rgb-colors-in-one-image/ and place it named as artgen.exe in same directory )
Preview:

heightmap used (stored in blue channel)

Input image:

The subalgorithm i use from it works in that way:
1. Sorting
2. Start with a black pixel at the center
3. Until all colors are used: place the current color at the closest fitting spot and add the unused neighbors as new usable spots
When it finished i mangle it to get it reduced to 256 different values
red&(green|blue)
4. then i use pregenerated sprites and generate the image layer by layer
import java.awt.Graphics;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.InputStreamReader;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import javax.imageio.ImageIO;
import javax.xml.bind.DatatypeConverter;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author LH
 */
public class Voxelizer2
{
    static final String zipembeddedsprites =
            "UEsDBAoAAAAAAJy4Y0RIepnubQEAAG0BAAAJAAAAZ3Jhc3MucG5niVBORw0KGgoAAAANSUhEUgAAABgAAA"+
            "AYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3gMDFgQ3dY+9CAAA"+
            "AB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAA0UlEQVRIx9XVsRHCMAyFYYnLBsksWSD0jMFsnBv"+
            "oYQG28AAUqVOIJvZdZMSTwRS8isL83wUOzCJCnvGFNwflIOx6HwJ0WA9BJoDCXqgAasMIysC3YQtiOlPTsF5H9/XV2LgcEpDW"+
            "Cgr6CfQ+hYL1EVnzQgH80Ka+FyKi2/Hx/uRYF55O3RZIg1D0hYsn0DOh6AtDwISiL+wGCij6wtVA3jxXHd/Rj/f/QP673g+Dt"+
            "PwOrsvCLy8cCAEgheGVaUIGoMPuS7+AFGCF3UABrQAKpz0BwAN2ISfnFZcAAAAASUVORK5CYIJQSwMECgAAAAAAwbhjRGZ6lp"+
            "5LAQAASwEAAAkAAABzdG9uZS5wbmeJUE5HDQoaCgAAAA1JSERSAAAAGAAAABgIBgAAAOB3PfgAAAAGYktHRAD/AP8A/6C9p5MAA"+
            "AAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfeAwMWBgGIA0oTAAAAHWlUWHRDb21tZW50AAAAAABDcmVhdGVkIHdpdGggR0lNU"+
            "GQuZQcAAACvSURBVEjH7dXBDcMgDIVhU3U2luDAVGwASzAASzAMPURGqhPrmYbe4mNE/k9BCrgxBlmmlPK1MITgLO85BMiwHASpA"+
            "ApboROwGkbQBO6GNcjlnLeG5bxrrURE5L3fGk4pHQA/2AVxeH6BXPArJMMqsAppYQggCIXNgIR670tb96I/zwM8wP2Zx3WM0XSqWv"+
            "+D1pq7vHAQhAAOwytTgzRAhs2XvoQkoIXNgIQYQGGeD4QxdHmEfUlXAAAAAElFTkSuQmCCUEsDBAoAAAAAAEl9Y0Q2U8gdJwEAACcBA"+
            "AAJAAAAd2F0ZXIucG5niVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsT"+
            "AAALEwEAmpwYAAAAB3RJTUUH3gMDDioRvrDDEQAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAAi0lEQV"+
            "RIx+2VQQ6AMAgEwd/Kg/juerEaUQJt8dY515nUJsAAKAMzPQ4CxKnvooAVW6KQG4jE2dAr0CuOQldgVuyFmAil4tcvItrPgBarxQYaW"+
            "iL+uIFFp8SJQDYk2TeI0C7xQGCMjX5mBVagYNjd41qKx7Wys3AEFeLEyhTMiDuWvmBEnA54oUjcOAD4sVBwKhEKKQAAAABJRU5ErkJg"+
            "glBLAQI/AAoAAAAAAJy4Y0RIepnubQEAAG0BAAAJACQAAAAAAAAAIAAAAAAAAABncmFzcy5wbmcKACAAAAAAAAEAGAD1dUScLDfPAeY"+
            "u0WzuNs8B5i7RbO42zwFQSwECPwAKAAAAAADBuGNEZnqWnksBAABLAQAACQAkAAAAAAAAACAAAACUAQAAc3RvbmUucG5nCgAgAAAAAA"+
            "ABABgAjxW2wyw3zwGyVc6t7jbPAbJVzq3uNs8BUEsBAj8ACgAAAAAASX1jRDZTyB0nAQAAJwEAAAkAJAAAAAAAAAAgAAAABgMAAHdhdG"+
            "VyLnBuZwoAIAAAAAAAAQAYAM5emMbuNs8BrSG4se42zwGtIbix7jbPAVBLBQYAAAAAAwADABEBAABUBAAAAAA=";
    public static void main(String[] args) throws Exception
    {
        //embedded zip idea borrowed from over here:
        //http://codegolf.stackexchange.com/a/22262/10801

        //algorithm and embedded executable borrowed from
        //http://joco.name/2014/03/02/all-rgb-colors-in-one-image/

        //256 8192 2048 4096 1024 1000 9263 11111111 hue-0 one
        /**/
        ProcessBuilder p = new ProcessBuilder("artgen","64","512","512","256","256","1",((int)(Math.random()*(2<<32)))+"","11111111","hue-0","one");
        Process po = p.start();
        BufferedReader x = new BufferedReader(new InputStreamReader(po.getInputStream()),1024);
        String xl = x.readLine();
        //String x2l = x2.readLine();
        while(!xl.startsWith("Press ENTER to exit"))
        {
            System.out.println(xl);
            xl=x.readLine();
        }
        System.out.println(xl);
        po.destroy();/**/
        BufferedImage source = ImageIO.read(new File("result00000.png"));
        BufferedImage heightmap = new BufferedImage(source.getWidth(), source.getHeight(), BufferedImage.TYPE_INT_RGB);
        for (int i = 0; i < source.getWidth(); i++)
        {
            for (int j = 0; j < source.getHeight(); j++)
            {
                int basecolor=source.getRGB(i, j)&0x00FFFFFF;
                int r = (basecolor&0x00FF0000)>>16;
                int g = (basecolor&0x0000FF00)>>8;
                int b = (basecolor&0x000000FF);
                int color = r&(g|b);//Math.max(r,Math.max(g,b));
                heightmap.setRGB(i, j, color);

            }
        }/**/
        ImageIO.write(heightmap, "png", new File("heightmap.png"));

        //generate sizedata for Sprites....

        ZipInputStream zippedSprites = new ZipInputStream(new ByteArrayInputStream(DatatypeConverter.parseBase64Binary(zipembeddedsprites)));
        ZipEntry z = zippedSprites.getNextEntry();
        BufferedImage water=null,grass=null,stone=null,air = new BufferedImage(24,24, BufferedImage.TYPE_INT_ARGB);
        while(z!=null)
        {
            String name = z.getName();
            switch(name)
            {
                case "water.png":
                    water=ImageIO.read(zippedSprites);
                    System.out.println("water");
                break;
                case "stone.png":
                    stone=ImageIO.read(zippedSprites);
                    System.out.println("stone");
                break;
                case "grass.png":
                    grass=ImageIO.read(zippedSprites);
                    System.out.println("grass");
                break;
            }
            z=zippedSprites.getNextEntry();
        }

        //int height = heightmap.getHeight()*12+12;
        int width16 = heightmap.getWidth()/16;
        int height16=heightmap.getHeight()/16;
        int widthtemp1 = 384+(height16-1)*(384/2);
        int width = (width16-1)*(384/2)+widthtemp1;
        //int heightt1=height16*(12*16)+12*16;
        int height = (width16-1)*(12*16)+(12*16);
        System.out.println(width*height);
        //if(true)return;

        int StartPos =heightmap.getHeight()*12;

        //BufferedImage[] layers = new BufferedImage[256];

        BufferedImage complete = new BufferedImage(width, height+(255*12), BufferedImage.TYPE_INT_ARGB);
        int mergeOffset=255*12;
        for (int i = 0; i < 256; i++)
        {
            System.out.println("Rendering layer"+i);
            BufferedImage layer = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
            int basePointerX = StartPos-12;
            int basePointerY=0;
            Graphics g = layer.getGraphics();
            for (int k = 0; k < heightmap.getHeight(); k++)
            {
                //System.out.println("Processing line"+k);
                int pointerX = basePointerX;
                int pointerY = basePointerY;
                for (int j = 0; j < heightmap.getWidth(); j++)
                {

                    Image tile = air;
                    int pxheight =heightmap.getRGB(j, k)&0x00FFFFFF;
                    if(pxheight>i)
                    {
                        tile=stone;
                    }
                    if(pxheight==i)
                    {
                        if(i<64)
                        {
                            tile=stone;
                        }
                        else
                        {
                            tile=grass;
                        }
                    }
                    if(pxheight<i)
                    {
                        if(i<64)
                        {
                            tile=water;
                        }
                        else
                        {
                            tile=air;
                        }
                    }
                    g.drawImage(tile, pointerX, pointerY, null);
                    pointerX+=12;
                    pointerY+=6;
                }

                basePointerX-=12;
                basePointerY+=6;

            }

            //

            complete.getGraphics().drawImage(layer, 0, mergeOffset, null);

            mergeOffset-=12;
        }
        ImageIO.write(complete, "png", new File("landscape.png"));
    }
}

HTML + JavaScript
Here is my attempt at the competition:
<html>
    <head>
        <script type='text/javascript' language='JavaScript'>
            function create() {
                var con = document.getElementById("can").getContext("2d"),
                    map = new Array(),
                    p = new Array(15 + Math.floor(Math.random() * 10)),
                    tc = ["#000040", "#000070", "#0000a0", "#5050ff", "#f0f000", "#007000", "#00aa00", "#00c000", "#00e000", "#00ff00", "#90ff90", "#a0ffa0", "#c0ffc0", "#e0ffe0", "#f0fff0"],
                    sc = ["#000020", "#000050", "#000085", "#3030df", "#d0d000", "#005000", "#008000", "#008000", "#00b500", "#00d000", "#00ea00", "#80ff80", "#a0ffa0", "#c0ffc0", "#d0ffd0"];
                for (var n = 0; n < p.length; n++) {
                    p[n] = [15 + Math.floor(Math.random() * 70), 15 + Math.floor(Math.random() * 70)];
                }
                for (var x = 0; x < 100; x++) {
                    map[x] = new Array();
                    for (var y = 0; y < 100; y++) {
                        map[x][y] = 0;
                        for (var n = 0; n < p.length; n++) {
                            if (20 - Math.sqrt(Math.pow(x - p[n][0], 2) + Math.pow(y - p[n][1], 2)) > map[x][y]) {
                                map[x][y] = 20 - Math.sqrt(Math.pow(x - p[n][0], 2) + Math.pow(y - p[n][2], 2));
                            }
                        }
                    }
                }
                for (var x = 0; x < 100; x++) {
                    for (var y = 0; y < 100; y++) {
                        if (map[x][y] < 0) {
                            map[x][y] = 0;
                        }
                        map[x][y] = Math.floor(map[x][y] / 2);
                        con.fillStyle = tc[map[x][y]];
                        con.fillRect(x * 10, y * 10 - map[x][y] * 4, 10, 10);
                        con.fillStyle = sc[map[x][y]];
                        con.fillRect(x * 10, y * 10 - map[x][y] * 4 + 10, 10, map[x][y] * 4);
                    }
                }
            }
        </script>
    </head>
    <body>
        <canvas id='can' width='1000' height='1000' style='border: 1px solid #000000;'></canvas>
        <button onclick='create();'>Create</button>
    </body>
</html>

I use the Euclidean F1 Cell Noise algorithm to generate a heightmap which I then transform into an image by taking the appropriate colour from an array and drawing a square at 10x,10y-height so higher pixels are raised up.  I then draw a rectangle as the side using the same colour from a different array.

Here is the same code using a 10,000-step random walk algorithm:
<html>
    <head>
        <script type='text/javascript' language='JavaScript'>
            function create() {
                var con = document.getElementById("can").getContext("2d"),
                    map = new Array(),
                    l = 10000,
                    tc = ["#000040", "#000070", "#0000a0", "#5050ff", "#f0f000", "#007000", "#00aa00", "#00c000", "#00e000", "#00ff00", "#90ff90", "#a0ffa0", "#c0ffc0", "#e0ffe0", "#f0fff0"],
                    sc = ["#000020", "#000050", "#000085", "#3030df", "#d0d000", "#005000", "#008000", "#008000", "#00b500", "#00d000", "#00ea00", "#80ff80", "#a0ffa0", "#c0ffc0", "#d0ffd0"];
                for (var x = 0; x < 100; x++) {
                    map[x] = new Array();
                    for (var y = 0; y < 100; y++) {
                        map[x][y] = 0;
                    }
                }
                x = 49;
                y = 49;
                for (var n = 0; n < l; n++) {
                    var d = Math.floor(Math.random() * 4);
                    if (d == 0) {
                        x++
                    }
                    else if (d == 1) {
                        y++
                    }
                    else if (d == 2) {
                        x--
                    }
                    else if (d == 3) {
                        y--
                    }
                    map[(x % 100 + 100) % 100][(y % 100 + 100) % 100]++;
                }
                for (var x = 0; x < 100; x++) {
                    for (var y = 0; y < 100; y++) {
                        if (map[x][y] < 0) {
                            map[x][y] = 0;
                        }
                        map[x][y] = Math.floor(map[x][y] / 2);
                        con.fillStyle = tc[map[x][y]];
                        con.fillRect(x * 10, y * 10 - map[x][y] * 4, 10, 10);
                        con.fillStyle = sc[map[x][y]];
                        con.fillRect(x * 10, y * 10 - map[x][y] * 4 + 10, 10, map[x][y] * 4);
                    }
                }
            }
        </script>
    </head>
    <body>
        <canvas id='can' width='1000' height='1000' style='border: 1px solid #000000;'></canvas>
        <button onclick='create();'>Create</button>
    </body>
</html>

![Random Walk 2][4]
When it 'walks' off one edge it wraps onto the other, so it still looks good tiled.
It is still technically parallel, just from a different angle.


text:
Create a sudoku solution CHECKER
Create a Sudoku solution CHECKER
There are oodles of Sudoku SOLVERS here, but I want you to create a solution CHECKER as small as humanly possible (code-golf).

A valid entry will be able to either take a 9x9 array as an argument (passed by reference, serialized on the command line, or however you want to take it) or accept an input file that is nine lines of nine numbers for the final grid.  See examples of input below.
Valid input should be base-10 numbers (1-9)
Missing, empty, extra, non-numeric positions, or positions with numbers outside of 1-9 should be rejected as invalid input by returning a non-zero result, printing an error, or both.
Your program needs to test whether each number appears once per column, once per line, and once per 3x3 sub-grid.  If it passes, return "0" and if not, return a non-zero result.
Use of external resources (websites, etc.) is to be avoided.
If your solution is a stand-alone program, exiting with a exit status of, or printing, "0" or non-zero for "Pass" or "Fail", respectively, is ok.

Let the smallest answer win!
Input Examples:
c array:
int input[9][9]={{1,2,3,4,5,6,7,8,9},
                 {4,5,6,7,8,9,1,2,3},
                 {7,8,9,1,2,3,4,5,6},
                 {2,3,1,5,6,4,8,9,7},
                 {5,6,4,8,9,7,2,3,1},
                 {8,9,7,2,3,1,5,6,4},
                 {3,1,2,6,4,5,9,7,8},
                 {6,4,5,9,7,8,3,1,2},
                 {9,7,8,3,1,2,6,4,5}
                };

file:
123456789
456789123
789123456
231564897
564897231
897231564
312645978
645978312
978312645

The 9 sub-grids:
+---+---+---+
|123|456|789|
|456|789|123|
|789|123|456|
+---+---+---+
|231|564|897|
|564|897|231|
|897|231|564|
+---+---+---+
|312|645|978|
|645|978|312|
|978|312|645|
+---+---+---+

GolfScript, 39 characters
.zip.{3/}%zip{~}%3/{[]*}%++{$10,1>=!},,

It takes an array of arrays as input (see online example) and outputs 0 if it is a valid grid.
Short explanation of the code
.zip         # Copy the input array and transpose it
.{3/}%       # Split each line into 3 blocks
zip{~}%      # Transpose these blocks
3/{[]*}%     # Do the same for the lines themselves and join again
++           # Make one large list of 27 9-element arrays
             # (9 for rows, 9 for columns, 9 for blocks)
{$10,1>=!},  # From those 27 select the ones which are not a permutation of [1 2 3 ... 9]
             #   $      -> sort
             #   10,1>  -> [1 2 3 ... 9]
             #   =!     -> not equal
,            # Count after filtering

I like that your code's non-zero output is more meaningful than just 1 or -1

I really liked your answer but in the end I elected not to go with a golfscript solution.  I really hope you understand

@DavidWilkins Actually I don't understand - you made the rules (!) and didn't state anywhere that GolfScript was not allowed.

Your point is entirely valid...in truth I have nothing to justify not choosing your answer.  Well played

Python, 103
I hate sudoku.
b = [[1,2,3,4,5,6,7,8,9],
     [4,5,6,7,8,9,1,2,3],
     [7,8,9,1,2,3,4,5,6],
     [2,3,1,5,6,4,8,9,7],
     [5,6,4,8,9,7,2,3,1],
     [8,9,7,2,3,1,5,6,4],
     [3,1,2,6,4,5,9,7,8],
     [6,4,5,9,7,8,3,1,2],
     [9,7,8,3,1,2,6,4,5]]

e=enumerate;print 243-len(set((a,t)for(i,r)in e(b)for(j,t)in e(r)for a in e([i,j,i/3*3+j/3]*(0<t<10))))

How it works: each row, column, and block must have each number from 1 to 9.  So for each 0 <= i, j < 9, the cell i,j is in block 3*floor(i/3) + floor(j/3).  Thus, there are 243 requirements to satisfy.  I make each requirement a tuple ((item index,item type number),symbol) where item index is a number between 0 and 8 (inclusive), item type number is 0,1, or 2 to denote row, column or block respectively, and symbol is the entry b[i][j].
Edit: I mistakenly didn't check for valid entries.  Now I do.

Your program should output 0 if the solution passes, not True

@DavidWilkins what an odd requirement.  Fixed.

You sir get my vote just for the way you started your answer :D

APL (46)
{∧/,↑∊∘Z¨(/∘(,⍵)¨↓Z∘.=,3/3⌿3 3⍴Z←⍳9),(↓⍵),↓⍉⍵}

This takes a 9-by-9 matrix. The example one can be entered on TryAPL like so:
     sudoku ← ↑(1 2 3 4 5 6 7 8 9)(4 5 6 7 8 9 1 2 3)(7 8 9 1 2 3 4 5 6)(2 3 1 5 6 4 8 9 7)(5 6 4 8 9 7 2 3 1)(8 9 7 2 3 1 5 6 4)(3 1 2 6 4 5 9 7 8)(6 4 5 9 7 8 3 1 2)(9 7 8 3 1 2 6 4 5)
     {∧/,↑∊∘Z¨(/∘(,⍵)¨↓Z∘.=,3/3⌿3 3⍴Z←⍳9),(↓⍵),↓⍉⍵} sudoku
1

Explanation:

↓⍉⍵: get the columns of ⍵,
↓⍵: get the rows of ⍵,
3/3⌿3 3⍴Z←⍳9: make a 3-by-3 matrix containing the numbers 1 to 9, then triplicate each number in both directions, giving a 9-by-9 matrix with the numbers 1 to 9 indicating each group,
Z∘.=: for each number 1 to 9, make a bitmask for the given group,
/∘(,⍵)¨: and mask ⍵ with each, giving the groups of ⍵.
∊∘Z¨: for each sub-array, see if it contains the numbers 1 to 9,
∧/,↑: take the logical and of all of these numbers together.

+1 Nice! But the 3×3 groups can be golfed some more. For example this ↓9 9⍴1 3 2⍉3 3 9⍴⍵ is equivalent to /∘(,⍵)¨↓Z∘.=,3/3⌿3 3⍴Z←⍳9 but quite shorter. I'm sure there are even shorter formulas.

Also, you could concatenate the matrices by 1st dimension ⍪ and perform a single split at the end: ↓(9 9⍴1 3 2⍉3 3 9⍴⍵)⍪⍵⍪⍉⍵

There's a bug: this code ∊∘Z¨ is testing whether each sub-array (row, column or block) is only made of numbers 1 to 9. It's not testing whether all numbers are represented. You need to do something like Z∘.∊ which tests that every number in Z is contained in every sub-array.

And this ∧/,↑ can be shortened to ∧/∊. I'm done, I'm done! ;-)

Very compact, but you missed one critical point that I can see right off: If it passes, return "0" and if not, return a non-zero result.

I would have chosen your answer but the return value was never fixed.  Hope you understand.

Java/C# - 183/180 181/178 173/170 bytes
boolean s(int[][]a){int x=0,y,j;int[]u=new int[27];for(;x<(y=9);x++)while(y>0){j=1<<a[x][--y];u[x]|=j;u[y+9]|=j;u[x/3+y/3*3+18]|=j;}for(x=0;x<27;)y+=u[x++];return y==27603;}

(Change boolean to bool for C#)
Formatted:
boolean s(int[][] a){
    int x=0, y, j;
    int[] u=new int[27];
    for(;x<(y=9);x++)
        while(y>0){
            j=1<<a[x][--y];
            u[x]|=j;
            u[y+9]|=j;
            u[x/3+y/3*3+18]|=j;
        }

    for(x=0;x<27;)
        y+=u[x++];

    return y==27603;
}

The method creates an array u with 27 bitmasks, representing the digits found in the nine rows, columns and squares.
It then iterates over all cells, performing the operation 1 << a[x][y] to create a bitmask representing the digit and ORs its column, row and square bitmask with it.
It then iterates over all 27 bitmasks, ensuring that they all add up to 27594 (1022*9, 1022 being the bitmask for all digits 1-9 being present). (Note that y ends up as 27603 due to it already containing 9 following the double loop.)
Edit: Accidentally left in a %3 that's no longer necessary.
Edit 2: Inspired by Bryce Wagner's comment, the code has been compressed a bit more.

Almost the same algorithm in C# 149 chars (but only if Linq is allowed):  bool s(int[]a){int x=0,y,j;var u=new int[27];while(x++<(y=9))while(y>0){j=1<<a[x+9*--y];u[x]|=j;u[y+9]|=j;u[x/3+y/3*3+18]|=j;}return u.Sum()==27594;}

@BryceWagner Linq would indeed be useful. However, my solution is for Java with C# being an afterthought (not even mentioned in the original post) and thus lower priority. I also used one-dimensional arrays for compactness at the start before deciding against it (as the examples use two-dimensional ones). Nevertheless, your code gave me a few ideas for how a few more bytes could be shaved off. :)

python = 196
Not the most golfed, but the idea is there. Sets are pretty useful.
Board:
b = [[1,2,3,4,5,6,7,8,9],
     [4,5,6,7,8,9,1,2,3],
     [7,8,9,1,2,3,4,5,6],
     [2,3,1,5,6,4,8,9,7],
     [5,6,4,8,9,7,2,3,1],
     [8,9,7,2,3,1,5,6,4],
     [3,1,2,6,4,5,9,7,8],
     [6,4,5,9,7,8,3,1,2],
     [9,7,8,3,1,2,6,4,5]]

Program:
n={1,2,3,4,5,6,7,8,9};z=0
for r in b:
 if set(r)!=n:z=1
for i in zip(*b):
 if set(i)!=n:z=1
for i in (0,3,6):
 for j in (0,3,6):
  k=j+3
  if set(b[i][j:k]+b[i+1][j:k]+b[i+2][j:k])!=n:z=1
print(z)

s/{1,2,3,4,5,6,7,8,9}/set(range(1,10))/ saves 3 characters.

In Python 3.5 you can use n={*range(1,10)}, but that's newer than the challenge. Instead use set(range(1,10)) as MatrixFrog said.

J 52 54
-.*/,(9=#)@~.@,"2(0 3 16 A.i.4)&|:(4#3)($,)".;._2]0 :0

Takes it's argument pasted on the command line, ended with a ) as:
1 2 3 4 5 6 7 8 9
4 5 6 7 8 9 1 2 3
7 8 9 1 2 3 4 5 6
2 3 1 5 6 4 8 9 7
5 6 4 8 9 7 2 3 1
8 9 7 2 3 1 5 6 4
3 1 2 6 4 5 9 7 8
6 4 5 9 7 8 3 1 2
9 7 8 3 1 2 6 4 5
)

Returns 1 if passed, 0 if not.
Internally, it converts the 9x9 grid to a 3x3x3x3 grid, and does some permutations on the axes to get the wanted unit (rows, lines and boxes) in the last 2 dimensions.
After doing that, it is checked that each unit has has 9 unique values.
Probably far from perfect, but beats the majority already ;-)

At first glance, you've been caught by the same requirement as some of the others....Your returns should be reversed...0 for pass, non-zero for fail

0 for pass is idiotic. There is a reason Boole chose 1 for true and 0 for false. But you are right. Adds 2 characters.

Think of it as an exit status, not a boolean value

I'm choosing your answer because it works.  You followed the rules and your program is very short.  Thanks!

Well I fibbed...In truth I can't justify not choosing the Golfscript answer that is shorter than yours...But kudos for 2nd place

I was already wondering :). anyhow, I might get around to giving it another golf, it still feels like overkill.

R 145
function(x)colSums(do.call(rbind,lapply(list(R<-row(b<-matrix(1,9,9)),C<-col(b),(R-1)%/%3+1+3*(C-1)%/%3),sapply,`==`,1:9))%*%c(2^(x-1))==511)==27

The de-golfed code (more or less) can be found here https://stackoverflow.com/a/21691541/1201032.

can you provide a working example on a site like r-fiddle?  http://www.r-fiddle.org/#/

Java - 385 306 328 260 characters
Edit:
I foolishly misread the instructions that the answer had to be a complete program. Since it can be just a valid function, I've rewritten and minimized to be a function, and rewritten my solution introduction with that in mind.
So, as a challenge to myself I thought I'd try to make the smallest Java solution checker.
To achieve this I assume that the sudoku puzzle will be passed in as a java multidimensional array, like so:
s(new int[][] {
    {1,2,3,4,5,6,7,8,9},
    {4,5,6,7,8,9,1,2,3},
    {7,8,9,1,2,3,4,5,6},
    {2,3,1,5,6,4,8,9,7},
    {5,6,4,8,9,7,2,3,1},
    {8,9,7,2,3,1,5,6,4},
    {3,1,2,6,4,5,9,7,8},
    {6,4,5,9,7,8,3,1,2},
    {9,7,8,3,1,2,6,4,5}});

Then, we have the actual solver, which returns "0" if valid solution, "1" if not.
Fully golfed:
int s(int[][] s){int i=0,j,k=1;long[] f=new long[9];long r=0L,c=r,g=r,z=45L,q=r;for(f[0]=1L;k<9;){f[k]=f[k-1]*49;z+=f[k++]*45;}for(;i<9;i++){for(j=0;j<9;){k=s[i][j];r+=k*f[i];c+=k*f[j];g+=k*f[j++/3+3*(i/3)];q+=5*f[k-1];}}return (r==z&&c==z&&g==z&&q==z)?0:1;}

Readable:
    int s(int[][] s) {
        int i=0,j,k=1;
        long[] f=new long[9];
        long r=0L,c=r,g=r,z=45L,q=r;
        for(f[0]=1L;k<9;){f[k]=f[k-1]*49;z+=f[k++]*45;}
        for(;i<9;i++) {
            for (j=0;j<9;) {
                k=s[i][j];
                r+=k*f[i];
                c+=k*f[j];
                g+=k*f[j++/3+3*(i/3)];
                q+=5*f[k-1];
            }
        }
        return (r==z&&c==z&&g==z&&q==z)?0:1;
    }

So how does this work? I basically just create my own number base with sufficient resolution in each digit that I only have to do three numeric comparisons after passing through the puzzle once to know if it's valid. I chose base 49 for this problem, but any base larger than 45 would be sufficient.
A (hopefully) clear example: imagine that every "row" in the sudoku puzzle is a single digit in a base-49 number. We'll represent each digit in the base-49 number as a base-10 number in a vector for simplicity. So, if all rows are "correct" we expect the following base-49 number (as a base-10 vector):
(45,45,45,45,45,45,45,45,45)

or converted to a single base-10 number: 1526637748041045
Follow similar logic for all the columns, and same for the "sub-grids". Any value encountered in the final analysis that doesn't equal this "ideal number" means the puzzle solution is invalid.
Edit to solve all-5s vulnerability and other related issues: I add a fourth base-49 number, based on the idea that there should be 9 of each number in every puzzle. So, I add 5 to each digit in the base-49 number for each occurrence of the base-10 number that represents the digit's index. An example, if there are 10 9's and 9 8's, 9 7's, 8 6's, and 9 of all others, you'd get a base-49 number (as a base-10 vector of size 10 to deal with overflow):
(1, 1, 45, 45, 40, 45, 45, 45, 45, 45)

Which will fail when compared against our "ideal" base-49 number.
My solution takes advantage of this mathematical solution, to avoid as much as possible looping and comparison. I simply use a long value to store each base-49 number as a base-10 number and use a lookup array to get the "factors" for each base-49 digit during column/row/subgrid check value computation.
As Java isn't designed to be concise, being careful in the mathematical construction was the only way I figured I could construct a concise checker.
Let me know what you think.

Actually, this suffers from the same vulnerability mentioned by @steve-verrill -- all 5's, or any set of numbers that sums to 45, will "trick" the solver. I'm going to revise. I have an idea how to beat that.

I've addressed this vulnerability in my latest update. Now that case is addressed, and all others of its type. Basically, it was a serious oversight not to deal with "counts" of each type of base-10 digit. I now perform that check directly, but using the same mathematical approach (base-49 number).

Dan, thanks for the acknowlegement. I saw it and wondered why I wasn't notified, but I see you put a dash in my name. This seems to have confused the system. Simply omit the space. I will consider changing the way my name is displayed.

Ahha, that explains it. Thanks @steveverrill -- I'm still getting accustomed to the stackexchange way of doing things. That said, your concise exploit of the sum-45 principle was brilliantly stated. Made my solution longer to overcome it, but that's life!

Javascript ES6, 150 chars
Takes input as a 81-char string without any delimeters.
s=>s.match("^(?=(#.{0,8}#.{9})+$)(?=(#(.{9}){0,8}#.){9})((#.?.?(.{9}){0,2}#...){3}.{18})+$".replace(/#(.*?)#/g,"123456789".replace(/./g,"(?=$$1$&)")))

Function returns null as negative answer and an array with original string in first element as a positive one. Can change to bool by adding !! to the function begining.
Test (see related challenge for more detais):
f=s=>s.match("^(?=(#.{0,8}#.{9})+$)(?=(#(.{9}){0,8}#.){9})((#.?.?(.{9}){0,2}#...){3}.{18})+$".replace(/#(.*?)#/g,"123456789".replace(/./g,"(?=$$1$&)")))
;`123456789456789123789123456231564897564897231897231564312645978645978312978312645
725893461841657392396142758473516829168429537952378146234761985687935214519284673
395412678824376591671589243156928437249735186738641925983164752412857369567293814
679543182158926473432817659567381294914265738283479561345792816896154327721638945
867539142324167859159482736275398614936241587481756923592873461743615298618924375
954217683861453729372968145516832497249675318783149256437581962695324871128796534
271459386435168927986273541518734269769821435342596178194387652657942813823615794
237541896186927345495386721743269158569178432812435679378652914924813567651794283
168279435459863271273415986821354769734692518596781342615947823387526194942138657
863459712415273869279168354526387941947615238138942576781596423354821697692734185
768593142423176859951428736184765923572389614639214587816942375295837461347651298`
.split`
`.every(f)
&&
`519284673725893461841657392396142758473516829168429537952378146234761985687935214
839541267182437659367158924715692843624973518573864192298316475941285736456729381
679543182158926473432817659567381294914256738283479561345792816896154327721638945
867539142324167859159482736275398684936241517481756923592873461743615298618924375
754219683861453729372968145516832497249675318983147256437581962695324871128796534
271459386435168927986273541518734269769828435342596178194387652657942813823615794
237541896186927345378652914743269158569178432812435679495386721924813567651794283
168759432459613278273165984821594763734982516596821347615437829387246195942378651
869887283619214453457338664548525781275424668379969727517385163319223917621449519
894158578962859187461322315913849812241742157275462973384219294849882291119423759
123456789456789123564897231231564897789123456897231564312645978645978312978312645
145278369256389147364197258478512693589623471697431582712845936823956714931764825`
.split`
`.every(s => !f(s))

That's one ridiculous regex... Amazing work.

Haskell (Lambdabot), 65 bytes
k x=and$(all$([1..9]==).sort)<$>[x,transpose x,join$chunksOf 3 x]

Mathematica, 84 79 chars
f=Tr[Norm[Sort@#-Range@9]&/@Join[#,Thread@#,Flatten/@Join@@#~Partition~{3,3}]]&

Examples:
f[{{1,2,3,4,5,6,7,8,9},
   {4,5,6,7,8,9,1,2,3},
   {7,8,9,1,2,3,4,5,6},
   {2,3,1,5,6,4,8,9,7},
   {5,6,4,8,9,7,2,3,1},
   {8,9,7,2,3,1,5,6,4},
   {3,1,2,6,4,5,9,7,8},
   {6,4,5,9,7,8,3,1,2},
   {9,7,8,3,1,2,6,4,5}}]

0

f[{{2,1,3,4,5,6,7,8,9},
   {4,5,6,7,8,9,1,2,3},
   {7,8,9,1,2,3,4,5,6},
   {2,3,1,5,6,4,8,9,7},
   {5,6,4,8,9,7,2,3,1},
   {8,9,7,2,3,1,5,6,4},
   {3,1,2,6,4,5,9,7,8},
   {6,4,5,9,7,8,3,1,2},
   {9,7,8,3,1,2,6,4,5}}]

2

f[{{0,2,3,4,5,6,7,8,9},
   {4,5,6,7,8,9,1,2,3},
   {7,8,9,1,2,3,4,5,6},
   {2,3,1,5,6,4,8,9,7},
   {5,6,4,8,9,7,2,3,1},
   {8,9,7,2,3,1,5,6,4},
   {3,1,2,6,4,5,9,7,8},
   {6,4,5,9,7,8,3,1,2},
   {9,7,8,3,1,2,6,4,5}}]

3

Your third output example:  Is 3 always indicative of invalid input, or is it sometimes a response to a failed solution?

Perl, 193 bytes
for(@x=1..9){$i=$_-1;@y=();push@y,$a[$i][$_-1]for@x;@y=sort@y;$r+=@y~~@x;@y=();push@y,$a[3*int($i/3)+$_/3][3*($i%3)+$_%3]for 0..8;@y=sort@y;$r+=@y~~@x}for(@a){@y=sort@$_;$r+=@y~~@x}exit($r!=27)

Input is expected in array form:
@a=(
    [1,2,3,4,5,6,7,8,9],
    [4,5,6,7,8,9,1,2,3],
    [7,8,9,1,2,3,4,5,6],
    [2,3,1,5,6,4,8,9,7],
    [5,6,4,8,9,7,2,3,1],
    [8,9,7,2,3,1,5,6,4],
    [3,1,2,6,4,5,9,7,8],
    [6,4,5,9,7,8,3,1,2],
    [9,7,8,3,1,2,6,4,5]
);

Exit code is 0, if @a is a solution, otherwise 1 is returned.
Ungolfed version:
@x = (1..9);
for (@x) {
    $i = $_ - 1;
    # columns
    @y = ();
    for (@x) {
        push @y, $a[$i][$_-1];
    }
    @y = sort @y;
    $r += @y ~~ @x;
    # sub arrays
    @y = ();
    for (0..8) {
        push @y, $a[ 3 * int($i / 3) + $_ / 3 ][ 3 * ($i % 3) + $_ % 3 ];
    }
    @y = sort @y;
    $r += @y ~~ @x
}
# rows
for (@a) {
    @y = sort @$_;
    $r += @y ~~ @x
}
exit ($r != 27);

Each of the 9 rows, 9 columns and 9 sub arrays are put into a sorted array
and checked, whether it matches the array (1..9). The number $r is incremented for each successful match that must sum up to 27 for a valid solution.

R, 63 50 bytes
Assumes the input m is a 9x9 matrix of numbers.
all(apply(m,1,match,x=1:9),apply(m,2,match,x=1:9))

I was right that further golfing was possible.
Explanation:
    apply(m,1,match,x=1:9),

Take m, and for each row, apply the match function. We specify a further argument x=1:9 to be passed to match. x is the default first position argument, and therefore each row is placed in the second argument position, which is table. The function match looks for instances of x in
table. In this case, then, it's looking for 1:9 (the numbers 1 through 9) in each row. For each of 1:9, it will return TRUE (or FALSE) if that number is found (or not).
So, this yields a series of 81 boolean values.
                           apply(m,2,match,x=1:9)

Repeat the above for each column of the input.
all(                                             )

Finally, all checks if every element of the list of booleans is TRUE. This will be the case if and only if the solution is correct (i.e. each number 1:9 is present only once in each column and each row).
Old approach:
for(i in 1:2)F=F+apply(m,i,function(x)sort(x)==1:9);sum(F)==162

It takes each row, sorts it, and then compares it to [1, 2, ... 9]. A correct row should match exactly. Then it does the same for each column. In total, we should have 162 exact matches, which is what the final portion checks for. There is likely some scope for further golfing here...

It looks like you are checking for columns and rows, but not for boxes...

Haskell - 175
import Data.List
c=concat
m=map
q=[1..9]
w=length.c.m (\x->(x\\q)++(q\\x))
b x=c.m(take 3.drop(3*mod x 3)).take 3.drop(3*div x 3)
v i=sum$m(w)[i,transpose i,[b x i|x<-[0..8]]]

The function v is the one to call. It works by getting the difference of each rows, column and block against the list [1..9] and summing up the lengths of those difference lists.
Demo using the example Sudoku:
*Main> :l so-22443.hs
[1 of 1] Compiling Main             ( so-22443.hs, interpreted )
Ok, modules loaded: Main.
*Main> v [[1,2,3,4,5,6,7,8,9],[4,5,6,7,8,9,1,2,3],[7,8,9,1,2,3,4,5,6],[2,3,1,5,6,4,8,9,7],[5,6,4,8,9,7,2,3,1],[8,9,7,2,3,1,5,6,4],[3,1,2,6,4,5,9,7,8],[6,4,5,9,7,8,3,1,2],[9,7,8,3,1,2,6,4,5]]
0

Javascript - 149 Characters
r=[];c=[];g=[];for(i=9;i;)r[o=--i]=c[i]=g[i]=36;for(x in a)for(y in z=a[x]){r[v=z[y]-1]-=y;c[v]-=x;g[v]-=3*(x/3|0)+y/3|0}for(i in r)o|=r[i]|c[i]|g[i]

Expects an array a to exist and creates a variable o for output which is 0 on success and non-zero otherwise.
Works by checking that the sum of the position at which each value occurs for each row, column and 3*3 grid equals 36 (0+1+2+3+4+5+6+7+8).
Testing
a=[
    [1,2,3, 4,5,6, 7,8,9],
    [4,5,6, 7,8,9, 1,2,3],
    [7,8,9, 1,2,3, 4,5,6],

    [2,3,1, 5,6,4, 8,9,7],
    [5,6,4, 8,9,7, 2,3,1],
    [8,9,7, 2,3,1, 5,6,4],

    [3,1,2, 6,4,5, 9,7,8],
    [6,4,5, 9,7,8, 3,1,2],
    [9,7,8, 3,1,2, 6,4,5]
  ];

Gives 'o=0'
a=[
    [1,2,3, 4,5,6, 7,8,9],
    [4,5,6, 7,8,9, 1,2,3],
    [7,8,9, 1,2,3, 4,5,6],

    [2,3,1, 5,6,4, 8,9,7],
    [5,6,4, 8,9,7, 2,3,1],
    [8,9,7, 2,3,1, 5,6,4],

    [3,1,2, 6,4,5, 9,7,8],
    [6,4,5, 9,7,8, 3,1,2],
    [9,7,8, 3,1,2, 6,5,4]
  ];

(Last 2 digits swapped)
Gives o=-1
a=[
    [5,5,5, 5,5,5, 5,5,5],
    [5,5,5, 5,5,5, 5,5,5],
    [5,5,5, 5,5,5, 5,5,5],

    [5,5,5, 5,5,5, 5,5,5],
    [5,5,5, 5,5,5, 5,5,5],
    [5,5,5, 5,5,5, 5,5,5],

    [5,5,5, 5,5,5, 5,5,5],
    [5,5,5, 5,5,5, 5,5,5],
    [5,5,5, 5,5,5, 5,5,5]
  ];

Gives o=-284

Haskell, 121 130 127 bytes (87 Lambdabot)
import Data.List
import Data.List.Split
c=concat
t=transpose
k=chunksOf
p x=all(==[1..9])$(sort<$>)=<<[x,t x,k 9.c.c.t$k 3<$>x]

uses:
-- k 9.c.c.t$k 3<$> x = chunksOf 9 $ concat $ concat $ transpose $ map chunksOf 3 x

let ts = k 9$[10*a+b|a<-[1..9],b<-[1..9]] --yep, this is ugly
in k 9.c.c.t$k 3<$>ts
-- prints:
--[[11,12,13,21,22,23,31,32,33],[41,42,43,51,52,53,61,62,63],[71,72,73,81,82,83,91,92,93],[14,15,16,24,25,26,34,35,36],[44,45,46,54,55,56,64,65,66],[74,75,76,84,85,86,94,95,96],[17,18,19,27,28,29,37,38,39],[47,48,49,57,58,59,67,68,69],[77,78,79,87,88,89,97,98,99]]

Lambdabot loads Data.List and Data.List.Split by default (I don't think BlackCap's solution checks the boxes).
Ideas for improvement welcome
//Edit: I messed up :)
//Edit: 3 bytes saved by BlackCap

You're right, I failed to notice that checking the rows and columns aren't enough..

well, I messed up as well :)

You can replace (map sort) with (sort<$>)

And .c$(sort<$>)<$> with $(sort<$>)=<<

oh my, should have remembered those 2

2 more bytes: t=transpose;k=chunksOf;p x=all(==[1..9])$(sort<$>)=<<[x,t x,k 9$id=<<id=<<t(k 3<$>x)]

k 9$id=<<id=<<t(k 3<$>x) can be replaced with k 9.join.join.t$k 3<$>x in lambdabot

05AB1E, 36 bytes
|©vy3ô})3ôøvyJvyê}}®øvyê}®vyê})êžh¦Q

Try it online!
1 is true, anything else is false.

JavaScript (Node.js), 143 bytes
A=>A.map((_,i)=>(c=d=>new Set(d).size==9)(A[i])&&c(A.map(b=>b[i]))&&c([0,0,0].reduce((a,_,O)=>a.concat(A[~~(i/3)*3+O].slice(l=i%3*3,l+3)),[])))

Try it online!

J, 56 chars
Reads 9 lines of digits from ARGV and does magic:
echo-.*/,(b~:0),,(2 2$3)(-:~.)&,;.3 b=:"."0>cutLF{:>ARGV

Part of this is infused with an older script I wrote for a similar challenge elsewhere, so I don't remember what everything does. What I do remember is that ;.3 is really the funny magic here, because it "divides" the matrix of numbers into smaller "squares" according to the value 2 2$3 (I don't remember what it means, but pretend it's important).
Try it online!

Clojure, 151 bytes
Quite long, but others seem to be as well. Also annoying that union of sets requires a require, so I used a concat of vectors instead.
Iterates over each row and column and if the value is between 1 and 9 it emits three vectors, one for row, col and 3x3 cell. Returns 0 on success and nil otherwise, with two extra characters could return 1 on fail. Handles numbers outside of 1 - 9 by returning nil but will crash on other anomalies such as non-integer values. Quotients are 0 - 2 so it is safe to use values 8 and 9 to differentiate cell values from rows and columns.
(fn[s](if(= 243(count(set(apply concat(for[i(range 9)j(range 9)](let[v(nth(nth s i)j)q #(quot % 3)](if(<= 1 v 9)[[8 v i][9 v j][(q i)(q j)v]])))))))0))

Input is a nested vector of vectors (so that nth works):
(def sudoku [[1 2 3 4 5 6 7 8 9]
             [4 5 6 7 8 9 1 2 3]
             [7 8 9 1 2 3 4 5 6]
             [2 3 1 5 6 4 8 9 7]
             [5 6 4 8 9 7 2 3 1]
             [8 9 7 2 3 1 5 6 4]
             [3 1 2 6 4 5 9 7 8]
             [6 4 5 9 7 8 3 1 2]
             [9 7 8 3 1 2 6 4 5]])

Ungolfed:
(defn f [s]
  (->> (for [i (range 9) j (range 9)]
         (let [v (-> s (nth i) (nth j)) q #(quot % 3)]
           (if (<= 1 v 9)
             [[:row v i] [:col v j] [:cell [(q i) (q j)] v]])))
    (apply concat)
    set
    count
    (#(if (= 243 %) :pass :fail))))

PHP, 196 190 bytes
while($i<9){for($b=$c=$k=$y="";$y++<9;)$b.=($a=$argv)[$y][$i];for(;$k<3;)$c.=substr($a[++$k+$i-$i%3],$i%3*3,3);if(($u=count_chars)($a[++$i],3)<($d=123456789)|$u($b,3)<$d|$u($c,3)<$d)die(1);}

Program takes 9 separate command line arguments (one string of digits for each line of the grid);
exits with 1 (error) for invalid, 0 (ok) for valid.
Run with php -nr '<code>' <row1> <row2> ....
breakdown
while($i<9)
{
    for($b=$c=$k=$y="";$y++<9;)$b.=($a=$argv)[$y][$i];  // column to string
    for(;$k++<3;)$c.=substr($a[$i-$i%3+$k],$i%3*3,3);   // sub-grid to string
    if(($u=count_chars)($a[++$i],3)<($d=123456789)      // check row
        |$u($b,3)<$d                                    // check column
        |$u($c,3)<$d                                    // check sub-grid
    )die(1);                                            // test failed: exit with 1
}

explanation
count_chars counts characters in a string and usually creates an array with ascii codes as keys and character count as values; but with 3 as mode parameter, it creates a sorted string from the characters; and that can easily be compared to the number with the wanted digits.
The comparison does not only check for duplicates, but also includes the check for invalid characters. And it only requires <, not !=, because this is numeric comparison: PHP will interpret the string as a number as far as it can. 123e56789, 0x3456789 or similar cannot appear, because the characters are sorted; and any pure integer with a digit missing is smaller than 123456789 ... and .23456789 too, of course.
$a=$argv saves one byte, $d=123456789 saves nine and $u=count_chars saves 13.

C# - 306 298 288 characters
The following Console program was used to call the checking function;
static void Main(string[] args)
    {
        int[,] i={{1,2,3,4,5,6,7,8,9},
             {4,5,6,7,8,9,1,2,3},
             {7,8,9,1,2,3,4,5,6},
             {2,3,1,5,6,4,8,9,7},
             {5,6,4,8,9,7,2,3,1},
             {8,9,7,2,3,1,5,6,4},
             {3,1,2,6,4,5,9,7,8},
             {6,4,5,9,7,8,3,1,2},
             {9,7,8,3,1,2,6,4,5}
            };

            Console.Write(P(i).ToString());
    }

All this does is initialise the array and pass it into the checking function P.
The checking function is as below (in Golfed form);
private static int P(int[,]i){int[]r=new int[9],c=new int[9],g=new int[9];for(int p=0;p<9;p++){r[p]=45;c[p]=45;g[p]=45;}for(int y=0;y<9;y++){for(int x=0;x<9;x++){r[y]-=i[x,y];c[x]-=i[x,y];int k=(x/3)+((y/3)*3);g[k]-=i[x,y];}}for(int p=0;p<9;p++)if(r[p]>0|c[p]>0|g[p]>0)return 1;return 0;}

Or in fully laid out form;
    private static int P(int[,] i)
    {
        int[] r = new int[9],c = new int[9],g = new int[9];
        for (int p = 0; p < 9; p++)
        {
            r[p] = 45;
            c[p] = 45;
            g[p] = 45;
        }

        for (int y = 0; y < 9; y++)
        {
            for (int x = 0; x < 9; x++)
            {
                r[y] -= i[x, y];

                c[x] -= i[x, y];

                int k = (x / 3) + ((y / 3) * 3);
                g[k] -= i[x, y];
            }
        }

        for (int p = 0; p < 9; p++)
            if (r[p] > 0 | c[p] > 0 | g[p] > 0) return 1;

        return 0;
    }

This uses the idea that all columns, rows and sub-grids should add up to 45. It works through the input array and subtracts the value of each position from it's row, column and sub-grid. Once complete it then checks that none of the rows, columns or sub-grids still have a value.
As requested returns a 0 if the array is a valid Sudoku solution and non-zero (1) where it's not.

I think you can save some chars by using private static int P(int[,]i){int[]r=new int[9],c=new int[9],g=new int[9]; instead. (Note the removal of the space after the close square bracket ].) Also, I'm not sure but I think you may get rid of the private static.

Also, for the last part, in C we can remove some braces i.e. for(int p=0;p<9;p++)if(r[p]>0|c[p]>0|g[p]>0)return 1;return 0;}, not sure if it works in C# though. (I don't actually know C#)

@ace - I've made several enhancements based on your suggestions. Now down to 298 chars.

Trimmed another 10 chars based on comments from @ace.

What happens with an array full of number 5's? All rows, columns and squares add up to 45.

As @steveverrill points out, this does not check uniqueness

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/