text:
The ASCII Architect
You don't want to pay money for the expensive architectural program, so you decide to roll your own. You decide to use ASCII to design your buildings. Your program will take in a single string formatted in a specific way, and the program will output the building.
Input
Input consists of a single line of characters. It can be assumed to only contain the letters a-j, the numbers 1-9, and the symbols - and +.
Output Description
For each letter a-j, the program will output a vertical line as follows. We will call this a column.
         .
        ..
       ...
      ****
     *****
    ******
   -------
  --------
 +++++++++
++++++++++
abcdefghij

For instance, the input abcdefgfedefghgfedc would output:
             .
      *     ***
     ***   *****
    ***** *******
   ---------------
  -----------------
 ++++++++++++++++++
+++++++++++++++++++

A letter may be prefixed with a positive integer n, which will add n whitespace characters below the column. We will call this an offset. For instance, using S to notate a whitespace, the input 3b2b3b would output:
+ +
+++
S+S
SSS
SSS

A letter may also be prefixed with a negative integer -m, which will remove the bottom m non-whitespace characters of the column (not replace them with whitespace, remove them entirely). We will call this a slice. For instance, the input -1j-2j-3j-4j-5j-6j-7j-8j would output:
.
..
...
*...
**...
***...
-***...
--***...
+--***..

An offset and a slice can be applied to the same line, but the offset must go first. In other words, the letter may be prefixed with n-m, where n is the size of the offset, and m is the size of the slice. For instance, using S to notate a whitespace, the input '2-4j' would output:
.
.
.
*
*
*
S
S

