text:
Golfed sort by debian version number
I wrote some perl to sort by debian package version number (specification here). Whilst readable, it was disappointingly long (114 lines, 2042 characters) - shocking. So this challenge is to produce the shortest program (in perl or otherwise) which takes debian package version numbers on STDIN separated by \n, sorts them, and puts the output on STDOUT separated by \n.
You can produce an dataset of debian versions numbers on a debian/ubuntu box by:
apt-cache madison . | perl -n -e 'print "$1\n" if /^\S+\s+\|\s+(\S+)\s+/;'

For those not on Debian / Ubuntu I've put a random selection of 1000 here. The sorted version of this sample is here. The md5sum of the unsorted and sorted versions (check they each end with a \n) are:
5ffd12d3f59b06619a712e92791c0dfd  input.sample
e6b2d03ddfd9491c5bdf2594a5aa82e5  output.sample

(note as Ventero points out in the comments, there are certain equivalent version numbers, e.g. lines 135-138 out of the output, where 08 and 8 are equivalent and thus the sort order is arbitrary)
For the purposes of verifying your input, you can install Debian::Dpkg::Version from CPAN and use the following to test:
#!/usr/bin/perl

use strict;
use warnings;
use Debian::Dpkg::Version;

my @input;

while (<>)
{
    chomp;
    push @input, $_;
}

my @output = sort version_compare (@input);
print join("\n", @output)."\n";

The following test data is thus sorted in the correct order, and (I believe) only contains lines complying with the Debian spec above, with each version being distinct:
0~~-~~
0~~-~
0~-~~
0~-~
0~-0
0-0
0-1
0-02
3-0
04-0
04a-0
5-0
04:3-0
5:3-0
06:3-0
06:3a-0
06:3a-01
06:3a-3~
06:3a-3
6:3a-04
06:3a-05
06:3.-0
06:3:a
06:3:a-01
06:3:a-05

The rules are:

Package name sorting must be exactly per the Debian spec
No inclusion of external modules written to perform Debian packages sorting, as that would make it rather easy. Therefore golfing the above test program will not produce a legal answer, as it includes Debian::Dpkg::Version. You may of course look to the source of that module for inspiration if you lack imagination, but I believe there are shorter ways to do this.
You may assume that any input line whose format is invalid (i.e. does not constitute a version number conforming to the debian spec) must be retained, but may be sorted arbitrarily.
Equivalent version numbers may be sorted arbitrarily, e.g. 0.08-1 is equivalent to 0.8-1 as the numeric components 08 and 8 are compared as integers.
Save in respect of the arbitrary sort order of any lines not constituting version numbers conforming to the debian spec, and equivalent version numbers, your output should be identical to the test program above.

Could you please also provide the sorted version of your input? And do we have to reject invalid version numbers?

@Ventero I've added a test program and md5sum of the input and output sample data. Invalid version numbers should be retained but may be sorted arbitrarily.

@Ventero oh, and a link to the sorted data which is what you actually asked for :-)

Nice, thanks a lot. Looks like I've still got a bug or two to iron out ...

Regarding lines 135-138 in your reference output: Those lines can appear in any order, as the integer value of 08 and 8 are compared for sorting, correct? (Also, a warning to others: files downloaded from pastebin have their lines terminated with \r\n)

@Ventero re lines 135-138, yes, you are correct. I have amended the rules to make this clear.

One last question, then I'll stop bugging you: In the test data in your post you have version numbers like 06:3a-05. The spec says about the epoch: "This is a single (generally small) unsigned integer" (emphasis mine). Does that mean that version number is invalid (or in other words: is the list in your post sorted correctly because incorrect versions can be sorted arbitrarily, or because it has to be sorted that way)? Awesome question, by the way!

@Ventero: My interpretation (which is compatible with reading the source to the actual Debian code) is that epoch 'integers' can be validly written with leading zeroes, i.e. it has to be sorted that way. This is also compatible with the way digit parts of the other strings are compared.

Ruby 2.0, 145 179 characters
puts$<.sort_by{|a|(1..3).map{|i|"#{a[/^(\d+:)?(.+?)(-[^-]+)?
/,i]}".scan(/(\D*)(\d*)/).map{|w,n|w.bytes.map{|c|c<126?c>58?c:c+99:-1}+[0,n.hex]}}}

Correctly sorts both the linked reference input (though it generates a slightly different output order due to different sorting of equivalent version numbers, e.g. 1.06-2 vs 1.6-2) and the included test data.

I've verified this works (158 characters when I verified).


text:
Brainfuck Sorting
Write a program in brainfuck that accepts input of 4 ASCII characters as numbers (from 32 to 126) and outputs the numbers or ASCII equivalent sorted in ascending order.
Requirements: Your program should prompt the user for 4 characters that will be sorted by their ASCII value. All the inputs will be distinct. Any sorting algorithm can be used. Every cell is one byte, and the shortest code wins. If there is a tie, the code that uses the least memory cells wins.
Example input:
(i"G

Example output:
"(Gi

Helpful links: How to compare 2 numbers with brainfuck
If you have any questions please ask them in the comments.
I tried to write a program that solves this problem. It works, but it's so inefficient and lenghty (500+) that I don't want to post it here. If you bothered to go through the pain I did, you'll get a +1 from me.

Meh, language-specific challenge. I can see how this would be a challenge in Brainfuck and fairly trivial in "normal" languages, but still...

How about allowing more esoteric languages?

@Knerd I'll allow it, but it's not the main focus of this question.

@qwr then you should edit your question :)

I get why this should be language-specific. Sorting in BF is very different from normal languages.

A lot of my early questions were of questionable quality.

33 code bytes, 2n+3=11 n+4=8 memory cells
Edited: I can improve memory usage by keeping the count in only one cell.
>,[>,]+[<[-<]>[>]>[<-[>]<.>>]<<+]

EOF is 0, 8 bit wrapping memory (0+256=0)
How it works

Read all numbers
Decrement each number, keep count of how many times you do this.
When something hits zero, print the count
Repeat until count rolls over.

Details
Memory: 0(start padding),[input],...,count,0(padding),0 (more padding)
> (start padding)
,[>,] read input
+ count=1
[ while count !=0
    <[-<] decrement all inputs
    >[>] go to an input that was just decremented to zero, or padding
    > point to next input or more padding
    [ if not padding
         <- change the 0 to 255 so it doesn't stop the next decrement pass
         [>]<. point to and print count
         >> point to more padding
    ]
    <<+ increment count
]

The old way
>,[->+>,]<[[+<-<]>[>>]>[.[>]>]<<]

Memory plan:
0(padding),[input,count],[input,count],...,[0,0](dummy input & count)

