text:
using a Markov Chain, because this question itself as input text for example
Create a Markov Chain generator, which generates (and outputs) an Order 4 text chain. It must be able to support all plain text formatting used on this question, so be sure to check for punctuation (parentheses count for example, but HTML doesn't need to be accounted for fortunately)! You could even use this question itself as input if you're so inclined. There must be a defined input variable (or something analogous to such, I am aware certain popular esoteric languages do not really have variables per se.)
Your generator also should start sentences with a capital letter, and end with ".", "!", or "?", according to how often those respective characters appear in the input text.
You must also include a way to change the amount of text which should be output, so the only two things that are really configurable are the amount to output and the input string. It should stick with an Order 4 chain, because those happen to be funniest when it all comes down to it really.
Oh and, if your generators happen to create something particularly funny, please feel free to include it in your post for the lulz.
The title of this question was generated using a Markov Chain.

Can you explain more and give sample I/O? I don't really understand the challenge.

@Peter Take a look at http://en.wikipedia.org/wiki/Markov_chain#Markov_text_generators

Welcome to CodeGolf.SE! You might want to review the FAQ section on questions because your post is a bit underspecified and does not seem to defined a task for which there is an objective winning criterion. Possibly you intend this to be [tag:code-golf]? If so it should be tagged as such because we support other categories of puzzles and tasks.

Perl, 108 chars
What, no answers?  Here's a quick Perl solution:
$/=$,;$_=<>;push@$1,$2while/(?=(....)(.))/sg;print+($m)=/(....)/s;print while($m.=($_=$$m[rand@$m]))=~s/.//s

And this is what I got the first time I fed the question text through it:

Create a defined. There must also inclined. There must be sure to be according a Markov Chain.

(The average output length should approximately match the input length, so such a short output is quite untypical.  On the other hand, the output length is roughly exponentially distributed, so both very short and very long outputs are quite possible.)

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


text:
Facial Recognition
The aim of this task is to identify, clean up, and mark out all the faces in any given 'image'.
What's in a face?
A face will be a ZxZ square where Z is an odd integer greater than 1. The top left and right corners and the centre will be 'O' characters, and the bottom line will be a '\' and a '/' surrounding enough '_' characters to fill the rest of the line.
Examples:
a 3x3 face:
O O
 O
\_/

a 5x5 face:
O   O

  O

\___/

a 7x7 face:
O     O

   O

\_____/

etc.
Input
Input will be on STDIN and will consist of a number of equal length strings of characters.
Output
Output should be the input with all recognizable faces cleared (i.e. all characters except the eyes, nose and mouth shoud be removed from within the face's bounds) and boxed (surrounded by +, -, and | characters). Where two or more faces overlap both should be cleared and boxed but priority should be given to the larger face (it should be placed on top); if both faces are the same size, the priority is left to the discretion of the implementer. If the input has no faces, output should be the same as input.
Some examples
Input:
*******
*******
**O*O**
***O***
**\_/**
*******
*******

Output:
*******
*+---+*
*|O O|*
*| O |*
*|\_/|*
*+---+*
*******

Input (incomplete face):
*******
*******
**O*O**
*******
**\_/**
*******
*******

Output:
*******
*******
**O*O**
*******
**\_/**
*******
*******

Input (nested faces):
*******
*O***O*
**O*O**
***O***
**\_/**
*\___/*
*******

Output:
+-----+
|O   O|
|     |
|  O  |
|     |
|\___/|
+-----+

Input (multiple faces):
~{$FJ*TBNFU*YBVEXGY%
FOCO$&N|>ZX}X_PZ<>}+
X$OOPN ^%£)LBU{JJKY%
@\_/$£!SXJ*)KM>>?VKH
SDY%£ILO(+{O:HO(UR$W
XVBFTER^&INLNLO*(&P:
>?LKPO)UJO$£^&L:}~{&
~@?}{)JKOINLM@~}P>OU
:@<L::@\___/GER%^*BI
@{PO{_):<>KNUYT*&G&^

Output:
+---+*TBNFU*YBVEXGY%
|O O|&N|>ZX}X_PZ<>}+
| O |N ^%£)LBU{JJKY%
|\_/|£+-----+M>>?VKH
+---+I|O   O|HO(UR$W
XVBFTE|     |LO*(&P:
>?LKPO|  O  |&L:}~{&
~@?}{)|     |@~}P>OU
:@<L::|\___/|ER%^*BI
@{PO{_+-----+YT*&G&^

Input (near boundary):
~{$FJ*TBNFU*YBVEXGY%
OCO$&N|>ZX}X_PZ<>}+^
$OOPN ^%£)LBU{JJKY%{
\_/$£!SXJ*)KM>>?VKHU
SDY%£ILO(+{8:HO(UR$W
XVBFTER^&INLNLO*(&P:
>?LKPO)UJ^$£^&L:}~{&
~@?}{)JKOINLM@~}P>OU
:@<L::@BJYT*GER%^*BI
@{PO{_):<>KNUYT*&G&^

Output:
---+J*TBNFU*YBVEXGY%
O O|&N|>ZX}X_PZ<>}+^
 O |N ^%£)LBU{JJKY%{
\_/|£!SXJ*)KM>>?VKHU
---+£ILO(+{8:HO(UR$W
XVBFTER^&INLNLO*(&P:
>?LKPO)UJ^$£^&L:}~{&
~@?}{)JKOINLM@~}P>OU
:@<L::@BJYT*GER%^*BI
@{PO{_):<>KNUYT*&G&^

Input (overlapping faces):
~{$FJ*TBNFU*YBVEXGY%
FXC£$&N|>ZX}X_PZ<>}+
X$*OPN O%£)LBO{JJKY%
@:U%$£!SXJ*)KM>>?VKH
SDY%£OLO(+{P:HO(UR$W
XVBFTER^&IOLNLO*(&P:
>?L\___/JR$£^&L:}~{&
~@?}{)JKOINLM@~}P>OU
:@<L::@\_____/R%^*BI
@{PO{_):<>KNUYT*&G&^

Output:
~{$FJ*TBNFU*YBVEXGY%
FX+---+-------+Z<>}+
X$|O  |O     O|JJKY%
@:|   |       |>?VKH
SD|  O|       |(UR$W
XV|   |   O   |*(&P:
>?|\__|       |:}~{&
~@+---|       |}P>OU
:@<L::|\_____/|%^*BI
@{PO{_+-------+*&G&^

What about conjoined faces (e.g. where an O doubles as a left eye and right eye)?  Should those be treated as overlapping?

@Joey Adams: that happens in the last example.

@Joey Adams @Lowjacker Yes, just like the last example.

I find the 3x3 face realistic and the 7x7 face derp. Just my opinion. Sad that I haven't got time to gain bountiez... :)

@tomsmeding If you find the 3x3 face realistic I'd hate to see the people you associate with. :-\

I say "realistic" relative to the realisticness of the 5x5 and the 7x7 faces. Lol though.

Ruby, 304 298 295 characters
I=$<.read
q=(O=I*s=1).size
k=??+O=~/$/
o=->m,n{n.chars{|c|(m+=1)*(m%k)>0&&m<q&&O[m-1]=c}}
q.times{f=[[?\\+?_*s+?/,k*s+=1],[?O,0],[?O,s],[?O,(s+=1)/2*(1+k)]]
q.times{|x|f.all?{|a,b|I[x+b,a.size]==a}&&(o[x+k*s-1,o[x-k-1,?++?-*s+?+]]
s.times{|a|o[x+k*a-1,?|+' '*s+?|]}
f.map{|a,b|o[x+b,a]})}}
$><<O

Lower right is preferred on overlap if faces are of identical size. E.g. for the input
O.OO.O
.O..O.
\_/\_/
O.OO.O
.O..O.
\_/\_/

it recognizes all four faces and yields
O |O O
 O| O
--+---
O |O O
 O| O
\_|\_/

Edit 1: As Lowjacker proposed we can replace the index with a regex match (-3 chars). Moreover the +1 can be compensated by an additional dummy char before the matching which saves another char (-2 for the +1, +3 for dummy char, -2 because brackets are no more necessary). Two more since we can write the range also without brackets.
Edit 2: Another two characters saved by replacing both if with && and another one removing the range completely.

You can use (O=~/$/) instead of O.index($/) on the third line (saves 3 characters).

@Lowjacker Thank you. I could even save one more with your trick (see my edit).

I think you can also save 2 characters by replacing the if statements with &&.

Python - 1199 941
I found the problem pretty interesting, so I solved in Python. Here's the compressed code.
#!/usr/bin/env python
import fileinput,sys
m=[[c for c in l if c!='\n'] for l in fileinput.input()]
X=len(m[0])
Y=len(m)
t=[]
for n in range(3,min(X,Y)+1,2):
  for x in range(X-n+1):
    for y in range(Y-n+1):
      if m[y][x]=='O' and m[y][x+n-1]=='O' and m[y+(n//2)][x+(n//2)]=='O' and m[y+n-1][x]=='\\' and m[y+n-1][x+n-1]=='/' and "".join(m[y+n-1][x+1:x+n-1])=='_'*(n-2):
        t.append((x,y,n))
for x,y,n in t:
  def a(v,h,c):
    w=x+h; z=y+v;
    if z>=0 and z<len(m):
      if w>=0 and w<len(m[y]):
        m[z][w]=c
  for v in range(n):
    for h in range(n):
      a(v,h,' ')
  a(0,0,'O')
  a(0,n-1,'O')
  a(n/2,n/2,'O')
  a(n-1,0,'\\')
  a(n-1,n-1,'/')
  for w in range(1,n-1):
    a(n-1,w,'_')
  for v in [-1,n]:
    for h in range(n):
      a(v,h,'-')
  for h in [-1,n]:
    for v in range(n):
      a(v,h,'|')
  a(-1,-1,'+')
  a(-1,n,'+')
  a(n,-1,'+')
  a(n,n,'+')
for l in m:
  for c in l:
    sys.stdout.write(c)
  print

Here's the more readable code :
#!/usr/bin/env python

import fileinput, sys

matrix = [[c for c in l if c != '\n'] for l in fileinput.input()]

max_X = len(matrix[0])
max_Y = len(matrix)

tuples = []
for n in range(3, min(max_X, max_Y)+1, 2):
  for x in range(max_X-n+1):
    for y in range(max_Y-n+1):
      # if is_face(matrix, x, y, n):
      if matrix[y][x] == 'O' and matrix[y][x+n-1] == 'O' and matrix[y+(n//2)][x+(n//2)] == 'O' and matrix[y+n-1][x] == '\\' and matrix[y+n-1][x+n-1] == '/' and "".join(matrix[y+n-1][x+1:x+n-1]) == '_'*(n-2) :
        tuples.append((x, y, n))

for x,y,n in tuples:
  # blank_and_border(matrix,x,y,n)
  def assign(dy, dx, c):
    xx = x + dx; yy = y + dy;
    if yy >= 0 and yy < len(matrix) :
      if xx >= 0 and xx < len(matrix[y]) :
        matrix[yy][xx] = c

  # blank
  for dy in range(n):
    for dx in range(n):
      assign(dy, dx, ' ')

  # face
  assign(0, 0, 'O')
  assign(0, n-1, 'O')
  assign(n/2, n/2, 'O')
  assign(n-1, 0, '\\')
  assign(n-1, n-1, '/')
  for w in range(1,n-1):
    assign(n-1, w, '_')

  # border
  for dy in [-1,n]:
    for dx in range(n):
      assign(dy, dx, '-')

  for dx in [-1,n]:
    for dy in range(n):
      assign(dy, dx, '|')

  assign(-1, -1, '+')
  assign(-1,  n, '+')
  assign( n, -1, '+')
  assign( n,  n, '+')

for l in matrix:
  for c in l:
    sys.stdout.write(c)
  print

Please do add your golfed version above this version in your answer. This is a code-golf question and you risk getting down votes if you haven't at least tried to golf it. You can leave your readable version here too.

Right on, @Gareth. I often write solutions in Java, which is not terribly golf-friendly, but I always take the time to golf my solution, both for the exercise (it's fun thinking of ways to trim characters and reduce overall length) and to satisfy the spirit of code-golf (which is getting your solution as concise as possible). So, looking forward to seeing your golfed solution, sgauria!

Thanks Gareth & @ProgrammerDan ! That's good advice - I am pretty new on codegolf. I have added my golfed solution above in addition to the longer solution.

source: Stack Exchange

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

sort: votes


text:
Soundex function
Write the shortest function to generate the American Soundex code for a surname only containing the uppercase letters A-Z. Your function must produce output consistent with all the linked page's examples (given below), although it need not and should not remove prefixes. Hyphens in the output are optional. Have fun!
Note: You may not use the soundex() function included in PHP or equivalents in other programming languages.
The examples:
WASHINGTON W-252
LEE L-000
GUTIERREZ G-362
PFISTER P-236
JACKSON J-250
TYMCZAK T-522
VANDEUSEN V-532
ASHCRAFT A-261

Perl, 143 150 characters
sub f{$_="$_[0]000";/./;$t=$&;s/(?<=.)[HW]//g;s/[BFPV]+/1/g;s/[CGJKQSXZ]+/2/g;s/[DT]+/3/g;s/L+/4/g;s/[MN]+/5/g;s/R+/6/g;s/(?<=.)\D//g;/.(...)/;"$t$1"}

This solution contains only regular expressions which are applied one after another. Unfortunately I didn't find a shorter representation with a loop so I hard-coded all the calls into the script.
The same version but a little bit more readable:
sub f{
  $_="$_[0]000";        # take first argument and append "000"
  /./;$t=$&;            # save first char to variable $t
  s/(?<=.)[HW]//g;      # remove and H or W but not the first one
  s/[BFPV]+/1/g;        # replace one or more BFPV by 1
  s/[CGJKQSXZ]+/2/g;    # replace one or more CGJKQSXZ by 2
  s/[DT]+/3/g;          # replace one or more DT by 3
  s/L+/4/g;             # replace one or more L by 4
  s/[MN]+/5/g;          # replace one or more MN by 5
  s/R+/6/g;             # replace one or more R by 6
  s/(?<=.)\D//g;        # remove and non-digit from the result but not the first char
  /.(...)/;"$t$1"       # take $t plus the characters 2 to 4 from result
}

Edit 1: Now the solution is written in form of a function. The previous one was reading/writing from/to STDIN/STDOUT. It cost me seven characters to work around that.

J - 99
{.,([:-.&' '@":3{.!.0[:(#~1,}.~:}:)^:#,@(;:@]>:@I.@:(e.&>"0 _~)[#~e.))&'BFPV CGJKQSXZ DT L MN R'@}.

Testing:
  sndx=: {.,([:-.&' '@":3{.!.0[:(#~1,}.~:}:)^:#,@(;:@]>:@I.@:(e.&>"0 _~)[#~e.))&'BFPV CGJKQSXZ DT L MN R'@}.
  test=: ;: 'JACKSON PFISTER TYMCZAK GUTIERREZ ASHCRAFT ASHCROFT VANDEUSEN ROBERT RUPERT RUBIN WASHINGTON LEE'
  (,. sndx&.>) test

+-------+-------+-------+---------+--------+--------+---------+------+------+-----+----------+----+
|JACKSON|PFISTER|TYMCZAK|GUTIERREZ|ASHCRAFT|ASHCROFT|VANDEUSEN|ROBERT|RUPERT|RUBIN|WASHINGTON|LEE |
+-------+-------+-------+---------+--------+--------+---------+------+------+-----+----------+----+
|J250   |P123   |T520   |G362     |A261    |A261    |V532     |R163  |R163  |R150 |W252      |L000|
+-------+-------+-------+---------+--------+--------+---------+------+------+-----+----------+----+

eTeX, 377.
\let\E\expandafter
\def\x#1;#2#3{\def\s##1#2{##1\s#3}\edef\t{\s#1\iffalse#2\fi}\E\x\t;}
\def\a[#1#2]{\if{{\fi\uppercase{\x#1,#2};B1F1P1V1C2G2J2K2Q2S2X2Z2D3T3L4M5N5R6A7E7I7O7U7
    H{}W{}Y{}{11}1{22}2{33}3{44}4{55}5{66}6{{}\toks0\bgroup}!}\E\$\t0000!#1}}
\def\$#1,#2{\if#1#2\relax\E\%\else\E\%\E#2\fi}
\def\%{\catcode`79 \scantokens\bgroup\^}
\def\^#1#2#3#4!#5{\message{#5#1#2#3}\end}
\E\a

Run as etex filename.tex [Ashcraft].

Perl, 110
sub f{$_="$_[0]000";/./;$t=$&;s/(?<=.)[HW]//g;y/A-Z/:123:12_:22455:12623:1_2:2/s;s/(?<=.)\D//g;/.(...)/;$t.$1}

I'm using Howard's solution with my translate table (y/A-Z/table/s instead of every s/[ABC]+/N/g)

Python, 274 285 241 235 225 200 190 183 179 174 166 161
- Fixed last clause (H or W as consonant separators). Ashcraft now has the right result.
- Made the dict smaller
- Formating is smaller (doesn't require python 2.6)
- Simpler dict search for k
- Changed vowel value from '*' to '' and .append to +=[i]
- List comprehension FTW
- Removed call to upper :D
I Can't golf any further. Actually I did. Now I think I can't golf any further! Did it again...
Using translate table:
def f(n):z=n.translate(65*'_'+'#123#12_#22455#12623#1_2#2'+165*'_').replace('_','');return n[0]+(''.join(('',j)[j>'#']for i,j in zip(z[0]+z,z)if i!=j)+'000')[:3]

Old list comprehension code:
x=dict(zip('CGJKQSXZDTLMNRBFPV','2'*8+'3345561111'))
def f(n):z=[x.get(i,'')for i in n if i not in'HW'];return n[0]+(''.join(j for i,j in zip([x.get(n[0])]+z,z)if i!=j)+'000')[:3]

Old code:
x=dict(zip('CGJKQSXZDTLMNRBFPV','2'*8+'3345561111'))
def f(n):
 e=a=[];k=n[0]in x
 for i in[x.get(i,'')for i in n.upper()if i not in'HW']:
  if i!=a:e+=[i]
  a=i
 return n[0]+(''.join(e)+'000')[k:3+k]

Test:
[f(i) for i in ['WASHINGTON', 'LEE', 'GUTIERREZ', 'PFSTER', 'JACKSON',
                'TYMCZAK', 'VANDEUSEN', 'ASHCRAFT']]

Gives:
['W252', 'L000', 'G362', 'P236', 'J250', 'T522', 'V532', 'A261']

As expected.

Great. You don't need to convert the input to uppercase; you can assume it already is.

»I can't golf any further« those words are rarely appropriate :-)

@Joey Python isn't the best language for code golf... If only it had first class regex as Perl...

It suffers from too long identifiers more, imho. Usually I can beat Python with PowerShell, but List comprehension is tricky to beat.

@Joey Now you'll have to work a little more to beat Python with PowerShell :P

I said usually ... let me have a coffee first; golfing in the morning rarely yields good results :-)

There you are :-)

GolfScript (74 chars)
This implementation uses a magic string which has non-printable characters. In xxd output form it's
0000000: 7b2e 313c 5c5b 7b36 3326 2741 4c15 c252  {.1<\[{63&'AL..R
0000010: d056 4c1e 8227 3235 3662 6173 6520 3862  .VL..'256base 8b
0000020: 6173 653d 7d25 7b2e 373d 2432 243d 7b3b  ase=}%{.7=$2$={;
0000030: 7d2a 7d2a 5d31 3e31 2c2d 5b30 2e2e 5d2b  }*}*]1>1,-[0..]+
0000040: 333c 7b2b 7d2f 7d3a 533b                 3<{+}/}:S;

Without using the base changes to compress a list of 3-bit numbers, it would be
{.1<\[{63&[1 0 1 2 3 0 1 2 7 0 2 2 4 5 5 0 1 2 6 2 3 0 1 7 2 0 2]=}%{.7=$2$={;}*}*]1>1,-[0..]+3<{+}/}:S;

Online test
It's basically a bunch of boring loops, but there's one interesting trick:
.7=$2$=

This is inside a fold whose purpose is to handle double-letters. Adjacent letters with the same code are merged into one unit, even if separated by an H or a W. But this can't be implemented trivially by removing all Hs and Ws from the string, because in the (admittedly unlikely in real life, but not ruled out by the spec) case that the first letter is H or W and the second letter is a consonant, we need to not elide that consonant when we remove the first letter. (I added a test case WM which should give W500 to check this).
So the way I handle that is to do a fold and to delete each letter other than the first (a convenient side-effect of using fold) which is either equal to the previous one or equal to 7, the internal code for H and W.
Given a and b on the stack, the naïve way to check whether a == b || b == 7 would be
.2$=1$7=+

But there's a 2-character saving by using a computed copy-from-stack:
.7=$

If b is equal to 7 then it copies a; otherwise it copies b. So by then comparing with a we get a guaranteed truthy value if b was 7 regardless of the value of a. (Before any pedants weigh in, GolfScript doesn't have NaNs).

APL (83)
{(⊃⍵),,/⍕¨3↑0~⍨1↓K/⍨~K=1⌽K←0,⍨{7|+/' '=S↑⍨⍵⍳⍨S←' BFPV CGJKQSXZ DT L MN R'}¨⍵~'HW'}⍞

PowerShell, 150 161
First try and I'm sure there can be golfed quite a bit more.
filter s{$s=-join$_[1..9]
1..6+'$1','',$_[0]|%{$s=$s-replace('2[bfpv]2[cgjkqsxz]2[dt]2l2[mn]2r2(.)\1+2\D|^.2^'-split2)[++$a],$_}
-join"${s}000"[0..3]}

Works correctly with the test cases from both the linked page and the Wikipedia article:

Jackson, Pfister, Tymczak, Gutierrez, Ashcraft, Ashcroft, VanDeusen, Robert, Rupert, Rubin, Washington, Lee

Ruby 140
I'm using Ruby 2.0, but I think it should work with earlier versions too.
def f s
a=s[i=0]
%w(HW BFPV CGJKQSXZ DT L MN R).each{|x|s.gsub!(/[#{x}]+/){i>0&&$`[0]?i: ''};i+=1}
a+(s[1..-1].gsub(/\D/,'')+'000')[0,3]
end

Example:
puts f "PFISTER" => P236


text:
Generate a JavaDoc comment
I'm too lazy to write a JavaDoc comment myself, there's a lot of typing and it is mostly boilerplate. Write a program to generate a JavaDoc comment with $ as a placeholder given a method specification.
Example input:
Integer method(int arg1, String arg2) throws InvalidArgumentException, NullPointerException

Example output:
/**
    $
@param arg1 $
@param arg2 $
@return $
@throws InvalidArgumentException $
@throws NullPointerException $
*/

Some notes:

There won't be any static, private, or other qualifier on the method, just the return type.
There should be no @return tag if the return type is void.
It is possible that there won't be any throws clause.
You should accept the one-line method spec on stdin and write the result to stdout.

Shortest code wins.

The javadoc comments on the Wikipedia page show leading * on the second to penultimate lines.  Could you either change the example output to match it, or clarify that no leading * should be printed?

@Joey - the * you mention are optional in Javadoc comments - they are not needed for this question.

What's about arrays and generic types as param/return type? They introduce new opportunity for blanks. Do we assume all delimiters being blanks, or may they be tabs? After a comma - is there always a blank (or a tab)?

You may assume that all types will be space-free (but as you point out, they may have []<> characters in them).  You may also assume that all blank spaces are composed of space characters only (i.e., no tabs).  There may or may not be spaces surrounding (both before and after) a comma.

the @return tag for that input shouldn't be @return Integer $?

Can we assume all input to be valid?

JBernado: The return type is already in the method signature. Why mention it a second time? While Java is happy to duplicate visible information elsewhere this isn't such a case.

Are all blanks guaranteed to be only one space character or can there be more? I.e. void     foo()   throws A    ,B. Will throws always be separated by a space from the )? Will there never be a space after the method name?

Can the method be generic? And if so, does the generic type argument be included in the JavaDoc?

@Joey: there may be any number of spaces, including zero, between any alphanumeric token and any punctuation token.  In other words, anything that would be legal java code (with the exception that I'm restricting all types to be space-free).

@Joey: no, the method will not be generic.  But the return and argument types might be.

Ruby, 177 182 186
a,e=gets.split /\bthrows\b/
a=a.split /[\s(),]+/
puts'/**
    $',3.step(a.size,2).map{|i|"@param #{a[i]} $"},a[0]=='void'?[]:'@return $',e ?e.scan(/\w+/).map{|x|"@throws #{x} $"}:[],'*/'

Doesn't handle generic throws types correctly, but I'll take it.

PowerShell, 209 213
'/**
    $'
($i="$input")-replace'.*\( *| *\).*'-split','-ne''|%{"@param $((-split$_)[1]) $"}
,'@return $'*!($i-clike'void *')
if($i-match'\) *t'){$i-replace'.*\) *throws *'-split' *, *'|%{"@throws $_ $"}}'*/'

bash and PowerShell test scripts. but I'm probably missing a few cases still. But 22 tests are better than only one example, I guess :-)

Wow, for an untrained eye, it looks as unreadable as the Perl script below... :-)

Perl 5.14 - 192 bytes
#!perl -n
print'/**
    $
';@F=split/\(|\) throws +|\)/;print"\@param $_ \$
"for values{split/[, ]+/,$F[1]};print(($F[0]!~/^void /?'@return $
':''),(map{"\@throws $_ \$
"}$F[2]=~/\w+/g),"*/")

This fails when there is no space between the closing parenthesis and throws.

scala 579:
import scala.util.parsing.combinator._
object M extends JavaTokenParsers{def i=ident
type P=Parser[Any]
def r:P=n~"("~rep(p)~")"~opt("throws"~rep(t))^^(s=>"\n/**\n    $"+s._1._1._2.mkString("")+s._1._1._1+"\n2:"+(s._2.getOrElse(""))+"\n*/")
def n:P=i~i^^(s=>if(s._1=="void")""else"\nreturn $")
def p:P=i~i~opt(",")^^(s=>("\n@param "+s._1._2+" $"))
def t:P=i~opt(",")^^(s=>("\n@throws "+s._1+" $"))
def main (args:Array[String])={val i=parseAll(r,readLine())
println(i.toString().replaceAll(".:.*","").replaceAll("[~(),]","").replaceAll("^[\\[].*","").replaceAll ("\n\n","\n"))}}

I'm sorry, I'm not experienced with TokenParsers. I guess I'm doing it wrong, and there is much room for improvement.


text:
Creative Programming
Make a story out of your programming.
Example in JavaScript:
self.book = {
    "story": function() {
        var once = "upon",
            aTime = setTimeout(function() {
                // Code would continue...
            }, 1000)
    }
};

self.book.story();

Stipulations:

Must run error-free before, during, and after it's compiled.
You can only use up to two words for the story per String/name.

JavaScript Example:
var story = "Once upon a"; // Wrong (Using more than two words)
var story = "Onceupona"; // Wrong (Using more than two "words")
var onceUponA = "time"; // Wrong (more than two words as a variable name)
var onceUpon = "a time"; // This is fine
var story = "Once upon"; // This is fine

The story must be a complete sentence (at least).
Having some sort of output (such as "printing" the story itself) is not necessary, but it's a plus.
Bring some creativity into it.

Since there are no length rules, the answer with the most votes / best creativity will win. :)