Lastly, the + operator used between two columns indicates that they should be stacked on top of each other in the same column instead of in seperate columns. For instance, the input `2-4ja' outputs:
.
.
.
*
*
*
S
S+

Whereas the input 2-4j+a outputs:
+
.
.
.
*
*
*
S
S

Here is a sample input:
abiehef+ehfhabc

And the resultant output:
      *
      -
  .   -
  . . +. .
  * * +* *
  * * ****
  ********
  --------
  --------  -
 +++++++++ ++
+++++++++++++

Looks like an old destroyed castle tower of some sort.
Here is another sample input:
6b5b+a6b1-2d+3-4f1-2d+-2c+2-4f+1-2d+-2c2-2d+1-4g+1-2c+b+-2c+-4e2-7j+-4g+d+-2c+-4f2-7j+-5h+b+-2c+a+-3f2-7j+-7i+-4e+b+b+a+-4f2-7i+a+-7h+-4f+b+b+a+-4f2-7j+-7h+-4f+a+-7h+a+-7i+-4f2-7j+-7i+-6h+a+-7i+b+-4e3-7i+a+-7h+-4e+a+-7h+b+1-7h3-7j+1-4f+-7h+b+-4f+a3-7j+2-4f+a+-4f+b3-2d+-2d+3-4g+b3-2d+-2d+-2c

And the resultant output:
      ****** +++
     ******+.*++
     ---++.+ ***
    -+-+++..++**
    -+--+++.+++*
    --++++.+..*
      +++++.+**
+++****.******  -
+++*****.**..  --
 +   ***....+..--
      ...+.....--
    --.........--
   ---......
   --

(It was supposed to be Mario but didn't turn out very good...)
If the specification still isn't clear, I have a non-golfed implementation written in Python 2.7. You can run it and experiment to get a feel for how the specification works. You may also choose to laugh at my programming skills.
This is code-golf, so shortest entry wins. Ask questions in comments if unclear.

Stacking of more than two towers is valid? I see "2c+b+-2c" in one of your examples, but I can't make out if that's how you stacked them.

@AndoDaan Towers can be infinitely stacked using +. For instance a+a+a+a+a would output five plus signs on top of each other.

Isn't this a duplicate of http://codegolf.stackexchange.com/questions/18967/landscapes?

@Howard Huh, you're right, these are surprisingly similar (the only additions being to be able to cut off the tower and to stack towers).

@Howard Huh. It didn't show up on the similiar questions thingo that pops up when you type in your title. The implementation of the whitespace is a little different though. I'll flag my post as a duplicate and see what the mods think.

Your Mario looks like a bunny's head and shoulder to me ;)

I suggest bonus points for sticking an @ somewhere atop the building.

Ruby, 223 214 bytes
g=$*[0].split(/(?<=[a-j])(?!\+)/).map{|r|r.scan(/(\d*)(-\d+)?([a-j])/).map{|a,b,c|' '*a.to_i+'++--***...'[-b.to_i..c.ord-97]}*''}
puts g.map{|s|s.ljust(g.map(&:size).max).chars.reverse}.transpose.map(&:join).join$/

That was fun. :)
Although it should be quite obvious, I discovered a new way to do these challenges where strings have be constructed from columns: just do them in rows, and transpose the array of characters before joining everything.
g=$*[0].split(/(?<=[a-j])(?!\+)/)               # Split into columns.
       .map{|r|                                 # For each column
            r.scan(/(\d*)(-\d+)?([a-j])/)       # Split into components.
             .map{|a,b,c|                       # For each component
                ' '*a.to_i+                     # Prepend spaces if any.
                '++--***...'[-b.to_i..c.ord-97] # Select the appropriate slice of the tower.
            }*''                                # Join all components together.
        }
puts g.map{|s|                                  # For each column
            s.ljust(g.map(&:size).max)          # Pad with spaces on the right such that.
                                                # all columns are the same height.
            .chars.reverse                      # Turn into character array and reverse.
      }
      .transpose                                # Mirror in the main diagonal.
      .map(&:join)                              # Join lines.
      .join$/                                   # Join columns.

Was trying out different styles of the final line and came out with: puts (0..z=g.map(&:size).max-1).map{|i|g.map{|y|(v=y[z-i])?v:?\ }*''}. But probably not so fun without the transpose.

@bitpwner Thanks, I'll have a look and test this later.

Cobra - 473
I don't think Cobra's ever going to win one of these :/
use System.Text.RegularExpressions
class P
    def main
        r=Regex.matches(Console.readLine,r'(?<=^|[a-j])(([^a-j]*[a-j])+?)(?=[^+]|$)')
        z,l=0String[](r.count)
        for m in r.count,for n in'[r[m]]'.split('+'),l[m]+=' '.repeat(int.parse('0[Regex.match(n,r'(?<!-)\d+')]'))+'++--***...'[int.parse('0[Regex.match(n,r'(?<=-)\d+')]'):' abcdefghij'.indexOf(n[-1:])]
        for y in l,if y.length>z,z=y.length
        for x in-z+1:1
            for y in l,Console.write(if(-x<y.length,y[-x],' '))
            print

All nice and commented:
EDIT: Just realized this looks suspiciously similar to the Ruby solution. Great minds think alike?
use System.Text.RegularExpressions
class P
    def main
        r=Regex.matches(Console.readLine,r'(?<=^|[a-j])(([^a-j]*[a-j])+?)(?=[^+]|$)')
        # Split into columns
        z,l=0,String[](r.count)
        # Assign the column-array
        for m in r.count
        # Loop through columns
            for n in'[r[m]]'.split('+')
            # Loop through individual letter instructions
            # - within columns
                l[m]+=
                # Add characters to the last column
                    ' '.repeat(int.parse('0[Regex.match(n,r'(?<!-)\d+')]'))+
                    # Any spaces, plus
                    '++--***...'[:' abcdefghij'.indexOf(n[-1:])]
                    # The default column string
                        [int.parse('0[Regex.match(n,r'(?<=-)\d+')]'):]
                        # Sliced to the right length
        for y in l,if y.length>z,z=y.length
        # Determine the maximum length of any column
        for x in-z+1:1
            for y in l
            # Loop through columns so that they rotate to the left
                Console.write(if(-x<y.length,y[-x],' '))
                # Write the character in the current position
            print
            # Insert newlines

Lua - 451
a=arg[1]j='++--***...'I=io.write M=string.match U=string.sub T=table.insert n=''y=0 t={}m=0 for i in a:gmatch('[%-%d]*[a-j]%+?')do b=M(i,'-(%d)')b=b or 0 s=M(U(i,1,1),'%d')s=s or 0 n=n..(' '):rep(s)..U(U(j,1,M(U(i,-2),'[a-j]'):byte()-96),1+b,-1)if U(i,-1,-1)~="+"then T(t,n)m=m<#n and #n or m n=""y=y+1 end end T(t,n)n=''for k,v in pairs(t)do n=#v<m and n..v..(' '):rep(m-#v)or n..v end for i=m,1,-1 do for k=0,m*y-1,m do I(U(n,i+k,i+k))end I'\n'end

Nothing special. It was fun to rename a butt-load of functions for once though. I'll edit the ungolfed code in later.
Try it out here. Sample Output:

PowerShell, 214 212 209 206 200 bytes
-3 bytes thanks @Veskah
switch -r($args-split'(-?.)'){\+{$c=1}\d{sv('ps'[0-gt$_])$_}[a-j]{if(!$c){$t+=,''}$t[-1]+=' '*$p+-join'++--***...'[-$s..($_[0]-97)];$c=$p=$s=0}}($t|% Le*|sort)[-1]..1|%{-join($t|% *ht $_|% ch*($_-1))}

Try it online!
Less golfed version:
# make table with lines instead columns
switch -r($args-split'(-?.)'){
    \+ {$c=1}
    \d {set-variable ('ps'[0-gt$_]) $_}
    [a-j] {
        if(!$c){$t+=,''}
        $t[-1]+=' '*$p+-join'++--***...'[-$s..($_[0]-97)]
        $c=$p=$s=0
    }
}
# transpose
($t|% Length|sort)[-1]..1|%{
    -join($t|% padRight $_|% chars($_-1))
}

Regex of (-?.) should work too

Python 3, 268 bytes
import re
q,t=[(p,' '*int(o or 0)+'++--***...'[-int(s or 0):ord(l)-96])for p,o,s,l in re.findall('(\+?)(\d?)(-\d)?(.)',input())],[]
while q:p,s=q.pop(0);t+=[t.pop()+s if p else s]
t=[*zip(*[[*c.ljust(max(map(len,t)))]for c in t])][::-1]
for l in t:print(*l,sep='')

Mostly ungolfed:
# import the regex module
import re

# array to store initial input
q = []
# array to store translated output
t = []

# split string from stdin into column groups, like: ('plus or blank', 'offset or blank', 'slice or blank', 'letter')
# ex: 6b1-2d+a would become:
# [('','6','','b'), ('', '1', '-2', 'd'), ('+', '', '', 'a')]
i = re.findall('(\+?)(\d?)(-\d)?(.)',input())

# iterate through the groups returned by the regex
for p,o,s,l in i:
    # create offset string
    # int() cannot parse '', but empty strings are falsey,
    # so (o or 0) is equivalent to 'parse the string as an int, or return 0 if it is empty'
    offset = ' ' * int(o or 0)

    # get the starting point of the slice
    # since the regex returns the minus, it must be negated after converting the string to an int
    # as before, (s or 0) ensures that the slice is converted to an int properly
    start = -int(s or 0)
    # since 'a' is ordinal 97, this ensures that the end position will be 1-9
    end = ord(l) - 96
    # slice the largest possible column string with the calculated start and end positions
    a = '++--***...'[start:end]
    # add the space offset
    a = offset + a
    # add the plus sting and the column string to the array
    q.append( (p, a) )

# while q is not empty
while q:
    # remove the first item from the list and separate it into a plus variable and a column string
    p, s = q.pop(0)

    # if p is not blank, it is a '+'
    # if p is truthy, remove the last item added and add s to it
    # otherwise just return s
    # append the resulting item to the ongoing list
    t += [t.pop()+s if p else s]

temp = []
for c in t:
    # call len() on all items in t, then return the maximum length
    m = max(map(len, t))
    # left justify c by adding spaces to the right, up to m total characters
    c = c.ljust(m)
    # unpack c into a list
    # this is equivalent to list(c), but shorter
    c = [*c]
    # add the list of characters to the array
    temp.append(c)

t = temp

# t is currently a list of rows, and needs to be rotated so that it displays correctly
# input: 'abcdefghij'
# before:
#
# +
# ++
# ++-
# ++--
# ++--*
# ++--**
# ++--***
# ++--***.
# ++--***..
# ++--***...
#
# after:
#
#  ++++++++++
#   +++++++++
#    --------
#     -------
#      ******
#       *****
#        ****
#         ...
#          ..
#           .
#
t = [*zip(*t)]
# t is currently upside down, reverse the list
t = t[::-1]

# for each line (currently a list of characters)
for l in t:
    # unpack the list into print as arguments, do not add a space between arguments
    print(*l,sep='')


text:
Shortest Longest Increasing Subsequence Code
The Challenge is to write the shortest implementation to find the Longest increasing subsequence .
Example :
Let S be the sequence 1 5 7 1 8 4 3 5 [length of S = 8 ]

We have 1 sub-sequence of length 0 [will consider it increasing]
6 sub-sequences of length 1 {1,5,7,8,4,3}[all of them are considered increasing]
(7*8)/2 sub-sequences of length 2 [but we will remove duplicates], the increasing sub-seq are in strong black.
{15,17,11,18,14,13,57,51,58,54,53,55,71,78,74,73,75,84,83,85,43,45,35}

[note that we only interested in strictly-increasing sub-sequences]
[you can't change the order of the elements inside the sequence , so there is no sub-sequence [37] in the example sequence]

We have increasing sub-sequences of length 4 which is 1578 , but there's no sub-sequence of length 5 , so we consider the length of the longest increasing sub-sequence = 4.

Input:
a1 a2 ... aN   (The sequence)
all numbers are positive integers less than 103
N <= 1000
Output:
One integer denoting the length of the longest increasing sub-sequence of the input sequence .
sample input(1)
1 2 4 2 5
sample output(1)
4

sample input(2)
1 5 7 1 8 4 3 5
sample output(2)
4

Your code should run in a timely manner please test your code on this case before submit it here (also the link contains my 290-byte c++11 solution )
You can either take the input from a file/stdin or as a function parameter and you can either print the output to a file/stdout or just return the value if you write a function
Score Board

Dennis CJam - 22
isaacg Pyth - 26
Howard GolfScript - 35
proud haskeller Haskell - 56
Ray Python 3 - 66
histocrat Ruby - 67
DLeh C# - 92
YosemiteMark Clojure - 94
faubiguy Python 3 - 113

"We have 1 sub-sequence of length 0 [will consider it increasing]", Well technically you have an infinite number of 0-length sub-sequences :)

Actually , I have to change the statement so that all the "Sets" must remove the duplicates , e.g. {1,5,7,1,8,4,3,5} should be {1,5,7,8,4,3} and then we can say that there is 1 0-length subsequence in the "Set" . thanks

For functions, should we count the bytes of the outer function (function f(){...}) or the inner function (just ...)? If we count outer functions, are anonymous functions allowed?

We count the outer function , and anonymous functions are allowed , But don't miss to provide a testable version (complete version with the input/output handling)

CJam, 22 bytes
1e3,q~{_2$<$0=(t}/$0=z

Try it online.
Example
$ cjam subsequence.cjam <<< '[2 1]'; echo
1
$ cjam subsequence.cjam <<< '[1 9 2 4 3 5]'; echo
4

The program prints 57 for this test case after 0.25 seconds.
How it works
I took the general idea from @Ray's answer.
1e3,    " Push the array [ 0 ... 999 ] (J).        ";
q~      " Read from STDIN and evaluate.            ";
{       " For each integer (I) of the input array: ";
  _2$<  " Push [ J[0] ... J[I - 1] ] (A).          ";
  $0=(  " Compute min(A) - 1.                      ";
  t     " Update J[I] with the value on the stack. ";
}/      "                                          ";
$0=     " Compute abs(min(J)).                     ";

Python 3, 66
Note that all numbers are in range [1, 999], we can use an array b to maintain the longest subsequence length ending with each number. b[x] = d means that the longest subsequence ending with x has length d. For each number from the input, we update the array using b[x] = max(b[:x]) + 1 and then we got the job done by taking max(b) finally.
The time complexity is O(n) O(m n), where m is always 1000 and n is the number of input elements.
def f(a):
 b=[0]*1000
 for x in a:b[x]=max(b[:x])+1
 return max(b)

Wow, looks like already ungolfed :)
You can test it using stdin/stdout by adding a line:
print(f(map(int,input().split())))

for x in a: max(b) looks pretty much O(n^2).

@Howard It's O(1000 n) and 1000 is a constant. You can also think it as O(m n).

With such argument the whole discussion is useless because on limited input the complexity is always O(1) ;-)

@Howard I come from the ACM-ICPC world and this is somewhat a convention there. You can think it as O(m n). It's still different from O(n^2). Anyway, the time it cost will be less than the interpreter start-up time so I think it's fast enough.

Impressively short algorithm! I can only spot one character (at least when switching to Python 2): You can print the result. print is shorter than return.

Oh there's another one: You can write def f(a,b=[0]*1000):.

@Falko Since I don't choose stdin as input, I can't use stdout as output. Setting b as default  argument would make the function fail to run the second time.

@Ray: As I understood the OP, the input and output format are independent of each other. And why shouldn't the program run twice? As long as you don't pass a second argument it should be fine. (And it's not explicitly required to run more than once. ;) ) But of course, it's up to you.

Haskell, 58 57 56 characters
(x:s)%v|v>x=x:s%v|0<1=v:s
_%v=[v]
l s=length$foldl(%)[]s

This uses an algorithm I saw once on the internet, but i can't find it.
It takes an unnoticeable amount of time on the given test case on my computer with GHCi (probably would be even faster if it was compiled).

The algorithm you mentioned is the same as that used by @faubiguy.

@Ray you're right

Clojure, 94 characters
Using @Ray's approach of updating results in a 1000-item vector:
(defn g[s](apply max(reduce #(assoc % %2(inc(apply max(take %2 %))))(into[](repeat 1e3 0))s)))

Per request, with print statement (will print answer and return nil).  Input should be a vector (g [1 2 3]) or a list (g '(1 2 3)):
(defn g[s](prn(apply max(reduce #(assoc % %2(inc(apply max(take %2 %))))(into[](repeat 1e3 0))s))))

can you add the print statement to make it testable ?  It will not be counted in the score.

Updated.  I've run it on both your large examples, and got 58 and 57 as expected.

I think you still need to call the function :p , but if you've tested it then that is enough .

Pyth, 26 29 33 39
J*]0^T3Fkyw=@JkheS:J0k)eSJ

Port of @ray's solution. Passes official tests. Now uses space-separated STDIN input, not function call.
Run as follows:
./pyth.py -c "J*]0^T3Fkyw=@JkheS:J0k)eSJ" <<< "1 5 7 2 8 4 3 5"
4

Explanation:
J*]0^T3                 J = [0]*10^3
Fkyw                    For k in space_sep(input()):
=@Jk                    J[k]=
heS:J0k                 max(J[0:k])+1
)                       end for
eSJ                     max(J)

Time unlimited:
Pyth, 18
L?eS,ytbhyf>Thbbb0

Technical note: I noticed a bug in my Pyth complier while writing this golf. L wasn't working. That's why there is a recent commit to the above git repository.

your code doesn't run in a timely manner for a case with large list (say 100 element)

@Mostafa36a2 If you'd like to make runtime a requirement, please say so in the question, and add a test case or two. If it's just a comment, then I agree, it's pretty slow.

Sorry but I've mentioned that is not the runtime but at least a [timely manner] , no problem if the code takes 10-20 minutes or even an hour , but the O(2^n) solutions will never give the result during our long life.

@Mostafa36a2 Got it, I just noticed that line. I'll work on an improvement.

@Mostafa36a2 It's memoized, should run in O(n^2), I think.

Sorry I see the update now , please try this case and tell me if it works .

Python - 113
a=[]
for i in map(int,input().split()):
 if not a or i>a[-1]:a+=[i]
 z=0
 while a[z]<i:z+=1
 a[z]=i
print(len(a))

Accepted solution. Your code have been tested here and here.

@Mostafa36a2 The word "accepted" has another meaning on this site. I think what you mean is "acceptable".

Sorry , yes I meant acceptable ,too early to choose the Accepted one .

With the line a+=[i]*(a==[]or i>a[-1]);z=0 and printing len(a) (without brackets) you can save 4 characters.

Bash+coreutils, 131 bytes
This solution fails horribly on the timely manner requirement, and is not even particularly short, but I liked that this sort of thing is at least theoretically possible in shell script, so I'm posting anyway.  This runs with an eternity-inducing time complexity of O(2^n).
s=${1//,/,:\},\{}
a=`eval echo "{$s,:}"`
for s in $a;{
b="$(tr , \\n<<<$s|grep -v :)"
sort -nC<<<"$b"&&wc -w<<<$b
}|sort -nr|sed 1q

Input is a comma separated list passed as a single command-line argument:
$ time ./slisc.sh 1,5,7,1,8,4,3,5
4

real    0m1.240s
user    0m0.518s
sys 0m0.689s
$

Brace expansion is used to build the list of all possible subsequences.

The first line replaces commas with ,:},{, which produces a string like 1,:},{5,:},{7,:},{1,:},{8,:},{4,:},{3,:},{5
The second line completes this string with braces, commas and semicolons to give this {1,:},{5,:},{7,:},{1,:},{8,:},{4,:},{3,:},{5,:}.  This is a valid bash brace expansion, which when evaled with an echo produces this space-separated list 1,5,7,1,8,4,3,5 1,5,7,1,8,4,3,: 1,5,7,1,8,4,:,5 1,5,7,1,8,4,:,: ...
by default, bash splits strings with whitespace, so we loop over each element of this list:

commas are replaced with newlines, then lines containing colons are removed, giving newline-separated lists for each possible subsequence
we then sort -C to test for increasing order, and if so, use wc -w to print the length of the list

the resulting list of list lengths is sorted in reverse and the first value printed to give the longest increasing subsequence length.

C#, 172 92 chars
Nothing special, but I did it so I figured I might as well submit it.
int a(int[] j){int c=2,m=2,i=1;for(;++i<j.Length;){c=j[i]>j[i-1]?c+1:2;m=c>m?c:m;}return m;}

Thanks Armin and Bob for their improvements!

you can change your parameter to int[] and then you'd have less characters because you wouldn't need to cast string to int

The spaces around => are unnecessary. You can also move the i=0 declaration outside the for loop, to int c=2,m=2,i=0;for(;. You can also drop the braces around the for body, since you only have a single statement in there.

And c++;if(c>m)m=c; can be m=c++>m?m:c;, and you can again drop the braces around that.

In fact, you can also discard the if(i>0) check by making the for loop start at 1. You can further shorten the int c=2,m=2,i=0;for(;i<j.Length;i++)if(i>0) suggested earlier into int c=2,m=2,i=0;for(;i++<j.Length;). That entire section could be converted to int c=2,m=2,i=0;for(;i++<j.Length;){c=j[i]>j[i-1]?c+1:2;m=c>m?m:c;} (using another ternary to replace the last remaining if - rule of thumb is ternaries are shorter if your if body is simply an assignment.

Sorry - typo in my previous comment, m=c>m?m:c should be m=c>m?c:m. And if you add in @Armin's suggestion, you get 92 bytes, almost halving the size! int a(int[] j){int c=2,m=2,i=0;for(;i++<j.Length;){c=j[i]>j[i-1]?c+1:2;m=c>m?c:m;}return m;}

I wasn't sure that it was allowed to take an int[], i thought the input was a string, but i guess you're right! I'll add some of these improvements.

hmm the final conversion to the ternary op is giving me an array out of bounds

Got it, had to change the for loop to pre-increment instead of post-increment. Thanks for the input! Some cool tricks there! I always forget the weird stuff you can do with a for loop

@DLeh Sorry - I noticed that mistake, and corrected it in my testing, but forgot to update the comment!

If I'm not mistaken, this will fail for 1 2 3 1 4, since the 1 after 3 will reset c.

c isn't the value that's returned, m is. c is supposed to get reset

GolfScript, 35 characters
~]]){1${~2$<*)}%1+$-1>[\+]+}/$-1=0=

An implementation working as a complete program with input on STDIN (without the length number given). The implementation is reasonable fast, even for longer inputs (try here).
Examples:
> 1 5 7 1 8 4 3 5
4

> 5 1 9 9 1 5
2

@MartinBüttner It takes about 5 seconds for 1000 numbers on my computer. Assuming $ is O(n log n) the algorithm is O(n^2 log n).

please try the input in this link

@Mostafa36a2 I did already (see comment before). After 5 seconds it returns 58.

this is another one , it should return 57 , so if your code did return 57 then it's Accepted :) Congratulations

@Mostafa36a2 Ah, now I see those are two distinct test cases. Yes, your second link returns 57 as does my solution on this input.

[Sorry when I said Accepted I mean acceptable , waiting for other solutions :) ]

Ruby, 67
s=Hash.new{|s,a|f,*r=a
s[a]=f ?[1+s[r.select{|x|x>f}],s[r]].max: 0}

This runs in 30 seconds on the large input, does that count as a timely manner? :p
It's brute recursion, but with some memoization.

Yes , this is a timely manner :)

Stax, 21 bytes
ë/NS7Γ╥╚┌{1╤╒¬è¶²╢╦┌☼

Run and debug it
This has two test cases, one of which is the 1000-element case.  It runs that one in 24 seconds on my machine.  It uses the classic dynamic programming approach for this type of problem.

J, 19 bytes
[:#]`I.`[} ::,~/@|.

Try it online!
Runs in O(n log n), using a modified patience sort since only the length, not the actual subsequence, is needed.
Explanation
[:#]`I.`[} ::,~/@|.  Input: array
                 |.  Reverse
               /     Reduce right-to-left
     I.                Find the index to insert while keeping it sorted
                       (uses binary search)
         }             Amend the current search array at that index with the next value
           ::          If error (when the index is not found)
             ,           Append the value at the end
 #                   Length of that array

J 34
Note that I read standard input as well.
>./;+/@:*&.>(<*>.)/\&.><\.".1!:1]3

Without reading standard input, the meat is 26 characters.
>./;+/@:*&.>(<*>.)/\&.><\.

Just noticed mine runs slow for large input, oh well.

C++ (gcc), 129 bytes
int f(int*a,int n){int l[n]{},i=n,j,m=0;for(;i--;m=l[i]>m?l[i]:m)for(j=n;--j>i;)if(a[i]<a[j]&&l[i]<l[j]+1)l[i]=l[j]+1;return++m;}

Try it online!

C# (.NET Core), 155 bytes
Used an array to compute the longest increasing subsequence ending at each position in the input array (dynamic programming), then returned the largest value. For example, the computed array for input [1,5,7,1,8,4,3,5] would be [1,2,3,1,4,2,2,3], and the largest value 4 is returned.
int b(int[]x){int l=x.Length,r=1,i=0,j,c;var a=new int[l];a[0]=1;while(++i<l)for(j=0;j<i;j++){c=x[j]<x[i]?a[j]+1:1;a[i]=a[i]<c?c:a[i];r=r<c?c:r;}return r;}

Try it online!

Wolfram Language (Mathematica), 38 bytes
Length@LongestOrderedSequence[#,Less]&

Try it online!
There is of course a Mathematica built-in for finding longest ordered sequences. Its name is very long: it makes up more than half the solution, and I won't be surprised if someone out-golfs this solution.

source: Stack Exchange

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

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

sort: votes


text:
Write a functioning bare-bones IRCd
A bit of an unusual one, but hey, why not? :)
The objective: Write a functioning IRC daemon in your language of choice that provides barebones functionality, in as few characters as possible. As long as it fulfills the criteria below, it does not have to fully comply with the IRC RFCs (this would make the challenge significantly less fun), it just needs to work.
Requirements:

Clients must be able to connect on port 6667 and use it. At least irssi and XChat must be able to connect to it successfully with a default configuration.
Users must be able to specify their own nickname, change it while already connected, join channels, leave channels, and exit cleanly (ie. QUIT).
Channels should be created like normal - joining a channel with no users in it 'creates' it. They do not have to be persistent.
Users must be able to send both channel messages and private messages (ie. to other users).
The WHOIS command must be implemented, as well as PING/PONG, LIST, and NAMES (mostly in order to keep clients happy).

Restrictions:

You may not use any third-party libraries (that includes non-core evented I/O libraries). Only standard libraries that come with the platform you use, are permitted.
If your implementation includes explicit support for IRC in the standard library, you may not use that either. Standard-library network functionality is, of course, fine.
Your submission must be able to run independently. No being clever with mIRC scripting :)

Modes, kicks, etc. do not have to be implemented (unless required to make it work with the above clients). SSL isn't necessary either. Just the above barebones functionality, to keep the challenge short and fun.
More information on what IRC is here, RFCs are 1459 and 2812 (I can't link to them directly due to my lack of reputation).
Shortest functional and requirements-compliant submission wins!

You might want to give some background what an IRCd (or even IRC) is for people who aren't familiar with IRC.

Have you written one yourself to have an idea of how much time it would take and how much code would be involved? Non-golfed example code would help people estimate whether this is the right size question for the amount of time they happen to have free.

@MartinBüttner Edited the post. Not enough reputation to link to the RFCs directly, but with the RFC numbers they shouldn't be hard to find.

@githubphagocyte Yup, I've had a go at writing one myself before (though it's more of an experiment than anything else). I'd say that an experienced developer in a dynamic language (think Python, Node.js) would be able to put together such a basic functioning IRCd in 1-2 hours at most, in non-golfed form. Probably less, if you're already familiar with the RFCs.

Which port should the server listen on? 6667, 194 or something else?

@nyuszika7h Port 6667 should suffice.

I have spent a couple days of spare time on an ungolfed C implementation using winsock.  It handles DIE, QUIT, PING and PONG and is over 8K in size.  Even golfed I don't see any way it could be less than 4K.  If I ever get time to implement the rest of the commands I will make an attempt to golf it slightly and post it.

C++ (partially golfed) 5655 (with CRLF counting for 1)
This compiles in VS 2013 (uses auto, lambdas and winsock)  It seemed to be working before I golfed it so unless I mucked it up it should still be ok.  One of the reasons it is so big is that the numeric replies I am returning include the text specified in the RFC - I don't know if that is necessary or not.  I tested it with KVirc because it runs portably (not allowed to install software on my PC!)  KVirc seems to work with my server but I don't know about other clients - I did what I thought the RFC said but a lot of it is underspecified so hopefully I understood it right.
The server handles DIE, KILL, NICK, USER, MODE, WHOIS, WHO, JOIN, PART, TOPIC, LIST, NAMES, PRIVMSG, USERS, PING, PONG and QUIT to varying degrees.  For most of them I return the required responses including doing most of the checks needed to return the specified error replies.  For some of them I cheat:

USERS always returns 446 "USERS has been disabled"
the channel MODE message always returns 477 "Channel doesn't support modes"
the user MODE message works properly but the flags are not used by the other commands

I figure it is only partially golfed because I am not very good at golfing so if you see something big please edit the answer and fix it.
Here is the golfed version
#include<time.h>
#include<map>
#include<list>
#include<vector>
#include<string>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<winSock2.h>
#pragma comment(lib,"ws2_32.lib")
#define P m.p[0]
#define Q m.p[1]
#define E SOCKET_ERROR
#define I INVALID_SOCKET
#define T c_str()
#define H second
#define Y first
#define S string
#define W stringstream
#define G else
#define J G if
#define A auto
#define Z bool
#define B empty()
#define K return
#define N 513
#define X(n,x)if(x){r=n;goto f;};
#define U(x,i)for(A i=x.begin();i !=x.end();++i)
#define L(x)U(x,i)
#define V(x)for(A i=x.begin();i!=--x.end();++i)
#define M(x)FD_ZERO(&x);FD_SET(t.s,&x);L(l){FD_SET(i->s,&x);}
#define R(a,b,...){M v={a,b,{__VA_ARGS__}};w(d,v);}
#define F(x)}J(!_stricmp(m.c.T,x)){
using namespace std;struct C{S t;list<S>n;};struct M{S f;S c;vector<S>p;};struct D{SOCKET s;SOCKADDR_IN a;int m,l,i;char b[N];S n,u,h,r;time_t p,q;};map<S,C>c;list<D>l;void w(D d,M m);void x(D&t,S r,Z n){L(c)i->H.n.remove(t.n);L(l){A d=*i;if(d.n!=t.n)R(d.n,"QUIT",t.n,r)J(n)R("","ERROR","QUIT",r)}closesocket(t.s);t.s=I;}void w(D d,M m){S s=(!m.p.B?":"+m.f+" ":"")+m.c;V(m.p)s+=" "+*i;s+=" :"+*m.p.rbegin()+"\r\n";int c=0;do{int b=send(d.s,s.T+c,s.size()-c,0);if(b>0)c+=b;G x(d,"send error",0);}while(s.size()-c>0);}Z e(D&d,M m){A z=m.p.size();if(!_stricmp(m.c.T,"DIE")){K 1;F("KILL")if(z<1)R("","461",d.n,"USER","Not enough parameters")G{Z f=0;L(l)if(i->n==P){f=1;x((*i),P,1);}if(f==0)R("","401",d.n,P,"No such nick/channel")}F("NICK")if(z<1)R("","431",d.n,"No nickname given")G{Z f=0;L(l)if(i->n==P)f=1;if(f==1)R("","433",d.n,"Nickname is already in use")G d.n=P;}F("USER")if(z<4)R("","461",d.n,"USER","Not enough parameters")G{Z f=0;L(l)if(i->u==P)f=1;if(f==1)R("","462",d.n,"Unauthorized channel (already registered)")G{d.u=P;d.m=atoi(Q.T);d.h=m.p[2];d.r=m.p[3];R("","001",d.n,"Welcome to the Internet Relay Network "+d.n+"!"+d.u+"@"+d.h)}}F("MODE")if(z<1)R("","461",d.n,"MODE","Not enough parameters")J(P==d.n){if(z<2)R("","221",d.n,S("")+(d.m&2?"+w":"-w")+(d.m&3?"+i":"-i"))G{A x=(147-Q[1])/14;if(Q[0]=='+'){d.m|=1<<x;}G{d.m&=~(1<<x);}}}G R("","477",d.n,P,"Channel doesn't support modes")F("WHOIS")if(z<1)R("","431",d.n,"No nickname given")G{Z f=0;L(l)if(i->n==P){f=1;R("","311",d.n,(i->n,i->u,i->h,"*",i->r))}if(f==1)R("","318",d.n,P,"End of WHOIS")G R("","401",d.n,P,"No such nick/channel")}F("WHO")L(c[P].n)U(l,j)if(*i==j->n)R("","352",d.n,P,j->u,j->h,"*",j->n,"",j->r)R("","315",d.n,P,"End of WHO")F("JOIN")if(z<1)R("","461",d.n,"JOIN","Not enough parameters")J(P=="0")L(c){U(i->H.n,j)if(*j==d.n)R("","PART",i->Y,d.n)i->H.n.remove(d.n);}G{A&C=c[P];Z f=0;L(C.n)if(*i==d.n){f=1;}if(f==0){C.n.push_back(d.n);R(d.n,"JOIN",P)if(C.t.B)R("","331",d.n,P,"No topic is set")G R("","332",d.n,P,C.t)S q;L(C.n)q+=(q.B?"":" ")+*i;R("","353",d.n,"=",P,q)R("","366",d.n,P,"End of NAMES")}}F("PART")if(z<1)R("","461",d.n,"PART","Not enough parameters")G{Z f=0;A&C=c[P];L(C.n)if(*i==d.n)f=1;C.n.remove(d.n);if(f){if(z<2)m.p.push_back(d.n);R(d.n,"PART",P,Q)}G R("","442",d.n,P,"You're not on that channel")}F("TOPIC")if(z<1)R("","461",d.n,"TOPIC","Not enough parameters")G{A&C=c[P];if(z<2){C.t="";R("","331",d.n,P,"No topic is set")}G{C.t=Q;R("","332",d.n,P,C.t)}}F("LIST")if(z<1){L(c){W ss;ss<<i->H.n.size();R("","322",d.n,i->Y,ss.str(),i->H.t.B?"No topic is set":i->H.t)}R("","323",d.n,"End of LIST")}G{W ss;ss<<c[P].n.size();R("","322",d.n,P,ss.str(),c[P].t.B?"No topic is set":c[P].t)R("","323",d.n,"End of LIST")}F("NAMES")if(z<1){L(c){S q;U(i->H.n,j)q+=(q.B?"":" ")+*j;R("","353",d.n,"=",i->Y,q)}R("","366",d.n,"End of NAMES")}G{S q;L(c[P].n)q+=(q.B?"":" ")+*i;R("","353",d.n,"=",P,q)R("","366",d.n,P,"End of NAMES")}F("PRIVMSG")if(z<1)R("","411",d.n,"No recipient given(PRIVMSG)")J(z<2)R("","412",d.n,"No text to send")G{Z f=0;A from=d.n;L(c)if(i->Y==P){f=1;U(i->H.n,k)U(l,j)if(*k==j->n){A d=*j;R(from,"PRIVMSG",d.n,Q)}}if(f==0)L(l)if(i->n==P){f=1;A d=*i;R(from,"PRIVMSG",d.n,Q)}if(f==0)R("","401",d.n,P,"No such nick/channel")}F("USERS")R("","446",d.n,"USERS has been disabled")F("PING")R("","PONG",P,Q)F("PONG")d.p=time(NULL)+60;d.q=0;F("QUIT")if(!z)m.p.push_back(d.n);x(d,P,1);}G{R("","421",d.n,m.c,"Unknown command")}K 0;}M g(char*d){M m;char*n=d;while(*d!='\0'){if(m.c.B){if(*d==':'){for(;*d!='\0'&&*d!=' ';++d);*d='\0';m.f=n+1;n=++d;}for(;*d!='\0'&&*d!=' ';++d);*d='\0';m.c=n;n=++d;}J(*d==':'){for(;*d!='\0';++d);m.p.push_back(n+1);n=++d;}G{for(;*d!='\0'&&*d!=' ';++d);*d='\0';m.p.push_back(n);n=++d;}}K m;}int main(){int r;WSADATA u;SOCKADDR_IN la;la.sin_family=AF_INET;la.sin_port=htons(6667);la.sin_addr.s_addr=htonl(INADDR_ANY);timeval h;h.tv_sec=0;h.tv_usec=10000;fd_set rs,ws,es;D t;t.n="IRCd";X(1,(0!=WSAStartup(MAKEWORD(2,2),&u)))X(2,(I==(t.s=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP))))X(3,(E==bind(t.s,(SOCKADDR*)&la,sizeof(la))))X(4,(E==listen(t.s,SOMAXCONN)))while(1){M(rs)M(ws)M(es)X(5,(E==select(0,&rs,&ws,&es,&h)))X(6,(FD_ISSET(t.s,&es)))if(FD_ISSET(t.s,&rs)){D d={};d.l=sizeof(d.a);d.s=accept(t.s,(SOCKADDR*)&d.a,&d.l);X(7,(I==d.s))W s;s<<inet_ntoa(d.a.sin_addr)<<":"<<ntohs(d.a.sin_port);d.n=s.str();d.p=time(NULL)+60;d.q=0;l.push_back(d);}L(l){D&d=*i;if(d.p>0&&time(NULL)>d.p){R("","PING",d.n)d.p=0;d.q=time(NULL)+60;}if(d.q>0&&time(NULL)>d.q)x(d,"PONG",1);if(FD_ISSET(d.s,&es))x(d,"select except",0);if(FD_ISSET(d.s,&rs)){int b=recv(d.s,d.b+d.i,sizeof(d.b)-d.i-1>0,0);if(b>0)d.i+=b;G x(d,"recv error",0);char*y=d.b+d.i-2;if(!strcmp(y,"\r\n")){*y++='\0';*y='\0';M m=g(d.b);memset(d.b,0,N);d.i=0;if(d.p>0&&time(NULL)<d.p){d.p=time(NULL)+60;d.q=0;}if(e(d,m))X(0,1)}}}l.remove_if([](const D&d){K d.s==I;});}r=0;f:L(l)x(*i,"exit",0);x(t,"exit",0);WSACleanup();K r;}

Here is the mostly ungolfed version (still uses some macros):
#include <time.h>
#include <map>
#include <list>
#include <vector>
#include <string>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <winSock2.h>
#pragma comment(lib, "ws2_32.lib")
#define READ_BUFFER_SIZE 513
#define EXIT_IF(n,x) if (x) { retval=n; goto finished; };
#define LOOPX(x,it) for (auto it = x.begin(); it != x.end(); ++it)
#define LOOP(x) LOOPX(x,it)
#define LOOP2(x) for (auto it = x.begin(); it != --x.end(); ++it)
#define MAKE_SET(x) FD_ZERO(&x); FD_SET(listener.socket, &x); LOOP(socket_list) { FD_SET(it->socket, &x); }
#define RESPOND(a, b, ...) { message response = {a, b, {__VA_ARGS__}}; tell(data, response); }
#define CASE(x) } else if (!_stricmp(msg.command.c_str(),x)) { std::cout << "Received " << x << " from " << data.nickname << std::endl;
struct channel { std::string topic;  std::list<std::string> nicknames; };
struct message { std::string prefix; std::string command; std::vector<std::string> params; };
struct socket_data { SOCKET socket; SOCKADDR_IN address; int mode,address_length,read_buffer_index; char read_buffer[READ_BUFFER_SIZE]; std::string nickname,username,servername,realname; time_t ping_timer,pong_timer; };
std::map<std::string,channel> channels;
std::list<socket_data> socket_list;
void tell(socket_data data, message msg);
void disconnect(socket_data& target, std::string reason, bool notify)
{
    LOOP(channels) it->second.nicknames.remove(target.nickname);
    LOOP(socket_list)
    {
        auto data = *it;
        if (data.nickname != target.nickname) RESPOND(data.nickname, "QUIT", target.nickname, reason)
        else if (notify) RESPOND("", "ERROR", "QUIT", reason)
    }
    closesocket(target.socket);
    target.socket = INVALID_SOCKET;
    std::cout << "Disconnected " << target.nickname << " reason=" << reason << std::endl;
}
void print(socket_data data, message msg, char *heading)
{
    std::cout << heading << ":\n  " << inet_ntoa(data.address.sin_addr) << ":" << ntohs(data.address.sin_port) << "\n";
    if (!msg.prefix.empty()) std::cout << "  Prefix=" << msg.prefix << "\n";
    std::cout << "  Command=" << msg.command;
    int count = 0; LOOP(msg.params) std::cout << "\n  Param[" << count++ << "]=" << *it;
    std::cout << std::endl;
}
void tell(socket_data data, message msg)
{
    print(data, msg, "Response");

    std::string str = (!msg.prefix.empty() ? ":" + msg.prefix + " " : "") + msg.command;
    LOOP2(msg.params) str += " " + *it;
    str += " :" + *msg.params.rbegin() + "\r\n";

    int start = 0;
    do
    {
        int bytes = send(data.socket, str.c_str() + start, str.size() - start, 0);
        if (bytes > 0) start += bytes; else disconnect(data, "send error", 0);
    }
    while (str.size() - start > 0);
}
bool process(socket_data &data, message msg)
{
    print(data, msg, "Request");

    auto size = msg.params.size();
    auto first = size<1 ? "" : msg.params[0], second = size<2 ? "" : msg.params[1];
    if (!_stricmp(msg.command.c_str(), "DIE")) { return true;
    // and now all the cases
    CASE("KILL")    if (size<1)
                        RESPOND("", "461", data.nickname, "USER", "Not enough parameters")
                    else
                    {
                        bool found = false;
                        LOOP(socket_list) if (it->nickname == first) { found = true; disconnect((*it), first, 1); }
                        if (found == false) RESPOND("", "401", data.nickname, first, "No such nick/channel")
                    }
    CASE("NICK")    if (size<1)
                        RESPOND("", "431", data.nickname, "No nickname given")
                    else
                    {
                        bool found = false;
                        LOOP(socket_list) if (it->nickname == first) found = true;
                        if (found == true) RESPOND("", "433", data.nickname, "Nickname is already in use")
                        else data.nickname = first;
                    }
    CASE("USER")    if (size<4)
                        RESPOND("", "461", data.nickname, "USER", "Not enough parameters")
                    else
                    {
                        bool found = false;
                        LOOP(socket_list) if (it->username == first) found = true;
                        if (found == true) RESPOND("", "462", data.nickname, "Unauthorized command (already registered)")
                        else
                        {
                            data.username = first; data.mode = atoi(second.c_str()); data.servername = msg.params[2];  data.realname = msg.params[3];
                            RESPOND("", "001", data.nickname, "Welcome to the Internet Relay Network " + data.nickname + "!" + data.username + "@" + data.servername)
                        }
                    }
    CASE("MODE")    if (size<1)
                        RESPOND("", "461", data.nickname, "MODE", "Not enough parameters")
                    else if (first == data.nickname)
                    {
                        if (size < 2)
                            RESPOND("", "221", data.nickname, std::string("") + (data.mode & 2 ? "+w" : "-w") + (data.mode & 3 ? "+i" : "-i"))
                        else
                        {
                            auto x = (147 - second[1]) / 14;
                            if (second[0] == '+')
                            {
                                data.mode |= 1 << x;
                                std::cout << "set " << first << " mode bit " << x << "w=2, i=3" << std::endl;
                            }
                            else
                            {
                                data.mode &= ~(1 << x);
                                std::cout << "clear " << first << " mode bit " << x << "w=2, i=3" << std::endl;
                            }
                        }
                    }
                    else
                        RESPOND("", "477", data.nickname, first, "Channel doesn't support modes")
    CASE("WHOIS")   if (size < 1)
                        RESPOND("", "431", data.nickname, "No nickname given")
                    else
                    {
                        bool found = false;
                        LOOP(socket_list) if (it->nickname == first) { found = true; RESPOND("", "311", data.nickname, (it->nickname, it->username, it->servername, "*", it->realname)) }
                        if (found == true) RESPOND("", "318", data.nickname, first, "End of WHOIS")
                        else RESPOND("", "401", data.nickname, first, "No such nick/channel")
                    }
    CASE("WHO")     LOOP(channels[first].nicknames) LOOPX(socket_list, dit) if (*it == dit->nickname)
                        RESPOND("", "352", data.nickname, first, dit->username, dit->servername, "*", dit->nickname, "", dit->realname)
                    RESPOND("", "315", data.nickname, first, "End of WHO")
    CASE("JOIN")    if (size < 1)
                        RESPOND("", "461", data.nickname, "JOIN", "Not enough parameters")
                    else if (first == "0")
                        LOOP(channels) { LOOPX(it->second.nicknames, dit) if (*dit == data.nickname) RESPOND("","PART", it->first, data.nickname) it->second.nicknames.remove(data.nickname); }
                    else
                    {
                        auto& channel = channels[first];
                        bool found = false;
                        LOOP(channel.nicknames) if (*it == data.nickname) { found = true; }
                        if (found == false)
                        {
                            channel.nicknames.push_back(data.nickname);
                            RESPOND(data.nickname, "JOIN", first)
                            if (channel.topic.empty()) RESPOND("", "331", data.nickname, first, "No topic is set")
                            else RESPOND("", "332", data.nickname, first, channel.topic)
                            std::string list; LOOP(channel.nicknames) list += (list.empty() ? "" : " ") + *it;
                            RESPOND("", "353", data.nickname, "=", first, list)
                            RESPOND("", "366", data.nickname, first, "End of NAMES")
                        }
                    }
    CASE("PART")    if (size < 1)
                        RESPOND("", "461", data.nickname, "PART", "Not enough parameters")
                    else
                    {
                        bool found = false;
                        auto &channel = channels[first];
                        LOOP(channel.nicknames) if (*it == data.nickname) found = true;
                        channel.nicknames.remove(data.nickname);
                        if (found)
                        {
                            if (size < 2) msg.params.push_back(data.nickname);
                            RESPOND(data.nickname, "PART", first, second)
                        }
                        else RESPOND("", "442", data.nickname, first, "You're not on that channel")
                    }
    CASE("TOPIC")   if (size < 1)
                        RESPOND("", "461", data.nickname, "TOPIC", "Not enough parameters")
                    else
                    {
                        auto& channel = channels[first];
                        if (size < 2) { channel.topic = ""; RESPOND("", "331", data.nickname, first, "No topic is set") }
                        else { channel.topic = second; RESPOND("", "332", data.nickname, first, channel.topic) }
                    }
    CASE("LIST")    if (size < 1)
                    {
                        LOOP(channels)
                        {
                            std::stringstream ss; ss << it->second.nicknames.size();
                            RESPOND("", "322", data.nickname, it->first, ss.str(), it->second.topic.empty() ? "No topic is set" : it->second.topic)
                        }
                        RESPOND("", "323", data.nickname, "End of LIST")
                    }
                    else
                    {
                        std::stringstream ss; ss << channels[first].nicknames.size();
                        RESPOND("", "322", data.nickname, first, ss.str(), channels[first].topic.empty() ? "No topic is set" : channels[first].topic)
                        RESPOND("", "323", data.nickname, "End of LIST")
                    }
    CASE("NAMES")   if (size < 1)
                    {
                        LOOP(channels)
                        {
                            std::string list; LOOPX(it->second.nicknames, dit) list += (list.empty() ? "" : " ") + *dit;
                            RESPOND("", "353", data.nickname, "=", it->first, list)
                        }
                        RESPOND("", "366", data.nickname, "End of NAMES")
                    }
                    else
                    {
                        std::string list; LOOP(channels[first].nicknames) list += (list.empty() ? "" : " ") + *it;
                        RESPOND("", "353", data.nickname, "=", first, list)
                        RESPOND("", "366", data.nickname, first, "End of NAMES")
                    }
    CASE("PRIVMSG") if (size < 1)
                        RESPOND("", "411", data.nickname, "No recipient given (PRIVMSG)")
                    else if (size < 2)
                        RESPOND("", "412", data.nickname, "No text to send")
                    else
                    {
                        bool found = false;
                        auto from = data.nickname;
                        LOOP(channels) if (it->first == first)
                        {
                            found = true;
                            LOOPX(it->second.nicknames, nit) LOOPX(socket_list, dit) if (*nit == dit->nickname) { auto data = *dit; RESPOND(from, "PRIVMSG", data.nickname, second) }
                        }
                        if (found == false)
                            LOOP(socket_list) if (it->nickname == first)
                            {
                                found = true;
                                auto data = *it; RESPOND(from, "PRIVMSG", data.nickname, second)
                            }
                        if (found == false)
                            RESPOND("", "401", data.nickname, first, "No such nick/channel")
                    }
    CASE("USERS")   RESPOND("", "446", data.nickname, "USERS has been disabled")
    CASE("PING")    RESPOND("", "PONG", first, second)
    CASE("PONG")    data.ping_timer = time(NULL) + 60; data.pong_timer = 0;
    CASE("QUIT")    if (!size) msg.params.push_back(data.nickname);
                    disconnect(data, first, 1);
    // end of the cases
    } else {
        std::cout << "Received invalid message from " << data.nickname << " msg=" << msg.command << std::endl;
        RESPOND("", "421", data.nickname, msg.command, "Unknown command")
    }
    return false;
}
message parse(char *data)
{
    message msg;
    char *pointer = data;
    while (*data != '\0')
    {
        if (msg.command.empty())
        {
            if (*data == ':')
            {
                for (; *data != '\0' && *data != ' '; ++data); *data = '\0';
                msg.prefix = pointer + 1;
                pointer = ++data;
            }
            for (; *data != '\0' && *data != ' '; ++data); *data = '\0';
            msg.command = pointer;
            pointer = ++data;
        }
        else if (*data == ':')
        {
            for (; *data != '\0'; ++data);
            msg.params.push_back(pointer+1);
            pointer = ++data;
        }
        else
        {
            for (; *data != '\0' && *data != ' '; ++data); *data = '\0';
            msg.params.push_back(pointer);
            pointer = ++data;
        }
    }
    return msg;
}
int main()
{
    int retval;
    WSADATA wsaData;
    SOCKADDR_IN listen_address; listen_address.sin_family = AF_INET; listen_address.sin_port = htons(6667); listen_address.sin_addr.s_addr = htonl(INADDR_ANY);
    timeval timeout; timeout.tv_sec = 0; timeout.tv_usec = 10000;
    fd_set socket_read_set, socket_write_set, socket_except_set;
    socket_data listener; listener.nickname = "IRCd";
    EXIT_IF(1, (0 != WSAStartup(MAKEWORD(2, 2), &wsaData)))
    EXIT_IF(2, (INVALID_SOCKET == (listener.socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP))))
    EXIT_IF(3, (SOCKET_ERROR == bind(listener.socket, (SOCKADDR *)&listen_address, sizeof(listen_address))))
    EXIT_IF(4, (SOCKET_ERROR == listen(listener.socket, SOMAXCONN)))
    while (1)
    {
        MAKE_SET(socket_read_set) MAKE_SET(socket_write_set) MAKE_SET(socket_except_set)
        EXIT_IF(5, (SOCKET_ERROR == select(0, &socket_read_set, &socket_write_set, &socket_except_set, &timeout)))
        EXIT_IF(6, (FD_ISSET(listener.socket, &socket_except_set)))
        if (FD_ISSET(listener.socket, &socket_read_set))
        {
            socket_data data = {}; // zero everything
            data.address_length = sizeof(data.address);
            data.socket = accept(listener.socket, (SOCKADDR *)&data.address, &data.address_length);
            EXIT_IF(7, (INVALID_SOCKET == data.socket))
            std::stringstream ss; ss << inet_ntoa(data.address.sin_addr) << ":" << ntohs(data.address.sin_port); data.nickname = ss.str();
            data.ping_timer = time(NULL)+60; data.pong_timer = 0;
            socket_list.push_back(data);
            std::cout  << "Connected " << data.nickname << " ping=" << data.ping_timer << std::endl;
        }
        LOOP(socket_list)
        {
            socket_data &data = *it;
            if (data.ping_timer > 0 && time(NULL) > data.ping_timer)
            {
                RESPOND("", "PING", data.nickname)
                data.ping_timer = 0; data.pong_timer = time(NULL) + 60;
                std::cout << "Sent PING to " << data.nickname << " pong=" << data.pong_timer << std::endl;
            }
            if (data.pong_timer > 0 && time(NULL) > data.pong_timer) disconnect(data, "PONG", 1);
            if (FD_ISSET(data.socket, &socket_except_set)) disconnect(data, "select except", 0);
            if (FD_ISSET(data.socket, &socket_read_set))
            {
                int bytes = recv(data.socket, data.read_buffer + data.read_buffer_index, sizeof(data.read_buffer) - data.read_buffer_index - 1 > 0, 0);
                if (bytes > 0) data.read_buffer_index += bytes; else disconnect(data, "recv error", 0);
                char *pointer = data.read_buffer + data.read_buffer_index - 2;
                if (!strcmp(pointer, "\r\n"))
                {
                    *pointer++ = '\0'; *pointer = '\0'; // remove the \r\n
                    message msg = parse(data.read_buffer);
                    memset(data.read_buffer, 0, READ_BUFFER_SIZE); data.read_buffer_index = 0;
                    if (data.ping_timer > 0 && time(NULL) < data.ping_timer)
                    {
                        data.ping_timer = time(NULL) + 60; data.pong_timer = 0;
                        std::cout << "Reset ping for " << data.nickname << " ping=" << data.ping_timer << std::endl;
                    }
                    if (process(data, msg)) EXIT_IF(0, true)
                }
            }
        }
        socket_list.remove_if([](const socket_data& data){ return data.socket == INVALID_SOCKET; });
    }
    retval = 0;
finished:
    LOOP(socket_list) disconnect(*it, "exit", 0);
    disconnect(listener, "exit", 0);
    WSACleanup();
    return retval;
}

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


text:
Given r and n, find first n numbers of x where moving first digit of x to last gives x/r = y
Objective
Given input r and n find the first n natural numbers x such that if we rotate the first digit to the last place we obtain x/r.
You may assume that 2 <= r <= 9 and 1 <= n <= 65535.
You may write a program which takes input from stdin or command-line arguments; or you may write a function which takes r and n as parameters. Output, however, should be to stdout. Output should be one line per value of x, formatted as x/r=y, in order of increasing x.
Your solution must be able to handle all valid cases within one minute on a reasonable desktop computer.
Test cases
Input: 4 5
Output:
102564/4=25641
205128/4=51282
307692/4=76923
410256/4=102564
512820/4=128205

Input: 5 1
Output: 714285/5=142857
This is code-golf, so least bytes win. Winning answer will be accepted 4 weeks from now (2014-09-19).
Credits for this question go to my colleague, who allowed me to post this question here :)

The time restriction is tough with the amount of output required.  According to gprof, one input case for my program spends less than half a second in my code, but takes around 80 seconds total, which I assume must be mostly blocking on output.

Ah, I got around it by avoiding printf.

Haskell, 182 179
Second version, probably further golfable, but with "proper" algorithm this time.  In particular, it finishes within a few minutes with r=4 and n=65535, but then again my computer is neither reasonable nor a desktop, so chances are this stays within a minute on other machines.
n#r=take n$[s(10^k*a+d)++'/':s r++'=':s d++s a|k<-[0..],a<-[1..9],let(d,m)=divMod(a*(10^k-r))(10*r-1),m<1]
s=show
main=interact$unlines.(\(r:n:_)->n#fromIntegral r).map read.words

It is based on the idea that x=10^k*a + m, where its first digit 0≤a≤9 is moved to the end to obtain y=10*m+a.  A little maths reveals that m can be obtained as a*(10^k-r)/(10*r-1), so we simply scan a over [1..9] for every k from 0 to infinity, and keep and print the first n results for which the above expression for m is integral.
The fromIntegral is required because reading a list with n as one of its elements in main, in combination with the use of n in take, would force r to Int throughout, which results in nasty overflows with the big numbers in question.  I could have used genericTake, but that requires an import.
This code also has the benefit of being almost trivial to expand to bases other than 10.
Input is read from stdin, the two values can be separated by any whitespace.

Your code should be shorter if you get rid of the backsticks

@proudhaskeller: not sure because there are no parentheses around them to separate operator and operand without requiring spaces.

I can't read Haskell, so I'm not entirely sure what you're doing. Will this solve r = 5; n = 65535 within a minute?

@MartinBüttner: I was waiting for that comment.  Yes, it probably will, but not on my computer (or anyone else's right now, in fact).  The problem needs a more advanced algorithm, I think.  :(

@TheSpanishInquisition But you ahould be able to replace y\mod`10withmod y10`, which is a char shorter

@proudhaskeller: No, since y10 is undefined.

C 468
#include <stdlib.h>
#include <stdio.h>
#define a(s)fputs(s,stdout);
#define b(c)putchar(c);
int r;int z(char*s,int m){for(int i=0;i++<=m;)a(s)b(47)b(r+48)b(61)char*t=s;
while(*++t==48);a(t)while(m--)a(s)b(*s)b(10)}char x[10][60];
int main(int c,char**v){r=atoi(v[1]);int n=atoi(v[2]),q=10*r-1,d=0,p;
while(d++<9){p=r*d;char*y=x[d];do{p*=10;*y++=p/q+48;p%=q;}while(p!=r*d);}
d=1;p=q=0;while(n--){r==5&p<6?z(x[7],7*q+p++):(z(x[d],(r==5&d==7)?7*q+6:q),
++d>9?q+=d=1,p=0:0);}}

(Some newlines not counted in the byte count have been added above to eliminate scroll bars. Yes, the final newline is counted.)
Expects arguments on the command line, and assumes standard output accepts ASCII.  Runtime is O(number of bytes output) = O(n*n).
No, I can't use printf.  That takes too much time and pushes the program over the minute limit on my desktop.  As it is, some test cases take about 30 seconds.
The algorithm treats the output as strings, not numbers, since they quickly get enormous, and there are strong patterns in the output.
Somewhat ungolfed:
#include <stdlib.h>
#include <stdio.h>

/* r is as in the problem description */
int r;

void show_line(const char* num, int repeats) {
    for (int i=0; i <= repeats; ++i)
        fputs(num, stdout);
    printf("/%c=", '0'+r);

    /* Assume the repeated num is a solution. Just move the first
       digit and skip any resulting leading zeros. */
    const char* num_tail = num;
    ++num_tail;
    while (*num_tail=='0')
        ++num_tail;
    fputs(num_tail, stdout);
    while (repeats--)
        fputs(num, stdout);
    printf("%c\n", *num);
}

/* sol[0] is unused. Otherwise, sol[d] is the repeating digits in the
   decimal representation of (r*d)/(10*r-1). */
char sol[10][60];

int main(int argc, char** argv) {
    r = atoi(argv[1]);
    int n = atoi(argv[2]);
    int q = 10*r-1;
    int d = 0;

    /* Populate the strings in sol[]. */
    while (d++<9) {
        int p = r*d;
        char* sol_str = sol[d];

        /* Do the long division p/q in decimal, stopping when the remainder
           is the original dividend. The integer part is always zero. */
        do {
            p *= 10;
            *sol_str++ = p/q + '0';
            p %= q;
        } while (p != r*d);
    }

    /* Output the answers. */
    d = 1;
    int repeats = 0;
    int r5x7_repeats = 0;
    while (n--) {
        if (r==5 && r5x7_repeats<6) {
            show_line(x[7], 7*repeats + r5x7_repeats);
        } else {
            if (r==5 && d==7)
                show_line(x[d], 7*repeats + 6);
            else
                show_line(x[d], repeats);
            if (++d > 9) {
                d = 1;
                ++repeats;
                r5x7_repeats = 0;
            }
        }
    }
}

Proof
that the program solves the problem:
(In the proof, take all operators and functions to be the real mathematical functions, not the computer operations that approximate them.  ^ denotes exponentiation, not bitwise xor.)
For clarity, I'll use a function ToDec to describe the ordinary process of writing a number as a sequence of decimal digits.  Its range is the set of ordered tuples on {0...9}.  For example,
ToDec(2014) = (2, 0, 1, 4).

For a positive integer n, define L(n) to be the number of digits in the decimal representation of n; or,
L(n) = 1+floor(log10(n)).

For a positive integer k and a non-negative integer n with L(n)<k, define Rep_k(n) to be the real number obtained by adding zeros in front of the decimal digits of n, if necessary to get k digits total, and then infinitely repeating those k digits after the decimal point.  E.g.
Rep_4(2014) = .201420142014...
Rep_5(2014) = .020140201402...

Multiplying Rep_k(n) * 10^k gives the digits of n before the decimal point, and the (zero-padded) digits of n infinitely repeated after the decimal point.  So
Rep_k(n) * 10^k = n + Rep_k(n)
Rep_k(n) = n / (10^k - 1)

Given a positive integer r, suppose x is a solution to the problem, and
ToDec(x) = ( x_1, x_2, ..., x_k )

where x_1 != 0 and k = L(x).
To be a solution, x is a multiple of r, and
ToDec(x/r) : ( x_2, x_3, ..., x_k, x_1 ).

Applying the Rep_k function gives a nice equation:
10*Rep_k(x) = x_1 + Rep_k(x/r)

Using its closed form from above,
10x / (10^k - 1) = x_1 + x / r / (10^k - 1)
x = x_1 * r * (10^k-1) / (10r - 1)

x_1 must be in the set {1 ... 9}. r was specified to be in the set {2 ... 9}.  Now the only question is, for what values of k does the above formula for x give a positive integer?  We'll consider each possible value of r individually.
When r = 2, 3, 6, 8, or 9, 10r-1 is 19, 29, 59, 79, or 89, respectively.  In all cases, the denominator p = 10r-1 is prime.  In the numerator, only 10^k-1 can be a multiple of p, which happens when
10^k = 1 (mod p)

The set of solutions is closed under addition and under subtraction that does not result in a negative number.  So the set comprises all the multiples of some common factor, which is also the least positive solution for k.
When r = 4 and 10r-1 = 39; or when r = 7 and 10r-1 = 69, the denominator is 3 times a different prime p=(10r-1)/3.  10^k-1 is always a multiple of 3, and again no other factor in the numerator can be a multiple of p, so again the problem reduces to
10^k = 1 (mod p)

and again the solutions are all the multiples of the least positive solution for k.
[Not finished...]

Python 3 - 223 179 bytes
Python implementation of TheSpanishInquisition's solution:
r,n=map(int,input().split());k=0
while 1:
 for a in range(1,10):
  D,M=divmod(a*(10**k-r),10*r-1)
  if M==0:
   print("%d/%d=%d"%(a*10**k+D,r,10*D+a));n-=1
   if n==0:exit()
 k+=1

Run:

python3 <whatever you named it>.py
Takes input on stdin
Input space separated

Output:
$python3 <whatever you named it>.py
4 8
102564/4=25641
205128/4=51282
307692/4=76923
410256/4=102564
512820/4=128205
615384/4=153846
717948/4=179487
820512/4=205128

Findings:
https://oeis.org/A092697 is the first value for each r.
It seems that only certain values of k produce answers, and that the interval is regular. E.g. for r = 4:
Form: k [a, a, ...]
0 []
1 []
2 []
3 []
4 []
5 [1, 2, 3, 4, 5, 6, 7, 8, 9]
6 []
7 []
8 []
9 []
10 []
11 [1, 2, 3, 4, 5, 6, 7, 8, 9]
12 []
13 []
14 []
15 []
16 []
17 [1, 2, 3, 4, 5, 6, 7, 8, 9]
18 []
19 []
20 []
21 []
22 []
23 [1, 2, 3, 4, 5, 6, 7, 8, 9]

The intervals are:

2 = 18
3 = 28
4 = 6
5 = 6 (5 seems to be an anomaly, as for most values of r, there are clumps of 9, 5 forms clumps of 9 and 1 (with only a = 7 working), see below)
6 = 58
7 = 22
8 = 13
9 = 44

This forms https://oeis.org/A094224.
Using these values, a more efficient version can be built:
import math

def A094224(n):
    return [18,28,6,6,58,22,13,44][n-2]

r,n=map(int,input().split());k=A094224(r)-1
H={}
while 1:
    for a in range(1,10):
        D,M=divmod(a*10**k-a*r,10*r-1)
        if M==0:
            print("%d/%d=%d"%(a*10**k+D,r,10*D+a));n-=1
            if n==0:exit()
    k+=A094224(r)

However, I can't (yet) prove that this continues mathematically.
Results for r = 5:
0 []
1 []
2 []
3 []
4 []
5 [7]
6 []
7 []
8 []
9 []
10 []
11 [7]
12 []
13 []
14 []
15 []
16 []
17 [7]
18 []
19 []
20 []
21 []
22 []
23 [7]
24 []
25 []
26 []
27 []
28 []
29 [7]
30 []
31 []
32 []
33 []
34 []
35 [7]
36 []
37 []
38 []
39 []
40 []
41 [1, 2, 3, 4, 5, 6, 7, 8, 9]

Have you tested it with input 9 65535?

I should probably use unsigned long long for that, and make it multicore to do that in one min.

If unsigned long long is 64 bits, it's not big enough.

True, I've switched to @TheSpanishInquisition's solution and used python instead.


text:
Shortest Code to randomly place points and connect them
The Task
This is quite a simple coding task, all your program has to do is place a point on a canvas (or your alternative in another coding language) and connect it to all the dots already placed.  Your program must take in one input, the number of dots that should be placed, and output some sort of display with the dots connected.  Example
Requirements

I have to be able to run it, which means that it has to have a
compiler/tool to run it either online, or publicly available to
download.
You are allowed to use any library created before this challenge was set, as long as it wasn't designed for the sole purpose of solving this.
This is a shortest code task, which means characters.  Comments, code that changes colour (for prettiness) and libraries will be ignored.
Your answer must be unique, don't steal other peoples code, shorten it a few characters and repost it.
It must be able to run in less than 5 minutes, for the values of 5 and 100. It must also use a resolution of at least 200*200 and put each dot in a random location on the canvas using a non-trivial distribution.

Current Leaderboard
Flawr        - Matlab        - 22  - Confirmed
Falko        - Python 2      - 41  - Confirmed
Wyldstallyns - NetLogo       - 51  - Confirmed
Ssdecontrol  - R             - 66  - Confirmed
9214         - Red           - 81  - Confirmed
David        - Mathematica   - 95  - Confirmed
Razetime     - Red           - 118 - Confirmed
ILoveQBasic  - QBasic        - 130 - Confirmed
Adriweb      - TI-Nspire Lua - 145 - Confirmed
Manatwork    - Bash          - 148 - Confirmed
Doorknob     - Python 2      - 158 - Confirmed
Kevin        - TCL           - 161 - Confirmed
M L          - HPPPL         - 231 - Confirmed
Manatwork    - HTML/JS       - 261 - Confirmed - Improved code of Scrblnrd3
Makando      - C#            - 278 - Confirmed
Scrblnrd3    - HTML/JS       - 281 - Confirmed
Geobits      - Java          - 282 - Confirmed

If I've missed you out, I'm very sorry, just add a comment to your work saying so and I'll add it as soon as I see it =)
TL;DR

Input - Number of dots (int, can be hard coded)
Output - Image of randomly placed dots, all connected to each other (graphic)
Winner - Shortest code

Am I allowed math libraries?  What libraries exactly are you trying to avoid with requirement #2?

Is there any limitation for resolution? This is quite easy if you let me output a 1x1 image

Hm, I'll post a solution to both these in the post.  Minimum resolution of the canvas must be 200*200, no maths libraries.

The resolution thing is still somewhat problematic, as you could just use a 360x1 canvas. You could just say something like "The dimensions of the canvas must be 200x200."

Thanks doorknob, changed.  Although I specifically said 360p, which should always be 360*480 (IIRC).

When you say no "math" libraries, what about languages where the default PRNG is included in "math"? I don't want to write a generator.

Oh, yeah, that's a fair point Geobits.  This is getting complicated quickly.  No using libraries that contain code for this specific task.

You might want to disallow degenerated solutions such as all points being the same point. You only mention random placement in the end, but even that is not enough to prevent such solutions as you don't specify any distribution.

@IngoBürk don't quite understand what you mean.  Do you mean like all points being on the same square?  Because they can't be, hence the minimum resolution of 200*200 and random points.

@PopeyGilbert Your question never even mentions "random" except for the title and the tl;dr. Most importantly, the requirements don't state it. Also, I could just choose a distribution that suits me to make the answer easier, so you might also want to require it to be a useful distribution. Although an answer misusing this would sort of be "cheating". But not mentioning randomness in the requirements is definitely something you should fix.

@IngoBürk Okay, I'll add randomness to requirements, what else would you recommend I do?

@PopeyGilbert You could require unform distribution, though I wouldn't count on that being the default everyhwere. I think "non-trivial" is enough of a requirement. I proposed an edit.

@IngoBürk There is a standard definition for "random" here, just so that it doesn't have to be explicitly spelled out each time.

@Geobits I think that definition needs an update. Where does it forbid other distributions? If my language happens to use a trivial distribution, that'd be fine according to there. But yeah, I guess one could easily call it out as "cheating". The other thing (actually mention randomness as a requirement) was more important

@IngoBürk If your language uses a trivial distribution, then it would either get voted up for being clever or voted down for being "cheaty", but I don't see a problem with calling it valid. Off hand I don't know of any built-in generator that is so trivial as to make this easier, though. Kudos to you if you find one, IMO. But yes, I agree that mentioning randomness is important. That was already done when I commented, so I didn't mention it.

Someone added something about non-trivial distribution, so this is sorted =)  Just for the future, as I can't find anything on google except P(X=x)=1 for trivial distribution.  What is it?

Looking at the Matlab answer from flawr, does that mean the input can already be stored in a variable n? Don't I have to read it from stdin like input() in Python?

Hm, I should probably fix that in the topic post.  I will say that you can hard code the number directly into your code, however you must be able to change it and the program will still work.  You're allowed to do one number tests for the char result.

Since you disallow library code that directly relates to the task, and that task is essentially to draw a random network graph, isn't use of native graph-drawing functions also disallowed? This restriction is far from well defined.

@comperendinous Your very correct, however I'm not sure how to word it in a manner that is fair for all languages.  If you have any suggestions on how I can change it, please do say.  As I said this is my first code golf post, and I've made a lot of mistakes.

I think code golf is never fair for all languages. ;)

You do have a point.  Java is doomed to never be the shortest, and golf script has an advantage for non-graphical problems.

@PopeyGilbert "trivial" is a general term, but a trivial distribution, in simple words, is a distribution which is "not very interesting" or "too simple" to matter in a meaningful way. You can't really pinpoint it, but that's why it fits so well. People with a math background will generally agree on what is or isn't trivial. In a sloppy way it's a more formal way of excluding distributions which were obviously used only because they make the given problem easier (or even trivial if you only have to draw a single point).

@PopeyGilbert This is the maths languages' domain, so they're naturally going to have an advantage, as Golfscript, etc. have a more general golfing advantage. I think there are some places where you could choose to draw the line, though. Most leniently, all libraries created before you posted the question are permitted. This would prevent a simple import answer-type submission. You could say standard (no third-party) libraries only, which permits Mathematica, etc. Or, most strictly, you could permit only primitive drawing functions: draw points and lines, but no graph-plotting functions.

@IngoBürk Thank-you for clearing that up and comperendinous, Wow, thanks for all the suggestions for wording!

@PopeyGilbert I must say, I've never seen a new user so responsive to issues with their question and also individually test each answer and maintain a leaderboard. Good work and welcome to PPGC!

Thanks @Calvin'sHobbies!  It's great to have some moral support :).  I feel it's good to be responsive to questions, otherwise people get a feeling of uneasiness.

Obviously as you say that,  I was not there for 12 hours.  Unfortunately people have this annoying need to sleep.

Matlab (22)
gplot(ones(n),rand(n))

It is assumend that n is the number of points, and it looks like this for n=10:

n=6:

Explaination
gplot is a command for plotting graphs. The first argument is a n x n incidence matrix (full of ones, obviously). The second argument should be a n x 2 matrix with the coordinates of the points, but it does not matter if the second dimension is bigger that 2, so I just generate an n x n matrix of random values (which is 2 characters shorter than generating an n x 2 matrix).
Links to documentation

gplot
ones
rand

Never used Matlab, so it will take a moment to test - But from the image it looks okay!  Congrats on doing it in 22 characters. EDIT - Turns out I can't test this, however looking at the image it seems correct so I'll allow it.  However can someone else test it please?

Thanks=) You can test it here: http://octave-online.net/ Since octave is basically the opensource version of MatLab.

Java : 318 282 265
Because, ya know, Java:
class M{public static void main(String[]a){new Frame(){public void paint(Graphics g){int i=0,j,d=640,n=25,x[]=new int[n],y[]=x.clone();for(setSize(d,d);i<n;i++)for(j=0,x[i]=(int)(random()*d),y[i]=(int)(random()*d);j<i;g.drawLine(x[i],y[i],x[j],y[j++]));}}.show();}}

Its just a simple loop that makes random dots and draws lines between the current dot and all previous ones.
Example with 25 dots:

With line breaks and imports:
import java.awt.*;
import static java.lang.Math.*;

class M{
    public static void main(String[]a){
        new Frame(){
            public void paint(Graphics g){
                int i=0,j,d=640,n=25,x[]=new int[n],y[]=x.clone();
                for(setSize(d,d);i<n;i++)
                    for(j=0,x[i]=(int)(random()*d),y[i]=(int)(random()*d);
                        j<i;
                        g.drawLine(x[i],y[i],x[j],y[j++]));
            }
        }.show();
    }
}

Edit: Since we're not counting imports, I imported a couple more things to save some characters later.
Edit 2: OP added an allowance for hardcoding number of dots. -17 chars :)

Nice!  Congrats on being first one.

First, but I'm sure it won't be the shortest by a long shot. Cause, ya know, Java ;)

Yeah, that's a problem with java, the public static void main... statement uses a lot of characters.

This is verified, I've gotten it to work!

@PopeyGilbert It's worse than that. The overhead on making a frame, as you can see here, is giant. And this is about as terse as it gets.

I admire people who always solve the task in Java, even when hopeless, I'd even be too lazy to start eclipse... so +1  =)

@Chruncher Yeah, java is most definitely not the best language for code golf.  However it was the first language I learnt, and it is quite easy to pick up.  It also held me in good stead however, and is personally, my favourite language.

It's not necessary to define main's parameter as final. You can cut off those 6 characters

@Cruncher I'm using Java6 on this box (ugh), so I need the final to access it anonymously. I know it'll work on my other machine, but I haven't cut it yet because I'm waiting to actually test it with 8 to see if I can cut more.

+1 because I never thought I'd see Java on CodeGolf. (I still never think I'll see it as a serious contender, but, ya know, Java.)

If there is a competition that a person has won by coding in java, please link it!  It would be hilarious to see.

@KyleStrand Java competes well within its weight class. You have no idea how sad I was to see my latest edit didn't quite beat the leading HTML/JS entry, but beating C# always gives a warm feeling :D

@PopeyGilbert I think the closest you'll find is this one, but...

You can use Char[] a instead of string[] a I think. -1 byte

Looking at this amazing golf, I gave up on Processing, since I could not come up with anything nearly as good as this, +1

Python 2 - 41 35
After importing some libraries as allowed for this challenge
from pylab import rand as r
from pylab import plot as p
from itertools import product as x
from itertools import chain as c

we can plot some number of connected points with just one line of code:
X=r(5,2);p(*zip(*c(*list(x(X,X)))))

(The screenshot was generated with 10 points.)

[Referring to a deleted comment:] I know, but here "libraries will be ignored". If not, I'd definitely implement it differently. Using those libraries does not save enough characters to justify the import statements in a normal code golf challenge.

is pylab part of standard distribution? I would imagine we can't just import anything we like. Under that metric you can implement anything in python with a single import statement.

Yes it is. I just did what I thought would be valid. But I'm not sure. And looking into the comments shows a huge discussion going on. As soon as this is clarified I'd be willing to adjust my code.

Although this competitions view on what libraries are allowed seems to change from day to day, PyLab should definitely be allowed.

Mathematica 95 87
With some help from belisarius.
CompleteGraph[n, VertexSize -> {2, 2},
VertexCoordinates -> Table[RandomInteger[{0, 199}, 2], {n}]]

n=5

n=100
Timing: 2.082654 sec

This is verified, I've gotten it to work!  Does Mathematica normally count as a language though?

@PopeyGilbert Sure it does. There are ~750 answers in Mathematica so far.

Oh, wow, Okay!  Fair enough <3

Methinks this is shorter and satisfies the rules CompleteGraph[100, VertexCoordinates -> RandomReal[{0, 199}, {100, 2}]]

Thanks, You are correct. I figured I couldn't win so I thought I'd make it pretty (VertexSize->{2,2}.  I did, however, overlook the fact that 100 was unnecessary to include, and that Input[] was optional.

I believe this code is shorter and satisfies the rules:
Graphics@Line@Tuples[{RandomReal[],RandomReal[]}~Table~{i, 1, n},{2}]

Python 2, 158
Import statements not included in character count, as noted in question ("libraries will be ignored").
from PIL import Image,ImageDraw
from random import randint

s=[(randint(0,200),randint(0,200))for _ in range(int(input()))]
i=Image.new('RGB',(200,200))
[ImageDraw.Draw(i).line((p,q),255)for p in s for q in s]
i.show()

Sample outputs:
n=2 (...):

n=10 (looks like fancy 3d thing or something):

n=100 (looks like someone went BLELEEEAARARGHHH with a red pen):

n=500, 1000, 10000 (runs in about 1.5 seconds, 5-6 seconds, and 3.5 minutes respectively):

Note: the 10000 points one was run with a slightly optimized version that changed line 3 (not including imports) to this:
d=ImageDraw.Draw
for p in s:
  for q in s:d.line((p,q),255)

Otherwise it would have taken forever. :P
Ungolfed:
from PIL import Image, ImageDraw
from random import randint
point_count = int(input())
image_size = 200
points = [(randint(0, image_size), randint(0, image_size)) for _ in range(point_count)]
image = Image.new('RGB', (200, 200))
draw = ImageDraw.Draw(image)
for start_point in points:
    for end_point in points:
        draw.line((start_point, end_point), 255)
image.show()

Congrats on currently being the shortest entrant!  Love your comment on n=100.  Might be best to put image.new and image_size to 800.  Might look less weird =)

@PopeyGilbert So I can remove the import statements from mine? I assumed "ignore libraries" meant the library itself wasn't counted (as usual).

Yeah, because some languages have very few base functions, and have to import all their stuff.  If you think  this is not fair Geobits, then please say =)  I want to try to make this fair.

@PopeyGilbert I just asked because it's not the norm and wanted to clear it up before I chopped a few more characters from my code :D

Ah, okay, but yeah!  You can take out the library import statements.

This is verified, I've gotten it to work!

Since the resolution only has to be at least 200x200, you could save a few characters (5, I think) by setting x=255 and using it to replace the instances of 200 and 255.

Save at least another 12 characters by importing randint as r, Image as I, ImageDraw.Draw as D, which, as part of the imports, doesn't count to your score.

Nice tips on how to golf a persons code!  Nice to see coders helping each other out to save characters!

R, 66
This one is borderline cheating but I still think it's within the rules. Set up by loading the igraph package with library(igraph), which can be downloaded from CRAN with install.packages("igraph"). Then assign the input to variable N. As per the rules, these are not counted in the total.
G=graph.adjacency(matrix(1,N,N),"un")
plot(G,layout=layout.random)

N = 50

Note that this code also draws self-connections. Eliminating them (although there's no rule against them) adds 6 characters:
G=graph.adjacency(matrix(1,N,N),"un",diag=F)
plot(G,layout=layout.random)

R, 141
This is an honest-to-goodness solution in base R:
p=replicate(2,runif(N))
g=as.matrix(expand.grid(1:N,1:N))
plot.new()
apply(g,1,function(i) segments(p[i[1],1],p[i[1],2],p[i[2],1],p[i[2],2]))

although you still have to enter N by hand.
N = 50

I'm wondering if a for loop would be fewer characters than apply but I'm happy with what I've got.

I'll accept self-connects, technically the question is draw a line to ALL points.  I've tested it and confirmed it also.

Do you mind arrows connecting the points? That'll save another 5 by eliminating ,"un" at the end of the first line.

If you don't mind, I think we should keep it so it has to be lines connecting each of the points.  That way the answer will appear similar in each of the answers.

QBasic or QuickBasic, 130 characters
SCREEN 1:RANDOMIZE:N=10:DIM X(100),Y(100):FOR I=1 TO N:X(I)=RND*320:Y(I)=RND*200:FOR J=1 TO I:LINE(X(I),Y(I))-(X(J),Y(J)):NEXT J,I

Code variations

If you do not want to be prompted for a seed, replace RANDOMIZE with RANDOMIZE TIMER.
If you want to be prompted for N, replace N=10 with INPUT N or INPUT "N";N.

Sample runs
For N=5, tested with QBasic 1.1 running on DOSBox 0.74:

For N=100, tested with QBasic 1.1 running on DOSBox 0.74:

Oh, wow, nice image for N=5!  Love that it's a pentagram when the seed is 42.  Tested and confirmed.

Bash + ImageMagick: 148 characters
c=()
while((i++<$1)); do
p=$[RANDOM%200],$[RANDOM%200]
c+=($p)
for e in ${c[@]};do
d+="line $p $e"
done
done
convert -size 200x200 xc: -draw "$d" x:

Sample run:
bash-4.3$ time ./line.sh 5

real    0m5.256s
user    0m0.137s
sys     0m0.017s

Sample output:

Sample run:
bash-4.3$ time ./line.sh 25

real    0m3.043s
user    0m0.574s
sys     0m0.023s

Sample output:

Sample run:
bash-4.3$ time ./line.sh 100

real    0m5.662s
user    0m11.156s
sys     0m0.076s

Sample output:

Tested and confirmed.  Well done manatwork!

I'm very sorry, did I completely forget to add this to the leader boards?  I will do that now.

[TI-Nspire] Lua - 145 135 130
(Updated fixed version)

"Importing" math.random as "r", first, as allowed : r=math.random
Actual code :
function on.paint(g)t={}for b=1,2*n-1,2 do t[b]=r(318)t[b+1]=r(212)for c=1,b-1,2 do g:drawLine(t[b],t[b+1],t[c],t[c+1])end end end

Note : This code works on the TI-Nspire calculators (TI added Lua scripting to recent OSes of this platform, with an even-based API allowing users to graph stuff etc. for example.)

It can also be tried online here (just erase the demo script and prepend mine with   n=10 for example)

Time for me to learn Lua!

This seems to suffer by the same mistake as fuandon's deleted PowerShell answer and Vlo's also deleted R answer: you connect the dots in pair, not every dot with all other dots. (Lua is so rare on this site. Please fix your code instead of deleting it.)

Oh, my bad - I'll fix that soon !

There we go, thanks for letting me know :)

This has been tested and confirmed!  Well done on using Lua.

TCL 161 chars
Clearly not going to win, but beats several others presented here, and I think it makes good use of a highly undervalued language.
for {set i 0} {$i<10} {incr i} {lappend l [expr rand()*291] [expr rand()*204]}
pack [canvas .c]
foreach {x y} $l {foreach {w z} $l {.c create line $x $y $w $z}}

The default canvas size on my system appears to be 291x204. Not sure why, but using it saves 13 characters.
Fairly fast, 400 points in < 5 seconds, 500 in ~10 s. Size and points can be scaled arbitrarily and colors and line styles can be altered, at the cost of characters of course. Un-golfed and using variables to make it clearer and easier to scale and color:
set n 20
set width 500
set height 500
set bg_color black
set line_color white
for {set i 0} {$i < $n} {incr i} {
        lappend points [expr rand() * $width] [expr rand() * $height]
}
canvas .c -width $width -height $height -background $bg_color
pack .c
foreach {x1 y1} $points {
        foreach {x2 y2} $points {
                .c create line $x1 $y1 $x2 $y2 -fill $line_color
        }
}

Image seems fine, unfortunately my computer isn't working so I'll test it later.  Congratulations on using such an underappreciated language.

Just confirmed it, congratulations on a successful entry!

129

122

Red, 118 bytes
a: collect[loop n[keep random d: 200x200]]
view[base d draw collect[foreach p a[foreach q a[keep reduce['line p q]]]]]

This was fun to figure out. Thanks to Toomas Vooglaid on Gitter and 9214 for helping with this. n is hardcoded.
-1 byte from Bubbler.
-2 bytes from Galen Ivanov.
Screenshots

Is it possible to reuse the constant 200 (or 200x200)?

the reuse saves a byte

You can put the initizlization d: 200x200 inside the expression for a:  a: collect[loop n[keep random d: 200x200]] for 118 bytes

didn't know that it would be globally initialized, Thanks!

Your "Try it online!" doesn't seem to work.  I get the following error: `*** Red Compiler Internal Error: Script Error : copy expected value argument of type: series port bitset
*** Where: rejoin
*** Near:  [mold copy/part pos 40]
/srv/wrappers/red: line 5: ./.bin.tio: No such file or directory`

Although verified locally.

It looks as if, in your screenshot, you write n:10 to initialise the value of n.  However, a space seems to be required n: 10 otherwise the code does not run.  This is on Red 0.6.4.

yes. Red requires word definitions to be separated by a space, so n:10 without a space is recognized as a token rather than a declarations.

Sorry, forgot to remove the tio link.

C# Windows forms, 268
static void k(int n,int s){var f=new Form{Height=s+50,Width=s+25};f.Paint+=(u,v)=>{var r=new Random();var p=new Point[n];while(n>0)p[--n]=new Point(r.Next(s),r.Next(s));foreach(var a in p)foreach(var b in p)f.CreateGraphics().DrawLine(Pens.Tan,a,b);};f.ShowDialog();}

N=5

N=50

Full code is given below
using System;
using System.Drawing;
using System.Windows.Forms;

namespace WindowsFormsApplication2
{
    static class Program
    {
        static void Main()
        {
            k(50, 200);
        }
        static void k(int n, int s)
        {
            var f = new Form {Height = s + 50, Width = s + 25};
            f.Paint += (u, v) =>
            {
                var r = new Random();
                var p = new Point[n];
                while (n > 0)
                    p[--n] = new Point(r.Next(s), r.Next(s));
                foreach (var a in p)
                    foreach (var b in p)
                        f.CreateGraphics().DrawLine(Pens.Tan, a, b);
            };
            f.ShowDialog();
        }
    }
}

Tested and confirmed!  When I checked the character count, I used the full code and was surprised when it came to <700 characters... >.<.  Anyway, congratulations on making a successful entry!

Isn't there some shortcut like Pens.Tan instead of new Pen(Color.Tan)?

Changed to use Pens.Tan, saving an extra 10

Red, 81 bytes
?(draw d: 200x200 loop n: 10[foreach x append[]y: random d[repend[]['line x y]]])

Try it locally in REPL

Verified locally :)

HTML/JS, 210, thanks to manatwork
<canvas id=q /><script>c=q.getContext("2d");r=Math.random;e=prompt(a=[]);for(i=0;i<e;i++){a[i]={x:r()*300,y:r()*150};for(j in a)c.beginPath()+c.moveTo(a[i].x,a[i].y)+c.lineTo(a[j].x,a[j].y)+c.stroke()}</script>

JSFiddle

This is verified, I've gotten it to work!

You can use ~~ instead of m.floor to save 5 bytes

Make the canvas tag self-closing and remove the single quotes around the id value: <canvas id=q />. (Note that you have to leave one space between the last attribute value and the self-closing /.) BTW, in Firefox works fine without m.floor() and ~~.

219 characters: http://jsfiddle.net/e866azzs/5/

The first time I tried manatwork's jsfiddle, I thought the alert box needed a password!  I was perplexed.  How stupid a person can be.  I believe this is sufficiently different to another persons answer to warrant another place in the leader board.  Do other people think this is different enough?

Not a big difference. Same 1 for to set up the array, same 2 fors to generate the combinations, same canvas methods to do the drawing… Wait a moment! Did I enumerated 3 fors? Very bad. 2 fors, 210 characters: http://jsfiddle.net/e866azzs/9/

C# WPF  306  296
partial class W:Window{public W(){InitializeComponent();int x=5,i=0,j,z=200;int[]f=new int[x],s=new int[x];var r=new Random();var X=new Grid();AddChild(X);for(;i<x;i++){f[i]=r.Next(z);s[i]=r.Next(z);for(j=i;j>=0;)X.Children.Add(newLine(){X1=s[j],Y1=f[j--],X2=s[i],Y2=f[i],Stroke=Brushes.Red});}}}

I would like to say that I could remove Stroke=Brushed.Red. But Sadly that means that I am painting transparent lines, and my Guess is that it wouldn't really count. :P I can also shave of a couple of bytes by just creating a grid in the XAML view. But that seemed unfair, so I stripped the XAML to become a blank canvas. (I don't count the XAML as bytes...)
partial class W:Window
{
    public W()
    {
        InitializeComponent();
        int x=5,i=0,j,z=200;
        int[]f=new int[x],s=new int[x];
        var r = new Random();
        var X = new Grid();
        AddChild(X);
        for (;i<x;i++)
        {
            f[i]=r.Next(z);
            s[i]=r.Next(z);
            for (j=i;j>=0;)
                X.Children.Add(new Line()
                {
                    X1 = s[j],
                    Y1 = f[j--],
                    X2 = s[i],
                    Y2 = f[i],
                    Stroke = Brushes.Red
                });
        }
    }
}

XAML
<Window x:Class="W"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
</Window>

5

100

Since it is WPF it will crash at around 3k Points for Out of Memory exception.

Tested and confirmed, well done on doing it in C# WPF!

Could be shorted a little by using var when declaring variables.

Yes, indeed. Thanks! I was also able to remove "this" from "this.AddChild".

HPPPL, 231 220
(HP Prime Programming Language for the HP Prime color graphing calculator)
golfed it down. 11 fewer chars by drawing all possible new lines right after every new point creation. Only two nested loops instead of the previous three.
export c(n) begin rect();local g,h;a:=makemat(0,n,2);for g from 1 to n do a(g,1):=ip(random(1,320));a(g,2):=ip(random(1,240));if g>1 then for h from 1 to g-1 do line_p(a(h,1),a(h,2),a(g,1),a(g,2));end;end;end;freeze;end;

Ungolfed (270 chars):
export randomnet(n)
begin
rect();
local g,h;
a:=makemat(0,n,2);
for g from 1 to n do
  a(g,1):=ip(random(1,320));
  a(g,2):=ip(random(1,240));
    if g>1 then
      for h from 1 to g-1 do
        line_p(a(h,1),a(h,2),a(g,1),a(g,2));
      end;
    end;
end;
freeze;
end;

examples:
c(10)

c(30)

The HP Prime color graphing calculator has a 320x240 pixel color display.

An emulator that also works with the connectivity kit is available at the HP website or here: http://www.hp-prime.de/en/category/6-downloads
... still waiting for the hardware to arrive. Update on the execution time will follow.
Today my HP Prime arrived. Here is the execution time for n=100 on an actual calculator:

Around 0.65 s for n=100.
The emulator is about 4 times as fast (around 0.178 s) on my Core i5 2410M laptop.

Well, I have never even heard of that programming language, but it worked on the emulator so congratulations!  I've added you to the leaderboard.

Thanks. As soon as I have the hardware, I’ll check the execution time. The emulator is faster than the actual calculator. But I think the 5 minutes limit for n=100 is very generous for the calculator.

NetLogo, 51 bytes
crt 9 [create-links-with other turtles fd random 9]

Replace 9s with other constants or variables as needed.

Added to the leaderboard!  Afraid I'm not entirely sure how to test this.  I've downloaded NetLogo and I've typed it into the observer section, then tried setting it as a pen command on a plot, neither appeared to function. If you could give me some pointers, I'd be able to confirm it =)

F'rinstance: go into the 'code' tab and wrap that line in a function that starts "to go" and stops with "end". Then you can add a button to the first that calls "go" and hit it.

Confirmed!  Beautiful solution.  It's great how if you know what a turtle is you can read the code like it's English.  Almost certainly the most readable solution yet.

Neat! Thanks! I've been on the lookout for questions like this one that NetLogo is geared toward solving. Ironically, I'm also building a pyth-ish front end to remove that nice verbosity to try and make NetLogo a real golf contender.

You probably noticed some differences in output - I snuck a "hide-turtle" in when I captured the image, and I had tweaked the scale and dimensions and wrap of the world so 9's act more like 300's.

Eh, I figured it was still an excellent answer!  Can't wait to see your Pyth NetLogo code, should hopefully be a sight to behold!

05AB1E (legacy), 17 chars
Imports (excluded from character count):
"exec('global r,p;from pylab import rand as r,plot as p')".E\

’p(*Œ¬(*r(,2))’.E

Beats all other answers. Port of Falko's Python answer. Go upvote him! Input is hard-coded before the first ,.
’...’.E  # trimmed program
     .E  # evaluate...
’...’    # "p(*zip(*r(num,2)))"...
     .E  # as Python code

====================

p(*zip(*r(num,2)))  # full program
p(               )  # display plot with lines connecting all points at coordinates in ordered pairs...
  *                 # in...
   zip(         )   # each element of...
       *            # first element of...
        r(   , )    # array of...
          num       # input...
        r(     )    # arrays each containing...
              2     # literal...
        r(     )    # random numbers from 0 to 1, half-inclusive...
   zip(         )   # paired with corresponding element in...
       *            # second element of...
        r(   , )    # array of...
          num       # input...
        r(     )    # arrays each containing...
              2     # literal...
        r(     )    # random numbers from 0 to 1, half-inclusive

Character scoring abuse (actually longer), 20 characters
""Ç6°βƵ6BÎ.:.E

"..."Ç6°βƵ6BÎ.:.E  # trimmed program
               .E  # evaluate...
     Ç             # list of charcodes of...
"..."              # literal...
        β          # converted from list of base-10 values of base...
       °           # 10 to the power of...
      6            # literal...
        β          # digits to decimal...
           B       # in base...
         Ƶ6        # 107...
             .:    # with all...
            Î      # 0...
             .:    # s replaced with...
            Î      # input

====================

p(*zip(*r(num,2)))  # full program
p(               )  # display plot with lines connecting all points at coordinates in ordered pairs...
  *                 # in...
   zip(         )   # each element of...
       *            # first element of...
        r(   , )    # array of...
          num       # input...
        r(     )    # arrays each containing...
              2     # literal...
        r(     )    # random numbers from 0 to 1, half-inclusive...
   zip(         )   # paired with corresponding element in...
       *            # second element of...
        r(   , )    # array of...
          num       # input...
        r(     )    # arrays each containing...
              2     # literal...
        r(     )    # random numbers from 0 to 1, half-inclusive

PostScript, 48 bytes
00000000: 8814 3292 6c7b 7261 6e64 887f 9204 7d92  ..2.l{rand....}.
00000010: 837b 7b92 6b92 1a92 1992 1a34 9252 7b92  .{{.k......4.R{.
00000020: 4e92 6392 a792 4d7d 9283 7d92 657d 92a3  N.c...M}..}.e}..

Number of points is in the second byte (here it is 0x14 = 20 points).
Un-tokenized version:
20                          % number of points
2 mul{rand 127 and}repeat   % random points on stack
{
    {
        moveto              % move to top point on stack
        count copy          % duplicate stack
            count 4 idiv{   % for each duplicated point
            gsave
            lineto stroke   % draw a line to it
            grestore        % (removing it from the stack)
        }repeat
    }loop
}stopped                    % stop when stack is empty

Woah!  Postscript!  That's so cool, and surprisingly short.  Got any ideas how to run it?

Sure - paste the hex dump into k20.txt and run it through xxd -r < k20.txt > k20.ps to get a binary, and then load it in a postscript viewer. For the screenshot, I used Preview.app on OS X, which converts to PDF internally. You can also use ghostscript by running gs k20.ps or  load it in ghostview (aka gs or gsview). Or you can convert manually to PDF using gs -sDEVICE=pdfwrite -sOutputFile=k20.pdf k20.ps and then open k20.pdf in a PDF viewer.

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