text:
Counting to now
This is the goal: count from 0 all the way to the current epoch time while the epoch time is still advancing in the fastest time possible. An example of how you'd do it could be as what is shown here in Python 2.7:
from time import time
start, end, count = None, None, 0
while count <= time():
    if start == None: start = time()
    count += 1
    end = time()

The above code took 10 minutes and 8 seconds to run through on an 8-core AMD with 16 GB of RAM. You must do it faster than that without skipping numbers and starting from zero.
Scoring
Achieving a lower time than what Python did is the goal in addition to using the least amount of code too, but special attention will be given to the following:

Code that takes the precise epoch time sourced from your counting to display something mentioning historical events or irrelevant ones that can be found on Wikipedia. (10 points)
Getting the current epoch time from a source other than your own. (5 points)
Your application continues to count alongside the epoch time after it catches up. (5 points)

50 points will be awarded to the person who achieves the lowest time and additional bonus points will be awarded from above if they're met.
Deadline
The contest closes June 1st.

How much are the bonuses worth? You define them, but don't give them a value.

Added the scoring there for you. I had them earlier. :)

Your scoring is still completely arbitrary. How are time and code size factored into a single score, how much is a "point" worth?

So I suppose now the base score is code size in bytes (= points), and then -50 for the fastest and -10/5/5 for the bonuses? How can you possibly display historical events with 10 bytes of code? Regardless, the combination of multiple scoring criteria makes this a "code-challenge" and not "code-golf".

I've made the tag change there.

What is the purpose of start and end in your example? They don't do anything, and otherwise it's just a simple loop to a billion or so. Why does it take over 10 minutes to run?

The purpose of start and end was something I did due to it being in the interpreter and not standalone. It doesn't have any bearing on the overall speed. The use of the for loop is what makes it slow.

@Geobits I think the real "challenge" intended is to minimize the number of calls to time(), but personally I don't think it's gonna make much difference...

C, about 5 seconds
#include <stdio.h>
#include <time.h>

int main(){
  time_t t=0, margin=0x40000000;
  int i;
  while (margin) {
    for (i=0;i<margin;i++) t++;
    while (margin && time(NULL)-t < margin) margin /= 2;
  }
  printf("t=%ld, time=%ld\n",t,time(NULL));
  return 0;
}

Java : 140
No bonuses, ~60ms runtime
Sets the start time in j and doesn't check time again until j is reached. Once it is, it keeps counting up to current time. Generally it only needs to check the time twice, since it runs in well under a second.
class N{public static void main(String[]a){for(int i=0,j=t();i++<j||i<t(););}static int t(){return (int)(System.currentTimeMillis()/1000);}}

Line breaks for clarity:
class N{
    public static void main(String[]a){
        for(int i=0,j=t();i++<j||i<t(););
    }
    static int t(){return (int)(System.currentTimeMillis()/1000);}
}


text:
Duct Tape some sorting
Your job is to make a sorting algorithm. The catch, you must copy it from Stack Overflow.
Your program will take an input array (or equivalency), and output a sorted permutation of the array.

Your program must consist solely of copy and pasted code blocks from Stack Overflow.
You may not take parts of a code block, nor may you rearrange one. A code block is everything within a single gray box.
The original question of the post may not have a tag, title, or question body containing the word "sort" in it.
You must cite the both the post and poster(s).
You may not use built in sorts.
The post must be older than this question.

Also, here are allowed modifications:

You may move import statements to the top
For any type of identifier type thing, you may replace all of its occurrences within the code block with a different name. Please list substitutions.

This is a popularity contest, so the correct answer with the most up-votes wins!

Are inline code segments allowed?

Can I refer to my own post?

'The original question of the post may not have a tag, title, or question body containing the word "sort" in it.' How about relaxing this rule such that posts containing stuff like "...this sort of..." can be used? i.e. only disallow sources where "sort" means "sorting". (Not sure you'll get a lot of false positives anyway, but it might be annoying in a case or two.)

@AJMansfield Yes

If there are posts like def foo(bar): # your code here is it acceptable to copy contents of another post to replace # your code here? Or to be more exact, can I replace Parallel here with another function I found on another post?

Does it need to work every time (randomness?), can it output more stuff than just the sorted array (all permutations), and can the answer contain the word sort? (Currently I only see restrictions on the question)

I think I like these newfangled duct tape questions!

Your question might be more clear and garner more attention/answers if you bring over the more explicit rule-set from the other questions.  When reading over your own, it's a little difficult to tell what's allowed, disallowed, or whatever without careful reading.  According to UX, you always have to lessen cognitive load for your user base. :)

Please, we don't need a sequel to code-trolling.

GolfScript
Straightforward bubble sort implementation. Can probably be golfed down further. Try it online.
~x {{ document.write man [
putc( 'c', stdout ) ;
\b {{ return 1 echo ${10}
return
true;
Convert.ToDouble(o)
datagrid1.ItemsSource = dataTable1.DefaultView;
echo $a:u
cat > file {{ \b }} ~x
int* arr1[8];
}}
source ~/.bashrc
return
true;
] document.write
@echo off
IP=`curl ifconfig.me`
return
true;
~x return !0
return
true;
}} ~x
for {0..10..2}; do
  ..
done
set -x
\b
basename `pwd`
~x

Sources
https://stackoverflow.com/a/2513659 (https://stackoverflow.com/u/276101):
~x
https://stackoverflow.com/a/3773868  (https://stackoverflow.com/u/394167):
{{
https://stackoverflow.com/a/802894   (https://stackoverflow.com/u/8815):
document.write
https://stackoverflow.com/a/2188223 (https://stackoverflow.com/u/116908):
man [
https://stackoverflow.com/q/4563825 (https://stackoverflow.com/u/111307):
putc( 'c', stdout ) ;

https://stackoverflow.com/a/16876671 (https://stackoverflow.com/u/980550):
\b
https://stackoverflow.com/a/22604291 (https://stackoverflow.com/u/1622022):
return 1
https://stackoverflow.com/a/6146038 (https://stackoverflow.com/u/116908):
echo ${10}
https://stackoverflow.com/a/4054267 (https://stackoverflow.com/u/69083):
return
true;

https://stackoverflow.com/q/23657401 (https://stackoverflow.com/u/1171811):
Convert.ToDouble(o)
https://stackoverflow.com/q/6097907 (https://stackoverflow.com/u/517871):
datagrid1.ItemsSource = dataTable1.DefaultView;

https://stackoverflow.com/a/4813101 (https://stackoverflow.com/u/591720):
echo $a:u

https://stackoverflow.com/q/19114714 (https://stackoverflow.com/u/72436):
cat > file
https://stackoverflow.com/a/3773868 (https://stackoverflow.com/u/394167):
}}
https://stackoverflow.com/a/859676 (https://stackoverflow.com/u/87234):
int* arr1[8];

https://stackoverflow.com/a/2518150 (https://stackoverflow.com/u/245602):
source ~/.bashrc

https://stackoverflow.com/a/5750751 (https://stackoverflow.com/u/187690):
]
https://stackoverflow.com/q/8823643 (https://stackoverflow.com/u/1059446):
@echo off

https://stackoverflow.com/a/9764597 (https://stackoverflow.com/u/167925):
IP=`curl ifconfig.me`

https://stackoverflow.com/a/8255667 (https://stackoverflow.com/u/179669):
return !0
https://stackoverflow.com/a/966110 (https://stackoverflow.com/u/104162):
for {0..10..2}; do
  ..
done

https://stackoverflow.com/a/6930980 (https://stackoverflow.com/u/705676):
set -x

https://stackoverflow.com/a/4641636 (https://stackoverflow.com/u/333698):
basename `pwd`

dude, ... kudos...

source: Stack Exchange

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

sort: votes


text:
Reverse order of words in a string inplace
The Task

You are given a mutable string that matches [a-z]+( [a-z]+)*.
You must mutate it into the string which contains the same words, but in reverse order, so that "hello there everyone" becomes "everyone there hello".
You are not permitted to use more than a constant amount of additional memory (so no copying the entire string or any whole word into a buffer you just allocated).
There are no time constraints. Being hopelessly inefficient will not harm your score.
If your language of choice does not permit mutation of strings, arrays of characters are an acceptable substitute.

Your Score

Your score is counted purely on the number of assigments you make to string elements (small scores are best). If you use a library function that writes to the string, its writes also count.
Suppose the number of assignments you need for input s is n(s). Then your score is the maximum (pedantically, supremum) over all inputs s (matching the regex specified above) of n(s)/length(s). If you cannot calculate this precisely, you can use the lowest upper bound that you can prove.
You can break a tie if you can prove that your algorithm uses asymptotically fewer assignments (this can happen even if you have the same score, see below). If you can't do this, you can break a tie by showing that you use less additional memory. However, the first tie-break condition always takes precedence.
For some inputs every character needs to change, so it is not possible to score less than 1.
I can think of a simple algorithm with score 2 (but I'm not entering it).

Notes on suprema and ties

A supremum of a set of numbers is the smallest number that is not smaller than any of them. This is much like the maximum of a set, except that some infinite sets like {2/3, 3/4, 4/5, 5/6, ...} have no single maximum element, but will still have a supremum, in this case 1.
If you manage to "save" only a constant number of assignments over my algorithm of score 2 (say), your score will still be 2, because you'll get arbitrarily close to 2 the larger your input gets. However, you win on the tie-break if it comes to that.

What do you mean by "number of assigments you make to string elements"? E.g. in C, str[0]='A'; counts as one? Or str[]="FOOBAR"; counts as one?

@ace I would think that str[a:b] = str[c:d], for example, should count as b-a.

str[0]='A' counts as one assignment. The latter case is only possible in initialisation, right? And with a string literal on the RHS? In that case I'm not sure it's going to help you very much. I say make it seven assignments (including the implicit null byte) (so primo is correct)

So we will end up with answers with the same score of 2 but different tie-breaks?

I'd be a little bit sad if this all came down to tie-breaking score-2 submissions on their memory usage. I mostly posted this question wondering if anyone would manage to score less than 2.

I don't have a formal proof, but my intuition tells me that with the constant-space restriction, it's impossible to do better than 2. If you only count variable declarations for space, I could cheat and make a recursive function. but that only disguises the little-omega(1) space by putting it on the stack.

We would need at least one temporary variable to use for swapping characters. Does this count as extra memory?

@bacchusbeale yes, but it's constant extra memory.

If you strictly enforce the rules then it's impossible to write such a program. The string can be of arbitrary length and you will need at least some kind of variable that stores an index. So I just have to make the string long enough to exceed the bounds of your variable. To successfully store at least one index your needed memory will grow with the string length.

@IchBinKeinBaum, the rule reads "You are not permitted to use more than a constant amount of additional memory." A single index takes constant memory, and is independent of the size of the string. Also nobody actually worries about strings exceeding RAM size or integer overflow with indices.

I found this question really hard to understand. Maybe because English is not my mother tongue. I have read the score calculation 3 times but still can't figure out how to apply these rules to the answers. Proving bounds or fewer assignments is neither simple nor code golfing IMHO.

Probably the scoring can be better formulated if you can provide (or hide) some test strings for which the scores of all programs will be calculated. The lowest number of assignments wins. That will be very objective. To count the number of assignments, you can create an function for people should use to modify the string, then you can count the number of assignments by counting the number of calls to the function.

@IchBinKeinBaum In the RAM model, which is usually used in algorithm analysis, it is assumed that for the machine word width w, we have n << 2^w. This is also practical. For w = 64 it's highly unlikely that the input size will ever be larger than what a word can address

Do you mean a mutable or immutable string?

@TheGuywithTheHat Mutable. The description specifically says that if your language doesn't support mutable strings, character arrays are acceptable.

@NiklasB. @rangu To make it concrete: If I use Java I have to use char arrays because Strings are immutable - kind of. Am I allowed to assume that the string length is < 2^31 because otherwise I can't fit the string into a single char array?

@IchBinKeinBaum I would assume so. That Java does not allow you to use the full word size to index an array is a rather arbitrary restriction of the language, not a theoretical problem (you can always use 64-bit indexing)

Certainly I am missing something here. Which part of the rule prohibits Perl s///? http://pastebin.com/A2z7PESK

@manatwork I suppose one would be disinclined, due to having  to wade through the perl source to show that a) additional memory usage is bounded by a constant for any arbitrary string (is it?), and b) that the number of inplace string operation is bounded by the length of the string (it probably is).

@IchBinKeinBaum is right, it is impossible to perform this task with O(1) additional space. You need O(log n) space to store an index position, since an k-bit integer can only store in them for strings of a length up to 2^k. Limiting the length of the strings makes the challenge rather pointless, since every algorithm would require O(1) space this way.