This sort of reminds me of this IOCCC entry, which is written as an exchange of letters

I hope you mean only up to 2 words in string literals? Otherwise combining strings would be illegal.

@jpjacobs Yup. Though something like "Hi how" + "are you" + "doing today" would be lame. ;)

No objective winning criteria.

DevExpress published a creative job offer for their Russian office.

JavaScript
Not sure how historically accurate this, but it's a mini-history of ECMAScript. Please feel free to suggest improvements.
function story() {
    var IE = {
        from: "Microsoft"
    },
        Netscape = {
            from: "Mozilla"
        };
    var setUp = {
        oncethere: "were two",
        browsers: IE + Netscape
    };
    var parts = {

        And: function() {
            var theyfought = "to be",
                theBest = "browser";
        },
        oneday: function() {
            var they = {
                added: function() {
                    var add = "scripting languages";
                    Netscape.language = add;
                    IE.language = add;
                    return add;
                },
                thought: function() {
                    if (what(they.added) === good) {
                        they.wouldBeat = "the other";
                    }
                }
            };

        },
        andso: function() {
            function callLanguage(name) { return name };
            Netscape.language = callLanguage("Javascript");
            IE.language = callLanguage("JScript");
        },
        butThen: function() {
            var ECMA = "Standards Committee";
            (function standardized(languages) {
                (function into() {
                    return "ECMAScript";
                })();
            })([IE.language, Netscape.language]);

        },
        theEnd: function() {
            return {
                andWe: "all lived",
                happilyEver: "after..."
            };
        },
        what: function(thing) {
            return thing;
        },
        good: true || false
    };
}
story();

