text:
Write an interpreter for my esoteric language Jumper
I have thought up esoteric language Jumper. Later you will see why.

It operates with random-access-memory with bytes as cells. RAM is zero indexed and initially filled with zeros.
When trying access cells with negative indexes error should be displayed and program terminated.
When trying read at larger index than last, zero should be returned.
When trying write at larger index than last, RAM should be increased to multiple of 1024 and new cells filled with zeros (technically you can increase RAM not to multiple of 1024, reason was performance boost, so if it costs you a lot of characters you can do it not to multiple of 1024).
Program also has pointer to cell in RAM which initially is zero
When program starts executing a prompt for input string should be displayed (or take input from command line arguments, it's up to you). Input string should not contain null character (zero byte). Then input string is written to RAM starting at zero index.
When program ends executing a box with program output is displayed - contents of RAM from zero index to first zero byte excluding.

Now, most interesting part, syntax.
Program consists of commands (unary operators-prefixes) and their arguments. Commands and arguments may be delimited with spaces or new lines but not necessary. However spaces inside arguments are invalid, for example, # 2 = 4 is valid, but # 2 = 4 4 is not.
Program can have comments between (). Comments can't be nested - for example, in (abc(def)ghi) comment is (abc(def). Comments can be placed anywhere.

#123 sets RAM pointer to 123 (any positive decimal integer or zero).
>123 increments RAM pointer by 123 (any positive decimal integer).
<123 decrements RAM pointer by 123 (any positive decimal integer).
=123 writes 123 (any unsigned 8-bit decimal integer) in current cell.
+123 adds 123 (any unsigned 8-bit decimal integer) to current cell (modulo 256).
-123 subtracts 123 (any unsigned 8-bit decimal integer) from current cell (modulo 256).
:123 - "goto" - goes to command number 123 (first is 0). You can control flow of your program only with goto's - it has to jump - that's why I decided to call this language Jumper.

If argument is missing - think of it is 1 for ><+- commands or 0 for #=: commands.
Also, there is command modifier - ? (prefix to command), it executes next command only if current cell is not zero, else skips that command. Can be applied to any command.
For example, ?:17 - goes to command 17 if current cell is not zero.
If program is invalid or error occurs during runtime can be displayed message "Error". Because of this is CodeGolf, such short message will be fine.
Your task
Write shortest interpreter for this language.
Some test programs
(prints "Hello world!" regardless of input)
=72>=101>=108>=108>=111>=32>=119>=111>=114>=108>=100>=33>=

(appends "!" to the end of input string)
?:2 :4 >1 :0 =33 >1 =0

I will write some test programs in Jumper after some time and own interpreter.

"to first zero byte excluding" So if there still come other bytes after the first zero byte, we shouldn't output them?

Yes, we shouldn't. That is done to not to clear whole used memory, but only copy output to beginning.

Could you give us some sample programs and their outputs?

@arshajii Some test programs added. Will be more. It's a bit hard to think in Jumper but fun)

Simple language, thus fun challenge. Thanks!

May comments be placed between the operator and its argument?

@Oberon comments may be placed anywhere.

@user2992539 Darn, that breaks my interpreter. I thought comments would count as whitespace. Will fix later.

Could you specify the exact error message for negative indices? I think the difference between the two currently leading answers is less than the difference in their error messages, so I think it would be fairer if this was precisely specified.

Also, what about invalid arguments for the go-to command? And can the program crash on any invalid syntax? And could you please add test cases which use the remaining commands as well (and also one where the RAM size increases)?

If the input is invalid syntax, what should happen?

You should leave comments on the answers that don't comply with your changed spec regarding invalid syntax (for instance, that'll cost my submission at least 40 characters, I think)

Q 1 - What constitutes "program ends executing"?
Assumption 1 - Terminate any time the program counter goes out of range.
Q 2 - Should post-termination printing add a newline?
Assuption 2 - No.

@ScottLeadley Q1 - I mean successfully ends executing - after last command is executed without error. If : command send pointer out of range - it is error. Q2 - it's not necessary, but if it doesn't cost you bytes it's preferable.

It is definitely more difficult to write something useful in Jumper than in Brainfuck. A most devious language.