In all seriousness, an unsigned 256 bit integer is nearly large enough to enumerate every electron in the observable universe. For all practicality, the space required to store such an index can safely be considered to be constant.

I'm curious. OP, is there any practical system where string assignment is the most costly part, hence you're willing to sacrifice time to save some assignments? It's cool that we can actually achieve a score of 1.25 =D

Thanks to the people who pointed out my sloppiness wrt constant memory. I indeed intended for indices into the string to count as constant size. I pondered clarifying it to "constant number of unbounded integers" but them some smart-alec would encode the entire string into a single integer and operate on it there :) I suspect just weakening to "logarithmic space overhead" would be fine, but since everyone seems to be interpreting the challenge as I intended, I will make no changes. In response to justhalf, there is no intended practical application, "cool" was all I hoped for :)

Voting to close this because "a mutable string" and "mutating the output" are unobservable requirements

@emanresuA How are they unobvervable?  The input is some location in memory representing a string and the program must change that memory.  That seems entirely observable.

Python, Score: 2 1.5 1.25
This is the direct combination between primo's answer and my answer. So credits to him also!
The proof is still in progress, but here is the code to play with! If you can find a counter example of score greater than 1.25 (or if there is a bug), let me know!
Currently the worst case is:

a a ... a a dcb...cbd

where there are exactly n of each the letters "a", "b", "c", and " " (space), and exactly two "d"s. The length of the string is 4n+2 and the number of assignments is 5n+2, giving a score of 5/4 = 1.25.
The algorithm works in two steps:

Find k such that string[k] and string[n-1-k] are word boundaries
Run any word reversing algorithm on string[:k]+string[n-1-k:] (i.e., concatenation of first k and last k chars) with small modification.

where n is the length of the string.
The improvement this algorithm gives comes from the "small modification" in Step 2. It's basically the knowledge that in the concatenated string, the characters at position k and k+1 are word boundaries (which means they are spaces or first/last character in a word), and so we can directly replace the characters in position k and k+1 with the corresponding character in the final string, saving a few assignments. This removes the worst case from the host word-reversal algorithm
There are cases where we can't actually find such k, in that case, we just run the "any word reversal algorithm" on the whole string.
The code is long to handle these four cases on running the word reversal algorithm on the "concatenated" string:

When k is not found (f_long = -2)
When string[k] != ' ' and string[n-1-k] != ' ' (f_long = 0)
When string[k] != ' ' and string[n-1-k] == ' ' (f_long = 1)
When string[k] == ' ' and string[n-1-k] != ' ' (f_long = -1)