Now there's a JavaScript Book. ;)

@Shaz HA yup. Imagine a book explaining JS written like that. O_o

Yeah it would certainly be interesting. :P  I'm just glad English is my native language.

Reminds me of LOLCode, everything is sort of a story (or at least a "conversation"):

HAI
CAN HAS STDIO?
I HAS A VAR
IM IN YR LOOP
    UPZ VAR!!1
    VISIBLE VAR
    IZ VAR BIGR THAN 10? GTFO. KTHX
KTHX
KTHXBYE

Interesting never heard of LOLCode. However, can you come up with something original or is this the only syntax available? o.O

That reminds me of Shakespeare programming language. lol.

lol yeah lmfao http://en.wikipedia.org/wiki/Shakespeare_(programming_language)

Downvoted for being neither interesting nor innovative. Should have been a comment, not an answer.

@cemper93 You should flag it as Not An Answer. And probably flag the question for not meeting the guidelines about objective winning criteria.

"flag this post for serious problems or moderator attention" - that kind of scares me away ;) And I like the question even though it is subjective. It's interesting, and I don't think you have to always have an objective winning criterion. Look at the Code Golfs: Everyone knows in advance Golfscript will be the winner, yet there are other entries. If everyone would only play by objectiveness, this site would soon be dead.

JavaScript
'How';do{'computers'^Function}while(0);'they have'|'no power?'