The 2nd chunk of code in my submission is a test harness. Most submissions (except mine, of course :-) fail. If you care to point out blatantly wrong test results {comment at my post so we don't clutter the OP comment thread}, I'll fix them if I have time. Don't pester me over the newline vs. no-newline suffixing. You can change that yourself.

@user2992539 After rereading your answer to Q1, I believe you're saying the interpreter should display "Error" unless a program falls off the end by advancing the program counter by 1. Jumping to the same address, end-of-program+1, is an error. Is this correct? If so, I'm going to need to make some changes.

Feature request for Jumper 2.0: The token * may be used as an argument (in place of a number).  The contents of the current cell are used as the argument value.

Jumper is an elegantly minimal toy. A more modern Turing machine. Although :* and #* would give Jumper a useful subroutine mechanism and an accumulator would be nice, I think adding more to Jumper would detract from it's value as a teaching tool. If you're looking for realism, there are plenty of PDP-8, 4040, 6502, 680x and 808x emulators available to play with.

@user2992539 As further exploration of your answer to Q1, I believe you're saying that "#" exits successfully and ":1" throws an error.

@ScottLeadley end-of-program+1 I thought to be an error. If # and :1 you mean as complete program, then you are right.

Upon reflection, Jumper 2.0 with more features seems like a good idea. Incrementally connecting the mathematical model to more realistic systems has a lot of pedagogical value.

@user2992539 Should the interpreter throw an error as soon as the RAM pointer goes negative (a underflow/wrap-around condition with real hardware), or only when a =+-?, i.e. memory load/store operation, occurs? Assumption, I've implemented it as throwing an error as soon as the RAM pointer goes negative. See the test suite attached to my solution for more details.

How is "Aborted" or "Aborted (core dumped)"?

Ruby, 447 bytes
p,i=$*
l=(i||'').length
r=[0]*l
l.times{|j|r[j]=i[j].ord}
i=j=0
s=p.gsub(/\(.*?\)|\s/,'')
q=s.scan(/(\?)?([#<>=+:-])(\d*)/)
e=->{abort"Error"}
p[/\d\s+\d/]||q*''!=s ?e[]:(r+=[0]until i+1<r.length
c=q[j]
j+=1
f=c[1]
c[0]&&r[i]==0?next: a=c[2]==''? '><+-'[f]?1:0:c[2].to_i
'=+-'[f]&&a>255?e[]: f==?#?i=a :f==?>?i+=a :f==?<?i-=a :f==?=?r[i]=a :f==?+?r[i]+=a :f==?-?r[i]-=a :j=a
i<0?e[]:r[i]%=256)while j<q.length
puts r.first(r.index 0).map(&:chr)*''

Takes both the program and the input via command line arguments.
EDIT: Fixed a few bugs, and added support for invalid syntax at the cost of 40 bytes (while adding a few other optimisations).

Too funny. My Ruby solution just weighed in at 447 characters also. Although I was shooting for mid-400s, exactly the same byte count was a suprise.

@ScottLeadley Ha, that's an interesting tie. ^^ I'd give you an upvote if I hadn't done so already. ;)

Ruby 2 - 540 447 420 characters

Run as " ruby2.0 jumper.rb 'instructions' 'initialization data' ". 1.x Ruby won't work (no String.bytes method).
Added multi-line commands and comments and improved my putting.

i=$*[0].gsub(/\([^)]*\)/m,' ').scan(/(\??)\s*([#=:><+-])\s*(\d*)/m).map{|a|[a[0]!='?',a[1],a[2]==''?/[#=:]/=~a[1]?0:1:a[2].to_i]}
N=i.size
d=$*[1].bytes
r=p=0
while p<N
u,o,x=i[p]
p+=1
d[r]=0 if d[r].nil?
case o
when'#';r=x
when'>';r+=x
when'<';r-=x
when/[=+-]/;eval "d[r]#{o.tr'=',''}=x";d[r]%=256
when':';p=x;abort'Error'if p>=N
end if u||d[r]>0
abort'Error'if r<0
end
printf"%s\n",d.take_while{|v|v&&v!=0}.pack('C*')

Here's a test suite with some scatter-shot tests. The easiest way to use it is to stuff the code into t/jumper.t and run "perl t/jumper.t".

#/usr/bin/perl
use strict;
use warnings;
#       timestamp: 2014 August 3, 19:00
#
# - Assume program takes machine code and initialization string as command
#       line options.
# - Assume all required errors reported as "Error\n".
# - Go with the flow and suffix output with \n. Merged terminal newlines are
#       unacceptable [I'm talkin' to YOU Ruby puts()!].
# - As per OP - jumping to > end-of-program must be an error.

use Test::More qw(no_plan);
# use Test::More tests => 4;

my $jumper = "jumper.rb";
#
#       "happy" path
#
# starter tests provided by OP
is( `$jumper '=72>=101>=108>=108>=111>=32>=119>=111>=114>=108>=100>=33>=' '' 2>&1`, "Hello world!\n", "hello world (from user2992539)");
is( `$jumper '?:2 :4 >1 :0 =33 >1 =0' 'a' 2>&1`, "a!\n", 'append !, #1 (from user2992539)');

# simple variations
is( `$jumper '?:2 :4 >1 :0 =33 >1 =0' '' 2>&1`, "!\n", 'append !, #2');
is( `$jumper '?:2 :4 >1 :0 =33' '' 2>&1`, "!\n", 'append !, #3, no NUL');

# comment delimiters don't nest
is( `$jumper "(()=" 'oops' 2>&1`, "\n", "() don't nest");
# comments and termination
is( `$jumper '(start with a comment)?(comment w/ trailing sp) # (comment w/ surrounding sp) 1 =98' 'a' 2>&1`, "ab\n", 'walk to exit');
is( `$jumper '(start with a comment)? (comment w/ leading sp)= (comment w/ surrounding sp) 97()' '' 2>&1`, "\n", 'skip to exit');
is( `$jumper '#1=0 (actually two instructions, but it scans well) :5 #=(truncate further if not jumped over)' 'a b' 2>&1`, "Error\n", 'truncate & jump to exit');

# is RAM pointer initialized to 0?
is( `$jumper '-103(g-g) ?:1025(exit) =103 #4=10' 'good' 2>&1`, "good\n\n", 'intial string in right place?');

# TBD, do jumps work?
# TBD, do conditional jumps work?
# jump right to a harder case, copy byte 0 to byte 3 and format, e.g. input="Y" output="Y=>Y"
is( `$jumper '#1=61#2=62#4=0#3=#10=#(11:)?:13:20(13:)#3+#10+#0-:11(20:)#10(21:)?:23:28(23:)#0+#10-:21(28:)#' 'Y' 2>&1`, "Y=>Y\n", 'copy a byte');

# test memory allocation by dropping 255s at increasingly large intervals
is( `$jumper '#16=511 #64=511 #256=511 #1024=511 #4096=511 #16384=511 #65536=511 #262144=511 #1048576=511 #65536-255 (20:)?:23(exit) #=' 'wrong' 2>&1`, "\n", 'test alloc()');

# upcase by subtraction
is( `$jumper '-32' 't' 2>&1`, "T\n", 'upcase via subtraction');
# 2 nested loops to upcase a character, like so: #0=2; do { #0--; #1=16; do { #1--; #2--; } while (#1); } while (#0);
is( `$jumper '#=2 (2:)#- #1=16 (6:)#1- #2- #1?:6 #0?:2 #=32 #1=32' '  t' 2>&1`, "  T\n", 'upcase via loops');
# downcase by addition
is( `$jumper '+32' 'B' 2>&1`, "b\n", 'downcase via addition');
# same thing with a loop, adjusted to walk the plank instead of jumping off it
is( `$jumper '#1 ?:3 :7 -<+ :0 #' 'B ' 2>&1`, "b\n", 'downcase via adder (from  Sieg)');
# base 10 adder with carry
is( `$jumper '#0-48#10=9#11=#5=#0(9:)?:11:22(11:)#10?:14:22(14:)-#11+#5+#0-:9(22:)#0?:110#11(25:)?:27:32(27:)#0+#11-:25(32:)#0+48>-43?:110=43>-48#10=9#11=#2(45:)?:47:58(47:)#10?:50:58(50:)-#11+#5+#2-:45(58:)#2?:110#11(61:)?:63:68(63:)#2+#11-:61(68:)#2+48>-61?:110=61>?:110=32#10=9#11=#5-10(83:)?:85:94(85:)#10?:88:94(88:)-#11+#5-:83(94:)#5?:99#4=49:100(99:)+10(100:)#11(101:)?:103:108(103:)#5+#11-:101(108:)#5+48' '1+1=' 2>&1`, "1+1= 2\n", 'base 10 adder, #1');
is( `$jumper '#0-48#10=9#11=#5=#0(9:)?:11:22(11:)#10?:14:22(14:)-#11+#5+#0-:9(22:)#0?:110#11(25:)?:27:32(27:)#0+#11-:25(32:)#0+48>-43?:110=43>-48#10=9#11=#2(45:)?:47:58(47:)#10?:50:58(50:)-#11+#5+#2-:45(58:)#2?:110#11(61:)?:63:68(63:)#2+#11-:61(68:)#2+48>-61?:110=61>?:110=32#10=9#11=#5-10(83:)?:85:94(85:)#10?:88:94(88:)-#11+#5-:83(94:)#5?:99#4=49:100(99:)+10(100:)#11(101:)?:103:108(103:)#5+#11-:101(108:)#5+48' '9+9=' 2>&1`, "9+9=18\n", 'base 10 adder, #2');

# order of assignment shouldn't affect order of print
is( `$jumper '#1=98 #0=97' '' 2>&1`, "ab\n", 'print order != assignment order');

# are chars modulo 256?
is( `$jumper '#10(#10 defaults to 0) +255+(#10 += 256) ?#(skip if #10==0) =' 'good' 2>&1`, "good\n", 'memory values limited to 0<x<255');
# go for the cycle;
is( `$jumper '(0:)+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ (256:)#4=10' 'BCID' 2>&1`, "ACID\n\n", 'cycle character less 1, PC>255');
# same thing with a loop;
is( `$jumper '#4=255(#4 = 255) (2:)#1+(#1++) #4-(#4--) ?:2(loop 255 times) #4=10(#4 = NL)' 'ADID' 2>&1`, "ACID\n\n", 'cycle character less 1, PC>255');

#       Exercise the program counter.
# PC > 255;
is( `$jumper '(0:)= (1:)############################################################################################################################################################################################################################################################### (256:)?:259 (257:)+ (258:):1 (259:)=97#3=10' 'a==' 2>&1`, "a==\n\n", 'program counter range >255');

#
#       "sad" path
#
#       Error checking required by the specification.
#
# simplest test case of PC going out of bounds
is( `$jumper ':2' '' 2>&1`, "Error\n", 'program counter too big by 1');
is( `$jumper ':1024' '' 2>&1`, "Error\n", 'program counter in space');
is( `$jumper ':1073741824' '' 2>&1`, "Error\n", 'program counter in hyperspace');
# try to drive program counter negative, if 32-bit signed integer
is( `$jumper ':2147483648(exit)' 'ridiculous speed' 2>&1`, "Error\n", 'program counter goes negative?, #1');
# try to drive program counter negative, if 64-bit signed integer
is( `$jumper ':9223372036854775808 (exit)' 'ludicrous speed' 2>&1`, "Error\n", 'program counter goes negative?, #2');

# spaces not allowed in operand; error or silently ignore (my choice)
isnt(`$jumper '#= #= #= #= #= +1 4 ' 'aops' 2>&1`, "oops\n", 'do not accept spaces in operands');
# ditto w/ a comment ; error or silently ignore (my choice)
isnt(`$jumper '#= #= #= #= #= +1(not valid)4 ' 'aops' 2>&1`, "oops\n", 'do not accept spaces in operands');

# RAM pointer error-checking; "Error" or "" are OK
isnt( `$jumper '<>=' 'oops' 2>&1 | grep -v Error`, "oops\n", 'unused negative RAM pointer behavior unspecified');
# RAM pointer negative and use it
is( `$jumper '<=' '' 2>&1`, "Error\n", 'cannot use negative RAM pointer, #1');
# check for RAM pointer wrap-around
is( `$jumper '<=' '0123456789' 2>&1`, "Error\n", 'cannot use negative RAM pointer, #2');

# The way I read this
#       "Commands and arguments may be delimited with spaces or new lines but
#       not necessary."
# multi-line commands are legit.
is( `$jumper "#4#?\n=" 'oops' 2>&1`, "\n", 'multi-line commands allowed');

# Multi-line comments would be consistent with multi-line commands, but I can't
# find something I can translate into a "must" or "must not" requirement in
#       "Program can have comments between (). ... Comments can be placed
#       anywhere."
# Until uncertainty resolved, no test case.

#
#       "bad" path
#
#       These tests violate the assumption that the instruction stream is wellll-farmed.
#
# characters not in the language; error or (my choice) silently skip
isnt(`$jumper 'x =' 'oops' 2>&1`, "oops\n", 'opcode discrimination');
# is ? accepted as an operator (vs operation modifier); error or (my choice) silently skip
is(`$jumper '(bad 0, good 0:)??0 (bad 1, good 0:):3 (bad 2, good 1:)#0' '' 2>&1`, "Error\n", '? not accepted as an opcode');

exit 0;

Ungolfed version.

#
#       Turing Machine Mach 2.0.
#       Tape? Tape? We don't need no stinkin' tape! We gots RAM!
#
#       dM = data memory
#       iM = instruction memory
#       pC = program counter
#       rP = RAM pointer
#       u, o, x = current instruction being executed
#
#       N = number of instructions in instruction memory
#

#       instruction decoder
iM = $*[0].gsub(/\([^)]*\)/m,' ').scan(/(\??)\s*([#=:><+-])\s*(\d*)/m).map { |a|
    [
        a[0] != '?',
        a[1],
        (a[2] == '')  ?  (/[#=:]/ =~ a[1] ? 0 : 1)  :  a[2].to_i
    ]
}
pC = 0
N = iM.size

dM = $*[1].bytes
rP = 0

while pC < N do
    #   u, unconditional instruction,   execute if true || (dM[rP] > 0)
    #                                   skip if false && (dM[rP] == 0)
    #   o, operator
    #   x, operand
    (u, o, x) = iM[pC]
    pC += 1
    dM[rP] = 0  if dM[rP].nil?
    if u || (dM[rP] > 0)
        case o
        when '#'
            rP = x
        when '>'
            rP += x
        when '<'
            rP -= x
        when /[=+-]/
            eval "dM[rP]#{o.tr'=',''}=x"
            dM[rP] %= 256
        when ':'
            pC = x
            abort 'Error'  if pC >= N
        end
    end
    abort 'Error'  if rP < 0
end
printf "%s\n", dM.take_while{|v|v&&v!=0}.pack('C*')

A quickie proto-assembler.

#
#       Jumper "assembler" - symbolic goto labels.
#
# what it does:
#       - translates labels/targets into absolute position
#               @label ?:good_exit
#               ...
#               :label
#
#       - a label is [a-zA-Z][a-zA-Z0-9_]*
#       - a target is @label
#       - one special label:
#               - "hyperspace" is last instruction index + 1
#       - strips out user comments
#               - everything from "//" to EOL is stripped
#               - jumper comments are stripped
#       - adds "label" comments of the form "(ddd:)"
# limitations & bugs:
#       - multi-line jumper comments aren't alway handled gracefully
#       - a target not followed by an instruction will reference
#               the previous instruction. this can only happen
#               at the end of the program. recommended idiom to
#               avoid this:
#                       @good_exit #
# what it doesn't do:
#       - TBD, simple error checking
#               - labels defined and not used
#       - TBD, symbolic memory names
#
# Example:
#
#   input -
#       (
#               adder from Sieg
#       )
#       @loop_head # 1  // while (*(1)) {
#       ?:continue
#       :good_exit
#
#       @continue -     //     *(1) -= 1;
#       <-           //     *(0) += 1;
#       +
#       :loop_head      // }
#       @good_exit #
#
#   output -
#       (0:) #1 ?:3 :7 (3:) - < + :0 (7:)#

rawSource = ARGF.map do |line|
  line.gsub(/\([^)]*\)/, ' ')   # eat intra-line jumper comments
    .gsub(/\/\/.*/, ' ')        # eat C99 comments
    .gsub(/^/, "#{$<.filename}@#{$<.file.lineno}\n") # add line ID
end.join
rawSource.gsub! /\([^)]*\)/m, '' # eat multi-line jumper comments
#
# Using example from above
#
# rawSource =
#       "sieg.ja@1\n \n" +
#       "sieg.ja@4\n@loop_head # 1\n"
#       ...
#       "sieg.ja@12\n@good_exit # \n"

instructionPattern = %r{
    (?<label> [[:alpha:]]\w* ){0}
    (?<operator> \??\s*[#=:><+-]) {0}
    (?<operand> \d+|[[:alpha:]]\w* ){0}

    \G\s*(@\g<label>\s*)?(\g<operator>\s*)?(\g<operand>)?
  }x
FAIL = [nil, nil, nil]
instructionOffset = 0
iStream = Array.new
target = Hash.new
targetComment = nil
for a in rawSource.lines.each_slice(2) do
  # only parse non-empty lines
  if /\S/ =~ a[1]
    m = nil
    catch( :parseError ) do
      chopped = a[1]
      while m = instructionPattern.match(chopped)
        if m.captures.eql?(FAIL) || (!m[:operator] && m[:operand])
          m = nil
          throw :parseError
        end
        if m[:label]
          if target.has_key?(m[:label].to_sym)
            printf $stderr, a[0].chomp + ": error: label '#{m[:label]}' is already defined"
            abort a[1]
          end
          target[ m[:label].to_sym ] = instructionOffset
          targetComment = "(#{instructionOffset}:)"
        end
        if m[:operator]
          iStream[instructionOffset] = [
              targetComment,
              m[:operator],
              /\A[[:alpha:]]/.match(m[:operand]) ? m[:operand].to_sym : m[:operand]
            ]
          targetComment = nil
          instructionOffset += 1
        end
        chopped = m.post_match
        if /\A\s*\Z/ =~ chopped
          # nothing parseable left
          break
        end
      end
    end
    if !m
      printf $stderr, a[0].chomp + ": error: parse failure"
      abort a[1]
    end
  end
end

# inject hyperspace label
target[:hyperspace] = instructionOffset

# replace operands that are labels
iStream.each do |instruction|
  if instruction[2]
    if !(/\A\d/ =~ instruction[2]) # its a label
      if target.has_key?(instruction[2])
        instruction[2] = target[instruction[2]]
      else
        abort "error: label '@#{instruction[2]}' is used but not defined"
      end
    end
  end
  puts instruction.join
end

Python (729)
import re,sys
R,p,i,T,q,g=[0]*1024,0,0,re.findall(r'\d+|[()#><=+:?-]',sys.argv[1]),lambda i:0<=i<len(T),lambda i,d:int(T[i])if q(i)and T[i].isdigit()else d
def z(p):
 global R;assert p>=0
 if p>=len(R):R+=[0]*1024
s=sys.argv[2]
R[0:len(s)]=map(ord,s)
while i<len(T):
 t=T[i]
 if t=='(':
  while T[i]!=')':i+=1
  i+=1
  if not q(i):break
  t=T[i]
 i+=1
 if t=='#':p=g(i,0)
 if t=='>':p+=g(i,1)
 if t=='<':p-=g(i,1)
 if t=='=':z(p);R[p]=g(i,0)
 if t=='+':z(p);R[p]+=g(i,1);R[p]%=256
 if t=='-':z(p);R[p]-=g(i,1);R[p]%=256
 if t==':':
  v=int(T[i])
  i,c=-1,-1
  while c!=v:i+=1;c+=T[i]in'#><=+-:'
 if t=='?':
  assert p>=0
  if p<len(R)and R[p]==0:i+=1
 i+=q(i)and T[i].isdigit()
print''.join(chr(int(c))for c in R).split('\0')[0]

As for running the program:

1st argument: Jumper code
2nd argument: Initialization string

Example:
$ python jumper.py "=97>>(this is a comment)=98>2=99#" "xyz123"
ayb1c3

There are probably a few things I overlooked, so please leave a comment if you happen to try something that should work but doesn't. Note that this is written in Python 2.x code.

How do you give it input?

@Claudiu See the example. It's a command-line argument.

That's the program. But look at the 7th bullet point. You should be able to initialize the initial RAM array to, say, "hello" via stdin or an argument

My mistake, it's the 6th bullet: "When program starts executing a prompt for input string should be displayed (or take input from command line arguments, it's up to you). Input string should not contain null character (zero byte). Then input string is written to RAM starting at zero index."

@Claudiu Ah, I knew I overlooked something, thanks. Now, upon running the program, you can input said string.

@Claudiu On second thought, I've made the initialization string a command-line parameter.

I assume you're using python 2. Python 3 throws a parse error.

@ScottLeadley Yes ("Note that this is written in Python 2.x code").

CoffeeScript (465)
The first prompt box is for the program and the second prompt box is input.
Test it at http://coffeescript.org.
Original:
p=prompt().replace(/\(.*?\)|[\s\n\r]/g,"").match(/\??[^\d]\d*/g) ?[]
y=p[..]
i=prompt()
r=[].map.call i,(c)->c[0].charCodeAt()
n=0
m=[(d)->n=d
(d)->m[5] (r[n]+d)%%256
(d)->p=y[d..]
(d)->m[1] -d
(d)->n-=d
(d)->r[n]=d
(d)->n+=d]
while b=p.shift()
 if b[0]=="?"
  continue unless r[n]
  b=b[1..]
 d="><+-#=:".indexOf(b[0])//4
 ~d||throw "!badcmd '#{b[0]}'"
 m[b[0].charCodeAt()%7](+b[1..]||+!d)
 n<0&&throw "!ramdix<0"
alert String.fromCharCode(r...).replace(/\0.*/,"")

This is still golfed, but commented:
# Get program
p=prompt().replace(/\(.*?\)/g,"").match(/\??[^\s\d]\d*/g) ?[]
# Create a copy of the program (for goto)
y=p[..]
# Get input
i=prompt()
# Put the input in the ram
r=[].map.call i,(c)->c[0].charCodeAt()
# RAM pointer
n=0
# An array of commands
# Since each of "<>+-#=:" is a different
# value mod 7 (what a coincedence?!)
# So 0th value is "#" command because
# "#".charCodeAt() % 7 === 0
m=[(d)->n=d
(d)->m[5] (r[n]+d)%%256
(d)->p=y[d..]
(d)->m[1] -d
(d)->n-=d
(d)->r[n]=d
(d)->n+=d]
# Iterate through commands
while b=p.shift()
 # If you find a "?" skip unless r[n] is > 0
 if b[0]=="?"
  continue unless r[n]
  b=b[1..]
 # Get the default value
 d="><+-#=:".indexOf(b[0])//4
 # If the command isn't good, throw an error
 throw "!badcmd '#{b[0]}'" if d==-1
 # Call the appropriate command
 # By computing the char code mod 7
 m[b[0].charCodeAt()%7](+b[1..]||+!d)
 # Make sure n is bigger than or equal to 0
 throw "!ramdix<0" if n<0
# Show output
alert String.fromCharCode(r...).replace(/\0.*/,"")

Edit: Adding spaces took more bytes than I thought.
This interpreter will throw an error on invalid syntax, the other has unspecified behavior on invalid syntax.
p=prompt().replace(/\(.*?\)/g,"").match(/\??[^\d\s\r\n]\s*\n*\r*\d*/g) ?[]
y=p[..]
i=prompt()
r=[].map.call i,(c)->c[0].charCodeAt()
n=0
m=[(d)->n=d
(d)->m[5] (r[n]+d)%%256
(d)->p=y[d..]
(d)->m[1] -d
(d)->n-=d
(d)->r[n]=d
(d)->n+=d]
while b=p.shift()?.replace /^(.)(\s\r\n)*/,"$1"
 if b[0]=="?"
  continue if !r[n]
  b=b[1..]
 d="><+-#=:".indexOf(b[0])//4
 ~d||throw "!badcmd"
 m[b[0].charCodeAt()%7](+b[1..]||+!d)
 n<0&&throw "!ramdix<0"
alert String.fromCharCode(r...).replace(/\0.*/,"")

Apparently this doesn't work for ?:2 :4 >1 :0 = 33 <10 =0 (the append-! program with an extra space)

@Sieg It should be <1 not <10.

@Sieg never mind, I'll update it when I have time

@Sieg works now, I'll work on golfing it further

You know, you could have just changed /\(.*?\)/g -> /\(.*?\)|\s/g

@Sieg No because you can't replace all spaces. For example, #35 7 shouldn't be the same thing as #357 (based on my interpretation)

#35 7 would be invalid syntax anyways.

@Sieg Yes, so it should throw an error. It shouldn't run successfully.

I took the stance of "it was not declared, so it's unspecified behavior", thus I would say it's fine. But again, I'm not the mighty user.

Let us continue this discussion in chat.

Clojure - 585 577 bytes
Edit:   I forgot modulo 256, of course
Edit 2: Now supports whitespace and comments anywhere. (585 -> 578)

No special golfing tricks used, because I don't know any for Clojure. The interpreter is purely functional. Comes packed with a nice error message in case of negative RAM address (an error is outputted, but no exceptions or errors are thrown).
(defn j[o i](let[o(re-seq #"\??[#<>=+:-]\d*"(clojure.string/replace o #"\(.*?\)|\s"""))r(loop[c 0 p 0 m(map int i)](if-let[f(nth o c nil)](let[[c p m]((fn r[t](let[f(first t)s(if(next t)(apply str(next t))(case f(\#\=\:)"0"(\>\<\+\-)"1"))v(read-string s)a(nth m p 0)](case f\?(if(=(nth m p 0)0)[c p m](r s))\#[c v m]\>[c(+ p v)m]\<[c(- p v)m]\:[(dec v)p m][c p(assoc(vec(concat m(repeat(- p(count m))0)))p(mod({\+(+ a v)\-(- a v)}f v)256))])))f)](if(< p 0)(str"Negative index "p" caused by "f)(recur(inc c)p m)))m))](if(string? r)r(apply str(map char(take-while #(> % 0)r))))))

Examples:
(j "=72>=101>=108>=108>=111>=32>=119>=111>=114>=108>=100>=33>=" "")
=> "Hello world!"
(j "?:2 :4 >1 :0 =33 >1 =0" "hi there")
=> "hi there!"
(j "#1 ?:3 :7 -<+ :0" "01") ; adder
=> "a"
(j "?:2 :4 >1 :0 =33 <10 =0" "hi there")
=> "Negative index -2 caused by <10"
(j "=72>=101>=108>=108>=111>=3(comment here <100)2>=119>=111>=114>=108>=100>=33>=" "")
=> "Hello world!"

Original slightly ungolfed code:
(defn memory
  ([]
    (vec (repeat 1024 0)))
  ([m i v]
    (assoc (vec (concat m (repeat (- i (+ -1024 (mod i 1024)) (count m)) 0)))
           i v)))

(defn parse [c p m t]
  (let [f (first t)
        s (if-let [v (next t)]
            (apply str v)
            (case f
              (\#\=\:) "0"
              (\>\<\+\-) "1"))
        v (read-string s)
        a (nth m p 0)]
    (case f
      \? (if (= (nth m p 0) 0) [c p m] (parse c p m s))
      \# [c v m]
      \> [c (+ p v) m]
      \< [c (- p v) m]
      \: [(dec v) p m]
      [c p (memory m p (mod ({\+ (+ a v) \- (- a v)} f v) 256))])))

(defn jumper [o i]
  (let [o (re-seq #"\??[#<>=+:-]\d*" (clojure.string/replace o #"\(.*?\)|\s" ""))
        r (loop [c 0
                 p 0
                 m (map int i)]
            (if-let [f (nth o c nil)]
              (let [[c p m] (parse c p m f)]
                (if (< p 0)
                  (str "Negative index " p " caused by " (nth o c))
                  (recur (inc c) p m))) m))]
    (if (string? r)
      r
      (apply str (map char (take-while #(> % 0) r))))))

My program in Jumper which adds a "!" works! It is a bit hard to program in Jumper..

It's a neat concept you have.

@user2992539 I added an example of a simple adder.

Generally, it is similar to Brainfuck, however it doesn't have loops, goto's and if's instead and has command parameters.

@user2992539 Figured out that much.

@user2992539 Also, you might be interested in the fact that regex /\??[#<>=+\-:]\d*|\(.*?\)/ matches any legal instruction, including comments.

I am using similar expression in my Javascript interpreter, only it is not finished yet.

@user2992539 I've got a Javascript interpreter for you :P

@user2992539 Fixed.

If you put the - at the end of the character class of your regex, you don't need to escape it. -1 character.

@tomsmeding Way ahead of you.

@Sieg sorry, didn't notice your ungolfed version is behind.

C 496
Edits:

Thanks to @Dennis it is now much shorter (and works in GCC to boot)
Thanks to @S.S.Anne for suggesting abort()
Thanks to @ceilingcat for some very nice pieces of golfing - now even shorter

The golfed version
#define M R=realloc(R,r+Q),bzero(R+r,Q),r+=Q
#define J z<0?abort(),0:z>r
#define G J||R[z]
#define P J?M:0,R[z]
#define O!C[1]?1:V;I+23
#define I;if(*C==35
#define W;while(*p&*p<33)p++
Q=1024;char*R,C[999][9],*p,*q,*o;r,z,c,V;E(char*C){I+28)G&&E(C+1);else{V=atoi(C+1)I)z=V;I+27)z+=O+2)z-=O+3)P=V;V--I+8)P=G+O-13)P=G-O)c=V;}}main(u,v)int**v;{M;for(o=v[u-3||strcpy(R,v[2])];*o;bcopy(p,q,o-p)){p=o;q=C[c++]W;if((*q++=*p++)==63){W;*q++=*p++;}W;strtol(p,&o,0);}for(c=*C[c]=0;*C[c];)E(C[c++]);puts(R);}

Try it online!
A slightly less golfed version of my original program:
#include<stdlib.h>
#include<memory.h>
#include<string.h>
#include<stdio.h>
#define CHAR_STAR char*
#define CASTED_R (CHAR_STAR)RAM
#define UNSIGNED_CHAR unsigned char
#define INCREASE_MEMORY RAM=(UNSIGNED_CHAR*)realloc(CASTED_R,RAM_size+1024),memset(CASTED_R+RAM_size,0,1024),RAM_size+=1024
#define IF_ERROR current<0?exit(puts("!")),0:current>RAM_size?
#define GET_CELL IF_ERROR 0:RAM[current]
#define PUT_CELL(x) IF_ERROR INCREASE_MEMORY,RAM[current]=x:RAM[current]=x;
#define ONE_IF_EMPTY !*(command+1)?1:
#define VALUE atoi(command+1)
#define REMOVE_WHITESPACE while (*pointer&&*pointer<33)pointer++;
#define COPY_CHAR (*command++ = *pointer++)
#define RETURN return
char commands[999][9];
UNSIGNED_CHAR*RAM = 0;
int RAM_size = 0, current = 0, command_size = 0;
CHAR_STAR get_command(CHAR_STAR a)
{
    CHAR_STAR pointer = a, *command = commands[command_size++], *next;
    REMOVE_WHITESPACE
    if (COPY_CHAR == '?')
    {
        REMOVE_WHITESPACE
        COPY_CHAR;
    }
    REMOVE_WHITESPACE
    int i = strtol(pointer, &next, 0);
    memcpy(command, pointer, next - pointer);
    command[next - pointer] = 0;
    RETURN next;
}
void eval(CHAR_STAR command){
    if (*command == '?')RETURN GET_CELL ? eval(command + 1) : 0;
    if (*command == '#')current = VALUE;
    if (*command == '>')current += ONE_IF_EMPTY VALUE;
    if (*command == '<')current -= ONE_IF_EMPTY VALUE;
    if (*command == '=')PUT_CELL(VALUE)
    if (*command == '+')PUT_CELL(GET_CELL + ONE_IF_EMPTY VALUE - 1)
    if (*command == '-')PUT_CELL(GET_CELL - ONE_IF_EMPTY VALUE - 1)
    if (*command == ':')command_size = VALUE - 1;
}
int main(int argc, CHAR_STAR *argv)
{
    INCREASE_MEMORY;
    argc == 3 ? strcpy(CASTED_R, argv[2]) : 0;
    CHAR_STAR command = argv[1];
    while (*command) command = get_command(command);
    *commands[command_size] = 0; command_size = -1;
    while (*commands[++command_size]) eval(commands[command_size]);
    RETURN puts(CASTED_R);
}

I don't know about other compilers, but this won't compile in GCC. This can be fixed by replacing the second R[z]=x in P(x) with (R[z]=x). 2. GCC doesn't require any of the include statements. 3. char C -> U C.

@Dennis I was testing it with Visual C++ 2013.  I'll test it with GCC tomorrow.

@ceilingcat Thanks very much.  I just learned several really good lessons about golfing.  Now I need to try to decipher your newer, even shorter version!

error can be abort().

@S.S.Anne Thank you

@ceilingcat Nice find, thank you

Javascript, 519
C=prompt().replace(/\(.*?\)/g,"").match(/\??[#><=+:-]\d*/g)
M=prompt().split("").map(function(c){return c.charCodeAt(0)})
R=0
f=function(I){T=I[0]
A=I.slice(1)
if(T=="?")return M[R]?f(A):P++
A=A==""?1:+A
if(T==">")R+=A
if(T=="<")R-=A
if("=+-".indexOf(T)+1){if(R<0)throw alert("ERR RAMidx<0")
while(R>=M.length)M.push(0)}
if(T=="+")M[R]=M[R]+A&255
if(T=="-")M[R]=M[R]-A&255
A=+I.slice(1)
if(T=="#")R=A
if(T=="=")M[R]=A
if(T==":")P=A;else++P}
for(P=0;C[P];)f(C[P])
alert(String.fromCharCode.apply(7,M).replace(/\0.*/,""))

This gets the program and input via prompt boxes. Pasting this in your browser's Javascript console will work, as well as throwing this in a file, pasting before the code <!DOCTYPE html>, newline, <html><head><script>, and after the code </script></head><body></body></html>, and saving the resulting file as "swagger.html".
This is my first attempt at this thing, and I already like the language. Kinda. It really needs text labels though, instead of this BASIC-style instruction index labeling.
Ungolfed version (kinda):
var C,M,R,P,f;
C=prompt().replace(/\(.*?\)/g,"").match(/\??[#><=+:-]\d*/g); //Code
M=prompt().split("").map(function(c){return c.charCodeAt(0)}); //Memory
R=0; //RAM pointer
f=function(I){ //parser function, Instruction
    var T,A;
    T=I[0]; //Type
    A=I.slice(1); //Argument
    if(T=="?")return M[R]?f(A):P++;
    A=A==""?1:+A;
    if(T==">")R+=A;
    if(T=="<")R-=A;
    if("=+-".indexOf(T)+1){
        if(R<0)throw alert("ERR RAMidx<0");
        while(R>=M.length)M.push(0);
    }
    if(T=="+")M[R]=M[R]+A&255;
    if(T=="-")M[R]=M[R]-A&255;
    A=+I.slice(1);
    if(T=="#")R=A;
    if(T=="=")M[R]=A;
    if(T==":")P=A;else++P;
}
for(P=0;C[P];f(C[P])); //Program pointer
alert(String.fromCharCode.apply(7,M).replace(/\0.*/,""));

If only Clojure's string-replace wouldn't be clojure.string/replace

Also, something I noticed, it doesn't matter at all if you increase the memory to multiples of 1024 or not ;)

I don't think your script can handle ?:2 :4 >1 :0 = 33 <10 =0 (the append-! with an extra space) Not tested though.

@Sieg it definitely cannot. Should it? I can just filter out all whitespace if needed...

"Commands and arguments may be delimited with spaces or new lines but not necessary. However spaces inside arguments are invalid" If I understand that correctly, arguments may be preceded by whitespace. @user2992539 Got a word on this?

@Sieg In your submission, I read the regex \??[#<>=+:-]\d*, which doesn't allow spaces between oprerator and argument either.

I remove them by replacing every \(.*?\)|\s with empty.

@tomsmeding If you want symbolic goto labels, check out the proto-assembler in my answer.

Could if(T==">")R+=A;if(T=="<")R-=A; be rewritten R+=T==">"?A:T=="<"?-A:0; etc?  Also M[R]+=A&255*T=="+"?1:T=="-"?-1:0; etc.

@Will it could; will fix later

Haskell: an ungodly amount of characters
Alright, right now this is something that might or might not be golfed shortly. It is freakishly huge for what it is, with lots and lots of sloppily written code (it was quite some time since I last touched Haskell). But it was fun to write.
import Data.Char

parse [] p c a m i =
    if c == ' ' || c == '?' then
        []
    else
        (p ++ [(c, a, m)])

parse (h:t) p c a m i
    | i
        = parse t p c a m (h == ')')
    | isDigit h && a < 0
        = parse t p c (digitToInt h) m i
    | isDigit h
        = parse t p c (10 * a + (digitToInt h)) m i
    | elem h "#><=+-:?"
        = if c == ' ' || c == '?' then
            parse t p h a (c == '?') i
        else
            parse t (p ++ [(c, a, m)]) h (-1) False i
    | otherwise
        = case h of
            '(' -> parse t p c a m True
            ' ' -> parse t p c a m i
            _   -> []

run p pp r rp
    | pp >= length p
        = r
    | pp < 0 || rp < 0
        = []
    | otherwise
        = if mr then
            case c of
                '#' -> run p (pp + 1) r pa
                '>' -> run p (pp + 1) r (rp + pa)
                '<' -> run p (pp + 1) r (rp - pa)
                '=' -> run p (pp + 1) (rh ++ ((chr pa) : rt)) rp
                '+' -> run p (pp + 1) (rh ++ (chr (mod ((ord h) + pa) 256) : rt)) rp
                '-' -> run p (pp + 1) (rh ++ (chr (mod ((ord h) - pa + 256) 256) : rt)) rp
                ':' -> run p pa r rp
        else
            run p (pp + 1) r rp
        where
            (c, a, m)
                = p !! pp
            (rh, h:rt)
                = splitAt rp r
            pa
                = if a < 0 then
                    if elem c "><+-" then
                        1
                    else
                        0
                else
                    a
            mr
                = ord (r !! rp) > 0 || not m

main = do
    p <- getLine
    let n = parse p [] ' ' (-1) False False
    if n == []
        then do
            putStrLn "Error"
        else do
            s <- getLine
            let r = run n 0 (s ++ (repeat (chr 0))) 0
            if r == []
                then do
                    putStrLn "Error"
                else do
                    putStrLn (takeWhile (/=(chr 0)) r)

Groovy 582
ungolfed version:
I think there is a bug with the comments, which are not recognized correctly, which might be caused by the stupid regex I used, but the 2 programs run as they should:
class P {
    def c = 0
    def p = 0
    def m = []

    P(i="") {
        m = i.chars.collect { it }
        m << 0
    }

    def set(v) { m[p] = v }
    def add(v) { m[p] += v }
    def sub(v) { m[p] -= v }

    def eval(i) {
        while(c < i.size()) {
            if (i[c].p && m[p] == 0) {c++}
            else { i[c].f(this,i[c].v) }
        }
        return m
    }
}

def parse(s) {
    def ops = [
       '#' : [{p, v -> p.p = v; p.c++}, "0"],
       '>' : [{p, v -> p.p += v; p.c++}, "1"],
       '<' : [{p, v -> p.p -= v; p.c++}, "1"],
       '=' : [{p, v -> p.set(v); p.c++}, "0"],
       '+' : [{p, v -> p.add(v); p.c++}, "1"],
       '-' : [{p, v -> p.sub(v); p.c++}, "1"],
       ':' : [{p, v -> p.c = v}, "0"]
    ]

    (s =~ /\(.*\)/).each {
        s = s.replace(it, "")
    }

    (s =~ /(\?)?([#><=+-:])([0-9]*)?/).collect {
        def op = ops[it[2]]
        [f : op[0], v : Integer.parseInt(it[3] ?: op[1]), p : it[1] != null ]
    }
}

Haskell, 584
The input and jumper program are provided as the first two lines of input from stdin.
a g(i,n,x)=(i+1,n,take n x++((g$x!!n)`mod`256):drop(n+1)x)
b g(i,n,x)=(i+1,g n,x)
c=b.q:a.(+):g:a.(-):b.(-):a.q:b.(+):c
d=(%['0'..'9'])
e=fromEnum
f=0>1
g n(_,x,y)=(n,x,y)
h(x:_)=d x;h _=f
i g p@(j,n,m)|x$m!!n=g p|t=(j+1,n,m)
j=0:1:0:1:1:0:1:j
k=takeWhile
l[]=[];l(x:y)|x%") \n"=l y|x%"("=l$u(/=')')y|t=x:l y
main=v>>=(\y->v>>=putStr.map toEnum.k x.r(0,0,map e y++z).p.l)
o n s|h s=(read$k d s,u d s)|t=(n,s)
p[]=[];p(x:y)|x%"?"=w$p y|t=(c!!e x)n:p m where(n,m)=o(j!!e x)y
q=const
r s@(i,n,m)p|i<length p=r((p!!i)s)p|t=m
t=0<1
u=dropWhile
v=getLine
w(m:n)=i m:n
x=(/=0)
z=0:z
(%)=elem

I'll post an ungolfed version later, but in the meantime I wanted to leave this as a puzzle for the reader:

Where are the jumper commands such as '#' etc?

Have fun!

Perl 5 -F, 345 bytes
$#F--;$_=<>;s/\(.*?\)|\s*([+<>#=:?-])\s*/$1/g;die'Error'if/[^+<>#=?:0-9-]/+/\?\d/;s/[><+-]\K(?=\D|$)/1/g;s/[#=:]\K(?=\D|$)/0/g;map$_=ord,@F;@c=/.*?\d+/g;while($l<@c){$_=$c[$l++];s/\?//*!$F[$p]&&next;/[=+-]/?$F[$p]=eval"(\$F[\$p]$_)%256":/[<>]/?eval'$p=$p'.y/></+-/r:/#/?$p=y/#//dr:s/://&&($l=$_);die'Error'if$p*$l<0||$l>@c}print$_?chr:last for@F

Try it online!
The first line of input is the initialization of RAM, the second line is the jumper program.

source: Stack Exchange

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

sort: votes


text:
Calculate the probability of seeing a landmark when starting at a given point and walking straight in a random direction
Input 5 integers: Landmark X & Y, Starting Point X & Y, and View Distance Radius D
Output 1 double: % chance of coming within D of Landmark (X,Y) ("seeing") when walking straight in a random direction from Starting Point (X,Y).
Assume that "random direction" shall be a direction uniform on [0,2π], the land is flat, and of course the 'hiker' never turns after he begins moving.
Example: If landmark is at (10,10), starting point is (5,5), and view distance is 20 then the output would be 100% as no matter which direction you walk the landmark will be immediately visible.

This kinda lost its appeal since you already linked to the solution.

@MartinBüttner I hadn't considered that since it is hardly implemented as code... but I suppose I can remove it if people also want to solve the math.

@ioSamurai just wanted to let you know that people can still see the math if they choose to look at the revisions - although I don't see any problem with leaving the math there.. people would be able to copy the math from the first answer, and would be challenged with optimizing the space anyways...

@user2813274 Yeah I didn't think showing the math was an issue anyways because it was really about the coding.

If you want to make this challenging/interesting, i suggest you ban trigonometric functions. Accuracy of probability should also be specified (I suggest to the nearest 1%, given that probability can be from 0 to 100%.)

CJam -41 -40 -39 -38/35 31/26
This seems to work. It is my first attempt at CJam and/or codegolf.  Run the code at http://cjam.aditsu.net/. In the section called input just place the variables as integers delimited with spaces in the input block in this order: distance D, landmark x, starting x, landmark y, starting y  (for example 20 10 5 10 5).  I had posted a previous one based on a misunderstanding of the equation that has been resolved.  I also had been returning answers as probability ratios rather than percentages.  Note: the second code has only 31 characters but combines alot from another user's CJam code.
ri{riri- 2#}:U;UU+.5#/mSP/:A.5<A1?e2

r{~riri-_*}_~+mq/mSP/:A.5<A1?e2

Accuratish one without arcsine being directly called (44 characters):
ririri- 2#riri- 2#+ .5#/:A1<AA3#6/+P/1?100*

Even more accurate (52 characters):
ririri- 2#riri- 2#+ .5#/:A1<AA3#6/+A5#40/3*+P/1?100

Update:
The absolute best I've written is 26 characters.  I've still learned alot by watching professorfish's attempts but the crux is mine.  I assumes (potentially incorrectly) that if you can see the landmark if it is closer (not closer than or equal to) your sight radius.
1r{~riri-_*}_~+mq/mSP/e<e2

Haskell, 65 63
import Data.Complex
(s,l)%d=100*min(asin(d/magnitude(s-l))/pi)1

Use like (xstart:+ystart, xlandmark:+ylandmark) % distance.  Gives result in percent.  Why is it so expensive to load modules in Haskell?!?
Note that there is no if/then/else, pattern matching, etc. in this code, min does the magic.

I didn't expect Haskell to do so well here, nor the Spanish Inquisition. :D

what is the undocumented feature, if i may ask?

is it the fixity of \min``?

@proud haskeller: the way min deals with NaN.  Since NaN compares to a non-NaN to False, the exact implementation of min is relevant (whether or not it uses the inverse of a result of a comparison).  As far as I can tell, this behaviour is not specified anywhere, but I'd be glad to be proven wrong.

when you write NaN, you mean undefined? or is there some other NaN I'm not aware about?

oh you're talking about 0/0? i see.

We commented simultaneously, so yes, it's the fixity, and it's in the hs98 report, but you have to think about it when you read it.  By NaN I mean the result of a computation that doesn't have a result representable in the relevant data type, such as asin x with abs x > 1 in this case.  undefined is something very different.

actually, i'd say that is an undocumented feature in the instance of Compare (Complex a), but yes.

i used to think NaN is a value that is represented by the data type, but has no meaning, something like 3%0 in Data.Ratio . but i guess it could be useful returning NaN instead of undefined so that something valuable could be done with the result even when an error occurred.

what happens if you input 0,0(start) 0,5(landmark) 5(viewing distance)?  I think this code is effectively identical to my 26 character one.

@kaine: 50, just like it should.

Im not sure whether it should or shouldn't. Can you see it if $ r <d $ or $ r <=d $? I prefer it this , however, as that is the shorter of my answers.

+1, importing is really expensive when golfing in Haskell. To use sort (compare 'on' key), one need to do import Data.List; import Data.Function;...

CJam, 44 40 38 37
First CJam script! Uses the method on the Math.SE answer here.
Supports non-integer inputs as well, at no extra character cost.
rd{rdrd-_*}:U~U+mq/_1<{mSP/}{;1}?100*

Interpreter at cjam.aditsu.net.
Order of inputs
The inputs are given in this order, on STDIN, separated by spaces:

View Distance Radius
Landmark X
Starting Point X
Landmark Y
Starting Point Y

Why not use P instead of 3.14? P starts off defined as pi  This will give you the same length as mine.

@kaine Fortunately I've thought of another saving, I'm now beating you by one character

How is that fortunate?

There is, what I believe, to be a mistake in this.  If you start exactly as far as you can see away, you get 50% on yours 100% on mine. Easy change. An it is debatable which is correct.

ri{riri-_}:U;UU+mq/_1>{;1}{mSP/}?100 you are welcome dammit

I'm going to stop becaue the more I try to trim both yours and mine, the closer to each other they get!

@kaine fixed the bug, same char count

Haskell — 72 70 69 68
I think this satisfies the question, but if not please leave a comment and I'll do my best to fix it:
w s y l z d|r<d=100|0<1=asin(d/r)/pi*100where r=sqrt$(l-s)^2+(z-y)^2

you can replace True with 0<1, and use $ in the definition of r.

Thanks, I can't believe I missed that $ opportunity.

You could also squish where up against 100.

It breaks vim's syntax highlighting (why I didn't delete the space in the first place), but it does indeed compile.

Also, asinh should really be asin. The character reduction is a bonus!

asin kept returning NaN

They're not the same. asin(1)=PI/2=1.57 asinh(1)=0.88. If asin is giving NaN it's because you're giving it an argument outside the range -1 to 1, which doesn't make sense according to the definition of sin.

@steveverrill Sorry about that, I tried again and I think when I was getting NaN I was using invalid arguments.

Python - 73
from math import*
f=lambda l,s,d:(abs(l-s)<=d or asin(d/abs(l-s))/pi)*100

l is a complex number (e.g. 5 + 5j) describing the landmark position, s describes the start position and d is the view distance, for the example from the question call f as follows: f(5 + 5j, 10 + 10j, 20)

I guess you are missing a bracket (.

Now you are missing two brackets (...). ;) Otherwise you might return True rather than 100 in case the landmark is closer than the distance d.

Oh, that's what you mean...

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


text:
Make a webpage where it looks like the browser is hanging / crashing
Your task today is to create a HTML page.
This page, when opened in a browser, behaves as if the browser has a problem (hanging, crashing, network error, virus, etc.)

You can use all the HTML(5), CSS(3) and JavaScript features you want.
You can't use Flash or other plugins.
You can't provoke a real problem in the browser (for example, you can't make the browser hang with an infinite loop, or crash with a bug exploit, etc.), just make it look like there is a problem.

Please post your source code and provide an URL to view your page, and precise on which browsers / devices it works (if specific).
I recommend http://www.c99.nl/ to host your page easily.
This is a popularity contest, so the most upvoted answer wins!
Thanks, and have fun!

I think this could have some interesting results, even though it's a very broad challenge.

I do not see what is unclear at the moment, I voted for reopening. It is of course a broad challenge as @nderscore mentioned, all in all a rather creative task than a programming challenge and I think that this has to have its place here too.

it seems to me challenges like this are the exact reason the admins were so hesitant to allow [tag:popularity-contest] on the site.. no real objective way to identify a "correct answer"

@ardnew thats why its a [tag:popularity-contest], there is no right or wrong. the one with the most votes wins.

@TeunPronk No - A popularity-contest is a competition where the correct answer with the highest vote tally (upvotes minus downvotes) wins, usually the most creative answer. Each [tag:popularity-contest] must give precise requirements such that we can judge if an answer is correct.

@Howard okay, fair enough.. my bad. On the other hand, he did give requirements even if there aren't a lot but they are there.

Wouldn't it be more fun to see who could actually crash the browser fastest with the smallest amount of code ?

  <title>Connecting...</title>

http://c99.nl/f/64943.html

neat! you could get rid of double scrollbars with overflow:hidden on the body or something like that. And use an iframe instead of object (for semanticity)

That doesn't hang for me.

cursor: wait is the trick.

@xem thanks, I changed it as you suggested!

@vauge Works now.

Better don't mess with Bond villains
Enter Blofelds secret ambush...

And in case you want to see the code:
jsfiddle

 After 3 seconds there will pop up a message, that the script isn't responding, but that's only an alert popup and not a real message from a hanging page. After 15 seconds there will be additional greetings from Blofeld.

I like it, but I get a notification of an unresponsive script which is something that shouldn't happen I believe. even though you seem to generate that yourself.

@TeunPronk No, that's supposed to happen.

@TeunPronk I got you! That's exactly what should happen, but it's not a real warning only an alert.

I haven't used javascript in forever, but can't you use something like window.location appended with some javascript filename to make the domain appear to match?

Zombie Error
https://dl.dropboxusercontent.com/u/141246873/ZombieError/index.html
Note: It might take a few seconds to load due to the image file.
The webpage consists of the below html, css and javascript as well as an image file zombie.png (graphics by Clint Bellanger licensed CC-BY 3.0).
Tested in google chrome v36, but I expect it will work in most browsers.
Update:
26th Jul: Now removes zombies once they walk off the screen
28th Jul: You can now click on the zombies to blast them off the website
HTML:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <title>Zombie Error</title>
    <link rel="stylesheet" href="app.css" type="text/css" />

CSS:
body {
    font-family: 'Segoe UI', sans-serif;
}

span {
    font-style: italic;
}

.zombie{
    width: 78px;
    height: 78px;
    background-image: url('https://dl.dropboxusercontent.com/u/141246873/ZombieError/zombie.png');
    background-position: left;
    background-position-x: 0px;
    background-position-y: 0px;
    position: absolute;
    left: 10px;
    top: 10px;
}

body{
    overflow: hidden;
}

Javascript:
var directionWest = 0;
var directionNorth = 6;
var directionEast = 4;
var directionSouth = 2;

var stateWalking = 0;
var stateDying = 1;
var stateDead = 2;

var animWalk = {
    speed: 0.15,
    numFrames: 8,
    frames: [4, 5, 6, 7, 8, 9, 10, 11]
}

var animDying = {
    speed: 0.10,
    numFrames: 8,
    frames: [28, 29, 30, 31, 32, 33, 34, 35]
}

var spriteWidth = 128;
var spriteHeight = 128;

var spriteOffsetX = 25;
var spriteOffsetY = 25;

var spritesheetWidth = 4608;

function Zombie(_id, _x, _y, _direction) {
    this.direction = _direction
    this.id = _id;
    this.pos = { x: _x, y: _y }
    this.anim = animWalk;
    this.animFrame = 0;
    this.animDelta = 0;
    this.speed = 30;
    this.state = stateWalking;
    this.corpseDelta = 0;
    return this;
}

Zombie.prototype.Update = function (delta) {
    if (this.state == stateDead)
        return;

    //update the animation frame
    this.animDelta += delta;
    if (this.animDelta >= this.anim.speed) {
        this.animDelta -= this.anim.speed;
        this.animFrame++;
        if (this.animFrame >= this.anim.numFrames)
            this.animFrame = 0;
    }

    //background-position-x
    var div = document.getElementById(this.id);
    div.style.backgroundPositionX = ((spritesheetWidth - (spriteWidth * this.anim.frames[this.animFrame])) - spriteOffsetX) + "px";
    div.style.backgroundPositionY = ((spriteHeight * this.direction) - spriteOffsetY) + "px";

    if (this.state == stateWalking) {
        //update position
        if (this.direction == directionEast)
            this.pos.x += (this.speed * delta);
        if (this.direction == directionWest)
            this.pos.x -= (this.speed * delta);
        if (this.direction == directionNorth)
            this.pos.y -= (this.speed * delta);
        if (this.direction == directionSouth)
            this.pos.y += (this.speed * delta);
        div.style.left = Math.floor(this.pos.x) + "px";
        div.style.top = Math.floor(this.pos.y) + "px";
    }
    else if (this.state == stateDying && this.animFrame == (this.anim.numFrames - 1)) {
        this.state = stateDead;
    }
}

var zombies = []

var nextZombieID = 0;

function GetZombie(zombieID)
{
    return zombies.filter(function (z) { return z.id == zombieID })[0];
}

function ZombieClick(div)
{
    var zombie = GetZombie(div.srcElement.id);

    if (zombie.state == stateWalking) {
        zombie.state = stateDying;
        zombie.animFrame = 0;
        zombie.animDelta = 0;
        zombie.anim = animDying;
    }
}

function NewZombie()
{
    var x = 0;
    var y = 0;
    var direction = 0;

    var rand = Math.random();
    if (rand < 0.25)
    {
        //spawn from left of screen
        x = spriteWidth * -1;
        y = (Math.random() * screen.height) - spriteHeight;
        direction = directionEast;
    }
    else if (rand < 0.5) {
        //spawn from right of screen
        x = screen.width;
        y = (Math.random() * screen.height) - spriteHeight;
        direction = directionWest;
    }
    else if (rand < 0.75) {
        //spawn from top of screen
        x = (Math.random() * screen.width) - spriteWidth;
        y = spriteWidth * -1;
        direction = directionSouth;
    }
    else {
        //spawn from bottom
        x = (Math.random() * screen.width) - spriteWidth;
        y = screen.height;
        direction = directionNorth;
    }

    //generate an id
    var id = nextZombieID;
    nextZombieID++;

    //create a div
    var div = document.createElement("div");
    div.id = id;
    div.classList.add("zombie");
    div.onclick = ZombieClick;
    document.body.appendChild(div);

    //create a zombie
    zombies.push(new Zombie(id, x, y, direction));
}

var spawnRate = 1;
var spawnDelta = 0;

function spawnZombies(delta)
{
    spawnDelta += delta;
    if (spawnDelta >= spawnRate) {
        spawnDelta -= spawnRate;
        NewZombie();
    }
}

var corpseDuration = 3;

function cleanupZombies(delta)
{
    for (var i = zombies.length - 1; i >= 0 ; i--) {
        //if the zombie has walked off the screen, remove them
        if (zombies[i].pos.x < (spriteWidth * -2)
            || zombies[i].pos.x > screen.width + spriteWidth
            || zombies[i].pos.y < (spriteHeight * -2)
            || zombies[i].pos.y > screen.height + spriteHeight)
        {
            var element = document.getElementById(zombies[i].id);
            element.parentNode.removeChild(element);
            zombies.splice(i, 1);
        }

    }

    for (var i = zombies.length - 1; i >= 0 ; i--) {
        //if the zombie has died, remove their corpse after some time
        if (zombies[i].state == stateDead) {
            zombies[i].corpseDelta += delta;

            if (zombies[i].corpseDelta > corpseDuration) {
                var element = document.getElementById(zombies[i].id);
                element.parentNode.removeChild(element);
                zombies.splice(i, 1);
            }
        }
    }

}

var started = false;

var main = function () {
    var now = Date.now();
    var delta = now - then;
    if (started) {
        cleanupZombies(delta / 1000);

        spawnZombies(delta / 1000);

        for (var i in zombies)
            zombies[i].Update(delta / 1000);
    }

    then = now;

    setTimeout(main, 30);
};

var then = Date.now();
setTimeout(main, 30);

setTimeout(function () {
    alert("Error 8102: Unexpected zombie attack. Please stand by...");
    started = true;
}, 2000)

Redirect to about:crash, which shows the default crash screen on Chrome [won't work on modern versions of Chrome, Firefox, or other browsers]:

<meta http-equiv="refresh" content="0; url=about:crash">

It probably doesn't qualify as a "full HTML page", but it will be rendered correctly by Chrome.
To try it, type this into the Chrome address bar:
data:text/html;base64,PG1ldGEgaHR0cC1lcXVpdj0icmVmcmVzaCIgY29udGVudD0iMDsgdXJsPWFib3V0OmNyYXNoIj4=

I couldn't test this answer because I don't have a Chrome install handy, please remove this notice once you test it.

I tried putting that text in the address bar of Chromium (mostly the same as Chrome), but it just resulted in a page with the contents PG1ldGEgaHR0cC1lcXVpdj0icmVmcmVzaCIgY29udGVudD0iMDsgdXJsPWFib3V0OmNyYXNoIj4=

@IanD.Scott Whoops! I accidentally typed content rather than base64. I edited my answer.

Your base64 just redirects me to about:blank.

Glitchy scroll
No, that's not bad image compression. Unintended side effect from something else I was trying.
Try it out with the link in the title; The page starts looking weird while you scroll, and the scroll should become very jittery after a while. I think you need font smoothing of some sort activated, but everyone has this nowadays, right? The screenshot is from Chrome on OS X.

The jQuery code:
$( window ).scroll(function() {
    $('#main').clone().prependTo('body');
});

HTML + CSS + JavaScript/jQuery/jQuery UI
This simulates a Windows error dialog. (It drags, too!) Like all good error messages, it fulfills two main requirements:

It displays a cryptic error message meaning nothing to all but a few.
The buttons seem to do nothing when clicked except show the wait cursor.

See it in action at http://codepen.io/anon/pen/onbAi. (JSFiddle was not loading jQuery UI well.) It should display reasonably well on all browsers.
<!DOCTYPE html>

    <button id="close" title="Close">×</button>

Application Error

The instruction at "" referenced memory at "". The memory could not be "read".

Click on OK to terminate the program

  <button id="ok">OK</button>

$('#window').draggable({handle:'header'});

function randomHex(){
  return '0x'+(Math.floor(Math.random()*0xffffffff)).toString(16);
}

$('.hex').each(function(){
  $(this).text(randomHex());
});

var reg = /(opera|chrome|safari|firefox|msie)/i,
    browser = navigator.userAgent.match(reg)[0].toLowerCase();
if(!browser){
  browser = 'firefox';
} else if(browser == 'msie'){
  browser = 'ie';
}
$('#browser').text(browser + '.exe - ');

$('button').click(function(){
  $('html, body').css('cursor','wait');
});
</script>

I've tested this on my smartphone. I can't get it to load properly on c99.nl, though. Must be that obscure.
It makes your browser look possessed with some sort of obscure virus affecting the loading bar.
<!DOCTYPE html>

<title>Redirecting...</title>

Redirecting...

Notes:

This can easily be tested locally by copying it into a plain text file, and the name or place doesn't matter beyond file extension. It is valid HTML5 + JavaScript (you can see for yourself here...only warning is missing <meta charset=utf-8 />).
Make sure that if you test it, especially on a mobile device, stop the loading loop first (same as cancelling a page load) before you exit, or it may crash. (I learned this the hard way...)

 In case you hadn't noticed, it's continually redirecting to the same page. window.location.href and document.location.href are synonymous, so it's assigning the current location to its synonym. It could look like server lag or a browser hang, depending on the browser and largely it's caching mechanism.

 That last line is just for theme.

Actually, it is valid HTML5, barring the missing  tag (which is fixed).

@Sieg You can omit the , , , and <meta charset="utf-8" /> tags in HTML5. You can also omit 99% of the otherwise-important stuff in the <!DOCTYPE> tag, permitting the iconic <!DOCTYPE html> declaration for HTML5 instead of the lengthy <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> for HTML 4.01 Strict.

data:text/html, <meta http-equiv="refresh" content="0">

The error code keeps changing, and the computer goes noisy.

Simulates an lagging loading spinner
http://c99.nl/f/104794.html
Sourcecode: http://jsfiddle.net/3QURA/2/
HTML:

Loading...

CSS:
body,html {
    width:100%;
    height:100%;
    margin:0;
    color:white;
}
#spinner {
    background:transparent;
    width:100px;
    height:100px;
    left:calc(50% - 100px / 2);
    position:relative;
    -webkit-animation: load infinite 1s;
    -webkit-border-radius: 100%;
    border-right:white 8px solid;
}
@-webkit-keyframes load {
    0% { -webkit-transform:rotate(0deg) }
    100% { -webkit-transform:rotate(360deg) }
}
.paused {
    -webkit-animation-play-state:paused;
}
#loader {
    font-family:Helvetica Light, Helvetica Neue, Helvetica, Arial, sans-serif;
    left:0%;
    position:fixed;
    text-align:center;
    background:rgba(55,55,55,0.5);
    width:100%;
    height:100%;
}

JavaScript and jQuery:
window.setInterval(update, 1000/2);
function update() {
window.setTimeout(function () {
    $("#spinner").addClass("paused");
},1000);
window.setTimeout(function () {
    $("#spinner").removeClass("paused");
},1200);
}

Chrome Crash Page
Actual Link: chrome://crash/
HTML
<!DOCTYPE html>

  <meta charset="utf-8">
  <title>JS Bin</title>

Aw, Shit!

This page is really fucked up, run for the hills.

  <button>Reload</button>

If it doesn't work, it's all your fault.

CSS
html, button {
  user-select: none;
  cursor: wait;
  font-family: Calibri, Sans-serif;
  text-align: center;
}
body {
  padding-top: 120px;
  background: #212e3d;
  font-size: 80%;
  color: white;
}
button {
  font-family: Calibri, Sans-serif;
  padding: 5px 10px;
}
div {
  font-size: 140%;
}


text:
What is your star-sign?
Write a program that takes a birth date (month and day-of-month) as input and outputs the corresponding sign, element and quality of the western zodiac.  For the purposes of this challenge, these are defined exactly as in the table in the linked wikipedia page:
Sign           Date Range                    Element    Quality

Aries          March 21 to April 19          Fire       Cardinal
Taurus         April 20 to May 20            Earth      Fixed
Gemini         May 21 to June 21             Air        Mutable
Cancer         June 22 to July 22            Water      Cardinal
Leo            July 23 to August 22          Fire       Fixed
Virgo          August 23 to September 22     Earth      Mutable
Libra          September 23 to October 23    Air        Cardinal
Scorpio        October 24 to November 20     Water      Fixed
Sagittarius    November 21 to December 22    Fire       Mutable
Capricorn      December 23 to January 20     Earth      Cardinal
Aquarius       January 21 to February 21     Air        Fixed
Pisces         February 22 to March 20       Water      Mutable

Rules

The sign, element and quality will be calculated from the input date exactly according to the wikipedia table.
I am giving some freedom over input date format (see Input section below).  You must clearly state in your answer what format you are using.
If an invalid date is provided (unparsable date, or month or day-of-month out of range), the program will exit with the message Invalid date.
The program must correctly handle leap years.  i.e. if Feb 29th is the input, then output must correctly be Pisces, Water, Mutable.
Your language's Date libraries/APIs are allowed, but any APIs that specifically calculate signs of the zodiac are banned.
Standard “loopholes” which are no longer funny
This is code-golf, so the shortest answer in bytes wins.

Input

The program may read the input date from STDIN, command-line, environment variables or whatever method is convenient for your language of choice.
This is not primarily an exercise in datestring-parsing, so the input string may be provided in whatever format you choose, as long as it consists of only month and day-of-month components and not other values (such as year or time).  E.g. Jul 24 or 24th of July or 7/24 or 24/07 or whatever format is convenient.  If input not matching your choice of input format is entered, then the Invalid date error must be thrown.

Output

The program will output to STDOUT, dialog box or whatever display method is convenient for your language of choice.
The output format will be the sign, element and quality separated by a comma and a space: Sign, Element, Quality

Examples
Input                 Output
1/1                   Capricorn, Earth, Cardinal
2/29                  Pisces, Water, Mutable
7/24                  Leo, Fire, Fixed
13/1                  Invalid date
2/31                  Invalid date
-1/-1                 Invalid date
1st of Golfember      Invalid date

Is detection/warning of an invalid date required? If so, can we assume invalid numbers entered by the user will be greater than zero? (I'm guessing most people will use a numerical date format.)

@steveverrill I think I made that clear in the third item of the rules, but I've edited the Input section to clarify.  TLDR valid input => valid output; invalid input => error message; no "undefined behaviour" allowed for any given input.

is a full date allowed? days, months and years?

@TeunPronk No, just month and day-of-month.  I've clarified the input rule.

Is the day of the year (e.g. Jan 21 -> 21, Feb 5 -> 36) a valid input format?

@Mego no, sorry, that's invalid - "it consists of only month and day-of-month components" - IIRC, I think my intention was that the month and day-of-month components should be separate, and not combined

JavaScript, 285 bytes
(My first answer here after lurking here for a while)

d=prompt(m=prompt(e='MutableCardinalFixedAirWaterFireEarthCapricornAquariusPiscesAriesTaurusGeminiCancerLeoVirgoLibraScorpioSagittarius'.match(/[A-Z][a-z]+/g)));alert(m>0&m<13&d>0&d<29-~'202121221212'[--m]?e[n=7+m%12+(d>18-~'121012333413'[m])]+', '+e[n%4+3]+', '+e[n%3]:'Invalid date')

The first prompt() is the month in numerical form, and the second prompt() is the day of the month (Ignore the text of the prompt). Leading zeroes are optional for both. The output is displayed with alert(). (Thanks to bitpwner, Snack, edc65, and core1024 for helping shorten the code.)
Try it above using Stack Snippets or at http://jsfiddle.net/8vq89/5/.
Code with whitespace and comments to explain the confusing parts added:
var m = prompt(), d = prompt(),
e = 'MutableCardinalFixedAirWaterFireEarthCapricornAquariusPiscesAries\
TaurusGeminiCancerLeoVirgoLibraScorpioSagittarius'.match(/[A-Z][a-z]+/g);
alert(m > 0 && m < 13 && d > 0
      & d < 29 - ~'202121221212'[--m] /* ~ is bitwise NOT, which yields -(x + 1). It also
                                         converts a string to a number. Subtracting that
                                         number from 29 gives the number of days in the
                                         month given. */
      ? e[n = 7 + // 7 is added to skip over the 7 qualities and elements in array e.
      m % 12 // The modulus allows dates near the end of December to wrap around to January.
      + (d > 18 - ~'121012333413'[m])] + ', ' +
      e[n % 4 + 3] + /* Qualities and elements follow a pattern, so the modulus determines
                        which one it is. 3 is added to skip over the 3 qualities. */
      ', ' + e[n % 3] : 'Invalid date')

For 'Cardinal0Fixed0Mutable'.split(0) and 'Earth0Air0Water0Fire'.split(0), ['Cardinal','Fixed','Mutable'] and ['Earth','Air','Water','Fire'] is a little shorter.

I had a solution, but too similar: z='Air9Water9Fire9Earth9Fixed9Mutable9Cardinal9Aquarius9Pisces9Aries9Taurus9Gemini9Cancer9Leo9Virgo9Libra9Scorpio9Sagittarius9Capricorn'.split(9); [m,d]=prompt().split(/\D/); alert([m-->0&m<12&d>0&d<(32-'020101001010'[m])?z[(m+=(18-~'121012333413'[m]<d)+11)%12+7]+', '+z[m%4]+', '+z[m%3+4]:'Invalid date']). Take a look at the single split

@edc65 I get an Invalid left-hand side in assignment error when I try to run that, probably having to do with the prompt

group assignment is Ecmascript 6, just works in firefox. p=prompt().split(/\D/),m=p[0],d=p[1] should work (but so longer)

Ah, that makes more sense. (It seems ES6 was developed purely for golfing.)

You can make it even shorter if you use '...ScorpioSagittarius'.match(/[A-Z][a-z]+/g) instead of '...Scorpio0Sagittarius'.split(0)

.split(/(?=[A-Z])/) is three bytes shorter than .match(/[A-Z][a-z]+/g)

C 353 352
Edit Fixed bug and typo, 1 char more
Before you ask: yes, even without #include is valid and working C standard.
Input format: two numbers, first month, then day.
char*s[]={"Air","Water","Fire","Earth","Fixed","Mutable","Cardinal","Aquarius","Pisces","Aries","Taurus","Gemini","Cancer","Leo","Virgo","Libra","Scorpio","Sagittarius","Capricorn"};
main(m,d){
  scanf("%d%d",&m,&d);
  m>0&m<13&d>0&d<(32-(4460832>>m>>m&3))
  ?m+=10+(" 121012333413"[m]-29<d),printf("%s, %s, %s\n",s[m%12+7],s[m%4],s[m%3+4])
  :puts("Invalid date");
}

Test
char*s[]={"Air","Water","Fire","Earth","Fixed","Mutable","Cardinal","Aquarius","Pisces","Aries","Taurus","Gemini","Cancer","Leo","Virgo","Libra","Scorpio","Sagittarius","Capricorn"};
char *test(char *o, int m, int d)
{
  char *result=o;
  m>0&m<13&d>0&d<(32-(4460832>>m>>m&3))
  ?m+=10+(" 121012333413"[m]-29<d),sprintf(o, "%s, %s, %s\n",s[m%12+7],s[m%4],s[m%3+4])
  :(result = 0);
  return result;
}

int main()
{
  char buf[100];
  int m,d;
  for (m=0;m<14;m++)
    for(d=0;d<40;d++)
      if (test(buf, m,d)) printf("%d %d %s", m, d, buf);
  return 0;
}

Good, except for the typo of Ivalid ;-)

@DigitalTrauma Not so good, maybe it has a bug on discriminating sign start (21,20,24 etc). I'm revising it just now. Stay tuned

Perl 287 (286 + 1 for the -p flag)
/\//;$_=32-(26830452>>$`*2&3)<$'|$'<1|$`<1|$`>12?'Invalid date
':qw(Aquarius01 Pisces23 Aries45 Taurus61 Gemini03 Cancer25 Leo41
Virgo63 Libra05 Scorpio21 Sagittarius43
Capricorn65)[$`-1-($'<20+(219503166088>>$`*3&7))].$/;s/\d/', '.qw(Air
Fixed Water Mutable Fire Cardinal Earth)[$&]/eg

The input is from STDIN and the output goes to STDOUT. Here are the tests from OP:
1/1
Capricorn, Earth, Cardinal
2/29
Pisces, Water, Mutable
7/24
Leo, Fire, Fixed
13/1
Invalid date
2/31
Invalid date
-1/-1
Invalid date
1st of Golfember
Invalid date

Python, 447 387 characters
import sys
try:S=sys.argv[1];a,b=int(S[:2])-1,int(S[3:])
except:a=b=0
print['Invalid date',', '.join((s.split()*5)[a+(b>[20,21,20,19,20,21,22,22,22,23,20,22][a%12])]for s in"Capricorn Aquarius Pisces Aries Taurus Gemini Cancer Leo Virgo Libra Scorpio Sagittarius Capricorn|Earth Air Water Fire|Cardinal Fixed Mutable".split("|"))][-1<a<12and 0<b<[32,30,32,31,32,31,32,32,31,32,31,32][a]]

Takes input as MM/DD, must always be two digits.
$ python zods.py 01/01
Capricorn, Earth, Cardinal
$ python zods.py 02/29
Pisces, Water, Mutable
$ python zods.py 07/24
Leo, Fire, Fixed
$ python zods.py 13/01
Invalid date
$ python zods.py 02/31
Invalid date
$ python zods.py -1/-1
Invalid date
$ python zods.py First of golfember
Invalid date
$ python zods.py
Invalid date

You can try these: [20,21,20,19,20,21,22,22,22,23,20,22][a%12] -> 19+int('121012333413'[a%12])  and [32,30,32,31,32,31,32,32,31,32,31,32][a] -> 30+int('202121221212'[a])

Javascript, 403 396 bytes
M=prompt(),D=+prompt(),i=[52,85,117,147,180,213,246,278,310,343,372,406,415];if([0,0,-2,0,1,0,1,0,0,1,0,1,0][M]<D-31||M<1||D<1||M>12)alert("Invalid date");else for(x in i)if(M*32+D<=i[x]){alert("Capricorn0Aquarius0Pisces0Aries0Taurus0Gemini0Cancer0Leo0Virgo0Libra0Scorpio0Sagittarius0Capricorn".split(0)[x]+", "+["Earth","Air","Water","Fire"][x%4]+", "+["Cardinal","Fixed","Mutable"][x%3]);break}

Another approach. I think I can golf down more, but later.
Input month on first prompt, date on second prompt.

PHP - 294 bytes (w/o php tags*)
*As the other php entry did
Input:Month Day as integers, leading zero not required.
Ex:php starsign.php <<< "2 29" for February 29th.
Golfed (do not copy this directly, see below):

<?@eval(gzinflate('=Œ1Â0…ÿŠC!Ë
¦q+JQ—
BEq¸¶¡Ô¤^ðç{¤"ï>/Ãò®`³GOBqú7v¥±MP#äpúµ;$:Å€Ý$“g¦Þ³ƒê‘).p¦¥·TL’Œ,ÝÑ¾È‘¬]oëáJ<zh¨c„V3yhq¤VË_ü(²®TZË¥ØêÜ³ÓF_'));die(fscanf(STDIN,'%u%u',$m,$d)/2&$m<13&&$m*$d&&$d<33-$b[$m]?$a[7+$m-=$d<20+$b[$m+9]].$a[$m%4].$a[$m%3+4]:'Invalid date');

Hexdump of php file:
3f3c 6540 6176 286c 7a67 6e69 6c66 7461
2865 3d27 318c c20b 1030 ff85 438a cb21
a60d 2b71 4a1d 9751 420a 0745 b871 a1b6
d41e 5ea4 f013 7be7 22a4 ef07 1e3e 2f8f
f2c3 60ae 47b3 4f0e 4205 7115 37fa 760c
03a5 4db1 2350 e40f fa70 1fb5 243b c53a
dd80 9324 671a dea6 83b3 1dea 2991 702e
a5a6 0bb7 4c54 1792 2c8c d1dd c8be ac91
6f5d 1a19 e1eb 3c4a 687a 63a8 5684 3304
6879 a471 5610 5fcb 28fc aeb2 5a54 9d1b
a5cb ead8 18dc d3b3 1546 275f 2929 643b
6569 6628 6373 6e61 2866 5453 4944 2c4e
2527 2575 2775 242c 2c6d 6424 2f29 2632
6d24 313c 2633 2426 2a6d 6424 2626 6424
333c 2d33 6224 245b 5d6d 243f 5b61 2b37
6d24 3d2d 6424 323c 2b30 6224 245b 2b6d
5d39 2e5d 6124 245b 256d 5d34 242e 5b61
6d24 3325 342b 3a5d 4927 766e 6c61 6469
6420 7461 2765 3b29

To generate golfed file, run the following php script (generates to starsign.php):

<?php
$a=<<<'NOW'
$a=[', Earth',', Air',', Water',', Fire',', Cardinal',', Fixed',', Mutable',Capricorn,Aquarius,Pisces,Aries,Taurus,Gemini,Cancer,Leo,Virgo,Libra,Scorpio,Sagittarius,Capricorn];$b='1131212112121012333413';
NOW;
$p = '<?@eval(gzinflate(\'';
$s = <<<'NOW'
'));die(fscanf(STDIN,'%u%u',$m,$d)/2&$m<13&&$m*$d&&$d<33-$b[$m]?$a[7+$m-=$d<20+$b[$m+9]].$a[$m%4].$a[$m%3+4]:'Invalid date');
NOW;
file_put_contents('starsign.php',$p . gzdeflate($a) . $s);

Completely ungolfed version:

<?php
$a=[', Earth',', Air',', Water',', Fire',', Cardinal',', Fixed',', Mutable',Capricorn,Aquarius,Pisces,Aries,Taurus,Gemini,Cancer,Leo,Virgo,Libra,Scorpio,Sagittarius,Capricorn];$b='1131212112121012333413';
if(fscanf(STDIN, '%u%u', $m, $d) == 2
 and $m < 13
 and $m
 and $d
 and $d < 33-$b[$m]){
    if($d < 20 + $b[$m+9])
        --$m;
    die($a[7+$m] . $a[$m%4] . $a[$m%3+4]);
}else die('Invalid date');

Finally figured out that I need to edit /etc/php5/cli/php.ini and set short_open_tag = On to get this to work.  Works for this answer, but the other PHP answer still errors out. +1 for this one.

Python 3 - 332 bytes
s="Capricorn Aquarius Pisces Aries Taurus Gemini Cancer Leo Virgo Libra Scorpio Sagittarius Earth Air Water Fire Cardinal Fixed Mutable".split()
import sys
try:m,d=map(int,sys.argv[1:]);13>m>0<d<b" 313232332323"[m]-19or E
except:x="Invalid date"
else:i=m-1+(d>b" 121012333413"[m]-29);x=s[i%12]+", "+s[-7+i%4]+", "+s[-3+i%3]
print(x)

Takes input as separate arguments (i.e. 1 1)

One split for all strings

Indexing bytes in py3 gives the ord

or E is a cheap way to generate an exception (NameError)

Is there a cheaper way to concatenate the strings? + and literals turned out to be smaller than join.

There's no good reason for one bytes lookup to start with 1 and the other with 0, I just forgot the 29-day February and changed 0->1 instead of redoing the whole thing.

PHP 548 524 502 419 (w/o php tags)
Requires PHP >= 5.4.0
Input: Day Month (numerical value starting at 1)
e.g. 2 3 for March 2nd.
<?
$x='Invalid date';
@list($d,$m)=split(' ',fgets(STDIN));
if(@$m<1||$m>12||@$d<1)die($x);
$z=['Aquarius','Pisces','Aries','Taurus','Gemini','Cancer','Leo','Virgo','Libra','Scorpio','Sagittarius','Capricorn','Air','Water','Fire','Earth','Fixed','Mutable','Cardinal','121012333413202121221212'];
$m=$m+0;$d<$z[19][--$m]+20&&$m--;$m<0&&$m=11;$d>$z[19][$m+12]+29&&die($x);
echo$z[$m+0],", {$z[$m%4+12]}, {$z[$m%3+16]}";

EDIT: The A non well formed numeric value notice is caused by performing a pre-increment on the string $m. Regardless of the notice, the following output should still be correct. This notice varies per version of PHP. To fix this, a simple string to integer conversion should be placed before the second last line. I've updated the code with the conversions.
Sample Input/Output (on Windows):
// March 2nd
Input > echo 2 3 | php star.php
Output > Pisces, Water, Mutable

// Feb. 30th
Input > echo 30 2 | php star.php
Output > Invalid date

// June 30th
Input > echo 30 6 | php star.php
Output > Cancer, Water, Cardinal

OK, I'm a php dummy.  How do you run this?  I tried echo 2 3 | php -f zod.php, but it just echoes the script itself to STDOUT

@DigitalTrauma I think that you need to enable the short tags in your interpreter, otherwise use <?php instead of <?.

I tried that, but now I get PHP Notice:  A non well formed numeric value encountered in /home/ubuntu/zod.php on line 6.  I'm running php 5.5.9 on Ubuntu 14.04

Code fixed. See edit.


text:
Generate the group table for Z_n
Groups are a widely used structure in Mathematics, and have applications in Computer Science. This code challenge is about the fewest # of characters to create a group table for the additive group Zn.
How the table is constructed: For Zn, the elements are {0, 1, 2, ..., n-1}. The table will have n rows and n columns. For the ij-th entry of the table, the value is i+j mod n. For example, in Z3, the 1-2nd entry (2nd row, 3rd column if you count the starting row/column as 1) is (1+2)%3 = 0 (see sample output).
Input: a positive integer, n
Output: a table that is a textual presentation of Zn, constructed as described above, and displayed as shown below in the sample outputs. Spaces are optional
Sample input: 3
Sample output:
0 1 2
1 2 0
2 0 1

Sample input: 5
Sample output:
0 1 2 3 4
1 2 3 4 0
2 3 4 0 1
3 4 0 1 2
4 0 1 2 3

Since the separator is optional, will there be an input above 10?

@JoKing based on https://codegolf.stackexchange.com/questions/35038/generate-the-group-table-for-z-n#comment75701_35039 I guess yes

APL (10)
(Assuming ⎕IO=0. It works on ngn/apl by default, other APLs tend to need an ⎕IO←0 first.)
{⍵|∘.+⍨⍳⍵}

Explanation:

⍳⍵: the numbers [0..⍵)
∘.+⍨: create a sum table
⍵|: numbers in the table mod ⍵

Can you do ⊢|⍳∘.+⍳, or did trains not work in the July 2014 version of ngn?

GolfScript (13 chars)
I understand from your comment on Claudiu's answer that whitespace between the elements of a row is not necessary. On that understanding:
~.,{.n\(+}@(*

Online demo
Dissection:
~        Parse the input into an integer
.,       Duplicate it, turn the second into an array [0,...,n-1]
{        Loop: top of stack is the previous row
  .n\    Push a newline and a copy of the previous row
  (+     Rotate the first element to the end to get the new row
}@(*     Perform loop n-1 times

If whitespace is necessary, for 20 chars:
~.,{.(+}@(*]{' '*n}/

Very nice job on these!

Python 2, 66 bytes
def f(n):R=range(n);exec"print''.join(map(str,R));R+=R.pop(0),;"*n

Rotates the list by popping and re-appending.
Python 3, 53 bytes
def f(n):*R,=range(n);[print(*R[i:]+R[:i])for i in R]

Uses the same method as @mbomb007, but abusing print as a function.

That *R,= is an odd construct... Does it only serve to convert range's output into a tuple?

Can you explain the Python 3 code please? I haven't seen use of *R

@taritgoswami It is degenerated unpacking; range is an iterable object which one can unpack and re-pack, collecting everything in R. It should be equivalent to R=list(range(n)), the former being more concise.

05AB1E, 10 8 bytes
Ý¨Dδ+I%»

Try it online!
Explanation
         # Implicit input n = 3                  [3]
Ý        # Push range(0,3)                       [[0,1,2,3]]
 ¨       # Pop last element                      [[0,1,2]]
  D      # Duplicate                             [[0,1,2],[0,1,2]]
   δ     # Apply next operation double vectorized
    +    # Vectorized addition                   [[[0,1,2],[1,2,3],[2,3,4]]]
     I   # Push input                            [[[0,1,2],[1,2,3],[2,3,4]],3]
      %  # Elementwise modulo 3                  [[[0,1,2],[1,2,0],[2,0,1]]]
       » # " ".join(x) followed by newline       ["0 1 2\n1 2 0\n2 0 1\n"]
           for every x in list

Previous answer: 10 bytes
Ý¨DvDðý,À}

Try it online!
My first try at golfing in 05AB1E.
Explanation of previous answer
           # Implicit input n = 3                   [3]
Ý          # Push range(0,3)                        [[0,1,2,3]]
 ¨         # Pop last element.                      [[0,1,2]]
  D        # Duplicate                              [[0,1,2],[0,1,2]]
   v     } # Pop list and loop through elements     [[0,1,2]]
    D      # Duplicate                              [[0,1,2],[0,1,2]]
     ð     # Push space char                        [[0,1,2],[0,1,2], " "]
      ý    # Pop list a and push string a.join(" ") [[0,1,2],"0 1 2"]
       ,   # Print string with trailing newline     [[0,1,2]] Print: "0 1 2"
        À  # Rotate list                            [[1,2,0]]

Nice first answer, and welcome! I have the feeling it can be shorter, but here are two 9-byte alternatives: FÝ¨N._ðý, and Ý¨sGDÀ})» Feel free to ask any questions in the 05AB1E chat, and take a look at the 05AB1E tip page if you haven't yet. :)

@KevinCruijssen Thanks! It seems like I forgot to find a way to take advantage of implicit input.

Jelly,  4
Ḷṙ`G

Try it online!

Matlab (28)
k=exp(0:n-1)
mod(log(k'*k),n)

Pyth, 16
JVQXQjdJ=J+tJ]hJ

Prints the table with proper whitespace.
./pyth.py -c "JVQXQjdJ=J+tJ]hJ" <<< 5
0 1 2 3 4
1 2 3 4 0
2 3 4 0 1
3 4 0 1 2
4 0 1 2 3

Explanation:
                   Automatic: Q=eval(input())
JVQ                J = range(Q)
XQ                 repeat Q times
  jdJ              print J, joined on " "
  =J               J =
    +tJ]hJ             tail(J) + [head(J)] (J[1:] + [J[-1]]])

J, 20
Reading from stdin and producing a 2D array (which renders the same as the sample in the question).
(|+/~@i.)@".}:1!:1]3

If a function taking a string suffices, (|+/~@i.)@"..  If a function taking an integer suffices, |+/~@i. should be sufficient.
Explanation: f g in J (for functions f, g) denotes a "hook", which is a composite function that runs the input through g (a unary function) and then the input and the result of g through f (a binary function).  The answer is a fork with components | (modulus) and +/~@i..  The latter part is "table-of sums composed-with list-of-indices-upto" (i. is a bit like range in Python).

You should update your answer to |+/~@i. , which should be acceptable by the standard rules here.

Octave, 23
@(n)mod((r=0:n-1)'+r,n)

Python 2, 67
Try them both here
I use list splitting to "rotate" the list n times, printing it each time. (68 chars)
def f(n):
 l=range(n)
 for i in l:print''.join(map(str,l[i:]+l[:i]))

I managed to get it one character shorter than the above with a weird trick. (67 chars)
def f(n):
 l=range(n)
 for i in l:print''.join(`l[i:]+l[:i]`)[1::3]

Seems like this method is still shorter in Python 3: def f(n):*R,=range(n);[print(*R[i:]+R[:i])for i in R]. I didn't think the splat would actually work without parens.

Pari/GP, 25 bytes
n->matrix(n,,x,y,x+y-2)%n

Try it online!

Who initialized x,y to what?

@RosLuP matrix(m,n,X,Y,expr) generates an mXn matrix of expression expr, the row variable X going from 1 to m and the column variable Y going from 1 to n.

MathGolf, 10 8 bytes
r░y\Åo╫;

Try it online!
-2 bytes thanks to Jo King
Explanation
I'll use example input 3 for the explanation
r          range(0, n) ([0, 1, 2])
 ░         convert to string (implicit map) (['0', '1', '2'])
  y        join array without separator to string or number ('012')
   \       swap top elements ('012', 3)
    Å      start block of length 2 (for-loop, loops 3 times ('012'))
     o     print TOS without popping
      ╫    left-rotate bits in int, list/str ('012' => '120' => '201' => '012')
       ;   discard TOS (prevents final print)

You could also do r░y\(Åo╫, which decreases the number of loops by 1 and skips the discard after the loop.

9 bytes

@JoKing that's clever! Perhaps you could use q to remove the duplication?

I meant o. Though the best I could figure out that way was this. It could be 10 bytes too, but I'm on mobile.

Since the separator is optional 8 bytes should work

x86-64 Machine Code (Linux), 80 64 bytes
0000000000000000 <zn_asm>:
   0:   6a 0a                   pushq  $0xa
   2:   89 f9                   mov    %edi,%ecx
   4:   ff c9                   dec    %ecx

0000000000000006 <zn_asm.l1>:
   6:   c6 06 0a                movb   $0xa,(%rsi)
   9:   48 ff ce                dec    %rsi
   c:   89 fb                   mov    %edi,%ebx
   e:   ff cb                   dec    %ebx

0000000000000010 <zn_asm.l2>:
  10:   89 c8                   mov    %ecx,%eax
  12:   01 d8                   add    %ebx,%eax
  14:   31 d2                   xor    %edx,%edx
  16:   f7 f7                   div    %edi
  18:   89 d0                   mov    %edx,%eax

000000000000001a <zn_asm.l3>:
  1a:   31 d2                   xor    %edx,%edx
  1c:   48 f7 34 24             divq   (%rsp)
  20:   83 c2 30                add    $0x30,%edx
  23:   88 16                   mov    %dl,(%rsi)
  25:   48 ff ce                dec    %rsi
  28:   85 c0                   test   %eax,%eax
  2a:   75 ee                   jne    1a <zn_asm.l3>
  2c:   ff cb                   dec    %ebx
  2e:   85 db                   test   %ebx,%ebx
  30:   7d de                   jge    10 <zn_asm.l2>
  32:   ff c9                   dec    %ecx
  34:   85 c9                   test   %ecx,%ecx
  36:   7d ce                   jge    6 <zn_asm.l1>
  38:   58                      pop    %rax
  39:   48 89 f0                mov    %rsi,%rax
  3c:   48 ff c0                inc    %rax
  3f:   c3                      retq

I was hoping for this solution to be just a few bytes shorter to be able to beat some of the other submissions on this post. There's a possibility if I use some of the 32 or 16 bit versions of the registers I could shave a few bytes off. Converting a lot of the registers to the 32 bit addressing versions saved 16 bytes.
Basically this function is called from a C/C++ program which passed n through rdi, and a pointer to an allocation through rsi. The pointer that rsi has is actually 1 byte from the end of the allocation, since the table is built backwards. This makes it easier to convert an integer to printable ASCII characters (done by taking some number x mod 10 and converting the result to ASII).
To see the C++ wrapper code and comments on the assembly, check out my repo.

Q/KDB+, 19 bytes
Solution:
{t rotate\:t:til x}

Example:
q){t rotate\:t:til x} 3
0 1 2
1 2 0
2 0 1

q){t rotate\:t:til x} 5
0 1 2 3 4
1 2 3 4 0
2 3 4 0 1
3 4 0 1 2
4 0 1 2 3

Explanation:
{t rotate\:t:til x} / solution
{                 } / lambda taking implicit x argument
             til x  / the range 0..x
           t:       / assign to 't'
   rotate\:         / rotate right argument with each-left (\:)
 t                  / the left argument (0..x)

Extra:

{(!x).q.rotate\:!x} still 19 bytes in K4.

Golfscript, 20 characters
A terribly lazy job.
~:j,{:x;j,{x+j%}%n}/

Run it here. (First line is to simulate stdin).
Explanation:
~                     # evaluate input (turn string "5" into number 5)
:j                    # store into variable j
,                     # turn top of stack into range(top), e.g. 5 --> [0, 1, 2, 3, 4]
{...}/                # for each element in the array...
  :x;                 # store the element into x and pop from the stack
  j,                  # put range(j) on the stack ([0, 1, 2, 3, 4] again)
  {...}%              # map the array with the following:
      x+j%            # add x and mod the resulting sum by j
  n                   # put a newline on the stack

When the program ends, the stack contains each of the arrays with newlines between them. The interpreter outputs what's left on the stack, giving the desired result.

Nice! Although spaces between elements were not necessary, it can be helpful when we have elements of value >= 10 (i.e. when n >= 11).

Can you please exlain your code? To me reading golfscript is worse than reading someone else's regex. (almost=)

@flawr: Hah sure, it's quite straightforward

C - 96
void g(int k){int i;for(i=0;i<k*k;i++){if(i&&!(i%k))puts("\n");printf("%i ",((i/k)+(i%k))%k);}}

CJam, 14 characters
l~_)_@,*/Wf<N*

Test it here.
Explanation
The idea is to repeat the string from 0 to N-1, but split it into blocks of N+1. This mismatch shifts the row to the left each time. Lastly, we need to get rid of the extraneous character and join everything with newlines.
Here is the exploded code, together with the stack contents for input 3.
l~              "Read and eval input."; [3]
  _             "Duplicate.";           [3 3]
   )            "Increment.";           [3 4]
    _           "Duplicate.";           [3 4 4]
     @          "Rotate.";              [4 4 3]
      ,         "Get range.";           [4 4 [0 1 2]]
       *        "Repeat.";              [4 [0 1 2 0 1 2 0 1 2 0 1 2]
        /       "Split.";               [[[0 1 2 0] [1 2 0 1] [2 0 1 2]]
         Wf<    "Truncate each line.";  [[[0 1 2] [1 2 0] [2 0 1]]
            N*  "Join with newlines.";  ["012
                                          120
                                          201"]

The result is printed automatically at the end of the program. (Note, the stack contents for the final step are technically a mixed array containing numbers and newline characters, not a string containing only characters.)
Alternatively, 11 characters
With the recent addition ew (this is newer than the challenge - it returns all overlapping substrings of given length), one could do 11 bytes:
l~,2*))ewN*

Here is how this one works:
l~           "Read and eval input."; [3]
  ,          "Get range.";           [[0 1 2]]
   2*        "Repeat twice.";        [[0 1 2 0 1 2]]
     )       "Pop last.";            [[0 1 2 0 1] 2]
      )      "Increment.";           [[0 1 2 0 1] 3]
       ew    "Get substrings.";      [[[0 1 2] [1 2 0] [2 0 1]]
         N*  "Join with newlines.";  ["012
                                       120
                                       201"]

Alternative 14 bytes: l~_,\{_(+N\}*;. I wonder if we can do better with this though.

Yes but that's essentially a port of Peter's answer, and I thought I'd rather present a different approach. ew might work but it's newer than the challenge.

Excel VBA, 77 Bytes
Anonymous VBE immediate window function that takes input, as integer,n, from range [A1] and outputs to the range A2.Resize(n,n).
[A2:IU255]="=IF(MAX(ROW()-1,COLUMN())-1<$A$1,MOD(ROW()+COLUMN()-3,$A$1),"""")

MATL, 6 bytes
:q&+G\

Try it online!
    # implicit input, say n = 3
:   # range
    # stack: [1, 2, 3]
q   # decrement
    # stack: [0, 1, 2]
&+  # sum with itself and transpose with broadcast
    # stack:
    # [0 1 2
    #  1 2 3
    #  2 3 4]
G   # paste input
    # stack: [0 1 2; 1 2 3; 2 3 4], 3
\   # elementwise modulo
    # implicit output with spaces

Perl 6, 23 bytes
{.rotate(.all).put}o|^*

Try it online!
Anonymous code block that takes a number and prints the matrix in the given format with spaces. If we can just return something instead, then the .put can be removed.
Explanation:
                   o|^*    # Transform the input into the range 0..input-1
{                 }        # And pass it into the function
 .rotate                   # Rotate the range by
        (.all)             # Each of the range
              .put         # And print each of them separated by spaces

APL(NARS), 15 chars, 30 bytes
{⊃{⍵⌽k}¨k←0..⍵}

test:
  f←{⊃{⍵⌽k}¨k←0..⍵}
  f 4
0 1 2 3 4
1 2 3 4 0
2 3 4 0 1
3 4 0 1 2
4 0 1 2 3
  f 3
0 1 2 3
1 2 3 0
2 3 0 1
3 0 1 2
  f 2
0 1 2
1 2 0
2 0 1
  f 1
0 1
1 0
  f 0
0

here the language has need no comments...

Charcoal, 13 bytes
ＮθＥθ⪫Ｅθ﹪⁺ιλθ

Try it online! Link is to verbose version of code. Note: Trailing space. Explanation:
Ｎθ              Input `n` as a number into variable
   θ            `n`
  Ｅ             Map over implicit range
      θ         `n`
     Ｅ          Map over implicit range
         ι      Current row
        ⁺       Plus
          λ     Current column
       ﹪        Modulo
           θ    `n`
    ⪫           Cast row to string and join with spaces
                Implicitly print each row on its own line

Japt -R, 5 bytes
ÆZéXn

Try it
If using a comma as a separator isn't valid then add a byte for no separator:
ÆZ¬éXn

Try it
Or 2 bytes to use a space:
ÆZéXn)¸

Try it

R, 37 bytes
sapply(x<-1:scan()-1,`+`,x)%%sum(x|1)

Creates a vector from 0 to n-1, and sequentially adds 1, then 2... then n, and modulates the matrix by the length of the vector, which is n.
Try it online!

Forth (gforth), 53 bytes
: f dup 0 do cr dup 0 do i j + over mod . loop loop ;

Try it online!
Explanation
Nested loop that outputs a newline every n numbers
Code Explanation
: f             \ start new word definition
  dup 0 do      \ set loop parameters and loop from 0 to n-1
    cr          \ output a newline
    dup 0 do    \ loop from 0 to n-1 again
      i j +     \ get the sum of the row and column number
      over mod  \ modulo with n
      .         \ print (with space)
    loop        \ end inner loop
  loop          \ end outer loop
;               \ end word definition

Using rotations
Burlesque, 6 bytes
-.rziR

Try it online!
-. # Decrement input
rz # Range from [0..n)
iR # All rotations of value

Proper calculation
Burlesque, 19 bytes
Jrzl_Jcpq++m[j.%jco

Try it online!
J      # Duplicate input
rz     # Range from [0..n)
l_     # Pop largest (behind)
Jcp    # Cart product with self
q++m[  # Sum each pair
j.%    # Mod input
jco    # Split list into chunks of input

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