I'm sure the code can be shortened. Currently it's long because I didn't have clear picture of the whole algorithm in the beginning. I'm sure one can design it to be represented in a shorter code =)
Sample run (first is mine, second is primo's):

Enter string: a bc def ghij
"ghij def bc a": 9, 13, 0.692
"ghij def bc a": 9, 13, 0.692
Enter string: ab c d e f g h i j k l m n o p q r s t u v w x y z
"z y x w v u t s r q p o n m l k j i h g f e d c ab": 50, 50, 1.000
"z y x w v u t s r q p o n m l k j i h g f e d c ab": 51, 50, 1.020
Enter string: a b c d e f g hijklmnopqrstuvwx
"hijklmnopqrstuvwx g f e d c b a": 38, 31, 1.226
"hijklmnopqrstuvwx g f e d c b a": 38, 31, 1.226
Enter string: a bc de fg hi jk lm no pq rs tu vw xy zc
"zc xy vw tu rs pq no lm jk hi fg de bc a": 46, 40, 1.150
"zc xy vw tu rs pq no lm jk hi fg de bc a": 53, 40, 1.325
Enter string: a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a dcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbd
"dcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbd a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a": 502, 402, 1.249
"dcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbd a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a": 502, 402, 1.249

You can see that the score is almost the same, except for the worst case of the host word-reversal algorithm in the third example, for which my approach yields score of less than 1.25
DEBUG = False

def find_new_idx(string, pos, char, f_start, f_end, b_start, b_end, f_long):
    if DEBUG: print 'Finding new idx for s[%d] (%s)' % (pos, char)
    if f_long == 0:
        f_limit = f_end-1
        b_limit = b_start
    elif f_long == 1:
        f_limit = f_end-1
        b_limit = b_start+1
    elif f_long == -1:
        f_limit = f_end-2
        b_limit = b_start
    elif f_long == -2:
        f_limit = f_end
        b_limit = b_start

    if (f_start <= pos < f_limit or b_limit < pos < b_end) and char == ' ':
        word_start = pos
        word_end = pos+1
    else:
        if pos < f_limit+1:
            word_start = f_start
            if DEBUG: print 'Assigned word_start from f_start (%d)' % f_start
        elif pos == f_limit+1:
            word_start = f_limit+1
            if DEBUG: print 'Assigned word_start from f_limit+1 (%d)' % (f_limit+1)
        elif b_limit <= pos:
            word_start = b_limit
            if DEBUG: print 'Assigned word_start from b_limit (%d)' % b_limit
        elif b_limit-1 == pos:
            word_start = b_limit-1
            if DEBUG: print 'Assigned word_start from b_limit-1 (%d)' % (b_limit-1)
        i = pos
        while f_start <= i <= f_limit or 0 < b_limit <= i < b_end:
            if i==f_limit or i==b_limit:
                cur_char = 'a'
            elif i!=pos:
                cur_char = string[i]
            else:
                cur_char = char
            if cur_char == ' ':
                word_start = i+1
                if DEBUG: print 'Assigned word_start from loop'
                break
            i -= 1

        if b_limit <= pos:
            word_end = b_end
            if DEBUG: print 'Assigned word_end from b_end (%d)' % b_end
        elif b_limit-1 == pos:
            word_end = b_limit
            if DEBUG: print 'Assigned word_end from b_limit (%d)' % (b_limit)
        elif pos < f_limit+1:
            word_end = f_limit+1
            if DEBUG: print 'Assigned word_end from f_limit+1 (%d)' % (f_limit+1)
        elif pos == f_limit+1:
            word_end = f_limit+2
            if DEBUG: print 'Assigned word_end from f_limit+2 (%d)' % (f_limit+2)
        i = pos
        while f_start <= i <= f_limit or 0 < b_limit <= i < b_end:
            if i==f_limit or i==b_limit:
                cur_char = 'a'
            elif i!=pos:
                cur_char = string[i]
            else:
                cur_char = char
            if cur_char == ' ':
                word_end = i
                if DEBUG: print 'Assigned word_end from loop'
                break
            i += 1
    if DEBUG: print 'start, end: %d, %d' % (word_start, word_end)
    word_len = word_end - word_start
    offset = word_start-f_start
    result = (b_end-offset-(word_end-pos)) % b_end
    if string[result] == ' ' and (b_start == -1 or result not in {f_end-1, b_start}):
        return len(string)-1-result
    else:
        return result

def process_loop(string, start_idx, f_start, f_end, b_start, b_end=-1, f_long=-2, dry_run=False):
    assignments = 0
    pos = start_idx
    tmp = string[pos]
    processed_something = False
    count = 0
    while pos != start_idx or not processed_something:
        count += 1
        if DEBUG and count > 20:
            print '>>>>>Break!<<<<<'
            break
        new_pos = find_new_idx(string, pos, tmp, f_start, f_end, b_start, b_end, f_long)
        if DEBUG:
            if dry_run:
                print 'Test:',
            else:
                print '\t',
            print 'New idx for s[%d] (%s): %d (%s)' % (pos, tmp, new_pos, string[new_pos])
        if dry_run:
            tmp = string[new_pos]
            if new_pos == dry_run:
                return True
        elif pos == new_pos:
            break
        elif tmp == string[new_pos]:
            pass
        else:
            tmp, string[new_pos] = string[new_pos], tmp
            assignments += 1
        pos = new_pos
        processed_something = True
    if dry_run:
        return False
    return assignments

def reverse(string, f_start, f_end, b_start, b_end=-1, f_long=-2):
    if DEBUG: print 'reverse: %d %d %d %d %d' % (f_start, f_end, b_start, b_end, f_long)
    if DEBUG: print
    if DEBUG: print ''.join(string)
    assignments = 0
    n = len(string)
    if b_start == -1:
        for i in range(f_start, f_end):
            if string[i] == ' ':
                continue
            if DEBUG: print 'Starting from i=%d' % i
            if any(process_loop(string, j, f_start, f_end, -1, f_end, dry_run=i) for j in range(f_start, i) if string[j] != ' '):
                continue
            if DEBUG:
                print
                print 'Finished test'
            assignments += process_loop(string, i, f_start, f_end, -1, f_end)
            if DEBUG: print
            if DEBUG: print ''.join(string)
        for i in range(f_start, (f_start+f_end-1)/2):
            if (string[i] == ' ' and string[n-1-i] != ' ') or (string[i] != ' ' and string[n-1-i] == ' '):
                string[i], string[n-1-i] = string[n-1-i], string[i]
                assignments += 2
    else:
        for i in range(f_start, f_end)+range(b_start, b_end):
            if string[i] == ' ' and i not in {f_end-1, b_start}:
                continue
            if DEBUG: print 'Starting from i=%d' % i
            if any(process_loop(string, j, f_start, f_end, b_start, b_end, f_long, i) for j in range(f_start, f_end)+range(b_start, b_end) if j<i and (string[j] != ' ' or j in {f_end-1, b_start})):
                continue
            assignments += process_loop(string, i, f_start, f_end, b_start, b_end, f_long)
            if DEBUG: print
            if DEBUG: print ''.join(string)
        for i in range(f_start, f_end-1):
            if (string[i] == ' ' and string[n-1-i] != ' ') or (string[i] != ' ' and string[n-1-i] == ' '):
                string[i], string[n-1-i] = string[n-1-i], string[i]
                assignments += 2
    return assignments

class SuperList(list):
    def index(self, value, start_idx=0):
        try:
            return self[:].index(value, start_idx)
        except ValueError:
            return -1

    def rindex(self, value, end_idx=-1):
        end_idx = end_idx % (len(self)+1)
        try:
            result = end_idx - self[end_idx-1::-1].index(value) - 1
        except ValueError:
            return -1
        return result

def min_reverse(string):
    assignments = 0
    lower = 0
    upper = len(string)
    while lower < upper:
        front = string.index(' ', lower) % (upper+1)
        back = string.rindex(' ', upper)
        while abs(front-lower - (upper-1-back)) > 1 and front < back:
            if front-lower < (upper-1-back):
                front = string.index(' ', front+1) % (upper+1)
            else:
                back = string.rindex(' ', back)
            if DEBUG: print lower, front, back, upper
        if front > back:
            break
        if DEBUG: print lower, front, back, upper
        if abs(front-lower - (upper-1-back)) > 1:
            assignments += reverse(string, lower, upper, -1)
            lower = upper
        elif front-lower < (upper-1-back):
            assignments += reverse(string, lower, front+1, back+1, upper, -1)
            lower = front+1
            upper = back+1
        elif front-lower > (upper-1-back):
            assignments += reverse(string, lower, front, back, upper, 1)
            lower = front
            upper = back
        else:
            assignments += reverse(string, lower, front, back+1, upper, 0)
            lower = front+1
            upper = back
    return assignments

def minier_find_new_idx(string, pos, char):
    n = len(string)
    try:
        word_start = pos - next(i for i, char in enumerate(string[pos::-1]) if char == ' ') + 1
    except:
        word_start = 0
    try:
        word_end = pos + next(i for i, char in enumerate(string[pos:]) if char == ' ')
    except:
        word_end = n
    word_len = word_end - word_start
    offset = word_start
    result = (n-offset-(word_end-pos))%n
    if string[result] == ' ':
        return n-result-1
    else:
        return result

def minier_process_loop(string, start_idx, dry_run=False):
    assignments = 0
    pos = start_idx
    tmp = string[pos]
    processed_something = False
    while pos != start_idx or not processed_something:
        new_pos = minier_find_new_idx(string, pos, tmp)
        #print 'New idx for s[%d] (%s): %d (%s)' % (pos, tmp, new_pos, string[new_pos])
        if pos == new_pos:
            break
        elif dry_run:
            tmp = string[new_pos]
            if new_pos == dry_run:
                return True
        elif tmp == string[new_pos]:
            pass
        else:
            tmp, string[new_pos] = string[new_pos], tmp
            assignments += 1
        pos = new_pos
        processed_something = True
    if dry_run:
        return False
    return assignments

def minier_reverse(string):
    assignments = 0
    for i in range(len(string)):
        if string[i] == ' ':
            continue
        if any(minier_process_loop(string, j, dry_run=i) for j in range(i) if string[j] != ' '):
            continue
        assignments += minier_process_loop(string, i)
    n = len(string)
    for i in range(n/2):
        if string[i] == ' ' and string[n-i-1] != ' ':
            string[i], string[n-i-1] = string[n-i-1], string[i]
            assignments += 2
        elif string[n-i-1] == ' ' and string[i] != ' ':
            string[i], string[n-i-1] = string[n-i-1], string[i]
            assignments += 2
    return assignments

def main():
    while True:
        str_input = raw_input('Enter string: ')
        string = SuperList(str_input)
        result = min_reverse(string)
        n = len(string)
        print '"%s": %d, %d, %.3f' % (''.join(string), result, n, 1.0*result/n)
        string = SuperList(str_input)
        result2 = minier_reverse(string)
        print '"%s": %d, %d, %.3f' % (''.join(string), result2, n, 1.0*result2/n)

if __name__ == '__main__':
    main()

Python, Score: 1.5
The exact number of assignments can be approximated by the formula:

n <= 1.5*length(string)

with the worst case being:

a b c d e f g h i jklmnopqrstuvwxyzzz

with 55 assignments on string with length 37.
The idea is similar to my previous one, it's just that in this version I tried to find prefix and suffix at word boundaries with length difference at most 1. Then I run my previous algorithm on that prefix and suffix (imagine them as being concatenated). Then continue on unprocessed part.
For example, for the previous worst case:

ab| a b| c

we will first do word reversal on "ab" and " c" (4 assignments) to be:

c | a b|ab

We know that at the boundary it used to be space (there are many cases to be handled, but you can do that), so we don't need to encode the space at the boundary, this is the main improvement from the previous algorithm.
Then finally we run on the middle four characters to get:

c b a ab

in total 8 assignments, the optimal for this case, since all 8 characters changed.
This eliminates the worst case in previous algorithm since the worst case in previous algorithm is eliminated.
See some sample run (and comparison with @primo's answer - his is the second line):

Enter string: i can do anything
"anything do can i": 20, 17
"anything do can i": 17, 17
Enter string: a b c d e f ghijklmnopqrs
"ghijklmnopqrs f e d c b a": 37, 25
"ghijklmnopqrs f e d c b a": 31, 25
Enter string: a b c d e f ghijklmnopqrst
"ghijklmnopqrst f e d c b a": 38, 26
"ghijklmnopqrst f e d c b a": 32, 26
Enter string: a b c d e f g h i jklmnozzzzzzzzzzzzzzzzz
"jklmnozzzzzzzzzzzzzzzzz i h g f e d c b a": 59, 41
"jklmnozzzzzzzzzzzzzzzzz i h g f e d c b a": 45, 41
Enter string: a b c d e f g h i jklmnopqrstuvwxyzzz
"jklmnopqrstuvwxyzzz i h g f e d c b a": 55, 37
"jklmnopqrstuvwxyzzz i h g f e d c b a": 45, 37
Enter string: ab a b a b a b a b a b a b a c
"c a b a b a b a b a b a b a ab": 30, 30
"c a b a b a b a b a b a b a ab": 31, 30
Enter string: ab a b a b a b a b a b a b a b c
"c b a b a b a b a b a b a b a ab": 32, 32
"c b a b a b a b a b a b a b a ab": 33, 32
Enter string: abc d abc
"abc d abc": 0, 9
"abc d abc": 0, 9
Enter string: abc d c a
"a c d abc": 6, 9
"a c d abc": 4, 9
Enter string: abc a b a b a b a b a b a b c
"c b a b a b a b a b a b a abc": 7, 29
"c b a b a b a b a b a b a abc": 5, 29

primo's answer is generally better, although in some cases I can have 1 point advantage =)
Also his code is much shorter than mine, haha.
DEBUG = False

def find_new_idx(string, pos, char, f_start, f_end, b_start, b_end, f_long):
    if DEBUG: print 'Finding new idx for s[%d] (%s)' % (pos, char)
    if f_long == 0:
        f_limit = f_end-1
        b_limit = b_start
    elif f_long == 1:
        f_limit = f_end-1
        b_limit = b_start+1
    elif f_long == -1:
        f_limit = f_end-2
        b_limit = b_start
    elif f_long == -2:
        f_limit = f_end
        b_limit = b_start

    if (f_start <= pos < f_limit or b_limit < pos < b_end) and (char == ' ' or char.isupper()):
        word_start = pos
        word_end = pos+1
    else:
        if pos < f_limit+1:
            word_start = f_start
            if DEBUG: print 'Assigned word_start from f_start (%d)' % f_start
        elif pos == f_limit+1:
            word_start = f_limit+1
            if DEBUG: print 'Assigned word_start from f_limit+1 (%d)' % (f_limit+1)
        elif b_limit <= pos:
            word_start = b_limit
            if DEBUG: print 'Assigned word_start from b_limit (%d)' % b_limit
        elif b_limit-1 == pos:
            word_start = b_limit-1
            if DEBUG: print 'Assigned word_start from b_limit-1 (%d)' % (b_limit-1)
        i = pos
        if not (i < f_limit and b_limit < i):
            i -= 1
        while f_start <= i < f_limit or 0 < b_limit < i < b_end:
            if i!=pos:
                cur_char = string[i]
            else:
                cur_char = char
            if cur_char == ' ' or cur_char.isupper():
                word_start = i+1
                if DEBUG: print 'Assigned word_start from loop'
                break
            i -= 1

        if b_limit <= pos:
            word_end = b_end
            if DEBUG: print 'Assigned word_end from b_end (%d)' % b_end
        elif b_limit-1 == pos:
            word_end = b_limit
            if DEBUG: print 'Assigned word_end from b_limit (%d)' % (b_limit)
        elif pos < f_limit+1:
            word_end = f_limit+1
            if DEBUG: print 'Assigned word_end from f_limit+1 (%d)' % (f_limit+1)
        elif pos == f_limit+1:
            word_end = f_limit+2
            if DEBUG: print 'Assigned word_end from f_limit+2 (%d)' % (f_limit+2)
        i = pos
        if not (i < f_limit and b_limit < i):
            i += 1
        while f_start <= i < f_limit or 0 < b_limit < i < b_end:
            if i!=pos:
                cur_char = string[i]
            else:
                cur_char = char
            if cur_char == ' ' or cur_char.isupper():
                word_end = i
                if DEBUG: print 'Assigned word_end from loop'
                break
            i += 1
    if DEBUG: print 'start, end: %d, %d' % (word_start, word_end)
    word_len = word_end - word_start
    offset = word_start-f_start
    return (b_end-offset-(word_end-pos)) % b_end

def process_loop(string, start_idx, f_start, f_end, b_start, b_end=-1, f_long=-2, dry_run=False):
    assignments = 0
    pos = start_idx
    tmp = string[pos]
    processed_something = False
    count = 0
    while pos != start_idx or not processed_something:
        count += 1
        if count > 20:
            if DEBUG: print 'Break!'
            break
        new_pos = find_new_idx(string, pos, tmp, f_start, f_end, b_start, b_end, f_long)
        #if dry_run:
        #    if DEBUG: print 'Test:',
        if DEBUG: print 'New idx for s[%d] (%s): %d (%s)' % (pos, tmp, new_pos, string[new_pos])
        if pos == new_pos:
            break
        elif dry_run:
            tmp = string[new_pos]
            if new_pos == dry_run:
                return True
        elif tmp == string[new_pos]:
            pass
        elif tmp == ' ':
            if b_start!=-1 and new_pos in {f_end-1, b_start}:
                tmp, string[new_pos] = string[new_pos], tmp
            else:
                tmp, string[new_pos] = string[new_pos], '@'
            assignments += 1
        elif string[new_pos] == ' ':
            if b_start!=-1 and new_pos in {f_end-1, b_start}:
                tmp, string[new_pos] = string[new_pos], tmp
            else:
                tmp, string[new_pos] = string[new_pos], tmp.upper()
            assignments += 1
        else:
            tmp, string[new_pos] = string[new_pos], tmp
            assignments += 1
        pos = new_pos
        processed_something = True
    if dry_run:
        return False
    return assignments

def reverse(string, f_start, f_end, b_start, b_end=-1, f_long=-2):
    if DEBUG: print 'reverse: %d %d %d %d %d' % (f_start, f_end, b_start, b_end, f_long)
    if DEBUG: print
    if DEBUG: print ''.join(string)
    assignments = 0
    if b_start == -1:
        for i in range(f_start, (f_start+f_end)/2):
            if DEBUG: print 'Starting from i=%d' % i
            if any(process_loop(string, j, f_start, f_end, -1, f_end, dry_run=i) for j in range(f_start, i)):
                continue
            assignments += process_loop(string, i, f_start, f_end, -1, f_end)
            if DEBUG: print
            if DEBUG: print ''.join(string)
    else:
        for i in range(f_start, f_end):
            if DEBUG: print 'Starting from i=%d' % i
            if any(process_loop(string, j, f_start, f_end, b_start, b_end, f_long, i) for j in range(f_start, i)):
                continue
            assignments += process_loop(string, i, f_start, f_end, b_start, b_end, f_long)
            if DEBUG: print
            if DEBUG: print ''.join(string)
    for i in range(len(string)):
        if string[i] == '@':
            string[i] = ' '
            assignments += 1
        if string[i].isupper():
            string[i] = string[i].lower()
            assignments += 1
    return assignments

class SuperList(list):
    def index(self, value, start_idx=0):
        try:
            return self[:].index(value, start_idx)
        except ValueError:
            return -1

    def rindex(self, value, end_idx=-1):
        end_idx = end_idx % (len(self)+1)
        try:
            result = end_idx - self[end_idx-1::-1].index(value) - 1
        except ValueError:
            return -1
        return result

def min_reverse(string):
    # My algorithm
    assignments = 0
    lower = 0
    upper = len(string)
    while lower < upper:
        front = string.index(' ', lower) % (upper+1)
        back = string.rindex(' ', upper)
        while abs(front-lower - (upper-1-back)) > 1 and front < back:
            if front-lower < (upper-1-back):
                front = string.index(' ', front+1) % (upper+1)
            else:
                back = string.rindex(' ', back)
            if DEBUG: print lower, front, back, upper
        if front > back:
            break
        if DEBUG: print lower, front, back, upper
        if abs(front-lower - (upper-1-back)) > 1:
            assignments += reverse(string, lower, upper, -1)
            lower = upper
        elif front-lower < (upper-1-back):
            assignments += reverse(string, lower, front+1, back+1, upper, -1)
            lower = front+1
            upper = back+1
        elif front-lower > (upper-1-back):
            assignments += reverse(string, lower, front, back, upper, 1)
            lower = front
            upper = back
        else:
            assignments += reverse(string, lower, front, back+1, upper, 0)
            lower = front+1
            upper = back
    return assignments

def minier_find_new_idx(string, pos, char):
    n = len(string)
    try:
        word_start = pos - next(i for i, char in enumerate(string[pos::-1]) if char == ' ') + 1
    except:
        word_start = 0
    try:
        word_end = pos + next(i for i, char in enumerate(string[pos:]) if char == ' ')
    except:
        word_end = n
    word_len = word_end - word_start
    offset = word_start
    result = (n-offset-(word_end-pos))%n
    if string[result] == ' ':
        return n-result-1
    else:
        return result

def minier_process_loop(string, start_idx, dry_run=False):
    assignments = 0
    pos = start_idx
    tmp = string[pos]
    processed_something = False
    while pos != start_idx or not processed_something:
        new_pos = minier_find_new_idx(string, pos, tmp)
        #print 'New idx for s[%d] (%s): %d (%s)' % (pos, tmp, new_pos, string[new_pos])
        if pos == new_pos:
            break
        elif dry_run:
            tmp = string[new_pos]
            if new_pos == dry_run:
                return True
        elif tmp == string[new_pos]:
            pass
        else:
            tmp, string[new_pos] = string[new_pos], tmp
            assignments += 1
        pos = new_pos
        processed_something = True
    if dry_run:
        return False
    return assignments

def minier_reverse(string):
    # primo's answer for comparison
    assignments = 0
    for i in range(len(string)):
        if string[i] == ' ':
            continue
        if any(minier_process_loop(string, j, dry_run=i) for j in range(i) if string[j] != ' '):
            continue
        assignments += minier_process_loop(string, i)
    n = len(string)
    for i in range(n/2):
        if string[i] == ' ' and string[n-i-1] != ' ':
            string[i], string[n-i-1] = string[n-i-1], string[i]
            assignments += 2
        elif string[n-i-1] == ' ' and string[i] != ' ':
            string[i], string[n-i-1] = string[n-i-1], string[i]
            assignments += 2
    return assignments

def main():
    while True:
        str_input = raw_input('Enter string: ')
        string = SuperList(str_input)
        result = min_reverse(string)
        print '"%s": %d, %d' % (''.join(string), result, len(string))
        string = SuperList(str_input)
        result2 = minier_reverse(string)
        print '"%s": %d, %d' % (''.join(string), result2, len(string))

if __name__ == '__main__':
    main()

Python, Score: asymptotically 2, in normal case much less
old code removed due to space constraint
The idea is to iterate through each index, and for each index i, we take the character, calculate the new position j, memorize the character at position j, assign the character at i to j, and repeat with character at index j. Since we need the space information to calculate the new position, I encode old space as the uppercase version of the new letter, and new space as '@'.

If you can reduce the number of words in the worse case to be in terms of length of the string (say, to length(string)/3 by forcing each word in the worst case to be at least of length 2 somehow), then the score will be less than 2 (in the example above it will be 1.67)

I added a swap counter to mine; yours does actually beat mine for the worst case (but not the general case). Need to find a way to fix that ;)

Line 127: if any(process_loop(...) for j in range(...)) Wouldn't the assignments from these process loops need to be counted?

That doesn't do any assignment. If you see, the dry_run parameter is set to non-zero (the value to i). Inside the process_loop, if dry_run is non-zero, it won't do any assignment.

Ahh, I see now. Perhaps you could explain the algorithm used, so that it would be easier to confirm the worst case ;)