The output is: 0 on console :D

I like this. :)

this.is,2,'show my',/appreciation/

What console? Perhaps you should indicate which language you used.

It's JavaScript just paste it into firebug/console.

Doesn't do anything here. Or is it just me?

Both Firefox and Chrome output zero because of the bitwise operators... Not sure what you are using

It's not so much of a story, and what the program does has nothing to do with what the code says, but...
C++
/* Preface (assuming nobody reads it anyway): */
#include <iostream>
#include <fstream>
#include <string>
#include <map>
#include <functional>
#include <time.h>
using namespace std;
int

/*Beginning   the*/ main(){//story:

#define   a   string
ofstream ing___water;   a   river;

#define   the
long   rivers,
each,  is
(a ( river +"of").length() > 4 );
a   normal ( river +"has   the");
a bility;   for ( float ing;  short (~1 - - 2 );){
char coal,  loaded,  ships,  on,  its,  water;
coal = is;  a   lot,   lighter;
if ( lighter  .compare ( normal ))water = 'H'*2+'O'; }

a   heavier,  ship,  may;  do { a   worse,  job;  a nd,  run;
a ground; }while ( "you"&&false)//ly
;try { a nd ( "navigate   through");
a ny, such ( normal.size()==rivers     ?

the  "ship" : may + "then"); }
catch ( exception ally ) { a wful;}} struct ural___damage {
long   before ( the   time_t o)                                                                                const{
return "to" == a( "harbour");
for ( a   rescue ("from   leaking"),
its ("load   or");o<the'r';) {
ofstream ing,  substances;
if ("not"=="even"||substances/*that*/.put( 'a').bad())
double   damage,  to,  both   the ((short) "river"[1]);
a nd   the ("overall   environment[2].");}}

a   sentient,  ship_owner,  should,  h;int //to
the operator<( struct ural___damage   might)                                                                                const{
a lso( "occur"), to( "his   own"),health( "when   not");
using   the ::map;
to  .find(  a ( "river   that's"),long( ~3 ) );
(to+="avoid")+=the "trouble   and";
(to+="cause")+=(less</*r*/ural___damage>()
(*this,/*seems like*/*this)?"is": a( "good   idea"));

return before ( the   time(0))||"is"==to +"late";}};