Commented code:
> get some elbow room
,[->+>,] read each number & do an initial count/decrement pass so count is not 0
< point at last count
[ while count !=0 (didn't roll over)
    [+<-<] decrement each number and increment each count
    > point at first input
    [>>] go to the first 0-ed input (probably the dummy input)
    > point at count or dummy count
    [ if not the dummy count
        . print it
        [>]> go to the dummy count (no other inputs will be 0 because they are all unique)
    ]
    << point at last count
]

Huh. That's smart. +1

This answer is incredible.

94 bytes code, 2n+5 = 13 bytes memory
>>,[>>+[->>+<<],]>>[<<<<<<[>>[<+<-[>>>]>>[-[-<<+>>]+>>>]<<<-]<[-<+>>+<]<<<]>>[>>]>>-]<<<<[.<<]

EOF is zero.
Example:
$ echo -n '(i"G'|beef sort.bf ;echo
"(Gi

What sort did you implement? Bubble sort, I guess?

@TheRare Yes. Bubble sort is the easiest to implement with BrainFuck.

@TheRare Maybe I'm wrong. Counting sort can be easier.

90 63 bytes code, 769 513 bytes memory
>>,[-[[>>]+[<<]>>-]>>[>>]<+<[-<<],]+[[>>]+<[<[<<]>>.>]<[<<]>>+]

This works much like the old way, but doesn't initialize memory with numbers.  Instead, it keeps track of which location it is checking and prints that number.
The old way
>>>+[[->+>>+<<<]>[-<+>]>>+]<<<[<<<]>>,[[->>[>>>]+[<<<]>]>>[>>>]<<+<[-<<<]>,]>[>>[<<.>>-]>]

EOF is 0, 255+1 = 0
How it works
Step 1: Prep the memory to look like: 0,0,0,[1,0,0],[2,0,0],...,[255,0,0],0
>>>+[[->+>>+<<<]>[-<+>]>>+]<<<[<<<]

Step 2: Read the input and increment memory at (3+input*3+2).  Reading space (32) results in 0,0,0,[1,0,0],...,[32,0,1],...
>>,[[->>[>>>]+[<<<]>]>>[>>>]<<+<[-<<<]>,]

Step 3: Read through the memory and output any number that has a non-zero value two cells to the right of it.  Stop after 255.  This prints out the characters in ascending order.
>[>>[<<.>>-]>]

source: Stack Exchange

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

sort: votes


text:
Has my milk expired?
Aww, man, this expiry date doesn't write the months with letters! I can't tell if it's expiring on March 10th or October 3rd... Wait, no, never mind, the year says 2012. (alley-oops half-used brick of cheese into the trash can like a pro)
So let's suppose for a moment that you're too busy to try to reason out when this jar of marinara is supposed to expire. You just want the Cliff Notes version: how likely is it that it's past due? Let's write some code!
You know that the manufacturers print the date as an ordered triple of integers, in one of three formats:
YEAR  MONTH DAY
MONTH DAY   YEAR
DAY   MONTH YEAR

And you know that some dates can only be interpreted in one or two ways, not all three: the 55 in 55-11-5 has to be a year, meaning this particular box of Twinkies expired November 5th, 1955. The year is sometimes given in four digits and not two, which can rule out some options. When it's two digits, though, 50..99 means 1950..1999 and 0..49 means 2000..2049.
Your job is to write a program or function that takes an array of integers which is a valid date in at least one of the interpretations above, and outputs a percent chance it is still good. The percent chance is simply the percentage of valid interpretations of the date that are on or later than today's date.
The array of integers will be your language's [Int] type of length three if it is an argument to a function, and given as either dash-, slash-, or space-separated (you get to pick) integers if used as input on STDIN to a full program.*
"Today's date" can be today's actual date, as obtained through a date function, or the date given in an extra argument to function or extra paramater in STDIN. It may be in Unix epoch seconds, another year-month-day triple entered in one of the three ways above, or another more convenient fashion.
Let's have some examples! The expiry date input will be in the dash-separated style, and assume for the examples below that today's date is July 5th, 2006.

14-12-14 - Both valid interpretations for this (DMY and YMD) are equivalent, December 14, 2014. The output is 100 because this product is definitely still good.
8-2-2006 - The last number is a year, for sure, since it has four digits. This could be either February 8th (expired) or August 2nd (still good). The output is 50.
6-7-5 - This could be anything! The "July 5th, 2006" interpretation is still good (for one day only), but the remaining two are both in 2005 and should be tossed as quickly as possible. The output is 33.
6-5-7 - Here, two out of three interpretations are safe. You can round your decimal up or down, so 66 or 67 are both okay.
12-31-99 - Okay, this one is unambiguously from the turn of the century (years from 50 to 99 are 19XX, and 31 can't possibly be a month). A big fat 0, and you really should clean out your fridge more often.

You can safely assume that any input which does not meet the standards above is not privy to the output rules above.
No web requests or standard loopholes. Date handling libraries are allowed. This is code golf: may the shortest program win.
* If you are using brainfuck or some similarly datatype-handicapped language, you can assume the ASCII values of the first three characters in input are the integers for the date. This excludes the four-digit year logic, sure, but I think we would be too astounded by seeing a solution to this in Brainfuck to slight you for it.

Umm... the current year is 2014, not 2006. Your milk is eight years past its expiry at best.

@JanDvorak I just didn't want to try very hard to construct meaningful examples, so I tweaked today's date to make it easier.

Do we need to account for 29 Feb and leap years?

Do we have to round?

@algorithmshark 6-7-5 example - will it stand for 2006-07-05 or 2016-07-05?

@eithedog "0..49 means 2000..2049." so the former

Those Twinkies expired December 5th, '55

@Dgrin91 don't care, I'll still eat them :D

Is output on stderr tolerated?

Is it safe to assume 6 doesn't mean 1906, 1806, or just 6 A.D.?

Do we actually need to support years outside of the 1950-2049 range?

@IanD.Scott: Looking at the examples and the problem description, 6 has to be treated as 2006.

@m.buettner Alright, alright, you guys don't have to round the percentage. I didn't think adding in a floor() was such a big deal, but okay. Four digit years have to stay, though, because those actually occur on some (many, nowadays) expiry labels.

@algorithmshark Oh no, I don't mind adding the floor as long it's a hard rule that everyone has to follow. Gotta fix my year-canonicalisation code, though.

In Australia, the milk expires about a week before the use by date

You should add a test with a 00 in it, since that can't be a legal day or month.

Wait, what? Twinkies expire!?

This problem implicitly makes the assumption that all three orderings of day/month/year are equally likely. A more accurate model of the problem would provide prior probabilities of each ordering, and require that the programs weight their answers by them. For example, if the three orderings have probabilities 0.5, 0.25, 0.25, then the date 6-7-5 would have the result 50 instead of 33.

@RoryO'Kane: And an even more accurate model would include information what item uses what format. So what? It's still a fun task and problems don't need to be terribly realistic either; they just should be fun.

@Јοеу I wasn’t suggesting that this code gold challenge should include prior probabilities; I know that that would be unnecessarily complicated. I was just pointing out an interesting feature of the problem that this is a simulation of, for the curious.

TBF, if there's ANYTHING with the number 32 or more, you need to throw the fridge out because that's a biohazard.

k4 (90) (88) (87) (82)
{100*(+/~d<x)%3-+/^d:{"D"$"."/:$|z,y,x+(x<100)*100*19+x<50}.'y@/:3 3#.:'$21020101}

Invoke with x of .z.D (a builtin) for comparison to today, or a date literal of your choice otherwise:
  f:{100*(+/~d<x)%3-+/^d:{"D"$"."/:$|z,y,x+(x<100)*100*19+x<50}.'y@/:3 3#.:'$21020101}
  .z.D f'(14 12 14;8 2 2006;6 7 5;6 5 7;12 31 99)
100 0 0 0 0f
  2006.07.05 f'(14 12 14;8 2 2006;6 7 5;6 5 7;12 31 99)
100 50 33.33333 66.66667 0

This is basically a port of @Alex-l's Python solution, with a few miscellaneous golfing tricks added:

The rearrangement instructions are encoded in a string to save a couple characters.
The conditional logic (ab)uses truth-as-integer (but in a different way from the Python solution).
The validity test is slightly different--k4/q will happily parse any string into any datatype; it simply returns a null if it can't make sense of it. Thus, I return a list of dates from the inner function, which may or may not be null.
The final result comes from checking how many of the possible date interpretations are null vs. how many are less than the comparison date; it's important here that the null date is considered less than any other date.

You can save a char by removing the last 0 from "012201210", since # takes its items cyclically. In fact, you can save a second char this way by swapping the last two cases: 3 3#.:'"0122102".

Shaved one more char by reversing args of inner func, saving the parens (but adding a reverse). Can anyone help me save another two chars? APL is beating me!

Shaved another five by rewriting the math at the end. Back in the lead!

And if I stoop to writing seriously non-functional code, I can shave another byte by polluting the global namespace: {c*(+/~d<x)%3-+/^d:{"D"$"."/:$|z,y,x+(c*19+x<50)*x<c::100}.'y@/:3 3#.:'$21020101}.

Ruby, 115 characters
f=->a,t{[a,a.rotate(~s=r=0),a.reverse].map{|x,*y|(t>Time.gm(x<100?x+2e3-100*x/=50:x,*y)||r+=100
s+=1)rescue p}
r/s}

This defines a function f that takes two arguments: an array containing the input, and "today's" date.
Examples:
f[[14,12,14], Time.new]
100
f[[8,2,2006], Time.new]
0
f[[8,2,2006], Time.new(2006, 7, 5)]
50
f[[6,7,5], Time.new(2006, 7, 5)]
33

Python 2.7 - 172
I use the datetime module for validity and comparison of dates. If date can't make a valid datetime out of the input, it raises ValueError. This way s is the sum of the non-expired dates and t is the total number of valid dates. I'm taking advantage of the fact that True == 1 for the purposes of addition and indexing in Python. I also save a character by using 25*(76,80) instead of (1900,2000).
Note the lines in the second level of indentation use a tab character, not 2 spaces.
def f(e,c,s=0,t=3):
 for Y,M,D in(0,1,2),(2,0,1),(2,1,0):
  y=e[Y]
  try:s+=date(y+25*[[76,80][y<50],0][y>99],e[M],e[D])>=c
  except:t-=1
 return 100*s/t

Add this to the end to test:
examples = [[14,12,14],[8,2,2006],[6,7,5],[6,5,7],[12,31,99]]
for e in examples:
 print f(e, date(2006,7,5))

PowerShell, 183 173 168
[int](100*(($d=@(($a,$b,$c=$args[0]),($c,$a,$b),($c,$b,$a)|%{$_[0]+=1900*($_[0]-le99)+100*($_[0]-le49)
.{date($_-join'-')}2>$x}|sort -u))-ge(date)+'-1').Count/$d.Count)

Input as int[] via parameter, e.g.
  PS> ./milk.ps1 5,6,7

Error messages are silenced via try/catch, as long as I don't know whether output on stderr is allowed or not.

Using +"-1" on the date, which gets interpreted as .AddDays(-1) to shift the current date by one day, so that we can compare to yesterday (instead of just today). This solves the problem that we get a date with 0:00 as time but need to compare with a date with time from today.

Heavily inlined by now

Using a new trick for silencing errors that's quite a bit shorter

R, 269
I was expecting this to be easy in R, but the single-digit years were a pretty big curveball. I feel like this could be much better than it is.
lubridate is a package from CRAN, you might need to install it with install.packages("lubridate").
require(lubridate)
f = function(d){
d=sapply(d,function(l)if(nchar(l)==1)sprintf("%02d",l)else l)
d=paste0(d,collapse="-")
t=ymd(Sys.Date())
s=na.omit(c(ymd(d),mdy(d),dmy(d)))
s=lapply(s,function(d){
if(year(d)>2049){year(d)=year(d)-100;d}
else d})
sum(s>t)/length(s)}

Usage: f(c(d1,d2,d3)) where c(d1,d2,d3) is a vector of integers.
e.g.
f(c(6,10,14)) returns 0.3333333.
The lubridate package has a series of wrapper functions for parsing dates in different orders. I use these to see which formats produce valid dates, throw out the invalid ones, and then see which ones haven't occurred yet.

Mathematica, 163 153 164 bytes
(edit: fixed dates outside the 1950 - 2049 range)
f=100.Count[#,x_/;x<1]/Length@#&[DateDifference[#,Date[]]&/@Cases[{If[#<100,Mod[#+50,100]+1950,#],##2}&@@@{{##},{#3,#2,#},{#3,#,#2}}&@@#,d_/;DateList@d~Take~3==d]]&

This defines a function which you can call like
f[{6,7,5}]

Currently, the percentage isn't rounded (waiting for the OP to clarify).
Here is a slightly lengthy explanation that should be understandable without any Mathematica knowledge (note that & makes everything left of it an anonymous function whose parameters are referred to as #, #2, #3...):
{{##},{#3,#2,#},{#3,#,#2}}&

This defines a function, which turns 3 parameters a,b,c into 3 lists {{a,b,c},{c,b,a},{c,a,b}. Note that ## is just a sequence of all parameters.
{{##},{#3,#2,#},{#3,#,#2}}&@@#

Applied to the expiry date, this gives a list of {y,m,d} for each of the three possible permutations.
{If[#<100,Mod[#+50,100]+1950,#],##2}&

This is an anonymous function that takes three parameters a,b,c and returns a list of the three, where the first has been converted to a year as per the given rules: numbers between 50 and 99 (modulo 100) are turned into a 20th century year, numbers between 0 and 49 (modulo 100) are turned into a 21st century year, all others are left along. Here, ##2 is a sequence of parameters starting with the second one, i.e. b,c.
{If[#<100,Mod[#+50,100]+1950,#],##2}&@@@{{##},{#3,#2,#},{#3,#,#2}}&@@#

Applied to each of the three previous results, this just canonicalises the year formats. Let's call this canonicalDates to shorten the following expression:
Cases[canonicalDates,d_/;DateList@d~Take~3==d]

This filters out invalid interpretations. DateList@d makes a full {y,m,d,h,m,s} representation out of various date formats. It will interpret lists in the same order, but the catch is that you can pass it things like {8,2,2006} in which case it will calculate 8 years + 2 months + 2006 days. So we check that the first three elements of the returned list are identical to the input (which can only happen if the month and day in the appropriate ranges).
To shorten the following lines, I'll refer to the result of that expression as validDates from now on:
DateDifference[#,Date[]]&

Another anonymous function which takes a date and returns the difference in days to today (obtained from Date[]).
DateDifference[#,Date[]]&/@validDates

Map that onto the valid date interpretations.
100.Count[#,x_/;x<1]/Length@#&

Yet another anonymous function which, given a list (#), returns the percentage of non-positive numbers in that list. The . is not a multiplication but just the decimal digit, to avoid rational numbers as the result (you'd get things like 100/3 instead of 33.333 - I don't actually know if that's a problem).
100.Count[#,x_/;x<1]/Length@#&[DateDifference[#,Date[]]&/@validDates]

Applied to the list of date differences, this gives us the fraction of interpretations which are not yet expired.

I think you incorrectly convert years like 2999 or 2099 to 1999.

@Ventero that's true. I kinda assumed we were only dealing with years 1950 - 2049 (and their 1 or 2 digit versions), but re-reading the challenge there's no mention of that.

@Ventero fixed (but you had already beaten me significantly anyway ;))

I am surprised to see that you have an account on [Mathematica.SE] but haven't posted any Questions or Answers.  Is something holding you back?

@Mr.Wizard sorry, totally forgot to respond to you. Questions: so far every problem I had could be solved with googling/other SE questions. Answers: I don't know... I guess I don't view myself as that proficient when it comes to using Mathematica productively... I only use it for quick snippets here and there (and code golf). Also, I guess to answer questions I'd have to actively watch new ones to see what I can answer, and currently all my SE time is allocated for PPCG. ;) If you want to me convince me otherwise, feel free to do so in chat! :)

JavaScript (E6) 159 164 172
Edit Thanks to nderscore for the hints and for pushing me to think again. Reorganized D avoiding parameters and cutting some chars.
Edit 2 Another trick by nderscore, 2 functions merged into 1. Then two parenthesis removed merging comma separated expressions into one. Readability near 0. Sidenote: Not rounding could save another 2 chars (|0).
F=(a,t)=>t?100*(3-((i=F([y,m,d]=a))<t)-((j=F([m,d,y]=a))<t)-((k=F([d,m]=a))<t))/(3-!i-!j-!k)|0:(q=new Date(y<50?y+2e3:y,--m,d)).getMonth()==m&q.getDate()==d&&q

Test In FireFox console
;[[14,12,14],[8,2,2006],[6,7,5],[6,5,7],[12,31,99]]
.map(x=>x + ' ' + F(x, new Date(2006,6,5)))

Output:
["14,12,14 100", "8,2,2006 50", "6,7,5 33", "6,5,7 66", "12,31,99 0"]

Ungolfed
NB D function tries to create a Date with given year, month, day but returns false if the created date is not what was intented (!= day or month)
F=(d,t)=>
(
  D=(y,m,d)=>(
    q=new Date(y<50?y+2000:y, --m, d), // decr m as javascript (like java) counts months starting at 0
    q.getMonth() == m & q.getDate() == d && q
  ),
  [a,b,c] = d,
  x=D(...d), // three ways of express the date ...
  y=D(c,a,b),
  z=D(c,b,a),
  100 * (3-(x<t)-(y<t)-(z<t)) / (3-!x-!y-!z) | 0
)

@nderscore OK for changes in D, sintax error for the other. But saved even more anyway

Weird. Something must've happened when I pasted it into the comment. Your latest optimizations make it irrelevant though :)

Putting this in a paste, as I don't trust SE's comments anymore: (-3) http://pastie.org/private/6bemdweyndcaiseay70kia

C# in LINQPad - 446 408 272 Bytes
Third Edit: Thanks to Le Canard fou for pointing out that DateTime.Today is correct, not DateTime.Now.
Second Edit: Thanks VisualMelon for this clever solution!
void g(int[]d){var p=".";int a=d[2],b=d[1],e=d[0],y=a+(a<100?a>49?1900:2000:0),q=0,s=0;DateTime c;Action<string>z=x=>{if(DateTime.TryParse(x,out c)){s++;if(c>=DateTime.Today)q+=100;}};z(e+p+b+p+y);z(b+p+e+p+y);z(a+p+b+p+(e<100?e>49?1900+e:2000+e:e));(q/(s>0?s:1)).Dump();}

Edit: Thanks to podiluska and edc65 for helping me shorting the code! I also noticed that my solution wasn't correct if the year input was 4 bytes long, therefore I included the fix for that problem. The score for this solution is 408 Bytes.
Even though I'm not beating any of the previous answers, I still wanted to share my C# solution. Any help/suggestions are appreciated! ;)
void g(int[]d){var q=new List<DateTime>();var p=".";int s=0,a=d[2],b=d[1],e=d[0],y=0;var c=new DateTime();y=(a<100)?(a>49)?1900+a:2000+a:a;if(DateTime.TryParse(e+p+b+p+y,out c)){q.Add(c);s++;}if(DateTime.TryParse(b+p+e+p+y,out c)){q.Add(c);s++;}y=(e<100)?(e>49)?1900+e:2000+e:e;if(DateTime.TryParse(a+p+b+p+y,out c)){q.Add(c);s++;}q=q.Where(i=>i>=DateTime.Now).ToList();if(s==0){s=1;}(q.Count*100/s).Dump();}

Formatted and ungolfed version:
void g(int[] d)
    {
        var q = new List<DateTime>();
        var p = ".";
        int s = 0, a = d[2],b = d[1],e = d[0], y=0;
        var c = new DateTime();
        y = (a < 100) ?((a > 49) ? 1900 + a : 2000 + a) : a;

        if (DateTime.TryParse(e + p + b + p + y, out c))
        {
            q.Add(c);
            s++;
        }
        if (DateTime.TryParse(b + p + e + p + y, out c))
        {
            q.Add(c);
            s++;
        }
        y = (e < 100) ? ((e > 49) ? 1900 + e : 2000 + e) : e;

        if (DateTime.TryParse(a + p + b + p + y, out c))
        {
            q.Add(c);
            s++;
        }
        q = q.Where(i => i >= DateTime.Now).ToList();
        if (s == 0)
        {
            s = 1;
        }
        (q.Count*100/s).Dump();
    }

I tried to make a solution where the "DateTime.TryParse"-Part isn't repeated as in this solution, but it was 21 bytes longer.
Solution without repeating "DateTime.TryParse" : 467 Bytes
void g(int[]d){var q=new List<DateTime>();int s=0;int a=d[2];int b=d[1];int e=d[0];int y=0;if(a<100){if(a>49){y=1900+a;}else{y=2000+a;}}if(z(e,b,y,q)){s++;}if(z(b,e,y,q)){s++;}if(e<100){if(e>49){y=1900+e;}else{y=2000+e;}}if(z(a,b,y,q)){s++;}q=q.Where(i=>i>=DateTime.Now).ToList();if(s==0){s=1;}(q.Count*100/s).Dump();}bool z(int a,int b,int d,List<DateTime> q){var c=new DateTime();var p=".";if(DateTime.TryParse(a+p+b+p+d,out c)){q.Add(c);return true;}return false;}

Ungolfed version:
private void g(int[] d)
    {
        var q = new List<DateTime>();
        int s = 0;
        int a = d[2];
        int b = d[1];
        int e = d[0];
        int y = 0;
        if (a < 100)
        {
            if (a > 49)
            {
                y = 1900 + a;
            }
            else
            {
                y = 2000 + a;
            }
        }
        if (z(e, b, y, q))
        {
            s++;
        }
        if (z(b, e, y, q))
        {
            s++;
        }
        if (e < 100)
        {
            if (e > 49)
            {
                y = 1900 + e;
            }
            else
            {
                y = 2000 + e;
            }
        }
        if (z(a, b, y, q))
        {
            s++;
        }
        q = q.Where(i => i >= DateTime.Now).ToList();
        if (s == 0)
        {
            s = 1;
        }
        (q.Count*100/s).Dump();
    }

    private bool z(int a, int b, int d, List<DateTime> q)
    {
        var c = new DateTime();
        string p = ".";
        if (DateTime.TryParse(a + p + b + p + d, out c))
        {
            q.Add(c);
            return true;
        }
        return false;
    }

int s=0;int a=d[2];int b=d[1];int e=d[0]; -> int s=0,a=d[2],b=d[1],e=d[0];

suggestion: use ternary (?:) when possible instead of if/else

I think you can get rid of y by reusing a.

Thank you for your suggestions! I've included your suggestions in my updated answer!

@ThomasW. I don't think since y has 2 different values, one time it is depending on a, the other time it is depending on e. Thanks anyway!

Removing the DateTime.TryParse calls was my first instinct, replaced it with a lambda that also put the value back into q. Also performed some other steps (pastebin) to get 328chars: void g(int[]d){var q=new List<DateTime>();var p=".";int a=d[2],b=d[1],e=d[0],y;DateTime c;y=(a<100)?(a>49)?1900+a:2000+a:a;Action<string>z=(x)=>{if(DateTime.TryParse(x,out c))q.Add(c);};z(e+p+b+p+y);z(b+p+e+p+y);y=(e<100)?(e>49)?1900+e:2000+e:e;z(a+p+b+p+y);(q.Where(i=>i>=DateTime.Now).Count()*100/(q.Any()?q.Count:1)).Dump();}

@VisualMelon Wow, you're really good at code-golfing! I never saw Action<string> before, so I could learn something from you ;)
I was able to get your answer down to 318 chars by replacing    q.Where(i=>i>=DateTime.Now).Count with q.Count(i=>i>=DateTime.Now. I also removed the brackets around x so I could save 2 more characters!

Making better use of the lambda (pastebin), got it down to 272chars: void g(int[]d){var p=".";int a=d[2],b=d[1],e=d[0],y=a+(a<100?a>49?1900:2000:0),q=0,s=0;DateTime c;Action<string>z=(x)=>{if(DateTime.TryParse(x,out c)){s++;if(c>=DateTime.Now)q+=100;}};z(e+p+b+p+y);z(b+p+e+p+y);z(a+p+b+p+(e<100?e>49?1900+e:2000+e:e));(q/(s>0?s:1)).Dump();} - @tsavinho ah, didn't notice the (x)! good catch (left it in my code)

@VisualMelon Are you the god of lambda or what? I really need to study it to get better scores at code golf! I included your answer [and obviously removed the (x)]!

@tsavinho Nah, I get easily confused by lambdas, this is just a really simple (and frankly poor) use of them to reduce repetition. I probably should have noticed that the lambda could be used better earlier on, then I wouldn't have had to replace s, and would have probably got to this solution somewhat faster. And evidently I'm not so used to them that I would remember you don't need the brackets around x ;)

Haskell, 171 165 characters
l=length
r y|y<100=(y+50)`mod`100+1950|y>0=y
q d m y z|d<32&&m<13&&d*m>0=(r y,m,d):z|1<3=z
v(a,b,c)=q c b a$q b a c$q a b c[]
t%d=(l$filter(>t)(v d))*100`div`l(v d)

The function's name is %. Run with the test date as an tuple in canonical (y,m,d) order with actual year, and the carton stamp as a tuple of three numbers:
λ: (2006,6,5)%(14,12,14)
100

λ: (2006,6,5)%(8,2,2006)
50

λ: (2006,6,5)%(6,7,5)
33

λ: (2006,6,5)%(6,5,7)
66

λ: (2006,6,5)%(12,31,99)
0

λ: (2006,6,5)%(0,1,7)
0

Erlang, 146
f([A,B,C]=U,N)->F=[T||T<-[{(Y+50)rem 100+1950,M,D}||[Y,M,D]<-[U,[C,A,B],[C,B,A]]],calendar:valid_date(T)],100*length([1||T<-F,T>=N])div length(F).

Test function would be:
t() ->
    0 = f([12,31,99],{2006,6,5}),
    66 = f([6,5,7],{2006,6,5}),
    33 = f([6,7,5],{2006,6,5}),
    100 = f([14,12,14],{2006,6,5}),
    50 = f([8,2,2006],{2006,6,5}),
    100 = f([29,2,2],{2006,6,5}).

Ungolfed
f([A,B,C]=U,Today)->
    Perms = [U,[C,A,B],[C,B,A]],
    WithYears = [{(Y+50) rem 100+1950,M,D} || [Y,M,D] <- Perms],
    ValidDates = [T || T <- WithYears, calendar:valid_date(T)],
    100*length([1 || T <- ValidDates, T >= Today]) div length(ValidDates).

This solution relies on list comprehensions. It borrows the modulo trick for the year from the Haskell solution. It also uses calendar:valid_date/1 to handle impossible dates because of the number of days in a given month (e.g. "29-2-2" can only be in YMD format). Also, Today is in Erlang's date() format (a YMD tuple).

APL (85)
This uses some of Dyalog APL 14's new functions, but no external libraries. For a change, it works on TryAPL.
{100×(+/÷⍴)⍺≤{(3/100)⊥⍵+(99≥⊃⍵)×3↑1900+100×50>⊃⍵}¨Z/⍨{∧/12 31≥1↓⍵}¨Z←(⊂⌽⍵),(⊂2⌽⍵),⊂⍵}

This is a function that takes the 3-element array as its right side (⍵) argument, and the date to check against as its left side (⍺) argument, as an integer of YYYYMMDD format. I.e., the date 2014-07-09 is represented as the number 20140709.
Test:
      20060705 {100×(+/÷⍴)⍺≤{(3/100)⊥⍵+(99≥⊃⍵)×3↑1900+100×50>⊃⍵}¨Z/⍨{∧/12 31≥1↓⍵}¨Z←(⊂⌽⍵),(⊂2⌽⍵),⊂⍵} 14 12 14
100
      20060705 {100×(+/÷⍴)⍺≤{(3/100)⊥⍵+(99≥⊃⍵)×3↑1900+100×50>⊃⍵}¨Z/⍨{∧/12 31≥1↓⍵}¨Z←(⊂⌽⍵),(⊂2⌽⍵),⊂⍵} 8 2 2006
50
      20060705 {100×(+/÷⍴)⍺≤{(3/100)⊥⍵+(99≥⊃⍵)×3↑1900+100×50>⊃⍵}¨Z/⍨{∧/12 31≥1↓⍵}¨Z←(⊂⌽⍵),(⊂2⌽⍵),⊂⍵} 6 7 5
33.3333
      20060705 {100×(+/÷⍴)⍺≤{(3/100)⊥⍵+(99≥⊃⍵)×3↑1900+100×50>⊃⍵}¨Z/⍨{∧/12 31≥1↓⍵}¨Z←(⊂⌽⍵),(⊂2⌽⍵),⊂⍵} 12 31 99
0

Explanation:

Z←(⊂⌽⍵),(⊂2⌽⍵),⊂⍵: turn the given date into Y-M-D format by flipping (⊂⌽⍵), rotating it to the left by 2 (⊂2⌽⍵), or just doing nothing ⊂⍵. At least one of these is now a proper date in Y-M-D format, maybe more than one if the date is ambiguous.
{∧/12 31≥1↓⍵}¨Z: test if each date is valid: the year (first element) is dropped, and then the month must be no higher than 12 and the day must be no higher than 31.
Z/⍨: filter the valid dates from Z.
{...}¨: for each valid date:

⍵+(99≥⊃⍵)×3↑1900+100×50>⊃⍵: if the year is not higher than 99, add 1900, then 100 if the year is lower than 50.
(3/100)⊥: decode it as if it were a set of base-100 numbers. (The year is higher than 100, but this doesn't matter as it's the first element.) This gives a number for each valid date in the same format as the left argument.

⍺≤: for each date, see if it is not smaller than ⍺. This will give a binary vector where 1 means OK and 0 means spoiled.
100×(+/÷⍴): divide the sum of the binary vector by its length and multiply by 100.

Save 7 bytes (and beat K by a nice margin) with stranding and making an inner function tacit: {100×(+/÷⍴)⍺≤((3/100)⊥⊢+(99≥⊃)×3↑1900+100×50>⊃)¨Z/⍨{∧/12 31≥1↓⍵}¨Z←(⌽⍵)(2⌽⍵)⍵}

Java: 349 Characters (3 w/o spaces)
int e(int[]n,Date t){int a=n[0],b=n[1],c=n[2];Date[]d=new Date[3];if(b<13&&c<32)d[0]=new Date((a<50?100:(a>100?-1900:0))+a,b-1,c);if(b<13&&a<32)d[1]=new Date((c<50?100:(c>100?-1900:0))+c,b-1,a);if(a<13&&b<32)d[2]=new Date((c<50?100:(c>100?-1900:0))+c,a-1,b);int v=0,g=0;for(int i=0;i<3;i++)if(d[i]!=null){if(!d[i].before(t))g++;v++;}return 100*g/v;}

Here is a containing class that can be used to test it, including a (slightly) degolfed version of the method:
import java.util.*;
class i{

   int e(int[]n,Date t){
      int a=n[0],b=n[1],c=n[2];
      Date[]d=new Date[3];
      if(b<13&&c<32)d[0]=new Date((a<50?100:(a>100?-1900:0))+a,b-1,c);
      if(b<13&&a<32)d[1]=new Date((c<50?100:(c>100?-1900:0))+c,b-1,a);
      if(a<13&&b<32)d[2]=new Date((c<50?100:(c>100?-1900:0))+c,a-1,b);
      int v=0,g=0;
      for(int i=0;i<3;i++)
         if(d[i]!=null){
            if(!d[i].before(t))
               g++;
            v++;
         }
      return 100*g/v;}

   public static void main(String[] args){
      int[]i=new int[3];
      for(int k=0;k<3;k++)
         i[k] = Integer.parseInt(args[k]);
      int j = new i().e(i,new Date());
      System.out.println(j+"%");
   }
}

This is my first round of code golf, and I think I figured out why I don't usually see very many Java golfers.

You need to accept an int[] as argument, not three ints.

ok, i fixed it.

C# 287 bytes
namespace System{class E{static float a,o,l;void M(int[]i){int d=i[0],m=i[1],y=i[2],t;if(l<3)try{if(l==1){t=y;y=d;d=t;}if(l++==0){t=d;d=m;m=t;}if(y<100&&(y+=1900)<1950)y+=100;o+=new DateTime(y,m,d)>=DateTime.Today?1:0;a++;if(l<3)i[9]=9;}catch{M(i);throw;}Console.Write(o/a);}}}

First time golfing, looking for advices. Notably, removing bytes due to namespace.
Abusing the fact that only a function is required, not an actual program. Also, the function always results in an uncaught exception.
Ungolfed
namespace System {
    class E {
        static float a, o, l;
        void M(int[] i) {
            int d = i[0], m = i[1], y = i[2], t;
            if (l < 3)
                try {
                    if (l == 1) {
                        t = y; y = d; d = t;
                    }
                    if (l++ == 0) {
                        t = d; d = m; m = t;
                    }
                    if (y < 100 && (y += 1900) < 1950)
                        y += 100;
                    o += new DateTime(y, m, d) >= DateTime.Today ? 1 : 0; // # not expired
                    a++; // # valid dates
                    if (l < 3)
                        i[9] = 9; // throw new Exception()
                }
                catch {
                    M(i);
                    throw; // fail after the first Console.Write()
                }
            Console.Write(o / a);
        }
    }
}

Mathematica, 118
Using m.buettner's code as a starting point I have a few improvements:
⌊100Mean@UnitStep@Cases[DateDifference@{If[#<100,Mod[#+50,100]+1950,#],##2}&@@@{#,RotateRight@#,Reverse@#},_Integer]⌋&

The golf may be a function taking a three-Int list as argument.

@algorithmshark Thanks.  I don't know how I missed that.  Updating...

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


text:
Draw with your CPU
I have come across an article where students used network traffic to draw their university on the country's IPv6 graph. [image]
Your goal is simple to tell, but hard to implement. Draw the text MAIL (as it is one of the few words that can be read on a 1D graph) on the CPU graph.
It should look something like this:

Elaborating a bit more on what qualifies:

The code does not need to be cross-platform (so you won't need unknown APIs to deal with).
You may capture it in any general CPU usage utility that you have.
The graph looks a bit worse on a different machine: I trust you this time.
The base CPU usage % must be continuous, so if you generate a random wave and highlight something that looks like the word MAIL, it's obviously cheating.
You may choose the maximum load to use, but it has to be substantial enough to clearly see it.
You must follow the linearity of the example. (For M it looks like this: base %, then sudden increase to the specified max, fall gradually to a lower %, rise back to max and sudden drop to the base % again.)
If it's unreadable, voters will notice after all.

Standard loopholes apply. Post the images too!

Interesting idea, but this question is about drawing pictures more than anything else. Wasting computer cycles isn't really much of a programming challenge, and art competitions don't belong here.

i changed the goal to code-golf so that it can be more challenging and less artistic :)

I don't see a reason for the close vote anymore. I personally find this a fun challenge, albeit a little system specific.

Well at least it's original! I like it, might have a go.

@bebe that's better

The problem I see with code golf is to judge how legible is legible enough. If you can think of a way to specify that objectively, that would greatly improve the challenge, but it's a really nice idea anyway!

@m.buettner i'm really thinking but i can't find a solution to check the entries' legibility. maybe fourier series to check the error rate compared to the example... no. i'm trying though.

@bebe you could specify the shape a bit more precisely. say: the user may choose the maximum load he's going to use, but it has to be substantial enough to clearly see it. then: have a sudden increase to that maximum, fall gradually off to ~half of that, and then rise back to the maximum at the same rate. sudden drop to 0. then rise gradually to the top, fall off with the same rate to 0. sudden rise to the top, sudden drop to 0. sudden rise to the top, sudden drop to ~one third, sudden drop to 0.

it's really just the same as your picture, but I guarantee you if you don't put it in words, people will interpret "draw MAIL" very liberally.

+1, it is so absurd I almost chuckled myself to death... "this is madness..." "madness.. THIS IS CODEGOLF!!!"

I wonder if a solution could be made to both look and sound good. Close to the end of the last millennium, I wrote a DOS program, that would play a sound with alternating pitch on my sound card without ever sending a byte to the sound card. Instead I just exploited that the sound card was overly sensitive to variations in the current drawn by the CPU.

Python, 143
from time import*
while 1:
 sleep((ord('00012345654321000~~~D:6300036:D~~~000~~~000DDDD~~~~~'[int(time())%52])-48)*0.001);x=10**5
 while x:x-=1

Each character of the string corresponds to one second of activity, from the ASCII character 0 (max load) through to ~ (very light load). The program runs on a time-synchronised loop, so you can run multiple instances for nicer results.
I used Python 2.7.6 on OS X with an Intel Core i7, but it should work on other computers with a bit of tweaking (adjust the 0.001). The screenshot below was taken with significant background activity.

Update - I was able to produce a clearer graph with time()/10 and a lower update frequency:

And finally, here's a more golfed version (123 bytes) and its result:
from time import*
while 1:
 sleep((ord('002464200~~A5005A~~00~~00DDD~~'[int(time()/2)%30])-48)*0.001);x=10**5
 while x:x-=1

Python, 358 281 268 221 194 bytes
Monochrome is so last year. This uses multiple processes and syscalls to achieve two color CPU graphs!
import os,time
A='%-99o'%int('t12q2lxqkap48euoej9429cstbnazl63ubyryteo49u',36)
for i in'0123456':
 t=os.fork()
 while t<1:T=int(time.time())%50;(time.sleep,(id,os.urandom)[i<A[T+49]])[i<A[T]](1)

Output from Activity Monitor (OS X 10.9):

Output from MenuMeters:

All outputs were generated with an update speed of 1s. No significant background tasks were running, though this output quite easily beats out any single-threaded CPU task.
This code assumes you have 8 cores. It should be pretty easy to modify for fewer/more. It is portable to Linux/UNIX systems (though it has only been tested on OS X), and should produce the same two-color output for any CPU monitor that can distinguish User from System CPU time.
Essentially, this works by forking off seven processes, each of which will choose to spend 1 second sleeping, spinning in usermode, or spinning the kernel. Spinning in kernel mode is achieved by requesting large globs of data from /dev/urandom, which forces the driver backing /dev/urandom to spend a lot of "system" CPU cycles.
EDITED [07/21]: Shortened significantly by using fork() instead of multiprocessing.Process (/dev/urandom only works on *NIX systems anyway so this doesn't reduce portability). Note however that the program now spawns background tasks; you may have to killall Python (or similar) to get rid of the CPU-eaters.

I couldn't resist implementing a few more letters. I got 16 letters, plus a few symbols:

The complete alphabet is "ACDFHILMNOPTUVWY", with symbols "._~/\". There are probably lots more characters that can be represented.
Entirely ungolfed code for the extra letters:
from time import*
from multiprocessing import*

chars6 = {
'A': ('123456654321',
      '000123321000'),
'C': ('344556666666',
      '321110000000'),
'D': ('666666655443',
      '000000011123'),
'F': ('66666666666666',
      '00002222244444'),
'H': ('666664444466666',
      '000002222200000'),
'I': ('66666',
      '00000'),
'L': ('666662222222',
      '000000000000'),
'M': ('6665544334455666',
      '0004321001234000'),
'N': ('66665544336666',
      '00003322110000'),
'O': ('3445556666555443',
      '3221110000111223'),
'P': ('666666666555',
      '000003333444'),
'T': ('777776666677777',
      '444440000044444'),
'U': ('6666322236666',
      '4211000001124'),
'V': ('66654322345666',
      '33321000012333'),
'W': ('66542466424566',
      '43210133101234'),
'Y': ('66665433456666',
      '44333000033344'),
'_': ('1111111111',
      '0000000000'),
' ': ('000',
      '000'),
'.': ('12221',
      '10001'),
'~': ('44445544334444',
      '11223322112233'),
'/': ('2234566',
      '0012344'),
'\\': ('6654322',
       '4432100'),
}

s = 'ANCHOVY '
A = '000'.join(chars6[t][0] for t in s)
B = '000'.join(chars6[t][1] for t in s)

t=time()
f=open('/dev/urandom')
def F(n):
 while 1:T=int(time()-t)%len(A);[sleep,[].count,lambda x:f.read(4**9)][(n<int(A[T]))+(n<int(B[T]))](1)
for i in range(7):Process(target=F,args=(i,)).start()
F(7)

+1 for giving the letters more definition using 2 colors

And +1 for table-driven letter creation

The A could in fact be properly rendered (with a hole) with 4 threads. Would have to set some CPU monitor colors to coincide though.

@Ruslan: What CPU monitor are you thinking of? My monitor shows only one aggregate graph, with 0 <= system <= user <= 100 at each point (which makes "holes" impossible AFAIK).

@nneonneo I mean monitors similar to yours. See this picture. Here if we change blue to green and red and purple to white, we'll get a nice "A" with holes.

@Ruslan: I don't have four colors on my CPU monitor, unfortunately. I would love to find one that does, for even more pixel art madness, though!

@nneonneo you'd need 4 CPU cores or 2 cores*2 hyperthreads. I think you could try using a VM emulating 4 logical CPUs.

C (Intel Core Duo + OS X/Darwin), 248 bytes
#include <unistd.h>
#include <mach/mach_time.h>
#define M mach_absolute_time()
main(){char*s="JJJIHGFGHIJJJ@BDFHJJJHFDB@JJJJ@JJJJBBBBBBB";uint64_t i,t,y=1;for(;*s;s++){
for(i=40;i;i--){for(t=M+(*s&15)*9090909;t>M;)y*=7;usleep((11-(*s&15))*9091);}}}

This code is about as portable as the Great Pyramid of Cheops. Sorry about that. The values returned from mach_absolute_time() are hardware-dependent, but on my machine the value increments about once per nanosecond.
Here's the result:

There are two graphs because the processor has two cores. I set the maximum CPU load to about 90% because the process is liable to switch between cores whenever I call usleep(). With a 100% load, the process is chained to one core and the results are illegible (see this, for example)

Good job! This looks very interesting. Could you please post a little explanation of the code? :)

i see braces. why are there braces in the for loops? you can put usleep into the second for loop's last block. i think you can golf down a little more easily.

Couldn't you put the declaration and initialisation of the uint64_t variables into the header of the following for loop?

+1: "This code is about as portable as the Great Pyramid of Cheops"

@Јοеу no, C variables must be declared at the beginning of a block. putting it in the initializtion block of for will throw an error. of course it only applies to <C99

@bebe: Hm, I thought since the for loop extends until the end of the program it would be okay, as it's still in the same scope. Cannot test, though.

Congrats on your 1st gold badge. =)

Can't you use #include<unistd.h>?

Ruby, 150 characters
a=(0..15).map{|i|[0.9-3*i*=0.02,i]}
[9,*a[0,11],*(z=a.reverse)[5,11],11,*z,*a,2,11,6,*[0.2]*9].map{|x,y|c=Time.now
1until Time.now-c>x/3
sleep y||x%3}

This isn't all that short so far, but in my opinion the output's rather nice, so I figured I'd post this anyway. As with most other solutions, you may have to pin the Ruby process to a certain core by prefixing it with taskset -c $core.
The code is a simple combination of spinning/sleeping for a certain amount of time, which should make it somewhat portable. Smooth gradients are created by varying the ratio of spin/sleep time.

Lowering the CPU sampling frequency makes the edges look a bit better:

By adding a few more letters to the alphabet (AILMNUVW are somewhat recognizable), we can also write some other words:

These pictures were generated with the following code:
def gradient num_samples, direction, base = 0.3, increment = 0.02, scale = 1
    range = [*0..num_samples]

    samples = case direction
        when :up then range.reverse
        when :down then range
        when :updown then range.reverse + range
        when :downup then range + range.reverse
    end

    samples.map{|i|
        i *= increment
        [base - scale * i, i]
    }
end

# letters are defined as a series of pairs of (spin-time, sleep-time)
# with the time in seconds
THIN_A = gradient(15, :updown, 0.2, 0.2/15)
A = gradient(15, :updown)
I = 2,0
L = 1.5,0, [[0.1,0.2]]*9
M = 2,0, gradient(9, :downup), 2,0
N = 1,0, gradient(9, :down), 2,0
U = 1,0, gradient(9, :downup, 0.1, 0.03, 0.1), 1,0
V = 0.5,0, gradient(12, :downup, 0.25, 0.02), 0.5,0
W = 0.5,0, [gradient(12, :downup, 0.25, 0.02)]*2, 0.5,0

[A,I,L,M,N,U,V,W].map{|i|
    # add 2 second pause after each letter
    i + [0,2]
}.flatten.each_slice(2){|x,y|
    # spin, then sleep
    c = Time.now
    1 until Time.now-c > x
    sleep y
}

Words that can be written with the implemented letters can be found with
grep -E '^[aijlmnuvw]+$' /usr/share/dict/words

+1 for the extension into more words!

You could have made the word "aluminium".

@OliverDaugherty-Long aluminum*

@TùxCräftîñg Aluminium is a variant spelling that has an extra letter, and is the longest word I can think of that works.

Python, on Intel Pentium 4 3.0Ghz, 180 166 145 141 138 bytes
Call with taskset -c 0 python cpu_graph_drawer.py.
taskset is needed to restrict the process to use only one CPU/core (hyperthreading in my case.)
from time import*;c=clock
a=[(3,.8),(3,5),(4,5),(1.3,5),(1.3,0)]
a.extend([(.1,.2)]*10)
for x,y in a:
    t=c()
    while c()-t<x:pass
    sleep(y)

Result isn't that great.

I'd love to see this with a CPU monitor that doesn't smoothen the curves...

Me too, but I don't feel like writing up a conky cpu-usage graph and gnome-system-monitor is the only thing I know. Got any alternatives that would run on LMDE Cinnamon?

Enable the "Draw CPU as stacked area chart", and set all colors to black.

@TejasKale The lines would still be curved.

FYI: you can golf a bunch of chars out by using a=[...]+[(.1,.2)]*10 instead of .extend.

Java 8, 482 characters
Every character in the String means number of threads, that will be utilized. Image taken on Intel Core i3 (2 cores / 4 threads).

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class Mail{
public static void main(String[] args) throws InterruptedException{
Thread.sleep(15000);
for(char c:"123432234321000012343210000444000044441111111".toCharArray()){
ExecutorService executorService = Executors.newScheduledThreadPool(4);
for(int i=1;i<c-48;i++)executorService.execute(()->{while(!Thread.interrupted());});
Thread.sleep(1500);
executorService.shutdownNow();
}}}

Edit: more golfed version (322 chars), same functionality:
import java.util.concurrent.*;
class M{
public static void main(String[]a)throws Exception{
for(int c:"123432234321000012343210000444000044441111111".toCharArray()){
ExecutorService s=Executors.newFixedThreadPool(4);
while(c>48){c--;s.execute(()->{while(!Thread.interrupted());});}
Thread.sleep(1500);
s.shutdownNow();
}}}

There's a less than sign there that got interpreted as HTML and messed up the formatting.

@ValekHalfHeart next two lines should explain it. Executor is a thread(asynchronous task manager) executing task(s) (here loops) until interruption. After creating it, main thread waits for 1.5s and then interrupts all tasks.

By just opening Eclipse, my CPU graph wrote "Simple Mail Transfer Protocol".

C, 78 bytes
You never said we couldn't accept user input, sooo..
#include <unistd.h>
int main(){int x=0;for(;x<1<<26;++x);read(0,&x,1);main();}

This program reads from standard in and every time it reads a character it executes a gratuitous CPU wasting for loop, then calls main again.  You control the amount of CPU time it uses by spamming the enter key at different speeds.
I ran this on an intel i3 4130T, which is a reasonably new processor.  But your mileage may vary, if it's using more or less CPU time than is practical for you to observe, try playing with the shift amount in the delay loop.
My program is awesome because it:

is mostly cross platform, it should work with very little fiddling on any *nix
defeats the question
great endgame play

After a few tries I produced a graph that looked like this:

It helps to restrict it to one CPU core with taskset, a.la. taskset -c 1 [file]

Running it with yes|test gives me constant 100% CPU usage, so the code doesn't work.

I don't see anything in the problem requirements that says our submissions will be invoked as yes | [program]

And I don't see how else I could make it work. It wants input, I give it with yes, but don't get the expected result. I even tried then as you say, "spamming enter key", which is almost the same, but results still are the same.

I'll give you a hint. the CPU usage is proportional to the rate at which you send it lines.

Ah... so you have to drive it manually. Okaaay...

Standard loophole...also falls under http://meta.codegolf.stackexchange.com/a/1085/6699.

"great endgame play" made me lol hard. +1

This answer is too good though, loopholes be damned xD!


text:
mathpack numeric literals
preface
In a very heated situation you have to go even further with golfing.
(e.g. in a challenge where your answer is 100 characters long and it is just embarrassing that you couldn't make it 99)
In that case, from now on you use the winner's algorithm of this challenge :)
goal
You have to write a program that takes an uint32 and returns the most compressed form.
$ mathpack 147456
9<<14

There will be multiple solutions for a number. Pick the shortest one
If the compressed form is longer or equal to the original number, return the original number

rules

write in any language - output in any language
i'm aware of that in C 'abc' is 6382179 and you can achieve pretty good results with this conversion. but languages are separated in this challenge so don't lose heart
it is prohibited to use external variables. only operators and literals and math related functions!

scoring
here are the test cases: pastebin.com/0bYPzUhX
your score (percent) will be the ratio of byte_size_of_your_output / byte_size_of_the_list without line breaks.
(you have to do this by yourself as i'll just verify the best codes just in case)
winners will be chosen by score and language of output!
examples:
$ mathpack 147456 | mathpack 97787584 |  mathpack 387420489
            9<<14 |           9e7^9e6 |            pow(9,9)

Lovely challenge, but you should add in a rule against hard coding.

y-you mean hardcoding 10k cases? although i would be glad to get some support on how to refine this challenge

edited (again and again...) for clarity. thanks for the advices.

Wouldn't this also be [rosetta-stone]? Also: write in any language - output in any language - the two languages can be different, right?

@ɐɔıʇǝɥʇuʎs [rosetta-stone] is actually about you solving it in as many languages as possible. And yes to your latter question - that has been edited in response to me asking that same question.

@bebe The last number in your test set doesn't fit in a uint32. Also I'm slightly disappointed that there is no number that has a few leading 1s in binary representation (that is, something close to 2³²). It seems apart from that last number you picked the numbers randomly in a range up to 2 billion, instead of the available ~4.3 billion.

i wanted to generate the list as long as possible as quick as possible so that seems to be the problem. Apparently no one posted an answer yet so i try to replace it with something more appropriate.

Some numbers also have leading 0s. Is that intentional?

i made a new list. it's smaller and has bigger potential for optimizations.

The [by-language] is for the output or the input?

for the output because the output matters not the implementation

Code: Mathematica, Output: C, ~62.1518% (12674/20392)
I thought I'd also give C a try because of those funny character literals. Currently this is the only thing this answer is trying, and it's working quite well.
mathpack[n_] := Module[{versions, charLiteral},
   charLiteral = "'" <> StringReplace[Map[
        Switch[#,
          (*d_ /; d < 32,
          "\\" <> IntegerString[#, 8],*)
          10,
          "\\n",
          13,
          "\\r"
          39,
          "\\'",
          92 ,
          "\\\\",
          _,
          FromCharacterCode@#] &,
        FromDigits[#,
           2] & /@ (Partition[PadLeft[IntegerDigits[n, 2], 32],
            8] //. {{0 ..} .., x__} :> {x})
        ] <> "",
      {(*"\\10" -> "\\b",
       "\\11" -> "\\t",
       "\\13" -> "\\v",
       "\\14" -> "\\f",*)
       RegularExpression["(?!<=\?)\?\?(?=[=/()!<>-]|$)"] -> "?\\?"
       }
      ] <> "'";
   versions = {ToString@n, charLiteral};
   SortBy[versions, StringLength][[1]]
 ];

I hope I didn't miss anything, but this answer makes sure to escape backslashes, single quotation marks as well as trigraphs. There is some commented out code that uses octal or other escape sequences for non-printable characters, but I don't think that's actually necessary, because C should be able to deal with any bytes in character literals, afaik (please correct me if I'm wrong).
As with the other submission, test this with
input = StringSplit[Import["path/to/benchmark.txt"]];
numbers = ToExpression /@ input;
output = mathpack /@ numbers;
N[StringLength[output <> ""]/StringLength[input <> ""]]

(On my system at least) GCC will accept any byte in single quotes except 10 (\n) and 13 (\r). A zero byte will compile OK, but with the error message warning: null character(s) preserved in literal.

@squeamishossifrage Thanks, fixed!

Code: Mathematica, Output: Julia, ~98.9457% (20177/20392 bytes)
optimise[n_] :=
  Module[{bits, trimmedBits, shift, unshifted, nString, versions,
    inverted, factorised, digits, trimmedDigits, exponent, base,
    xored, ored, anded},
   nString = ToString@n;
   versions = {nString};

   (* Try bitshifting *)
   bits = IntegerDigits[n, 2];
   trimmedBits = bits /. {x___, 1, 0 ..} :> {x, 1};
   shift = ToString[Length[bits] - Length[trimmedBits]];
   unshifted = ToString@FromDigits[trimmedBits, 2];
   AppendTo[versions, unshifted <> "<<" <> shift];

   (* Try inverting *)
   inverted = ToString@FromDigits[1 - PadLeft[bits, 32], 2];
   AppendTo[versions, "~" <> inverted];

   (* Try invert/shift/invert *)
   trimmedBits = bits /. {x___, 0, 1 ..} :> {x, 1};
   shift = ToString[Length[bits] - Length[trimmedBits]];
   unshifted = ToString@FromDigits[trimmedBits, 2];
   AppendTo[versions, "~(~" <> unshifted <> "<<" <> shift <> ")"];

   (* Try factoring *)
   factorised = Riffle[
      FactorInteger[n]
        /. {a_, 1} :> ToString@a
       /. {a_Integer, b_Integer} :> ToString[a] <> "^" <> ToString[b]
      , "+"] <> "";
   AppendTo[versions, factorised];

   (* Try scientific notation *)
   digits = IntegerDigits[n, 10];
   trimmedDigits = digits /. {x___, d_ /; d > 0, 0 ..} :> {x, d};
   exponent = ToString[Length[digits] - Length[trimmedDigits]];
   base = ToString@FromDigits[trimmedDigits, 10];
   AppendTo[versions, base <> "e" <> exponent];

   (* Don't try hexadecimal notation. It's never shorter for 32-bit uints. *)
   (* Don't try base-36 or base-62, because parsing those requires 12 characters for
      parseint("...") *)

   SortBy[versions, StringLength][[1]]
  ];

mathpack[n_] :=
 Module[{versions, increments},
  increments = Range@9;
  versions = Join[
    optimise[#2] <> "+" <> ToString@# & @@@ ({#, n - #} &) /@
      Reverse@increments,
    {optimise@n},
    optimise[#2] <> "-" <> ToString@# & @@@ ({#, n + #} &) /@
      increments,
    optimise[#2] <> "*" <> ToString@# & @@@
      Cases[({#, n / #} &) /@ increments, {_, _Integer}],
    optimise[#2] <> "/" <> ToString@# & @@@ ({#, n * #} &) /@
      increments
    ];
  SortBy[versions, StringLength][[1]]
 ];

The function takes a number and returns the shortest string it finds. Currently it applies four simple optimisations (I might add more tomorrow).
You can apply it to the entire file (to measure its score) as follows:
input = StringSplit[Import["path/to/benchmark.txt"]];
numbers = ToExpression /@ input;
output = mathpack /@ numbers;
N[StringLength[output <> ""]/StringLength[input <> ""]]

Note that some of these optimisations assume that you're on a 64-bit Julia, such that integer literals give you an int64 by default. Otherwise, you'll be overflowing anyway for integers greater than 231. Using that assumption we can apply a few optimisations whose intermediate steps are actually even larger than 232.
EDIT: I added the optimisation suggested in the OP's examples to bitwise xor two large numbers in scientific notation (actually, for all of xor, or and and). Note that extending the xormap, ormap and andmap to include operands beyond 232 might help finding additional optimisations, but it doesn't work for the given test cases and only increases run time by something like a factor of 10.
EDIT: I shaved off another 16 bytes, by checking all n-9, n-8, ..., n+8, n+9 for whether any of those can be shortened, in which case I represented the number based on that, adding or subtracting the difference. There are a few cases, where one of those 18 numbers can be represented with 3 or more characters less than n itself, in which case I can make some extra savings. It takes about 30 seconds now to run it on all test cases, but of course, if someone actually "used" this function, he'd only run it on a single number, so it's still well under a second.
EDIT: Another incredible 4 bytes by doing the same for multiplication and division. 50 seconds now (the divided ones don't take as long, because I'm only checking these if the number is actually divisible by the factor of interest).
EDIT: Another optimisation that doesn't actually help with the given test set. This one could save a byte for things like 230 or 231. If we had uint64s instead, there'd be a lot of numbers where this could be a huge saving (basically, whenever the bit representation ends in a lot of 1s).
EDIT: Removed the xor, or, and optimisations altogether. I just noticed they don't even work in Julia, because (quite obviously) scientific notation gives you a float where bit-wise operators are not even defined. Interestingly, one or more of the newer optimisations seem to catch all of the cases that were shortened by these optimisations, because the score didn't change at all.

J to C (untested, but works in most cases, kind of a baseline answer.)
    f=:(,~ (($&0) @: (8&-) @: (8&|) @: #)) @: #:
    g=:($~ ((,&8) @: (%&8) @: #))@:f
    toCString=:({&a.)@:#.@:g
    toCString 6382179
abc

Outputs an string literal that, if entered in C, represents the number (as mentioned in the OP). This is not a serious submission, but rather something to strengthen my J skills, that I thought I'd share.
Alternative one-liner:
toCString=:({&a.) @: #. @: ($~ ((,&8) @: (%&8) @: #))@: (,~ (($&0) @: (8&-) @: (8&|) @: #)) @: #:

What J tries to make of this when you input it:
{&a.@:#.@:($~ ,&8@:(%&8)@:#)@:(,~ $&0@:(8&-)@:(8&|)@:#)@:#:

Thanks a bunch, J. Also, for those in 'the know' about J, visio rocks for creating more complex functions:

Since I can't read any of it: what does this do if the character is non-printable, or if the character is \ , ? or '?

@m.buettner Nothing (yet), I still have to build something for that

Instead of m&u@:v, use m u v to save precious characters and to enhance readability. Applying this to your code, we get f =: [: (,~ 0 $~ 8 - 8 | #) #: and g =: [: ($~ 8 ,~ # % 8:) f and lastly toCString =: a. {~ [: #. g. All combined we get a. {~ [: #. [: ($~ 8 ,~ # % 8:) [: (,~ 0 $~ 8 - 8 | #) #:, which is really easy to read.


text:
Fake infinite loop
The challenge is to write a fake infinite loop in any imperative programming language.
At first sight, the code should seem not to halt at all.
As a naive example:
int f(int x)
{
    return f(4.0);
}

int f(double x)
{
    return 0;
}

But remember
You're not allowed to use overflows:
int f(int x)
{
    if(x < 0) return -1;
    return f(x*x);
}

is illegal. When the number exceeds the integer limit, the function will stop. It's a good trick. But not good enough :)
The answer with the highest votes wins! Duration is 1 week.

@m.buettner You're right. I changed it to popularity contest. Anything else is good enough. Overflows is the first thing that pops into one's mind (as well as mine).

I'd suggest maybe broadening the anti-overflow rule to just say you can't break out of the loop using an error/exception.

Nevertheless, I don't think this adds a lot over this challenge because I think in most cases you will be able to find some kind of termination condition that you just need to invert to fulfil the condition for this challenge. I'd vote to close as duplicate (instead of my now wrong close reason "unclear"), but I can't close vote again if I retract, so I guess the wrong reason stays for now.

It's unclear too. Neither of the two examples looks remotely like an infinite loop.

For the record, I voted to close as duplicate rather than as unclear, so I don't see any point in trying to improve the clarity, but since I see that someone has voted to reopen: the second example is still unclear IMO. What if I call f(0)? (And the first example still wouldn't fool anyone with an IQ above 90 and at least two hours of programming experience).

Bash
trap 'exec "$0"' exit

It re-execs itself when it should exit. So it will never really exit.

 It doesn't have the shebang. So you must run it like bash a.sh. And $0 will probably not be something executable.


text:
Output a non-Context-Free Language
Your challenge is to write a program which will output a non-context-free language.
A Context-free Grammar is a series of replacement rules, describing which symbols can be replaced by which other symbols. It defines set of strings, known as a language, which is generated by performing all possible replacement rules on an initial symbol until no more replacements can be made.
Any language which can be generated this way is known as a context-free language.
Your challenge is to write a program which will output a language which cannot be generated this way.
Details:

Output your language in increasing order of length. Ordering between strings of a given length is up to you.
As all CSLs are infinite, your program must not halt.
The strings must be separated from each other. However, you may choose the separation.
Please include in your answer a description of the language you generate and an explanation of why it is not context-free.
One possible way to prove this is by using the pumping lemma.
Example context-sensitive language: [abc, aabbcc, aaabbbccc, aaaabbbbcccc, ...]

Scoring: For all programs which can be encoded in ASCII or another 7 bit or less character set, scoring is by character. For all other programs, scoring is (# of bits in binary encoding)/7.
Feel free to ask questions.

Using your last example, what's to stop us from using something like the following (pseudocode based on various languages mashed together): i = 1; while true { print ("a" * i) + ("b" * i) + ("c" * i) }

I thought a context-sensitive language was one that could be produced be a context-sensitive grammar? Are you looking for one of these, or just something not context free?

Is this really to write a program that generates all strings in the language produced by a single context-sensitive lanaguge of the programmers choosing? That seems a poor challenge, as there are many trivial choices.

I apologize for the confusion, I meant non-context-free. I will change the description.

Pyth, 6
I didn't find the Pyth documentation. But it works.
W1~ddd

Sorry about the lack of documentation - it's in progress.

Also, while I've seen programs whose code was all whitespace, that's the first one I've ever seen whose output was all whitespace. Good job!

Python 2 (24) (26)
s="1"
while 1:print s;s+=s

Prints the language of strings in the symbol 1 whose length is a power of 2, i.e {"1"*(2**n) | n>=0}. The s+=s is equivalent to s*=2; it doubles the string each time.
Since unary (one-symbol) CFG's are regular, and unary regular CFG's are periodic past a point, this cannot be regular and thus is not a CFG. Alternatively, use the pumping lemma to see that the possible lengths of words in a CFL must have finite density and can't have arbitrarily large gaps.
Unfortunately, Python doesn't have a short way to produce an infinite counter. I'm sure some language can do for i in Naturals:print("1"*i*i) shorter (squares suffice just as well).
Edit: Can shorten to
s=2
while 1:print s;s*=s

which prints numbers of the form 2**(2**n), which can be taken as strings over 0123456789. Because the decimal length doubles at each step, this can't be context-free because the length gaps cannot satisfy the pumping lemma.

CJam, 8 7
{]`_p}h

It is not context-free because there are only at most 4 strings between length n and 7n for any n.
It is context-sensitive because the memory usage is always growing, and it prints almost everything in the memory.

Sorry for the mixup, the problem should have said non-context-free.


text:
One Bad Ternary Operator Deserves Another
Today's Daily WTF quotes the following line of code...
FailSafe==0?'No technical alarms':((FailSafe&1)!=0&&(FailSafe&2)!=0&&(FailSafe&4)!=0&&(FailSafe&8)!=0?'Detection zones staying in a given state; Bad visibility;
Initialization; Bad configuration':((FailSafe&1)!=0&&(FailSafe&2)!=0&&(FailSafe&4)!=0?'Detection zones staying in a given state; Bad visibility; Initialization':
((FailSafe&1)!=0&&(FailSafe&2)!=0&&(FailSafe&8)!=0?'Detection zones staying in a given state; Bad visibility; Bad configuration':((FailSafe&1)!=0&&(FailSafe&4)!=0&&
(FailSafe&8)!=0?'Detection zones staying in a given state; Initialization; Bad configuration':((FailSafe&2)!=0&&(FailSafe&4)!=0&&(FailSafe&8)!=0?'Bad visibility;
Initialization; Bad configuration':((FailSafe&1)!=0&&(FailSafe&2)!=0?'Detection zones staying in a given state; Bad visibility':((FailSafe&1)!=0&&(FailSafe&4)!=0?'Detection
zones staying in a given state; Initialization':((FailSafe&1)!=0&&(FailSafe&8)!=0?'Detection zones staying in a given state; Bad configuration':((FailSafe&2)!=0&&
(FailSafe&4)!=0?'Bad visibility; Initialization':((FailSafe&2)!=0&&(FailSafe&8)!=0?'Bad visibility; Bad configuration':((FailSafe&4)!=0&&(FailSafe&8)!=0?'Initialization; Bad
configuration':((FailSafe&1)!=0?'Detection zones staying in a given state':((FailSafe&2)!=0?'Bad visibility':((FailSafe&4)!=0?'Initialization':((FailSafe&8)!=0?'Bad
configuration':'Unknown')))))))))))))))

Write some code that takes an integer value named FailSafe and returns the same string that the above code would produce from the same integer value.

The challenge is to rewrite that line, so "boilerplate" code is free, including any code that loads an integer value and outputs the string. Only the code that performs the above transformation from an integer to a string counts.
You may use a different name to "FailSafe" if you wish, as long as your chosen identifier has the same golf score.
No calling external resources to perform the lookup.
Normal code-golf rules apply.

Are we allowed to store FailSafe in another variable (for example, f=FailSafe or something like that)?

@ProgramFOX That's fine, but that assignment is included in the count. Only the boilerplate that leads you the point where there's a variable named FailSafe is free.

Could you please pretty-print the code for us? Or is the challenge to understand the challenge?

@JanDvorak I'm not sure I can...

I hope this: http://pastebin.com/jzXt4fsp is nicer to read

@numlock please notify me when you undelete your answer for realz

it's not just FailSafe. Ruby treats all Uppercase identifiers as constants

@JanDvorak I've modified the rule to allow any name for any reason, just as long as the golf score is the same.

I think that the 'Unknown' result is a bug / questionable design, and probably a "can never happen" condition in the original code.  But it is part of the original functionality.  So it's fair to say that it must be preserved in this golf game, as the game requires us to strictly preserve the existing functionality.

Ruby, 210 characters
Similar to @Jan Dvorak's solution but a bit more functional and a bit shorter.
f=FailSafe
e=[f&1,f&2,f&4,f&8,1-f].zip(["Detection zones staying in a given state","Bad visibility","Initialization","Bad configuration","No technical alarms"]).map{|a,b|a>0&&b}-[!0]
e[0]||="Unknown"
e.join"; "

GolfScript, 167 characters
FailSafe.15&["Unknown"][""]"Bad configuration
Initialization
Bad visibility
Detection zones staying in a given state"
n/{`{n+1$+}+%}/1>+=n%"; "*"No technical alarms"if

The code assumes the value in variable FailSafe and pushes the result on the stack (i.e. output the string if run as standalone program). You can test the code online.
The code basically generates an array of all 16 possible outcomes, selects the error message depending on the four lowest bits of FailSafe. The outermost if then handles the zero case.

I think or instead of if would save you the .. But I admit that I haven't tried to decipher the original code.

Rebol/Red: 208 chars
I'm not as interested in golfing this as in agreeing that nested ternary operators are annoying...and mentioning this is actually a nice instance for Rebol/Red's CASE.  It's related to SWITCH and really helps flatten things like this out:
f: FailSafe
append case [
    0 < f and 1 ["Detection zones staying in a given state"]
    1 < f and 2 ["Bad visibility"]
    3 < f and 4 ["Initialization"]
    7 < f and 8 ["Bad configuration"]
    f > 0 ["Unknown"]
    true ["No technical alarms"]
] "; "

There's a variant called CASE/ALL that will actually run all the conditions, but the default just stops after the first true one.
I'll "golf" it a little to 208:

x: func[y][y < (f: FailSafe) and ++ y]append case[x 0["Detection zones staying in a given state"]x 1["Bad visibility"]x 3["Initialization"]y 7["Bad configuration"]f > 0["Unknown"]1["No technical alarms"]]"; "

APL (172)
2↓⊃,/'; '∘,¨{⍵=0:⊂'No technical alarms'⋄0=16|⍵:⊂'Unknown'⋄'Detection zones staying in a given state' 'Bad visibility' 'Initialization' 'Bad configuration'/⍨⌽⍵⊤⍨4/2}FailSafe

Explanation:

{...}FailSafe: generate the strings

⍵=0:⊂'No technical alarms': the 0 case
0=16|⍵:⊂'Unknown': the Unknown case (FailSafe is not 0 but the first four bits are)
'Detection zones staying in a given state' 'Bad visibility' 'Initialization' 'Bad configuration'/⍨⌽⍵⊤⍨4/2: get the lowest 4 bits in the argument (⍵⊤⍨4/2), reverse (⌽), and select the strings for the bits that are on (/⍨).

'; '∘,¨: add '; ' to the front of each returned string,
⊃,/: join all the strings together,
2↓: and remove the first two characters (because there's an extra '; ' at the front.)

Save two bytes by changing ⊃,/ to ∊.

Ruby, 183 characters
[(f=FailSafe)<1?"No technical alarms":f&15<1?:Unknown:["Detection zones staying in a given state"*f[0],"Bad visibility"*f[1],"Initialization"*f[2],"Bad configuration"*f[3]]-[""]]*"; "

Yet another Ruby solution, but a bit shorter than the others. This is a single expression that uses the constant FailSafe (in Ruby, all uppercase identifiers are constants) to create the output string.

in ruby you should declare constant (like FailSafe) before using. And you code raise uninitialized constant FailSafe

@Зелёный As the question states: "Write some code that takes an integer value named FailSafe" - so my code (like all other answers here) assumes FailSafe is already defined. When you want to run the code, you'll have to define the constant yourself first.

Ruby, 213 characters
f=failSafe
e=f&1>0?["Detection zones staying in a given state"]:[]
e+=["Bad visibility"]if f&2>1
e+=["Initialization"]if f&4>3
e+=["Bad configuration"]if f&8>7
e[0]||=f>0?"Unknown":"No technical alarms"
e.join"; "

This will work just fine wrapped in a function body (def transform failSafe; ...; end). It can also be used as a single expression (wrap in parentheses because a semicolon/newline has the lowest priority) or as a sequence of statements with the last expression (e.join"; ") used within an expression.

I'll add a rule to allow a different name.

e+=["Initialization"]if f&4>3 I want this in Python.

@ɐɔıʇǝɥʇuʎs are you not impressed by []||=?

Not sure what it does... Also: since FailSafe must be a constant in Ruby Huh. Python's attitude is more like "Yeah, you can break stuff, but don't expect me to clean up the mess"

@ɐɔıʇǝɥʇuʎs ||= is like += but with || - a ||= b is equivalent to a = a || b.  It is commonly used to default a variable when it is falsy.

you should declare constant before use(FailSafe).

@Зелёный went ahead and renamed the input

JavaScript, 197195 characters
FailSafe?['Detection zones staying in a given state','Bad visibility','Initialization','Bad configuration'].filter(function(_,i){return FailSafe&1<<i}).join('; ')||'Unknown':'No technical alarms'

formatted:
FailSafe
  ? [ 'Detection zones staying in a given state',
      'Bad visibility',
      'Initialization',
      'Bad configuration'
    ].filter(function(_, i) {
      return FailSafe & 1<<i;
    }).join('; ') || 'Unknown'
  : 'No technical alarms';

Could be further reduced by using ES6 or Coffeescript function expressions.

what if FailSafe is 18?
(actually, the original challenge code does only look at the lower 4 bits, so the Unknown case is actually never detected!) So the question is, if we should actually care for it or provide a "fixed" algorithm.

@blabla999: It will return "Bad visibility" because the 2-bit is set and none of the other lower 4 bits. The Unknown case happens when none of the lower 4 bits is set, but FailSafe is != 0 - just as in the original code(try with 16). Whether we should "fix" this you should ask the OP (in a comment on the question), not me…

you'r right - me stupid. I got so confused by that piece of code. Sorry for that.

VBScript, 204 234 232 characters
(edit: improved score by 2 by using array() instead of split(). 232 now.)
f=failsafe:for b=0to 3:s=s&split(",; Detection zones staying in a given state,; Bad visibility,,; Initialization,,,,; Bad configuration",",")(f and 2^b):next:array("No technical alarms","Unknown",mid(s,3))(2+(f=0)+(len(s)=0))

(edit: forgot the "unknown" part. 234 chars now.)
f=failsafe:for b=0to 3:s=s&split(",; Detection zones staying in a given state,; Bad visibility,,; Initialization,,,,; Bad configuration",",")(f and 2^b):next:split("No technical alarms,Unknown,"&mid(s,3),",")(2+(f=0)+(len(s)=0))
(original, 230)
for b=0to 3:s=s&split(",; Detection zones staying in a given state,; Bad visibility,,; Initialization,,,,; Bad configuration",",")(FailSafe and 2^b):next:array(mid(s,3),"No technical alarms")(-(len(s)=0))
Of course, this is just part of a script.  to test it, try something like this:
FailSafe=cint(inputbox("Please enter Failsafe as an integer"))
f=failsafe:for b=0to 3:s=s&split(",; Detection zones staying in a given state,; Bad visibility,,; Initialization,,,,; Bad configuration",",")(f and 2^b):next
msgbox array("No technical alarms","Unknown",mid(s,3))(2+(f=0)+(len(s)=0))

me too forgot the Unknown case ;-)

@blabla999 Indeed.  Fixed.  Thanks!

Smalltalk, 243 characters
FailSave>15ifTrue:'Unknown'ifFalse:[((((1to:4)select:[:b|FailSafe isBitSet:b])collect:[:b|#('Detection zones staying in a given state' 'Bad visibility' 'Initialization' 'Bad configuration')at:b])asStringWith:'; ')ifEmpty:'No technical alarms']

formatted for readability:
FailSafe > 15
    ifTrue:'Unknown'
    ifFalse:[
        ((((1 to:4)
            select:[:b | FailSafe isBitSet:b ])
                collect:[:b|
                    #( 'Detection zones staying in a given state'
                       'Bad visibility'
                       'Initialization'
                       'Bad configuration') at:b ]
                    ) asStringWith:'; ')
                        ifEmpty:'No technical alarms']

Thanks to Bergi, for pointing to the bug in the first version.
This brings up an idea: if I map the FailSafe value into a 6-bit mask,
(mapping 0 -> 16 and greater-than-15 -> 32), I can get rid of the final tests.
The mapping to the 6bit mask m can be done with:
m := {16},(1 to: 15) at:FailSafe+1 ifAbsent:32.
that is, m will be 16 for a zero FailSafe, and 32 for out-of-bounds values.
Then select and collect strings as above.
This gives the new code:
m := {16},(1 to:15) at:FailSafe+1 ifAbsent:32.
(((1 to:6) select:[:b | m isBitSet:b ])
        collect:[:b|
            #( 'Detection zones staying in a given state'
               'Bad visibility'
               'Initialization'
               'Bad configuration'
               'No technical alarms'
               'Unknown') at:b ]
               ) joinWithAll:'; '

(I also replaced asStringWith: by joinWithAll:, which is an alias).
Although this seems to be a nice idea, this has the same character count - sigh.
Maybe some other programming language with denser operator names scores better here!
I could save a few chars by not using a temporary variable for m, but recompute it in the loop and by not using a literal array for the string vector, to get a count slighty below 240 chars.
Finally, the mask m could also be computed by m:={32},(1 to: 16) at:(FailSafe+1 min:17), which might be shorter in APL. Then exchange the last two strings in the vector.
PS: The first version assumes FailSafe is non-negative, like some other solutions here do. The second can deal with anything, even nil or other non-numbers.

What about the Unknown configuration?

ouch sorry - I have to fix it.

CoffeeScript, 161 160 221 chars
F = FailSafe;F<16 and (F and [0..3].filter((i)->(1<<i)&F).map((i)->(['Detection zones staying in a given state','Bad visibility','Initialization','Bad configuration'])[i]).join('; ') or 'No technical alarms') or 'Unknown'

What happened to Unknown and No technical alarms?

Aw crap. I should have been suspicious when I beat the GolfScript answer...

As always, I forgot the edge cases...

VB.net
Function StateText(f As FailFlag) As String
  If f=0 Then Return "No Technical Alarm"
  Dim t=""
  If f.HasFlag(f1) Then t &= "Detection zones staying in a given state; "
  If f.HasFlag(f2) Then t &= "Bad visibility; "
  If f.HasFlag(f4) Then t &= "Initialization; "
  If f.HasFlag(f8) Then t &= "Bad configuration; "
  Return If( t<>"", t.TrimEnd("; "),"Unknown")
End Function

<Flags>
Enum FailFlag
  f1 = 1
  f2 = 2
  f4 = 4
  f8 = 8
End Enum

Edit: Better Entry
Function StateText(f As FailFlag) As String
  If f = 0 Then Return "No Technical Alarm"
  Dim t = String.Join("; ",
            From e In [Enum].GetValues(GetType(FailFlag))
            Where f.HasFlag(e)
            Select [Enum].GetName(GetType(FailFlag), e).Replace("_", " "))
  Return If( t<>"", t,"Unknown")
End Function

<Flags>
Enum FailFlag
  Detection_zones_staying_in_a_given_state = 1
  Bad_visibility = 2
  Initialization = 4
  Bad_configuration = 8
End Enum

Perl, 208 197 Characters
$f=$FailSafe;%m=(1,'Detection zones staying in a given state',2,'Bad visibility',4,'Initialization',8,'Bad configuration');($f?join'; ',@m{map{$f&$_?$_:()}1,2,4,8}:'No technical alarms')||'Unknown'

With boilerplate code to make it work:
#!/usr/bin/env perl
$FailSafe=17;
print failmsg() . "\n";

sub failmsg {
$f=$FailSafe;%m=(1,'Detection zones staying in a given state',2,'Bad visibility',4,'Initialization',8,'Bad configuration');($f?join'; ',@m{map{$f&$_?$_:()}1,2,4,8}:'No technical alarms')||'Unknown'
}

Reread the code: There isn't a bounds check.

Java 275 characters  (not counting unnecessary white space)
    String s = "";
    int b = 1;
    for (String m : new String[]{"Detection zones staying in a given state; ","Bad visibility; ", "Initialization; ", "Bad configuration; "}) {
        if ((FailSafe & b) != 0) s = s + m;
        b <<= 1;
    }
    return (s.length() == 0) ? (FailSafe == 0) ? "No technical alarms" : "Unknown" : s.substring(0, s.length() - 2);