I already explained it in the previous version of my answer. Basically I try to find a sequence of first few words and a sequence of last few words which lengths differ by at most one, then perform the reversal on the concatenation of those two sequences, with additional advantage that, depending on the case (there are 4 possible cases), we know in some positions that the original position is a space or not. Hence we can directly swap the characters in those places, saving a few assignments. =)

@primo: explanation added :)

I think I have a better picture now. In essense, two distinct methods with different worst case behavior are combined, in order to eliminate the worst case for both. I like it. I think in general, this may be the best approach to take, although it seems likely two (or more) completely different methods could be combined to reduce the worst case even further.

Hmm, I think it's not about combining two distinct methods, as there is only one single "word reversal algorithm" (which is yours, in my latest update) in my algorithm. My algorithm can be regarded as "the framework to improve any word reversal algorithm", which is the finding of position k as described.

Perl, score 1.3̅
For each non-space character one assignment is performed, and for each space character two assignments. Because space characters cannot amount to more than one half the total number of characters, the worst case score is 1.5.
The algorithm hasn't changed, but I can prove a lower upper bound. Let us make two observations:

Spaces directly across from spaces do not need to be swapped.
Single character words directly across from spaces are not swapped during the main phase, but only once at the end.

It can then be seen that the theoretical 'worst case' with asymptotically 1/2 spaces is not worst case at all: ab c d e f g h i ...
$ echo ab c d e f g h i j k l m n o p q r s t u v w x y z|perl reverse-inplace.pl
z y x w v u t s r q p o n m l k j i h g f e d c ab
swaps: 51; len: 50
ratio: 1.02

In fact, it's quite a good case.
In order to prevent observation one and two above, each one-character word would need to be repositioned into the middle of a word three or more characters long. This would suggest a worst case containing asymptotically 1/3 spaces: a bcd a bcd a ... bc
$ echo a bcd a bcd a bcd a bcd a bcd a bc|perl reverse-inplace.pl
bc a bcd a bcd a bcd a bcd a bcd a
swaps: 45; len: 34
ratio: 1.32352941176471

Or equivalently, only two-character words: a bc de fg hi jk ...
$ echo a bc de fg hi jk lm no pq rs tu vx xy|perl reverse-inplace.pl
xy vx tu rs pq no lm jk hi fg de bc a
swaps: 49; len: 37
ratio: 1.32432432432432

Because the worst case contains asymptotically 1/3 spaces, the worst case score becomes 1.3̅.
#!perl -l
use warnings;

$words = <>;
chomp($words);
$len = length($words);
$words .= ' ';
$spaces = 0;
# iterate over the string, count the spaces
$spaces++ while $words =~ m/ /g;

$origin = 0;
$o = vec($words, $origin, 8);
$cycle_begin = $origin;
$swaps = 0;

# this possibly terinates one iteration early,
# if the last char is a one-cycle (i.e. moves to its current location)
# one-cycles previous to the last are iterated, but not swapped.
while ($i++ < $len - $spaces || !$was_cycle) {
  $w_start = rindex($words, ' ', $origin);
  $w_end = index($words, ' ', $origin);
  $pos = ($origin - $w_start) - 1;
  $target = $len - ($w_end - $pos);
  $t = vec($words, $target, 8);

  if ($t == 32) {
    $target = $len - $target - 1;
    $t = vec($words, $target, 8);
  }

  # char is already correct, possibly a one-cycle
  if ($t != $o) {
    $swaps += 1;
    vec($words, $target, 8) = $o;
  }

  $origin = $target;
  $o = $t;
  if ($origin == $cycle_begin) {
    if ($i < $len - $spaces) {
      # backtrack through everything we've done up to this point
      # to find the next unswapped char ...seriously.
      $origin += 1;
      if (vec($words, $origin, 8) == 32) {
        $origin += 1;
      }
      $bt_origin = 0;
      $bt_cycle_begin = 0;
      while ($bt_cycle_begin < $origin) {
        $w_start = rindex($words, ' ', $bt_origin);
        $w_end = index($words, ' ', $bt_origin);
        $pos = ($bt_origin - $w_start) - 1;
        $target = $len - ($w_end - $pos);
        $t = vec($words, $target, 8);

        if ($t == 32) {
          $target = $len - $target - 1;
          $t = vec($words, $target, 8);
        }

        if ($target == $bt_cycle_begin) {
          $bt_origin = ++$bt_cycle_begin;
          if (vec($words, $bt_origin, 8) == 32) {
            $bt_origin = ++$bt_cycle_begin;
          }
        } else {
          $bt_origin = $target;
        }

        if ($target == $origin) {
          $origin += 1;
          if (vec($words, $origin, 8) == 32) {
            $origin += 1;
          }
          $bt_origin = $bt_cycle_begin = 0;
        }
      }
    }

    $cycle_begin = $origin;
    $o = vec($words, $origin, 8);
    $was_cycle = 1;
  } else {
    $was_cycle = 0;
  }
}

for $i (0..$len/2-1) {
  $mirror = $len - $i - 1;
  $o = vec($words, $i, 8);
  $m = vec($words, $mirror, 8);
  # if exactly one is a space...
  if (($o == 32) ^ ($m == 32)) {
    $swaps += 2;
    vec($words, $mirror, 8) = $o;
    vec($words, $i, 8) = $m;
  }
}

chop($words);
print $words;
print "swaps: $swaps; len: $len";
print 'ratio: ', $swaps/$len;

Edit: Added a swap counter, and the ratio.
Input is taken from stdin. Sample usage:
$ echo where in the world is carmen sandiego|perl reverse-inplace.pl
sandiego carmen is world the in where
swaps: 35; len: 37
ratio: 0.945945945945946

Method
To begin, the first character of the string is moved to its final destination. The character just replaced is then moved to its destination, etc. This continues until one of two conditions is met:

The character should be swapped with a space.
When this occurs, the character is not swapped with the space, but rather into the mirror position of the space. The algorithm continues from that position.
A cycle has been reached.
When the target returns to the initial starting position of the current cycle, the next unswapped character (or rather, any unswapped character would do) needs to be found. To do this under constant memory constraints, all swaps that have been made up to this point are back-tracked.

After this phase, each non-space character has been moved at most once. To finish, all space characters are swapped with the characters at their mirror positions, requiring two assignment operations per space.

Wow, that's cool. Can you explain why putting the character to the mirror position of the space gives correct answer?

I think this can be improved to score 1 at the cost of a lot, lot more backtracking

@Niklas, I don't think that's possible. Because to do the backtracking you need the space position information. If you override that information, you can't do the backtracking.

@justhalf I'm thinking to find the position, virtually (but not actually) reverse all the work you have done before, which of course again involves recreating the cycles that are no longer valid, so you need to backtrack again etc. All in all it's super expensive, and I'm not really sure if it would actually work

I make a comparison against my algorithm in my answer here: http://codegolf.stackexchange.com/a/26952/16337

@justhalf nvm, can't be done in constant space of course

@justhalf In the final string, all spaces will be in their mirrored position. Therefore, we can safely use this position to store the character that replaces the space, and switch them at the end.

Well done. I had a similar idea but didn't think of just leaving the spaces in place and then mirroring them.

Bravo for the new proven upper bound of 1.33! =D

@justhalf I need to thank you for pointing out that the theoretical worst case wasn't worst case after all.

I'm working on a hybrid approach of yours and mine. I'm trying to prove that the score is 1.25 =D

Ruby, score 2
As a starter a very basic algorithm. It first reverses the whole string and then reverses each word in the string again. In the worst case (one word, even number of characters) the score becomes 2.
def revstring(s, a, b)
  while a<b
    h = s[a]
    s[a] = s[b]
    s[b] = h
    a += 1
    b -= 1
  end
  s
end

def revwords(s)
  revstring(s, 0, s.length-1)
  a = 0
  while a<s.length
    b = a+1
    b += 1 while b<s.length and s[b]!=" "
    revstring(s, a, b-1)
    a = b+1
  end
  s
end

Usage:
> revwords("hello there everyone")
"everyone there hello"

Why didn't you use a Ruby built-in function to reverse a string? Would it change the score?

use, s[a], s[b] = s[b], s[a]

C++: Score 2
#include<iostream>
#include<algorithm>

void rev(std::string& s)
{
    std::reverse(s.begin(),s.end());
    std::string::iterator i=s.begin(),j=s.begin();
    while(i!=s.end())
    {
        while(i!=s.end()&&(*i)==' ')
            i++;
        j=i;
        while(i!=s.end()&&(*i)!=' ')
            i++;
        std::reverse(j,i);
    }
}

int main()
{
    std::string s;
    getline(std::cin,s);
    rev(s);
    std::cout<<s;
}

I tested it. Works well!

C : Score 2
This just flips the entire string once then reverses each word.
#include <stdio.h>
#include <string.h>

void reverse(char *s,unsigned n){
    char c;
    unsigned i=0,r=1;
    while(i < n){ //no swap function in C
        c=s[i];
        s[i++]=s[n];
        s[n--]=c;
    }
}

unsigned wordlen(char *s){
    unsigned i=0;
    while (s[i] != ' ' && s[i]) ++i;
    return i;
}

int main(int argc, char **argv) {
    char buf[]="reverse this also";
    char *s=buf;
    unsigned wlen=0,len=strlen(s)-1;
    reverse(s,len);  //reverse entire string
    while(wlen<len){  // iterate over each word till end of string
      wlen=wordlen(s);
      reverse(s,wlen-1);
      s+=wlen+1;
      len-=wlen;
    }
    printf("%s\n",buf);
    return 0;
}

This is a code-only answer. Consider adding an explanation of what goes on in your code.

Rebol
reverse-words: function [
    "Reverse the order of words. Modifies and returns string (series)"
    series [string!] "At position (modified)"
  ][
    first-time: on
    until [
        reverse/part series f: any [
            if first-time [tail series]
            find series space
            tail series
        ]
        unless first-time [series: next f]
        first-time: off
        tail? series
    ]

    series: head series
]

I'm unclear on the scoring for this.   There is no direct string assignment in this code.  Everything is handled by the one reverse/part which does in-place reversing within and initially on the whole the string.
Some detail on the code:

Loop through string (series) until it reaches the tail?

First time in loop do full reverse of string - reverse/part series tail series (which is same as reverse series)

Then reverse every word found on further iterations - reverse/part series find series space

Once exhausted word finds then return tail series so that it will reverse last word in string - reverse/part series tail series

Rebol allows traversing of a string via an internal pointer. You can see this at series: next f (move pointer to after space so beginning of next word) and series: head series (resets pointer back to the head).
See Series for more info.
Usage example in Rebol console:
>> reverse-words "everyone there hello"
== "hello there everyone"

>> x: "world hello"
== "world hello"

>> reverse-words x
== "hello world"

>> x
== "hello world"

>> reverse-words "hello"
== "hello"

On the first pass each character is repositioned once, and on the second pass each non-space character is repositioned again. For an arbitrarily large input with relatively few spaces, the score approaches 2.

Python: score 2
Almost identical to Howard's algorithm, but does the reversal steps in reverse (first flips words then flips the whole string). Additional memory used is 3 byte-size variables: i, j, and t. Technically, find and len are using some internal variables, but they could just as easily re-use i or j without any loss of function.
quick edit: saving on string assignments by only swapping when characters differ, so I can grab some extra points from note #2.
from sys import stdin