As plain text:

Beginning the main story:

define a string ofstreaming water a river;
define the long rivers, each is a river of length > 4;
a normal river has the ability for floating short (~1--2) charcoal-loaded ships on its water; coal is a lot lighter if lighter compare normal water = H2O;
a heavier ship may do a worse job and run aground while you falsely try and navigate through any such normalsize rivers, the  ship may then
catch exeptionally awful structural damage long before the time toconst return to a harbour for a rescue from leaking its load or other ofstreaming substances, if not even substances that put a bad double damage to both the short river [1] and the overall environment[2].
a sentient ship_owner should hint to the operator structural damage mightconst also occur to his own health when not using the map to find a river   that's long(~3) to avoid the trouble and to cause less rural damage. this seems like this is a good idea.

return before the time is to late.

Brainfuck
+++++ +   + +++++ +++++ +++++   +++++ +++++
  +   +   + +     +   + +         +   +
  +   +++++ +++   +++++ +++       +   +++++
  +   +   + +     + ++  +         +       .
  +   +   + +++++ +   + +++++   +++++ +++++

+++++ +   + +     +   +   +++++ +   + +.+++
[   + ]+  + +      + +    +   + ++  + +
+   + + [ + ]       +     +   + + + + +++
+   + +  ++ +       +     +   + +  ++ +
+++++ +   + +++++   +     ++++. +   + +++++

++++  +++++ +++++ +++++  +   +
+   + +   + +   +   +    ++  +
++++  +++++ +++++   +    + + +
+   + + +   +   +   +    +  ++     +
++++  +   + +   + +.[+]  +   +    +

+++++ +   + +++++ +   + +++++ +++++ +++++ .
+     +   + +     +  +  +     +   + +     +
+++   +   + +     +++   +++   +++++ +++++ +
+     +   + +     +  +  +     + ++      +
.     +++++ +++++ +   + +++++ +   + +++++ .

I "accidentally" ran this through bf and that came out
It's Me

*SCNR* :)

Interesting! :P

BASIC
slightly simplistic, but very true for those of us who stay up till 3 AM debugging...
On Error GoTo sleep

much nicer than PHP's or die

Python Love
def initely(there, were):
    if not None:
        atLeast = not "many"
    who.made("my heart")
    "beat as", you.do(_,_)
    return your.smile
warm = "ly"

try:
    toKeep = "it" + warm
    while walkingHome: pass
    ing(emptyWindows)
except:ionally = "sad"
finally: it = "'s over"

your = not any([1, "to me"]) or "just my toy" and \
type("",(), {"youWere": "more"} )()

your.smile = "kept me"
_ = warm in "these days"

but, you = "were failed by", your #love: me

if _: only(I)
hadKnown, you.were = "innocent as a", lambda \
young, blueEyed: \
[("but ", "the retribution") for myMisdoings #comes
in "time"]

sometimes, you.do = ("make me", #think of who
you.were)
""in "another story"

I, who = "I've been", your#'s
"sit" in "my room"
"look"in"g at" #old photographs
#relentlessly remembering
the, love = you.do, "give to me"
who.made = all #these mistakes

"Had thought" + it + "would go"
on = "inf"+initely(
"Oh!, the", "fool I've")#been
regretting = all("my errors") #today

_, im = "hold" in "paraly","sys"
_ = open; "cans" and "cans of"
_ = _(__import__(#ed beer
im).#in a d
argv[0]#id
).read() #sad poems

love, is_ = the, "thing I" #miss forever
iTake = "my camera"
go = "out to have"
new, photos = "to look", _ #at

print ("them" if 0 #they're dull
else _); "they make" + "me think of", love("lost", "for me")
EDIT: This is now a (if cheated) quine.

bash or other shells on Unix or Linux:
who am I & whereis edit || eliza && find ada

I really can't claim this one to myself, but I think it would be really good for you all to be able to look at it.
This is called PHP Sad Poem, and comes from here.
$timeWaiting = 0;
while (!$you->near($me)) {
    $me->thinkAbout($you);
    switch (true) {
        case $timeWaiting < 5:
            $me->wait($you);
            break;
        case $timeWaiting < 10:
            $me->worry();
            break;
        case $timeWaiting < 20:
            $me->lookFor($you);
            break;
        case $timeWaiting < 40:
            $me->worry();
            $me->lookFor($you);
            break;
        case $timeWaiting < 80:
            $me->worry();
            $me->cry();
            $me->lookFor($you);
            $me->lookFor($you);
            $me->lookFor($you);
            break;
        case $timeWaiting < 160:
            $me->worry();
            $me->cry();
            $me->drink();
            $me->lookFor($you);
            $me->lookFor($you);
            $me->lookFor($you);
            $me->thinkAbout($you);
            $me->thinkAbout($you);
            $me->cry();
            $me->lookFor($you);
            $me->lookFor($you);
            $me->drink();
            $me->drink();
            break;
        default:
            throw new CantLiveWithoutYou();
            die(“alone”);
        }
    $timeWaiting++;
}
$me->happy = true;


text:
Multiples of 67 in a constructed array of arrays?
A triangle-shaped table is constructed such the first row is "1, 3, 5, 7, ..., 99"
Each subsequent row has the following properties:

One less element than the row above
Each element is the sum of the two elements above it

Like so:
1   3   5    7    9    11 ....
  4   8   12   16   20 ....
    ...............

This continues until the last row with one element.
How many elements are divisible by 67?
Fewest lines, chars, or whatever may win.  Depends on ingenuity.
EDIT: the answer is 17 but you have to prove it.
ADDENDUM:
I have three-line python code for this but try to beat it:
a = [[2*i+1 for i in range(50)]]
while len(a[-1])>1:a.append([a[-1][i]+a[-1][i+1] for i in range(len(a[-1])-1)])
print len([i for b in a for i in b if i%67==0])

Heads up: the numbers overflow 32-bit int.  You'll need big integers (or at least 64-bit integers) for the final rows.

Is this the way to go? Inform the others of possible pitfalls? I would prefer to wait for the first users, trapping into the trap.

By induction, row (2n) = 4^n (2n+1, 2n+3, ..., 99-2n); and row (2n+1) = 4^(n+1) (n+1, n+2, ..., 49-n). gcd(4, 67) = 1, 49 < 67 < 99 < 2*67, so there is one number divisible by 67 in the even rows until row 32 (=99-67), for a total of 17. If I put this in a comment then I can justify hard-coding the answer, and when I golf I remove comments. Therefore I've downvoted this as a bad question.

@Peter Taylor:  Sounds good.  Now all you have to do is code-golf the proof ;)

@Peter Taylor: I dare you to write the proof in Coq or similar.

JavaScript: 91, 88 (thanks trinithis), 84, 77 (thanks again trinithis), 75 (thanks shesek), 74 Characters (thanks Shmiddty)
91-->88 - See Trinithis's comment
88-->84 - moved j-- into conditional check.
84-->77 - See trinithis's comment (removed {} from for loops, ignored first index of a array) plus some additional work (fixed logic for building arrays and incrementing counters)
77-->75 - See Shesek's comment (instead of (condition)&&val++: val+=(condition))
75-->74 - See Shmiddty's comment (instead of i=c=1,a=[]: a=[i=c=1])
Golfed:
for(a=[i=c=1];i<51;)for(a[i]=i*2-1,j=i++;j>1;)c+=1>(a[--j]=a[1+j]+a[j])%67

Ungolfed:
/**
 * i - counter for array index and array initialization
 * c - count of elements divisible by 67
 * a - array of numbers in diagonal bottom-to-right row.
 *        For example, here are the first 3 iterations:  [1], [4,3], [12,8,5]
 * j - index into array a
 */
for(a=[i=c=1];i<51;){
    a[i]=i*2-1;
    for(j=i++;j>1;){
        c+=1>(a[--j]=a[1+j]+a[j])%67
    }
}

Here's a fiddle for both as well as a test that outputs what is in the arrays for the first 3 iterations.
Note:  I initialize the count to 1 because the first row [1,3,5..67..97,99] has one number divisible by 67.  That way, I did not have to worry about checking the first row.

if(0==(a[j]=a[j]+a[j+1])%67)c++ -> 1>(a[j]=a[j]+a[j+1])%67&&c++ Might be able to use ! instead of 0== or 1> if you can figure it out.

73 chars: for(i=c=1,a=[];i<51;)for(a[i]=i*2-1,j=i++;j;)1>(a[--j]=a[j]+a[j])%67&&c++

@trinithis: Thanks!  One thing:  I didn't understand a[--j]=a[j]+a[j] in your code.  Because of this, I did some debugging and ended up finding a mistake with my second iteration (a[j]=a[j--]+a[j] is not equal to a[j-1]=a[j]+a[j-1] but instead a[j]=a[j]+a[j-1]).  This is fixed in the above version, and is much shorter because of you, so thanks again for the help!

Sliced down 2 more characters by adding the boolean result of 1>... to c (which is casted to an integer), for(i=c=1,a=[];i<51;)for(a[i]=i*2-1,j=i++;j>1;)c+=1>(a[--j]=a[1+j]+a[j])%67

@shesek: Updated, thanks much!

a=[i=c=1]; saves another character

@Shmiddty:  Thanks much, code-ninja:  Updated!

Haskell - 86 chars
98 → 92: Use list comprehensions and sum instead of filter and length.
92 → 86: Convert nested list comprehensions into one, and change ==0 to <1 (thanks st0le).
f s=zipWith(+)s$tail s
main=print$sum[1|r<-take 50$iterate f[1,3..99],n<-r,n`mod`67<1]

Ungolfed:
initialRow :: [Integer]
initialRow = [1,3..99]

nextRow :: (Num a) => [a] -> [a]
nextRow xs = zipWith (+) xs (tail xs)

triangle :: [[Integer]]
triangle = takeWhile (not . null) $ iterate nextRow initialRow

main = print $ length $ filter ((== 0) . (`mod` 67)) $ concat triangle

replace ==0 by <1

You can replace f with tail>>=zipWith(+)

You can also change the inners of the comprehention to n<-(take50$iterate f[1,3..99])>>=id,

Nice trick with using sum