def word_reverse(string):
    # reverse each word
    i=0
    j=string.find(' ')-1
    if j == -2: j=len(string)-1
    while True:
        while i<j:
            if string[i] != string[j]:
                t = string[i]
                string[i] = string[j]
                string[j] = t
            i,j = i+1,j-1
        i=string.find(' ', i)+1
        if i==0: break
        j=string.find(' ', i)-1
        if j == -2: j=len(string)-1
    # reverse the entire string
    i=0
    j=len(string)-1
    while i<j:
        if string[i] != string[j]:
            t = string[i]
            string[i] = string[j]
            string[j] = t
        i,j = i+1,j-1
    return string

for line in stdin.readlines():
    # http://stackoverflow.com/a/3463789/1935085
    line = line.strip() # no trailing newlines ore spaces to ensure it conforms to '[a-z]+( [a-z]+)*'
    print word_reverse(bytearray(line))

Batch
I'll admit to not fully understand the scoring (I think it's two).. but I will say - it does the thing.
@echo off

setLocal enableDelayedExpansion
set c=
set s=

for %%a in (%~1) do set /a c+=1 & echo %%a >> f!c!

for /L %%a in (!c!, -1, 1) do (
    set /p t=<f%%a
    set s=!s!!t!
    del f%%a
)

echo !s!