Mathematica 82 chars
Count[Mod[#,67]==0&/@Flatten@NestList[2MovingAverage[#,2]&,Range[1,99,2],49],True]

-> 17

Python 95 bytes
l,c=range(1,100,2),0
while l:c+=len([i for i in l if i%67<1]);l=map(sum,zip(l,l[1:]))
print c

Nice one.  I borrowed some of your ideas, and found a few places to save a few characters.

Python
85 bytes - thanks to st0le
l,c=range(1,100,2),0
while l:c+=sum(i%67<1for i in l);l=map(sum,zip(l,l[1:]))
print c

J, 48
1225-~+/,-.*67|((<:/|.)a)*(+1&|.)^:a>:2*a=:i.50x

Explanation (bits of it, anyway):

a is 0 .. 49
>:2*a is 1 3 5 ...
The verb (+1&|.) shifts a row and adds it to the original to get the desired next row (plus extras, since the result is still 50 elements).
(+1&|.)^:a>:2*a gives 50 rows of results. Row one is 1 3 5 etc, row 2 is 4 8 12 etc.
((<:/|.)a) is a 50x50 matrix of 1 1 ... 1 1, 1 1 ... 1 0 etc. down to 1 0 ... 0 0. This zeroes out the 1225 extras. (1225 is the 49th triangular number.)
After taking mod 67 and counting, we subtract those 1225 zeroes that we know will be present.

C++ 133 131 125 chars, 2 Lines
#include<iostream>
__int64 c=1,s=1,r,a=2,e=51,i;int main(){for(;e;c=s+=s+a,a*=2)for(i=e--;--i;c+=a)c%67?0:r++;std::cout<<r;}

I'm not sure how portable this is with the use of __int64, if it does complains you     can change it to long long.
Ungolfed
#include<iostream>

__int64 curr,start=1,ret,add=2,end_line=50;
int main(){
    for(;end_line>0;end_line--,add*=2){
        curr=start;
        for(int i=1;i<=end_line;++i){
            if(curr%67){
            }else{
                ret++;
            }
            curr+=add;
        }
        start+=start+add;
    }
    std::cout<<ret;
}

I don't think you need the =1 in c=1 in the golfed version?

You were right thanks, well spotted.

The i loop can be shortened by counting down. for(i=e;i--;c+=a) (i think)

@st0le, Thanks, rejigged it a bit as well though I'm now unsure about that c=1.  I get the correct result without it but looking through the debug I don't think it is doing it the correct way, anyway i put it back in.

Can't you just use int if you change the %67 to %=67?

@Peter Taylor, it's not just curr that goes over the int limit, start and add go over it also.  I looked into keeping all those values low(using %67) but I couldn't find a way to do it in less than 4 characters( the cost of __int64 over just int).

 Ruby 113 bytes
l,c=(1..100).step(2).to_a,0
[c+=l.count{|i|i%67<1},l=l.zip(l[1..-1]).map{|x,y|x+y if y}.compact!]until[]==l
p c

until[]==l instead of while !l.empty? saves 5 characters

Q, 53 43
sum 0=(raze{1_msum[2]x}\[1+2*(!)50])mod 67

.
q)sum 0=(raze{1_msum[2]x}\[1+2*(!)50])mod 67
17i

Don't have to cast to long in q 3.0 which saved some characters.

scala, 125 chars:
def s(v:Seq[Long]):Seq[Long]=if(v.size==1)v else
v++s(v.sliding(2).map(v=>v(0)+v(1)).toSeq)
s(1L to 99 by 2).count(_%67==0)

Since the first row contains the number 67, which is divisible by 67, and the next number, divisible by 67 is 2*67 is bigger than 99, we know that we start with count = 1.

Perl (84+1)
there might still be a way to shorten this :)
@q=grep$_%2,1..99;while(@q){$_%67or$c++for@q;$q[$_]+=$q[$_+1]for 0..$#q;pop@q}say$c

GolfScript, 39 38 characters
100,{2%},0\{.{67%!},,@+\(\{.@+}%\;.}do


text:
Compute the CRC32 table at compile-time
The reference implementation of CRC32 computes a lookup table at runtime:
/* Table of CRCs of all 8-bit messages. */
unsigned long crc_table[256];

/* Flag: has the table been computed? Initially false. */
int crc_table_computed = 0;

/* Make the table for a fast CRC. */
void make_crc_table(void)
{
    unsigned long c;

    int n, k;
    for (n = 0; n < 256; n++) {
        c = (unsigned long) n;
        for (k = 0; k < 8; k++) {
            if (c & 1) {
                c = 0xedb88320L ^ (c >> 1);
            } else {
                c = c >> 1;
            }
        }
        crc_table[n] = c;
    }
    crc_table_computed = 1;
}

Can you compute the table at compile-time, thus getting rid of the function and the status flag?

What is the objective primary winning criterion here?

also, language specific questions are frowned upon here. you should remove the c++ tag.

Here's a plain C solution:
crc32table.c
#if __COUNTER__ == 0

    /* Initial setup */
    #define STEP(c) ((c)>>1 ^ ((c)&1 ? 0xedb88320L : 0))
    #define CRC(n) STEP(STEP(STEP(STEP(STEP(STEP(STEP(STEP((unsigned long)(n)))))))))
    #define CRC4(n) CRC(n), CRC(n+1), CRC(n+2), CRC(n+3)

    /* Open up crc_table; subsequent iterations will fill its members. */
    const unsigned long crc_table[256] = {

    /* Include recursively for next iteration. */
    #include "crc32table.c"

#elif __COUNTER__ < 256 * 3 / 4

    /* Fill the next four CRC entries. */
    CRC4((__COUNTER__ - 3) / 3 * 4),

    /* Include recursively for next iteration. */
    #include "crc32table.c"

#else

    /* Close crc_table. */
    };

#endif

It relies on the nonstandard __COUNTER__ macro, as well as an evaluation semantics where __COUNTER__ is evaluated before it is passed as an argument to a macro.
Note that, since STEP evaluates its argument twice, and CRC uses eight nested invocations of it, there is a small combinatorial explosion in the code size:
$ cpp crc32table.c | wc -c
4563276

I tested this in GCC 4.6.0 and Clang 2.8 on 32-bit Linux, and both produce the correct table.

Awesome, I certainly wasn't expecting this. Have a +1.

The core loop
for (k = 0; k < 8; k++) {
    if (c & 1) {
        c = 0xedb88320L ^ (c >> 1);
    } else {
        c = c >> 1;
    }
}

can be converted into a meta-function:
template <unsigned c, int k = 8>
struct f : f<((c & 1) ? 0xedb88320 : 0) ^ (c >> 1), k - 1> {};

template <unsigned c>
struct f<c, 0>
{
    enum { value = c };
};

Then, 256 calls to this meta-function (for the array initializer) are generated by the preprocessor:
#define A(x) B(x) B(x + 128)
#define B(x) C(x) C(x +  64)
#define C(x) D(x) D(x +  32)
#define D(x) E(x) E(x +  16)
#define E(x) F(x) F(x +   8)
#define F(x) G(x) G(x +   4)
#define G(x) H(x) H(x +   2)
#define H(x) I(x) I(x +   1)
#define I(x) f<x>::value ,

unsigned crc_table[] = { A(0) };

If you have Boost installed, generating the array initializer is a bit simpler:
#include <boost/preprocessor/repetition/enum.hpp>

#define F(Z, N, _) f<N>::value

unsigned crc_table[] = { BOOST_PP_ENUM(256, F, _) };

Finally, the following test driver simply prints all array elements to the console:
#include <cstdio>

int main()
{
    for (int i = 0; i < 256; ++i)
    {
        printf("%08x  ", crc_table[i]);
    }
}

A C++0x solution
template<unsigned long C, int K = 0>
struct computek {
  static unsigned long const value =
    computek<(C & 1) ? (0xedb88320L ^ (C >> 1)) : (C >> 1), K+1>::value;
};

template<unsigned long C>
struct computek<C, 8> {
  static unsigned long const value = C;
};

template<int N = 0, unsigned long ...D>
struct compute : compute<N+1, D..., computek<N>::value>
{ };

template<unsigned long ...D>
struct compute<256, D...> {
  static unsigned long const crc_table[sizeof...(D)];
};

template<unsigned long...D>
unsigned long const compute<256, D...>::crc_table[sizeof...(D)] = {
  D...
};

/* print it */
#include <iostream>

int main() {
  for(int i = 0; i < 256; i++)
    std::cout << compute<>::crc_table[i] << std::endl;
}

Works on GCC (4.6.1) and Clang (trunk 134121).

Regarding C >> 1, Isn't shifting negative values to the right unspecified behavior? ;)

Also, can you explain the part where you define the array? I'm a bit lost there...

@Fred you are right. I shall also make C a unsigned long. The constant array is defined to be initialized by the pack expansion D.... D is a non-type template parameter pack. Once GCC supports it, one can also declare the array in-class with static unsigned long constexpr crc_table[] = { D... };, but GCC doesn't parse braced in-class initializers yet. The benefit will be that compute<>::crc_table[I] could be used within constant expressions later in the code.

C++0x with constexpr. Works on GCC4.6.1
constexpr unsigned long computek(unsigned long c, int k = 0) {
  return k < 8 ? computek((c & 1) ? (0xedb88320L ^ (c >> 1)) : (c >> 1), k+1) : c;
}

struct table {
  unsigned long data[256];
};

template<bool> struct sfinae { typedef table type; };
template<> struct sfinae<false> { };

template<typename ...T>
constexpr typename sfinae<sizeof...(T) == 256>::type compute(int n, T... t) {
  return table {{ t... }};
}

template<typename ...T>
constexpr typename sfinae<sizeof...(T) <= 255>::type compute(int n, T... t) {
  return compute(n+1, t..., computek(n));
}

constexpr table crc_table = compute(0);

#include <iostream>

int main() {
  for(int i = 0; i < 256; i++)
    std::cout << crc_table.data[i] << std::endl;
}

You can then use crc_table.data[X] at compile time because crc_table is constexpr.

This is my first metaprogram:
#include <cassert>
#include <cstddef>

template <std::size_t N, template <unsigned long> class T, unsigned long In>
struct times : public T<times<N-1,T,In>::value> {};

template <unsigned long In, template <unsigned long> class T>
struct times<1,T,In> : public T<In> {};

template <unsigned long C>
struct iter {
    enum { value = C & 1 ? 0xedb88320L ^ (C >> 1) : (C >> 1) };
};

template <std::size_t N>
struct compute : public times<8,iter,N> {};

unsigned long crc_table[] = {
    compute<0>::value,
    compute<1>::value,
    compute<2>::value,
    // .
    // .
    // .
    compute<254>::value,
    compute<255>::value,
};

/* Reference Table of CRCs of all 8-bit messages. */
unsigned long reference_table[256];

/* Flag: has the table been computed? Initially false. */
int reference_table_computed = 0;

/* Make the table for a fast CRC. */
void make_reference_table(void)
{
    unsigned long c;

    int n, k;
    for (n = 0; n < 256; n++) {
        c = (unsigned long) n;
        for (k = 0; k < 8; k++) {
            if (c & 1) {
                c = 0xedb88320L ^ (c >> 1);
            } else {
                c = c >> 1;
            }
        }
        reference_table[n] = c;
    }
    reference_table_computed = 1;
}

int main() {
    make_reference_table();
    for(int i = 0; i < 256; ++i) {
        assert(crc_table[i] == reference_table[i]);
    }
}

I "hardcoded" the calls to the template that does the computation :)

If you're going to do it that way, why wouldn't you just hardcode the actual values into the program? (After obtaining them with another method, of course.)  Saves on compile time.

+1 for the test and the times template

@Matthew: with only C++03, there's little choice. You could use the preprocessor, like Fred did, but that won't shorten compilation time. And apparently, his preprocessor chokes on his solution :)

@Matthew The point is to actually compute it at compile-time, not to have them hardcoded. Fred's answer generates an array of this form: unsigned crc_table[] = { f<0>::value , f<0 + 1>::value , f<0 + 2>::value , f<0 + 2 + 1>::value , f<0 + 4>::value , f<0 + 4 + 1>::value , f<0 + 4 + 2>::value , f<0 + 4 + 2 + 1>::value , f<0 + 8>::value , using the preprocessor. It takes about as long to compile as mine. If you want, you can read that last paragraph as "I unrolled the outer loop". There's no other choice in C++03

Ah, I wasn't paying enough attention to the requirements of the question.  +1, though I'm not sure I like the question anymore.  I like my code challenges practical :P

D
import std.stdio, std.conv;

string makeCRC32Table(string name){

  string result = "immutable uint[256]"~name~" = [ ";

  for(uint n; n < 256; n++){
    uint c = n;
    for(int k; k < 8; k++)
      c = (c & 1) ? 0xedb88320L ^ (c >> 1) : c >>1;
    result ~= to!string(c) ~ ", ";
  }
  return result ~ "];";
}

void main(){

  /* fill table during compilation */
  mixin(makeCRC32Table("crc_table"));

  /* print the table */
  foreach(c; crc_table)
    writeln(c);
}

It really puts C++ to shame, doesn't it?

Actually, I prefer the non-stringly-typed solutions. This looks a lot like compile-time eval.

No need to use a string mixin for this, here is how we do it in D's standard library, genTables and call-site to store the result in const data segment.

C/C++, 306 295 bytes
#define C(c)((c)>>1^((c)&1?0xEDB88320L:0))
#define K(c)(C(C(C(C(C(C(C(C(c))))))))),
#define F(h,l)K((h)|(l+0))K((h)|(l+1))K((h)|(l+2))K((h)|(l+3))
#define R(h)F(h<<4,0)F(h<<4,4)F(h<<4,8)F(h<<4,12)
unsigned long crc_table[]={R(0)R(1)R(2)R(3)R(4)R(5)R(6)R(7)R(8)R(9)R(10)R(11)R(12)R(13)R(14)R(15)};

Working in reverse, we wind up with an unsigned long array named crc_table. We can omit the size of the array as the macros will ensure there are exactly 256 elements in the array. We initialize the array with 16 'rows' of data by using 16 invocations of the macro R.
Each invocation of R expands into four fragments (macro F) of four constants (macro K) for a total of 16 'columns' of data.
The macro K is the unrolled loop indexed by k in the code from the original question. It updates the value c eight times by invoking the macro C.
This preprocessor based solution uses quite a bit of memory during macro expansion. I tried to make it a little shorter by having an extra level of macro expansion and my compiler puked. The code above compiles (slowly) with both Visual C++ 2012 and g++ 4.5.3 under Cygwin (Windows 7 64 bit 8GB RAM).
Edit:
The fragment above is 295 bytes including white space. After expanding all of the macros except for C it grows to 9,918 bytes. As each level of C macro is expanded the size grows quickly:

25,182
54,174
109,086
212,766
407,838
773,406
1,455,390
2,721,054

So by the time all the macros have been expanded, that little 295 byte file expands into over 2.7 megabytes of code that must be compiled to generate the original 1024 byte array (assuming 32 bit unsigned long values)!
Another edit:
I modified the C macro based on a macro from another answer to squeeze an extra 11 bytes out, and greatly reduced the full expanded macro size. While 2.7 MB isn't as bad as 54 MB (the previous final size of all macro expansion), it is still significant.

This isn't [tag:code-golf], so you don't need to minimize the character count.

Ah. So it is. My bad on that part. Though I do think this implementation is portable (by which I mean it conforms the the C language and preprocessor; its true portability would depend on the environment's exact limits on macro expansion).

I would modify the previous answer by replacing the last three lines with:
#define crc4( x)    crcByte(x), crcByte(x+1), crcByte(x+2), crcByte(x+3)
#define crc16( x)   crc4(x), crc4(x+4), crc4(x+8), crc4(x+12)
#define crc64( x)   crc16(x), crc16(x+16), crc16(x+32), crc16(x+48)
#define crc256( x)  crc64(x), crc64(x+64), crc64(x+128), crc64(x+192)

Where crcByte is his K macro without the trailing comma. Then build the table itself with:
static const unsigned long crc32Table[256] = { crc256( 0)};

And never leave out the size of the array as the compiler will then verify that you have the correct amount of elements.