Input is taken as first standard input value, and so needs to be surrounded by quotation marks -
call: script.bat "hello there everyone"
out: everyone there hello.
Maybe someone else can score me (assuming I haven't, in some other way, disqualified myself).

Javascript
function reverseWords(input) {
    if (input.match(/^[a-z]+( [a-z]+)*$/g)) {
        return input.split(' ').reverse().join(' ');
    }
}

Usage:
> reverseWords('hello there everyone');
'everyone there hello'

I get the strange feeling I missed something...

Yes, this is not in place, because you don't modify the input string. As that's not possible in JavaScript you need to emulate strings with an array of characters (i.e. code point integers or single-character strings).

More to the point, it uses lots and lots of additional space.

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


text:
Algorithmic braiding - for mother's day
Task:
Your task is to create a program that, when given a number of strands and number of iterations of a braid, will tell where each strand goes. Rules are as follows:

The number of strands will always be odd, and between 3 and 6000 (inclusive)
When you start, the strands will be divided into 2 (almost) equal bunches, the left and the right. The left will have one more strand when you start.

For an input of 7:
/ / / / \ \ \
1 2 3 4 5 6 7

Every iteration, the outermost strand of the side with more strands will be put in the center facing the opposite direction. The center is defined as between opposite facing strands: ////middle\\\.

1 iteration of input 7 (strand 1 was moved to the center):
/ / / \ \ \ \
2 3 4 1 5 6 7

Example:
Input:
3 4

Computations:
1 2 3
 \
2 1 3
   /
2 3 1
 \
3 2 1
   /
3 1 2

Output:
3 1 2

Rules:

You do not need to display the slashes for strand direction, only the numbers.
You only need to display the numbers after the last iteration.
Your output will be space-deliminated ids of the strands
Input will be in the form: strands [space] iterations
The number of strands will always be odd, and 3<=x<=6000
This is code-golf, so the shortest code wins!

Would it not be 3 to 5999 as 6000 is not odd so you will not have 'up to 6000'?

so the output for 11 2 would be 2345611178910?

there should be spaces between numbers in the output so that it's readable for larger inputs

@m.buettner yes, i need to add spaces

@Howard Your submission broke my change

@TheDoctor My answer was there before your change.

make the spaces optional? of course, without the spaces the result is ambiguous, but what are the odds of someone getting it accidentally right?

I think your example should read 123 -> 213 -> 231 -> 321 -> 312.

GolfScript, 33 characters
~\),(@{:^1$[=]:y-.,2//y*^~}*;' '*

The input must be provided on stdin.
Examples (you may test online):
> 7 1
2 3 4 1 5 6 7

> 3 4
3 1 2

> 11 2
2 3 4 5 6 11 1 7 8 9 10

Python: 179 240, 152 characters
First, the 179
For N strands and i iterations, this answer uses O(1) space and O(N) time. I simply compute the end position of each strand, never iterating over the intermediate positions!
big edit: golfed this answer by changing conditionals to boolean algebra. I also wrote a lengthy explanation of how it works. TL;DR: formulaic patterns, modulo division.
from sys import *
N,i=map(int,stdin.readline().split())
h,t=N/2,3*N
f=lambda p:(p>N)*(t/2-(p&-2))+p/2+1
for s in xrange(N):print f((2*s+1+(s>h)*(t-4*s-2)+i*(N+1-N*(s!=h)))%(2*N)),

Now the 152
This is more reasonably golfed python. (edit: thanks to Alex Thornton for editing from 165 to 152)
from sys import*;l=map;r=range;n,m=l(int,stdin.readline().split());b=r(1,n+1)
for k in r(m):v=b.pop((0,n-1)[k%2]);b.insert(n/2,v)
print' '.join(l(str,b)

Have golfed it even further down to 151 if you're interested: http://pastebin.com/1pbwax6s

simple changes, but very effective. thanks!

I think you could cut it down even further by removing the l and v variables and changing the insert to a slice assignment.

I'm sure the golf could be shorter. Honestly I just expected comments on the first one if anything!

I wrote up an explanation anyway and updated the post :)

And all the way down to 104: http://pastebin.com/Jb0QdQu3

Python 2 (109) / Python 3 (121)
Python 2
s,n=map(int,raw_input().split())
b=range(s)
for i in range(n):b[s/2:s/2]=[b.pop(0-i%2)]
for x in b:print x+1,

Python 3
s,n=map(int,input().split())
b=list(range(s))
for i in range(n):b[s//2:s//2]=[b.pop(0-i%2)]
for x in b:print(x+1,end=' ')

The code must have been bribed by Python 2 to showcase its golfing advantages over Python 3: ranges being lists, division rounding down to an int, print not starting a newline.
The weird 0-i%2 is because -i%2 evaluates as (-i)%2.
There's probably a more efficient approach than iterating, namely computing each final result directly. The braiding operation has period 2*s, so it can't be that complicated.

Ruby, 105
Just a lot of set manipulation.  Push, pop, reverse and shift!  I tried not converting inputs to integers, but it added about 20 characters.
n,i=$*.map(&:to_i)
f=l=(1..n).to_a
t=r=l.pop(n/2).reverse
i.times{f,t=t<<f.shift,f}
$><<(l+r.reverse)*' '

l and r (left and right) are the "thread" queues. right is reversed so we start pulling from the outside.
t and f (to and from) start off as right and left, respectively, but as we go we keep swapping them so we can always shift the last "thread" from from and push it to to (f,t=t<<f.shift,f).  This saves a LOT of space.
Then we just re-reverse right at the end.
Changelog:
2.2 105 oh yeah, map can take a proc
2.1 108 And actually, just flip things as part of manipulation.
2.0 116 don't use that temporary array. Instead use two pointer variables we can manipulate and keep re-pointing. Then only display the end
1.0 123 initial idea

Java, 270 chars
golfed:
import java.util.*;class B{public static void main(String[] a){int n=Integer.valueOf(a[0]),t=Integer.valueOf(a[1]),i=0;List<Integer> r=new ArrayList<Integer>();for(;i<n;i++){r.add(i+1);}for(i=0;i<t;i++){int k=i%2==0?0:n-1;r.add(n/2,r.remove(k));}System.out.println(r);}}

un-golfed:
import java.util.*;
public class Braid {
    public static void main(String[] args) {
        int num = Integer.valueOf(args[0]);
        int iterations = Integer.valueOf(args[1]);

        //populate array
        List<Integer> arr = new ArrayList<Integer>();
        for (int i=0; i < num; i++) {
            arr.add(i+1);
        }
        for (int i=0; i < iterations; i++) {
            int index = i%2==0?0:num-1;
            arr.add(num/2, arr.remove(index));
        }
        System.out.println(arr);
    }
}

Run online


text:
Golf the Pigeonhole sort
Implement the Pigeonhole sort. This is a variant of the Bucket sort, and its logic is very simple: index your items (by a given function) and then return all non-empty indexes' items.
Your program/function should get an array of items in the most comfortable way for your language of choice, (i.e. a parameter, stdin, etc.), and in any format you like (for example: JSON). It should return/output a sorted array.
Do not modify the given array.
The second parameter that will be given to your program/function will be the "sort-by function". For exmaple, in JavaScript it will be something like function(item){return item.id;}.
For simplicity, you can assume this function returns a unique positive Integer for each item in the given array.
Shortest code wins. Only ASCII is allowed.

To implement pigeonhole sort you need to know the range of your sort-by function.

Fair enough. Range is 1 to INT_MAX. (This is why I added the assumption).

Can we assume the function returns a unique integer for each item, or only for each unique item? (say if the array is [1,1,1] will the function return three different values?)

As I said, the sort-by function will return a unique ID per each item in the given array. This imply that the input array has no repetitions. If this is not understood, you can simply assume all items in the input array are unique (i.e. [1,1,1] is not a valid input for this challenge.

Husk solution: Ö

@Razetime amazing! But if Husk was only created in 2017, it cannot compete in thit this challenge which was composed in 2014.

J (39)
f=:1 :'y{~z i.g#~+/z=/g=.i.>:>./z=.u y'

Explanation:

z=.u y: apply the function u to the argument y. The function should distribute over the array.
g=.i.>:>./z: Make the 'holes' (in the range [0..max(u(y))]).
+/z=/g: for each hole, get how many elements it contains.
g#~: replicate each hole coordinate by how many elements it contains (so if holes 3 and 5 had 1 element, and hole 8 had 3, we get 3 5 8 8 8).
z i.: look up the position of each value in z. For example, if u y is 5 for the 3rd element of y, this gives 3 for 5.
y{~z: look up the matching elements in the starting array

Examples:
   f=:1 :'y{~z i.g#~+/z=/g=.i.>:>./z=.u y'

   NB. functions and data
   ascii=:a.&i.
   text=:'here is some text to sort'
   length=:#&>
   arrays=:1 2;3;4 5 6 7;8 9 10 NB. these will be sorted by length

   NB. show effect of functions
   ascii text
104 101 114 101 32 105 115 32 115 111 109 101 32 116 101 120 116 32 116 111 32 115 111 114 116
   length arrays
2 1 4 3

   NB. sort
   ascii f text
     eeeehimooorrsssttttx
   length f arrays
┌─┬───┬──────┬───────┐
│3│1 2│8 9 10│4 5 6 7│
└─┴───┴──────┴───────┘

Ruby, 43
def s a,*b,&f
a.map{|x|b[f[x]]=x}
b-[p]
end

Calling looks like
p s(["a","ccc","bb","eeeee"],&:length)
  -> ["a", "bb", "ccc", "eeeee"]

Tricks: *b in the arg list creates an empty output array (so long as you don't, y'know, pass any args). &f creates a lambda reference to the passed-in block that can be called via f[] (normal Ruby convention is to use yield). a.map iterates over the input array without modifying it and is one character shorter than a.each. b-[p] strips out the nil values, equivalent to b.compact.

Excellent example of Ruby golf tricks. If the sort can be an anonymous lambda, one can write it in 37 characters as ->(f,a,*b){a.map{|x|b[f[x]]=x} newline nb-[p]}, but then the call would look like ->(f,a...b-[p]}[proc(&:length),["a","ccc","bb","eeeee"]].

Python 2 - 98 92 bytes
def p(l,f):
 x=[None]*max(map(f,l))
 for e in l:x[f(e)-1]=e
 return[i for i in x if i!=None]

l is the list to sort, f is the sort-by function.
Ungolfed (a bit):
def pigeonhole(list, sort_function):
    max_value = max(map(sort_function, list)) # Find how big the final list has to be
    sorted_list = [None] * max_value # Create a list of that many Nones

    for element in list:
        sorted_list[sort_function(element) - 1] = element # Subtract one because sort_function returns positive ints and lists are 0-indexed

    return [element for element in sorted_list if element is not None] # Filter out Nones and return

def return_same(x):
    return x # This sort function will make the pigeonhole sort ints normally. There's no reason it has to be this function, it just has to return positive ints.

print pigeonhole([8, 4, 5, 9, 11, 3], return_same) # [3, 4, 5, 8, 9, 11]

Groovy - 135 chars
Using Groovy 2.2.1, inspired by undergroundmonorail's answer, though here input data and sort function are specified in files:
e={new GroovyShell().evaluate(new File(args[it]))}
l=e(0)
f=e(1)
s=new Object[l.max{f(it)}]
l.each{s[f(it)-1]=it}
println s.findAll{it}

As an assist to the reader, l = list of items (from file), f = sort function (from file), s = sorted list, and e = simple convenience function to evaluate data as code.
An example command-line looks like:
groovy P.groovy data.txt f.txt

where data.txt is:
[8,4,5,9,11,3]

and f.txt is:
{ x -> x }

JavaScript - 92
I believe this is what is asked for.
function s(a,b){c=[];a.map(function(e){c[b(e)]=e});return c.filter(function(f){return !!f})}

Test:
console.log(s([{id:3},{id:5},{id:7},{id:1}],function(x){return x.id}));

returns:
[1: Object, 3: Object, 5: Object, 7: Object]
1: Object
id: 1
3: Object
id: 3
5: Object
id: 5
7: Object
id: 7

EDIT: fixed as per @Jacob's comments.

Does not meet requirement of "all non-empty indexes' items". Your output is sparse array, while the expected output array length has to be the same as the input's length. Consider this input for example: s([{id:7,n:'T'},{id:34,n:'R'},{id:2,n:'Q'}],function(i){return i.id}), your output is [undefined × 2, Object, undefined × 4, Object, undefined × 26, Object] (length is 35), while the expected length is 3.

Haha, if you wrap that in console.log it outputs nicely. Will fix up. Thanks.

C++14, 154 bytes
As unnamed lambda:
#include<map>
#include<vector>
[](auto&v,auto f){std::map<int,int>m;for(int c:v)m[f(c)]=c;std::vector<int>r;for(auto p:m)r.push_back(p.second);return r;}

Assumes v to be a container like vector<int>, could also be int[]
Ungolfed:
auto f =
[](auto&v, auto f){
  std::map<int,int> m;
  for(int c:v)
    m[f(c)]=c;
  std::vector<int> r;
  for(auto p:m)
    r.push_back(p.second);
  return r;
};

Usage:
int main() {
  std::vector<int> v={5,2,1,3,4};
  auto w = f(v, [](int x){return x;});
  for (auto c:w) std::cout << c << ", ";
  std::cout << "\n";
}


text:
Linear Function Solver from Two Points (x,y)
The Task
Write a function L() that takes two Tuple arguments of coordinates in the form (x, y), and returns their respective linear function in the form (a, c), where a is the co-efficent of the x term and c is the y-intercept.
You can assume that the input will not be a line perpendicular the the x axis, and that the two inputs are separate points.
Scoring
This is Code Golf: shortest program wins.
Please Note: No use of any mathematical functions apart from basic operators (+,-,/,*).
Example
Here is my un-golfed solution in Python.
def L(Point1, Point2):
    x = 0
    y = 1
    Gradient = (float(Point1[y]) - float(Point2[y])) / (float(Point1[x]) - float(Point2[x]))
    YIntercept = Point1[y] - Gradient * Point1[x]
    return (Gradient, YIntercept)

Output:
>>> L( (0,0) , (1,1) )
(1.0, 0.0)

>>> L( (0,0) , (2,1) )
(0.5, 0.0)

>>> L( (0,0) , (7,1) )
(0.14285714285714285, 0.0)

>>> L( (10,22.5) , (5,12.5) )
(2.0, 2.5)

L( (0,0) , (0,1) )?

You can assume that the input is not a line parallel to the X axis.

You can assume that the input is not a line parallel to the X axis. Do you mean Y axis?

Sorry, the edit on the post was correct, perpendicular to the X axis.

L((0,0),(0,0))?

You guys are so good at digging holes... Two inputs must be different.

This is extremely close to being a cut-down version of Shamir's secret-sharing.

@PeterTaylor This is also close to being a duplicate of http://codegolf.stackexchange.com/questions/5429/rosetta-stone-challenge-find-the-rule-for-a-series.

J - 23 char
Fairly straightforward. Defines a dyadic verb L to be used as (x1,y1) L (x2,y2).
L=:%~/@:-,-/@(*|.)%-&{.

Explanation:
L=:%~/@:-,-/@(*|.)%-&{.  NB. the function L
                    &{.  NB. x coord of both points
                   -     NB. left x minus right x
             ( |.)       NB. flip right argument: (y2,x2)
              *          NB. pointwise multiplication of (x1,y1) and (y2,x2)
          -/@            NB. subtract the two results: (x1*y2)-(y1*x2)
                  %      NB. divide: (x1*y2 - y1*x2)/(x1-x2)
        -                NB. pointwise subtraction
   %~/@:                 NB. divide y difference by x diff: (y1-y2)/(x1-x2)
         ,               NB. append results together
L=:                      NB. assign function to L

Examples:
   L=:%~/@:-,-/@(*|.)%-&{.
   0 0 L 1 1
1 0
   0 0 L 2 1
0.5 0
   0 0 L 7 1
0.142857 0
   10 22.5 L 5 12.5
2 2.5
   0 0 L 0 1  NB. __ is negative infinity
__ 0

GNU dc, 30 24 bytes
[sysxly-rlx-/dlx*lyr-]sL

Defines a macro L such that
(x1, y1, x2, y2) should be pushed to the stack in that order before calling, and after calling L, (a, c) may be popped from the stack (in reverse order of course - it is a stack).
Testcase (save as "linear.dc" and run dc linear.dc):

[sysxly-rlx-/dlx*lyr-]sL   # Define L macro

10                         # Push x1 to the stack
22.5                       # Push y1 to the stack
5                          # Push x2 to the stack
12.5                       # Push y2 to the stack

lLx                        # Call L macro
f                          # Dump the stack

Output is:

$ dc linear.dc
2.5
2
$

Explanation of L macro:

sy pop y2 to y register
sx pop x2 to x register
ly push y register (y2)
- subtract y2 from y1
r swap (y1 - y2) and x1 on stack
lx push x register (x2)
- subtract x2 from x1
/ divide (y1 - y2) by (x1 - x2) to get gradient
d duplicate gradient
lx push x register (x2)
* multiply (x2) by gradient
ly push y register (y2)
r swap (y2) and (x2 * gradient) on stack
- subtract (x2 * gradient) from (y2)

Thanks, not bad. I admit to being beaten. ;)

@m.buettner Re-golfed and re-explained.

Haskell, 41 characters
f(x,y)(u,v)=(a,y-a*x)where a=(y-v)/(x-u)

Not a lot to golf here. It's pretty much what you'd write normally minus whitespace.

Mathematica, 55 38 bytes
This was surprisingly long (those pesky long function names...) EDIT: Changed the approach for the axis intercept (taking some inspiration from the OP's own answer). It turns out calculating it directly wasn't the most clever idea.
L={g=1/Divide@@(#2-#),#[[2]]-g#[[1]]}&

Use like
L[{10,22.5},{5,12.5}]
> {2., 2.5}

Thanks to Mathematica you can also obtain the general result:
L[{r,s},{p,q}]
> {(p - r)/(q - s), (q r - p s)/(q - s)}

(This last example shows how I had originally implemented this.)
Just for the record
L[{0,0},{0,1}]
> {ComplexInfinity, Indeterminate}

which is technically correct.

Ahh, Awesome, I had a bit of a mind black figuring that out, I'll blame it on my tiredness

+1.  Why ComplexInfinity and not plain old Infinity? (I don't know Mathematica)

@DigitalTrauma I think it's because, without explicitly telling Mathematica that it can work in reals, it always assumes the the space in question to be complex numbers, so as not to throw away complex solutions of real equations.

JavaScript, 62 48
Thanks to @Michael for golfing it down with ES 6.
L=(a,b)=>[s=(b[1]-a[1])/(b[0]-a[0]),a[1]-s*a[0]]

Old version:
function L(a,b){return[s=(b[1]-a[1])/(b[0]-a[0]),a[1]-s*a[0]]}

Sample input:
L([0,0],[7,1])

Sample output:
[0.14285714285714285, 0]

For the record:
L([0,0],[0,1])
[Infinity, NaN]

46 using ES6 : L=(a,b)=>[g=(p=a[1]-b[1])/(q=a[0]-b[0]),p-g*q]

@Michael Cool. I am sort of a JS newbie, so I didn't know you could do that. Thanks.

@m.buettner You're right... Fixed

Now all answers are exactly ten characters apart. :D

Awww. The bunny changed!

C# 105 bytes
This is isn't just the function and will compile completely on it's own. I had put L in the System namespace to shorting the using, but it's better to fully qualify and save on using a namespace. Saved the brackets. Also a saving from return new z[] into return new[]
using z=System.Single;class P{z[] L(z[]a,z[]b){z c=(a[1]-b[1])/(a[0]-b[0]);return new[]{c,a[1]-c*a[0]};}}

Is (c*a[0]) necessary? Can't you eliminate those parenthesis and save 2 bytes?

@KyleKanos Yes, thanks. While c# doesn't use BODMAS the multiplication will be done first (I think).

I'd say you have to include the namespace declaration, or change it to System.Single, for this solution to be valid.

Python3 (51)
def L(p,q):x,y=p;X,Y=q;m=(Y-y)/(X-x);return m,y-x*m

Lua 5.1.4: 66 64 bytes
function L(q,w)a=(q[2]-w[2])/(q[1]-w[1])return a,q[2]-a*q[1];end

Example Usage:
> print(L( {0,0}, {1,0} ))
-0   0
> print(L( {0,0}, {1,1} ))
1    0
> print(L( {0,0}, {7,1} ))
0.14285714285714    0
> print(L( {0,0}, {0,1} ))
-inf   -nan
> print(L( {0,0}, {0,0} ))
-nan   -nan

C++ 88 (was 106)
Improved: thanks for your comments.
struct t{double x,y;};
t L(t u, t v){u.x=(v.y-u.y)/(v.x-u.x);u.y=v.y-u.x*v.x;return u;}

Golfed:
typedef struct T{double x,y;}t;
t line(t u, t v){t z;z.x=(v.y-u.y)/(v.x-u.x);z.y=v.y-(z.x*v.x);return z;}

Source
typedef struct T{
    double x,y;
} t;

t line(t u, t v)
{
t z;
z.x=(v.y-u.y)/(v.x-u.x);
z.y=v.y-(z.x*v.x);
return z;
}

I see an unnecessary space ;)

If it is C++, why the typedef?

Also, I think you can get rid of z: u.x=(v.y-u.y)/(v.x-u.x); u.y=v.y-z.x*v.x; return u;

Apple Swift 95 86
This may be the first Swift entry on PCG.SE??
func L(x:Float...)->(Float,Float){var a=(x[3]-x[1])/(x[2]-x[0]);return(a,x[1]-a*x[0])}

I don't see this language being a huge hit to the Code Golf community.

Python3 - 64 57 Bytes
def L(q,w):a=(q[1]-w[1])/(q[0]-w[0]);return a,q[1]-a*q[0]

You can get it down to 43 if you don't use Tuple, which many people are doing...
def L(x,y,q,w):a=(x-q)/(y-w);return a,y-a*x

return(a,q[1]-a*q[0])

@ace Thanks, that was sloppy

Golfscript: 25 bytes
~:y\:x;-\x--1?*.x-1**y+\p

Since the function needs to be named 'L', I saved it as 'L.gs' locally.
The catch, as explained by @Dennis in this post, is that we need to trick Golfscript into using rational numbers instead of integers. So this works if you're willing to accept input X1 Y1 X2 Y2 in golfscript notation
# L( (0,0) , (1,1) )
echo "0 0 1 1" | golfscript L.gs
> 1/1
> 0/1
#L( (10,22.5) , (5,12.5) )
echo "10 22 2-1?+ 5 12 2-1?+" | golfscript L.gs
> 2/1
> 5/2

Ruby – 48 characters
Nearly identical to the JavaScript answer:
L=->u,v{a,b,c,d=*u,*v;[s=(d-b).fdiv(c-a),b-s*a]}

PHP (75 chars)
function L($u,$v){return[$s=($v[1]-$u[1])/($v[0]-$u[0]),$v[1]-($s*$v[0])];}

test : print_r(L([0,0],[7,1]));
output :
Array
(
    [0] => 0.14285714285714
    [1] => 0
)

(thanks @ace)


text:
Encode a string for aliens that read and write English, but don't know ASCII
Turns out there are some distant aliens who know English (and have coincidentally standardized on 8-bit computer architectures).  Yet they have never heard of ASCII, nor even alphabetical order.
It is believed that these aliens are picking up information from Earth.  Yet they are doing so with digital equipment that reads meaningless information when no transmission is being sent...thus the signal must be contained in a way to stand out from surrounding noise.
A new standard has been created, modeled after the Arecibo Message's use of a semiprime signal length:
Universal Semiotic Coding for Information Interchange (USCII)
(See: http://uscii.hostilefork.com)
In USCII, each code is derived from a bitmap representing the character, that has a prime width and a prime height.  For instance, this 5x7 representation of a letter A:
01110
10001
10001
10001
11111
10001
10001

That produces 35 bits.  Yet in order to make even single-character messages stand out from the noise and look coherent, strings are embedded in a container format that helps reinforce the prime factors.  The container has been chosen to also make it easy to manipulate the strings on architectures that operate on multiples of 8 bits.
With its container, the "A" above would look like:
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
1111111111111111111111111111111111100000
1111111111111111111111111111111111100000
1111111111111111111111111111111111100000
1111111111111111111111111111111111100000
1111111111111111111111111111111111100000
0111010001100011000111111100011000100000
1111111111111111111111111111111111100000
1111111111111111111111111111111111100000
1111111111111111111111111111111111100000
1111111111111111111111111111111111100000
1111111111111111111111111111111111100000
1111111111111111111111111111111111100000
1111111111111111111111111111111111100000
1111111111111111111111111111111111111111
1111111111111111111111111111111111111111
1111111111111111111111111111111111111111
1111111111111111111111111111111111111111
1111111111111111111111111111111111111111

The characters of the message are first prefixed with five solid 5x7 bitmaps, and seven solid 5x7 bitmaps added to the end.  (The "meter".)  Then each of these have five 0 bits tacked onto the end to make an even 40 bits.
Finally there are 7 all-zero 40-bit runs added to the beginning, and 5 all-one 40-bit runs added to the end.  (The "silence".)
Your mission
You are to write an encoder.  Input is a conventional ASCII string typed from the keyboard.  The bitmaps you will use are from the 5x7 PIC CPU font.
(Note: It's easy enough to extract the font from the page for all the talented code golfers here, but if you want those bytes all together here they are.)
Output should be a printed string in hexadecimal.
Examples
Input:
ABCDEFG

Output:
0000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFE0FFFFFFFFE0FFFFFFFFE0FFFFFFFFE0FFFFFFFFE074631FC620F463E8C7C074610845C0E4A318CB80FC21E843E0FC21E84200746178C5E0FFFFFFFFE0FFFFFFFFE0FFFFFFFFE0FFFFFFFFE0FFFFFFFFE0FFFFFFFFE0FFFFFFFFE0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
Input:
Dear aliens: Please get me off of this planet!!!

Output:
0000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFE0FFFFFFFFE0FFFFFFFFE0FFFFFFFFE0FFFFFFFFE0E4A318CB80001D1FC1E0001C17C5E0002D9842000000000000001C17C5E061084211C00100421080001D1FC1E0002D98C620001F0707C003180630000000000000F463E8420061084211C0001D1FC1E0001C17C5E0001F0707C0001D1FC1E00000000000001F1787C0001D1FC1E0213E421440000000000000375AD620001D1FC1E00000000000001D18C5C01148E210801148E210800000000000001D18C5C01148E210800000000000213E4214408421E8C6200100421080001F0707C00000000000003D1F420061084211C0001C17C5E0002D98C620001D1FC1E0213E421440210840008021084000802108400080FFFFFFFFE0FFFFFFFFE0FFFFFFFFE0FFFFFFFFE0FFFFFFFFE0FFFFFFFFE0FFFFFFFFE0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
Clarifications

There is no need to handle any non-printable characters for this assignment (although feedback on ideas for what those might look like is welcome)

Winning Conditions
0000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFE0FFFFFFFFE0FFFFFFFFE0FFFFFFFFE0FFFFFFFFE074610845C0001D18C5C00842F8C5E0001D1FC1E00000000000746178C5E0001D18C5C061084211C01148E21080210840008021084000802108400080FFFFFFFFE0FFFFFFFFE0FFFFFFFFE0FFFFFFFFE0FFFFFFFFE0FFFFFFFFE0FFFFFFFFE0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF

In my opinion, aliens probably think we are crazy for sending them that stuff.

@KyleKanos If the aliens are smart, they'll think it's cool.  The conclusion that humanity is crazy will happen shortly after someone then uses the format to transmit them information from global news outlets.

The last line is not formatted, can you please format it like the other input and output lines?

@n.1 Is it not displaying properly in your browser?  It looks fine in mine.  Happy to change it if there's a technical problem, but as it describes the winning condition it is technically a "use" and not a "mention" in the use-mention distinction, so I actually had it in the body text style on purpose.  :-)

@Dr. Rebmu: in my browser on the desktop it's OK, but with the Android app the question is too wide: http://meta.stackexchange.com/q/231512/237701

Python 2, 671 669 663 bytes
D=str.decode
d=D(D("eJxNUmsSHiEIuxIgvn76sXr/IzVB26kzqyxCCBGRt0xlOM5RbXp6qv32Omu6lT22nTGiOVe05muMFXM11ZuuynwV52f8E7W11+SdzGMvTl6GHvm3ig6RRBbp3nqNqGEFeACK7m5YZYPAMMGV6qyk4ydKKD3FTPeAcQZhUAw4lh4aR8YcWaaVV480lDTJF64thyT4T+8tCjVofOtLnKInAAYDyJ0e9lxj+wJk/MYJ0nBQvYaRhnbQQEIrB5t1fX2VwdMnZF1zLF/Gf2H62PtXGYwypU5msXo2mNUvclE+QXqY3sNkg3GcKReKRTPrGnizNNCOw+tenSWaLQZf6VC926UYVw7I0y/eDEOo/LfKvvLdEQjt7NTzLXrkI2MmNrMPRYDng4a6VR0ThTKMgUA9XlYzTIsk+XtCH+y2mk1rf6VD4V7Xh2Cxb2YWkdkprlDCTR6yv5jnQSuQScEb0CBu5WXZ1ScN6gMDvWa73HNoy845VMg7wLBlA9wwhAMTiNn6ravFH00dtSc=","base64"),"zip")
i=raw_input()
m="F"*8+"E0"
o="0"*70+m*5
for c in i:x=ord(c)*9-288;o+=d[x:x+9]+"0"
print o+m*7+"F"*50

PHP with zlib, 738 716 715 bytes
<?php $d=gzinflate(base64_decode("TVJrEh4hCLsSIL5++rF6/yM1QdupM6ssQggRkbdMZTjOUW16eqr99jprupU9tp0xojlXtOZrjBVzNdWbrsp8Fedn/BO1tdfkncxjL05ehh75t4oOkUQW6d56jahhBXgAiu5uWGWDwDDBleqspOMnSig9xUz3gHEGYVAMOJYeGkfGHFmmlVePNJQ0yReuLYck+E/vLQo1aHzrS5yiJwAGA8idHvZcY/sCZPzGCdJwUL2GkYZ20EBCKwebdX19lcHTJ2Rdcyxfxn9h+tj7VxmMMqVOZrF6NpjVL3JRPkF6mN7DZINxnCkXikUz6xp4szTQjsPrXp0lmi0GX+lQvdulGFcOyNMv3gxDqPy3yr7y3REI7ezU8y165CNjJjazD0WA54OGulUdE4UyjIFAPV5WM0yLJPl7Qh/stppNa3+lQ+Fe14dgsW9mFpHZKa5Qwk0esr+Y50ErkEnBG9AgbuVl2dUnDeoDA71mu9xzaMvOOVTIO8CwZQPcMIQDE4jZ+q2rxR8="));$i=trim(fgets(STDIN));$f="str_repeat";echo $f(0,70).$f($m="FFFFFFFFE0",5);foreach(str_split($i)as$c)echo substr($d,ord($c)*9-288,9)."0";echo $f($m,7).$f("F",50);

First, your PHP needs to be configured with --with-zlib. And run this script from command line, like php 26972.php. This program takes input from STDIN.
(If short_open_tag=On, I can save 3 more bytes.)
Ungolfed
<?php
$data = gzinflate(base64_decode("TVJrEh4hCLsSIL5++rF6/yM1QdupM6ssQggRkbdMZTjOUW16eqr99jprupU9tp0xojlXtOZrjBVzNdWbrsp8Fedn/BO1tdfkncxjL05ehh75t4oOkUQW6d56jahhBXgAiu5uWGWDwDDBleqspOMnSig9xUz3gHEGYVAMOJYeGkfGHFmmlVePNJQ0yReuLYck+E/vLQo1aHzrS5yiJwAGA8idHvZcY/sCZPzGCdJwUL2GkYZ20EBCKwebdX19lcHTJ2Rdcyxfxn9h+tj7VxmMMqVOZrF6NpjVL3JRPkF6mN7DZINxnCkXikUz6xp4szTQjsPrXp0lmi0GX+lQvdulGFcOyNMv3gxDqPy3yr7y3REI7ezU8y165CNjJjazD0WA54OGulUdE4UyjIFAPV5WM0yLJPl7Qh/stppNa3+lQ+Fe14dgsW9mFpHZKa5Qwk0esr+Y50ErkEnBG9AgbuVl2dUnDeoDA71mu9xzaMvOOVTIO8CwZQPcMIQDE4jZ+q2rxR8="));
$input = trim(fgets(STDIN));
$f = "str_repeat";

echo $f(0, 70).$f($m = "FFFFFFFFE0", 5);
foreach(str_split($input) as $c)
    echo substr($data, ord($c) * 9 - 288, 9)."0";
echo $f($m, 7).$f("F", 50);

+1 for idea of using only 9 hex digits in compressed data.

716 is the # to beat so far... though I'd imagine it can be done in less!  I'll bounty it in a bit, but if no one beats the count, I'll wind up giving it to you... at least you have a Python version and not PHP.  :-)

All right, 663 and not in PHP--even better.  :-)  The bounty is yours!

i and d can be inlined as they are not reused

C
This actually prints human readable hex (vs binary for readablity).  Everything is represented in unsigned long long and only 9-10 hex digits are used due (depending whether you include the 00000 padding) the unfortunate 6x5 format (an 8x4 font would have just been too easy)
#include <stdio.h>
#define u unsigned long long
void p(int n, u x){while(n--) printf("%09llX",x);}
int main(void){
char *s="ABCDEFG";
u a[128]={0xAAAAAAAAAULL,0xADEB7ADEAULL,0xDFF7FDFF6ULL,0xDEF7BDFF6ULL,0xFFFFFFCE6ULL,0xFF41DB82EULL,0xFD7FF747EULL,0xDC63107F6ULL,0xFEEE0BEFEULL,0x0003D0800ULL,0xE1084FB88ULL,0x21084201CULL,0xFB880FB88ULL,0x084ADFB08ULL,0x25F7BDF78ULL,0xE777BDDC8ULL,0xFFC8E27FEULL,0xFDE719DFEULL,0xDED4A73A2ULL,0xFD6B5AD7EULL,0xFC6318C7EULL,0xFD7FF8BBEULL,0xFFFFFFABEULL,0xF81CA703EULL,0x881445022ULL,0xFC58A347EULL,0x8BBDDDFF6ULL,0x1995E73A2ULL,0xAD6B5AD6AULL,0xDEF7BDEF6ULL,0xF7B5204F6ULL,0xFFFFF9EEEULL,0x000000000ULL,0x210840008ULL,0x529400000ULL,0x52BEAFA94ULL,0x23E8E2F88ULL,0xC644444C6ULL,0x64A88AC9AULL,0x611000000ULL,0x111084104ULL,0x410421110ULL,0x012AEA900ULL,0x0109F2100ULL,0x000006110ULL,0x0001F0000ULL,0x000000318ULL,0x004444400ULL,0x74675CC5CULL,0x23084211CULL,0x74422223EULL,0xF88820C5CULL,0x11952F884ULL,0xFC3C10C5CULL,0x3221E8C5CULL,0xF84444210ULL,0x7462E8C5CULL,0x7462F0898ULL,0x031806300ULL,0x031806110ULL,0x111104104ULL,0x003E0F800ULL,0x410411110ULL,0x744222008ULL,0x7442DAD5CULL,0x74631FC62ULL,0xF463E8C7CULL,0x74610845CULL,0xE4A318CB8ULL,0xFC21E843EULL,0xFC21E8420ULL,0x746178C5EULL,0x8C63F8C62ULL,0x71084211CULL,0x388421498ULL,0x8CA98A4A2ULL,0x84210843EULL,0x8EEB58C62ULL,0x8C7359C62ULL,0x746318C5CULL,0xF463E8420ULL,0x74631AC9AULL,0xF463EA4A2ULL,0x7C20E087CULL,0xF90842108ULL,0x8C6318C5CULL,0x8C6318A88ULL,0x8C631AD54ULL,0x8C5445462ULL,0x8C62A2108ULL,0xF8444443EULL,0x72108421CULL,0x000000000ULL,0x70842109CULL,0x22A200000ULL,0x00000003EULL,0x410400000ULL,0x001C17C5EULL,0x8421E8C7CULL,0x001F0841EULL,0x0842F8C5EULL,0x001D1FC1EULL,0x1148E2108ULL,0x001F1787CULL,0x8421E8C62ULL,0x010042108ULL,0x100421498ULL,0x4212A6292ULL,0x61084211CULL,0x00375AD62ULL,0x002D98C62ULL,0x001D18C5CULL,0x003D1F420ULL,0x001F17842ULL,0x002D98420ULL,0x001F0707CULL,0x213E42144ULL,0x002318C5CULL,0x002318A88ULL,0x00231AD54ULL,0x0022A22A2ULL,0x0022A2110ULL,0x003E2223EULL,0x190882106ULL,0x210802108ULL,0xC10822130ULL,0x0BA000000ULL,0xFE2A2AE3EULL};
p(7,0ULL);
p(5,0xFFFFFFFE0ULL);
while(*s)p(1,a[*s++]);
p(7,0xFFFFFFFE0ULL);
p(5,0xFFFFFFFFFULL);
return 0;
}

bash
#!/bin/sh
p(){
i=0
while ([ $i -lt $1 ]) do
printf $2
i=$((i+1))
done
}

t(){
#Given string input $1, go char by char & create "alien" representation

C='~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !"#$%&~)*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~'
A="AAAAAAAAA0ADEB7ADEA0DFF7FDFF60DEF7BDFF60FFFFFFCE60FF41DB82E0FD7FF747E0DC63107F60FEEE0BEFE00003D08000E1084FB88021084201C0FB880FB880084ADFB08025F7BDF780E777BDDC80FFC8E27FE0FDE719DFE0DED4A73A20FD6B5AD7E0FC6318C7E0FD7FF8BBE0FFFFFFABE0F81CA703E08814450220FC58A347E08BBDDDFF601995E73A20AD6B5AD6A0DEF7BDEF60F7B5204F60FFFFF9EEE000000000002108400080529400000052BEAFA94023E8E2F880C644444C6064A88AC9A0611000000011108410404104211100012AEA90000109F2100000000611000001F000000000003180004444400074675CC5C023084211C074422223E0F88820C5C011952F8840FC3C10C5C03221E8C5C0F8444421007462E8C5C07462F08980031806300003180611001111041040003E0F8000410411110074422200807442DAD5C074631FC620F463E8C7C074610845C0E4A318CB80FC21E843E0FC21E84200746178C5E08C63F8C62071084211C038842149808CA98A4A2084210843E08EEB58C6208C7359C620746318C5C0F463E8420074631AC9A0F463EA4A207C20E087C0F9084210808C6318C5C08C6318A8808C631AD5408C544546208C62A21080F8444443E072108421C0000000000070842109C022A200000000000003E04104000000001C17C5E08421E8C7C0001F0841E00842F8C5E0001D1FC1E01148E21080001F1787C08421E8C620010042108010042149804212A6292061084211C000375AD620002D98C620001D18C5C0003D1F4200001F178420002D984200001F0707C0213E421440002318C5C0002318A88000231AD5400022A22A200022A21100003E2223E019088210602108021080C1082213000BA0000000FE2A2AE3E0"

j=0
p 7 0000000000
p 5 FFFFFFFFE0
while ([ "${j}" -lt "${#1}" ]) do
   i=${C%${1:$j:1}*}
   i=${#i}
   printf ${A:$(( $i*10 )):10}
   j=$(($j+1))
done
p 7 FFFFFFFFE0
p 5 FFFFFFFFFF
}
t "Dear aliens: Please get me off of this planet!!!"

@Dr.Rebmu It took longer than I expected to get the "font" into a workable format.  I had planned to post my other shortly, but it took more conversions and formatting than expected.

+1 for meeting the spec!  But there are lots of possibilities in golfing.  Why introduce a new counter in the p routine when n is mutable?  Why repeat the phrase "unsigned long long" twice when a #define could cut that down? Is paying for an 0x and ULL worth it in a hex encoded table where you're only getting 4 bits per character on the digits themselves?  Etc.

@Dr.Rebmu fixed the extra counter (oversight), and I planned to use a macro for the 0x##number##ULL (see bash version for the char alternative), but ideone.com thought it was a function call so I nixed it (gcc was fine) ... I could remove the (void) from main too, but some things just seem wrong.

In code golf, the only "wrong" is if it doesn't run or meet the spec...being "right" is fewer characters!  If you're going to use the approach here in your C program, I'd definitely say you can get the character count down by using hex strings instead of bothering with the unsigned long long (especially when you don't need the integer values except to convert them back into strings, which adds code...)

Please add byte count to the title. Also, you should golf your code down more.

You can remove #include <stdio.h>, remove return 0;, change int main(void) to main(int c,char**v) (with s=v[1] to avoid hardcoding the input string)

PHP, 874 bytes
You will need to run this script from the command line (php uscii.php) because it takes input from stdin.
<?php $f=base64_decode(str_replace('@','AA','@@@QhC@RSl@AClfV9SiPo4viYyIiJjZKiKyawi@@REIQQSCCEIiAEq6p@IT5C@@GEQ@Pg@@@xgAiIiAHRnXMXEYQhCOdEIiI/8RBBi4RlS+IX4eCGLjIh6MXfCIiEIdGLoxc6MXhEwDGAYwAGMAwiBERBBBAB8HwAQQQREQ6IREAR0QtrVzoxj+MfRj6MfOjCEIu5KMYy5+EPQh/8IehCDowvGL4xj+MYuIQhCOOIQhSZGVMUlGEIQhD8d1rGMYxzWcYujGMYu9GPoQg6MY1k30Y+pKL4QcEPvkIQhCRjGMYujGMYqJGMY1qqMVEVGMYxUQhPhEREPuQhCEOBBBBBA4QhCE4iog@@@AH0EE@@A4L4vhCHox8AD4Qg8IQvjF4AOj+DxFI4hC@+Lw+hCHoxiAgCEIQQBCFJiEJUxSWEIQhHAButaxAC2YxiADoxi4APR9C@Pi8IQAtmEI@+Dg+IT5CFEAEYxi4AIxiogARjWqgAioiogBFRCIAD4iI+MhEEIMhCAIQmCEEQmAug@@='));$a=trim(fgets(STDIN));$r='str_repeat';echo$r('0',70).$r($q='FFFFFFFFE0',5);foreach(str_split($a)as$c){$v=(ord($c)-32)*35;$x=$v>>3;$y=1<<(7-$v%8);$b=0;for($i=0;$i<40;$i++){$b+=$b+($i<35&&ord($f[$x])&$y);if(($i&7)==7)$b=!printf('%02X',$b);if(!($y>>=1)&&$x++)$y=128;}}echo$r($q,7).$r('F',50);

Ungolfed:
<?php

// Font bitmap data rearranged as 95 consecutive 35-bit strings and padded
// out to 416 bytes with zeros:
$f=base64_decode(str_replace('@','AA',
    '@@@QhC@RSl@AClfV9SiPo4viYyIiJjZKiKyawi@@REIQQSCCEIiAEq6p@IT5C@@GEQ@Pg'.
    '@@@xgAiIiAHRnXMXEYQhCOdEIiI/8RBBi4RlS+IX4eCGLjIh6MXfCIiEIdGLoxc6MXhEw'.
    'DGAYwAGMAwiBERBBBAB8HwAQQQREQ6IREAR0QtrVzoxj+MfRj6MfOjCEIu5KMYy5+EPQh'.
    '/8IehCDowvGL4xj+MYuIQhCOOIQhSZGVMUlGEIQhD8d1rGMYxzWcYujGMYu9GPoQg6MY1'.
    'k30Y+pKL4QcEPvkIQhCRjGMYujGMYqJGMY1qqMVEVGMYxUQhPhEREPuQhCEOBBBBBA4Qh'.
    'CE4iog@@@AH0EE@@A4L4vhCHox8AD4Qg8IQvjF4AOj+DxFI4hC@+Lw+hCHoxiAgCEIQQB'.
    'CFJiEJUxSWEIQhHAButaxAC2YxiADoxi4APR9C@Pi8IQAtmEI@+Dg+IT5CFEAEYxi4AIx'.
    'iogARjWqgAioiogBFRCIAD4iI+MhEEIMhCAIQmCEEQmAug@@='));

// Fetch input:
$a=trim(fgets(STDIN));

// Header:
$r='str_repeat';
echo $r('0',70).$r($q='FFFFFFFFE0',5);

// Convert each input character into its corresponding hex sequence:
foreach (str_split($a) as $c) {
  $v=(ord($c)-32)*35;
  $x=$v>>3;
  $y=1<<(7-$v%8);
  $b=0;
  for ($i=0;$i<40;$i++) {
    // When $i>34, pad with zeros
    $b += $b + ($i<35 && ord($f[$x]) & $y);
    if (($i&7)==7) $b=!printf('%02X',$b); // print out $b and set $b=0
    // Shift mask to next bit position
    if (!($y>>=1)&&$x++) $y=128;
  }
}

// Tail:
echo $r($q,7).$r('F',50);

+1 (though I hope no one sends PHP to the aliens!!)

JavaScript ES6 (838 Bytes)
_="z='00000';r=(n,m)=>m.repean);fop=prompi=o=';i<p.length;)o+=parseInatob('RSlClfV9SiPo4viYyIiJjZKiKyawiRQQSCCEq6pGEQPgxgAiIHRnXMXEYOdiI/8Ri4RlS+IX4eCGLjIhXfCIidGLcXhEwDGAYwAGMAwiBERBAB8HwAQQQREQ6IREAR0QtrVzj+MfRjfOjCu5KMYy5+EP/8IeDowvGL4xj+MYuIOOISZGVMUlGD8d1rxzWcYuju9GPoQgY1k30Y+pKL4QcEPvkIRjujqJ1qqMVEVxUPhEREPuEOBA4E4H0EEA4L4vH8AD4Qg8IQvjF4AOj+DxFI4+Lw+HgCQQBCFJiEJUxSWHAButaxAC2YxDi4APR9CPi8IQAtm+Dg+FEAEYxi4AIxARjWqgAioBFRCIAD4iI+MhEMAIQmCEEQmAugRV8nyE.split   p(e=>e028)).join    tch(/.{35}/g)[pi++)-32]+z,21610);14,z5,y='E0+o.toUpperCase(7,y5,10,'F)A.charCodeAQhGMY).toString(EI)).slice(-)+ ('.maC')hCoxiog(z+z+t(r(iABB6MFFAIT5C";for(Y in $=" ")with(_.split($[Y]))_=join(pop());eval(_)

Not crushed :
z='00000';r=(n,m)=>m.repeat(n);for(p=prompt(i=o='');i<p.length;)o+=(z+z+parseInt(atob('AAAAAAQhCAARSlAAAClfV9SiPo4viYyIiJjZKiKyawiAAAAREIQQSCCEIiAEq6pAAIT5CAAAAGEQAAPgAAAAAAxgAiIiAHRnXMXEYQhCOdEIiI/8RBBi4RlS+IX4eCGLjIh6MXfCIiEIdGLoxc6MXhEwDGAYwAGMAwiBERBBBAB8HwAQQQREQ6IREAR0QtrVzoxj+MfRj6MfOjCEIu5KMYy5+EPQh/8IehCDowvGL4xj+MYuIQhCOOIQhSZGVMUlGEIQhD8d1rGMYxzWcYujGMYu9GPoQg6MY1k30Y+pKL4QcEPvkIQhCRjGMYujGMYqJGMY1qqMVEVGMYxUQhPhEREPuQhCEOBBBBBA4QhCE4iogAAAAAAAH0EEAAAAA4L4vhCHox8AD4Qg8IQvjF4AOj+DxFI4hCAA+Lw+hCHoxiAgCEIQQBCFJiEJUxSWEIQhHAButaxAC2YxiADoxi4APR9CAAPi8IQAtmEIAA+Dg+IT5CFEAEYxi4AIxiogARjWqgAioiogBFRCIAD4iI+MhEEIMhCAIQmCEEQmAugAAARV8nyE').split('').map(e=>(z+z+e.charCodeAt(0).toString(2)).slice(-8)).join('').match(/.{35}/g)[p.charCodeAt(i++)-32]+z,2).toString(16)).slice(-10);r(14,z)+r(5,y='FFFFFFFFE0')+o.toUpperCase()+r(7,y)+r(5,r(10,'F'))

+1 but beyond an un-crushed version, it's helpful to see it in a readable format without horizontal scrolling...