text:
Determine if all decimal digits are unique
Deleted questions on Stack Overflow sometimes make for great golf material.
Write a function that takes a nonnegative integer as input, and returns true if all the digits in the base 10 representation of that number are unique. Example:
48778584 -> false
17308459 -> true

Character count includes only the function.
If you choose to answer in C or C++: no macros, no undefined behaviour; implementation-defined behaviour and compiler warnings are fine.

I'd still be interested in other C or C++ solutions as per the question that inspired this one.

Why no C or C++ macros or undefined behavior? That's oddly limiting to just two languages.

Golfscript, 8 7 characters:
{`..&=}

` - stringify the argument
.. - clone twice
& - intersect with itself (remove duplicates)
= - check for equality.

if the function needs to be named (10 9 characters):
{`..&=}:a

if a program suffices (5 4 characters):
..&=

The $ is unnecessary, as .& preserves the order of the array elements.

@IlmariKaronen good catch, thanks

The hard part about challenges like this is being the first to see it.

@primo yet, somehow, they still get +6 score within half a day.

@JanDvorak Parkinson's law of triviality at work

@Claudiu You can understand the law. Realise you're being subjected to it. Then upvote the answer anyway.

Golfscript 'answers' are officially not funny any more.

@NathanChere what do you mean? the last (and only) time that loophole was suggested it dropped to -3 before getting deleted by the suggester the next morning. If you don't like golfscript answers, don't upvote them.

Python 2 (28)  (32)
lambda n:10**len(set(`n`))>n

The backticks take the string representation. Converting to a set removes duplicates, and we check whether this decreases the length by comparing to 10^d, which is bigger than all d-digit number but no (d+1)-digit numbers.
Old code:
lambda n:len(set(`n`))==len(`n`)

Ha I had this exact same answer ready, just replace n with i

@Claudiu so did I. f=lambda _:len(\`)==len(set(``))`

Yeah, with these bite-size challenges, everyone is going to converge on pretty much the same thing. I was also trying lambda n:max(map('n'.count,'n'))<2 (the single quotes are backticks), but it's two chars longer.

Never knew about backticks before!  Unfortunately it appears to be eliminated in Python 3: What do backticks mean to the Python interpreter?

APL (6)
≡∘∪⍨∘⍕

One of the few times where tacit style is shorter in APL too.
It's 8 characters to give it a name,
f←≡∘∪⍨∘⍕

but that's not necessary to use it:
      ≡∘∪⍨∘⍕ 199
0
      ≡∘∪⍨∘⍕ 198
1
      f←≡∘∪⍨∘⍕
      f¨ 198 199 200 201
1 0 0 1
      ≡∘∪⍨∘⍕¨ 198 199 200 201
1 0 0 1

I think the second jot can be removed to make it 5. It would still be a valid function by itself (though it would require grouping parens to use it with each operator in the last example).

Perl, 19 characters
print<>!~/(\d).*\1/

assuming output can be treated as true and no-output can be treated as false, your logic is reversed. You should return true if there's no repetition.

@JanDvorak Sounds about right. I'll fix that.

Not-match operator: <>!~/(\d).*\1/.

@primo Thanks! So much to learn :)

The input is specified as being a non-negative integer, so I don't think you need to verify that. If you indeed don't, you can change \d to ..

Rebmμ (10 characters)
e? AtsAuqA

Rebmu's "mushing" trick is that it's case-insensitive, so characters are run together.  Whenever a case transition is hit, that splits to the next token.  By using transitions instead of a CamelCase kind of thing, the unique choice to start with a capital run means a "set-word" is made.  (While set-words can be used for other purposes in symbolic programming, they are evaluated as assignments by default).
So this "unmushes" to:
e? a: ts a uq a

The space is needed because once you've begun a series of runs of alternating cases, you can't use that trick to get a set-word after the first unless you begin a new run.  So e?AtsAuqA would have gotten you e? a ts a uq a...no assignment.
(Note: For what may be no particularly good reason, I tend to prefer rethinking solutions so that there are no spaces, if character counts are equal.  Since brackets, parentheses, and strings implicitly end a symbol...there are often a fair number of opportunities for this.)
In any case, when mapped to the Rebol that it abbreviates:
equal? a: to-string a unique a

Throwing in some parentheses to help get the gist of the evaluation order:
equal? (a: (to-string a)) (unique a)

So the prefix equality operator is applied to two arguments--the first the result of assigning to a of the string version of itself, and the second the result of unique being run against that string.  It so happens that unique will give you back the elements in the same order you passed them...so unique of "31214" is "3124" for instance.
Run it with:
>> rebmu/args "e? AtsAuqA" 17308459
== true

There's also some stats and debug information:
>> rebmu/args/stats/debug "e? AtsAuqA" 48778584
Original Rebmu string was: 10 characters.
Rebmu as mushed Rebol block molds to: 10 characters.
Unmushed Rebmu molds to: 15 characters.
Executing: [e? a: ts a uq a]
== false

If the requirement is that one must define a named/reusable function you can make an "A-function" which implicitly takes a parameter named a with a|.  (A B-function would be created with b| and take a parameter named A then one named B).  So that would add five more characters...let's say you call the function "f"
Fa|[e? AtsAugA]

"You laugh!  They laughed at Einstein!  Or wait...did they?  I...don't know."

I used to think the language was pronounced like Reb moo, but now I'm not sure if it's supposed to be Rebum mew or Reb mew or something else.

After playing Nethack, I read Fa|[e? AtsAugA] as False? SomeGibberish

@Quincunx does s really decay to [ in Nethack?

@JanDvorak I've seen some letters do decay into [ after some time

@Quincunx Just playing with the logo.  I think REBmu is probably better.  Either way, the beard is tight..it pinches.  Guess you get what you pay for.

FRACTRAN - 53 38 fractions
47/10 3/5 106/47 3599/54272 53/61 2881/27136 2479/13568 2077/6784 1943/3392 1541/1696 1273/848 1139/424 871/212 737/106 469/53 142/3953 67/71 5/67 1/147 1/363 1/507 1/867 1/1083 1/1587 1/2523 1/2883 1/4107 1/5547 1/7 1/11 1/13 1/17 1/19 1/23 1/29 1/31 1/37 1/43

Uses division to count the number of occurrences of each digit. Call by putting n in register 2 and setting register 5 to 1, gives output in register 3 (0 if false, 1 if true). Also, make sure the rest of your program uses only registers > 71.

Edit 25/12/14: It's been 7 months and we've since gotten Stack Snippets, so here's one to test the code (using my could-be-better interpreter here).

var ITERS_PER_SEC=1E5;var TIMEOUT_MILLISECS=5E3;var ERROR_INPUT="Invalid input";var ERROR_PARSE="Parse error: ";var ERROR_TIMEOUT="Timeout";var ERROR_INTERRUPT="Interrupted by user";var running,instructions,registers,timeout,start_time,iterations;function clear_output(){document.getElementById("output").value="";document.getElementById("stderr").innerHTML=""};function stop(){running=false;document.getElementById("run").disabled=false;document.getElementById("stop").disabled=true;document.getElementById("clear").disabled=false}function interrupt(){error(ERROR_INTERRUPT)}function error(msg){document.getElementById("stderr").innerHTML=msg;stop()}function factorise(n){var factorisation={};var divisor=2;while(n>1){if(n%divisor==0){var power=0;while(n%divisor==0){n/=divisor;power+=1}if(power!=0)factorisation[divisor]=power}divisor+=1}return factorisation};function fact_accumulate(fact1,fact2){for(var reg in fact2)if(reg in fact1)fact1[reg]+=fact2[reg];else fact1[reg]=fact2[reg];return fact1};function exp_to_fact(expression){expression=expression.trim().split(/\s*\*\s*/);var factorisation={};for(var i=0;i<expression.length;++i){var term=expression[i].trim().split(/\s*\^\s*/);if(term.length>2)throw"error";term[0]=parseInt(term[0]);if(isNaN(term[0]))throw"error";if(term.length==2){term[1]=parseInt(term[1]);if(isNaN(term[1]))throw"error";}if(term[0]<=1)continue;var fact_term=factorise(term[0]);if(term.length==2)for(var reg in fact_term)fact_term[reg]*=term[1];factorisation=fact_accumulate(factorisation,fact_term)}return factorisation}function to_instruction(n,d){instruction=[];divisor=2;while(n>1||d>1){if(n%divisor==0||d%divisor==0){reg_offset=0;while(n%divisor==0){reg_offset+=1;n/=divisor}while(d%divisor==0){reg_offset-=1;d/=divisor}if(reg_offset!=0)instruction.push(Array(divisor,reg_offset))}divisor+=1}return instruction};function run(){clear_output();document.getElementById("run").disabled=true;document.getElementById("stop").disabled=false;document.getElementById("clear").disabled=true;timeout=document.getElementById("timeout").checked;var code=document.getElementById("code").value;var input=document.getElementById("input").value;instructions=[];code=code.trim().split(/[\s,]+/);for(i=0;i<code.length;++i){fraction=code[i];split_fraction=fraction.split("/");if(split_fraction.length!=2){error(ERROR_PARSE+fraction);return}numerator=parseInt(split_fraction[0]);denominator=parseInt(split_fraction[1]);if(isNaN(numerator)||isNaN(denominator)){error(ERROR_PARSE+fraction);return}instructions.push(to_instruction(numerator,denominator))}try{registers=exp_to_fact(input)}catch(err){error(ERROR_INPUT);return}running=true;iterations=0;start_time=Date.now();fractran_iter(1)};function regs_to_string(regs){reg_list=Object.keys(regs);reg_list.sort(function(a,b){return a-b});out_str=[];for(var i=0;i<reg_list.length;++i)if(regs[reg_list[i]]!=0)out_str.push(reg_list[i]+"^"+regs[reg_list[i]]);out_str=out_str.join(" * ");if(out_str=="")out_str="1";return out_str};function fractran_iter(niters){if(!running){stop();return}var iter_start_time=Date.now();for(var i=0;i<niters;++i){program_complete=true;for(var instr_ptr=0;instr_ptr<instructions.length;++instr_ptr){instruction=instructions[instr_ptr];perform_instr=true;for(var j=0;j<instruction.length;++j){var reg=instruction[j][0];var offset=instruction[j][1];if(registers[reg]==undefined)registers[reg]=0;if(offset<0&&registers[reg]<-offset){perform_instr=false;break}}if(perform_instr){for(var j=0;j<instruction.length;++j){var reg=instruction[j][0];var offset=instruction[j][1];registers[reg]+=offset}program_complete=false;break}}if(program_complete){document.getElementById("output").value+=regs_to_string(registers);stop();return}iterations++;if(timeout&&Date.now()-start_time>TIMEOUT_MILLISECS){error(ERROR_TIMEOUT);return}}setTimeout(function(){fractran_iter(ITERS_PER_SEC*(Date.now()-iter_start_time)/1E3)},0)};

Code:
<textarea id="code" rows="4" style="overflow:scroll;overflow-x:hidden;width:90%;">47/10 3/5 106/47 3599/54272 53/61 2881/27136 2479/13568 2077/6784 1943/3392 1541/1696 1273/848 1139/424 871/212 737/106 469/53 142/3953 67/71 5/67 1/147 1/363 1/507 1/867 1/1083 1/1587 1/2523 1/2883 1/4107 1/5547 1/7 1/11 1/13 1/17 1/19 1/23 1/29 1/31 1/37 1/43</textarea>
Input:
<textarea id="input" rows="2" style="overflow:scroll;overflow-x:hidden;width:90%;">2^142857 * 5</textarea>
Timeout:<input id="timeout" type="checkbox" checked="true"></input>

Output:
<textarea id="output" rows="6" style="overflow:scroll;width:90%;"></textarea>
<input id="run" type="button" value="Run" onclick="run()"></input><input id="stop" type="button" value="Stop" onclick="interrupt()" disabled="true"></input><input id="clear" type="button" value="Clear" onclick="clear_output()"></input>

Replace 142857 with another number. Output should be 3^1 if true, 1 = 3^0 if false. Takes a while for larger numbers (well, this is FRACTRAN...).

See this answer for a 15-fraction solution.

C# 73 60 59
First golfing for me ...

Write a function that takes a nonnegative integer as input

bool f(int i){return(i+"").Distinct().SequenceEqual(i+"");}

Could strip another character by converting uint to int, but I rather take the task too literally than the other way around.
Here we go ...

Some options: i => (i + "").Distinct().SequenceEqual(i + "");

@NPSF3000 Thanks! Edited my answer. I had something like this on my mind, but oh well ... I totally forgot about +"" calling ToString() under the hood.

A more literal interpretation of "nonnegative integer" suggests that a signed integer will be passed in, but it will never be negative.

Well, I guess it will be ok then ...

Use C# 6 and you can use: bool f(int i)=>(i+"").Distinct().SequenceEqual(i+""); (53 bytes)

Some people claim you must count the characters in using System.Linq; as well.

@JeppeStigNielsen Some, yes. Common practice on CG.SE seems to be that usings can be omitted.

JavaScript - 23 Characters
As a function (ECMAScript 6):
f=x=>!/(.).*\1/.test(x)

Or taking input from a prompt (25 characters)
!/(.).*\1/.test(prompt())

Trilangle, 34 bytes
UB is only disallowed in C, huh?
'0.<".@|>i\re@..j..2'2#!>.(&,\,<.-

This works on x64, at least. Can't guarantee it'll work on other architectures.
Expects the number on STDIN, immediately followed by EOF (no trailing newline). Prints "0" (with trailing newline) iff the digits are unique.
Edit: there is now an online interpreter. This code seems to work in wasm, too (but I still haven’t tested native ARM or other processors).
High-level Overview
Roughly equivalent to this C code:
#include <stdio.h>

int main() {
    // A bitfield of the seen numbers:
    // e.g. if "12" is input, this is 0b0000'0000'0000'0110;
    // if "3" is input, this is 0b0000'0000'0000'1000; etc.
    int seen = 0;

    while (1) {
        // Get a number in. If EOF is read,
        // we haven't encountered a duplicate, so indicate success.
        int i = getchar();
        if (i == EOF) {
            puts("0");
            break;
        }

        // Check if the digit has already been seen.
        // If so, exit without printing anything.
        // If not, add this digit to the bitfield.
        i = 1 << (i - '0');
        if (i & seen) break;
        seen = seen | i;
    }
}

How does Trilangle work?
Trilangle is a 2-D programming language laid out in a triangular grid (hence the name). The IP can move in one of six directions; it starts heading southwest. If it walks off the edge of the grid, it continues one row or diagonal to its left.
The memory model is like a stack, but it's possible to index into it.
Explanation of the Code
The interpreter unfolds that code into this triangular grid:
       '
      0 .
     < " .
    @ | > i
   \ r e @ .
  . j . . 2 '
 2 # ! > . ( &
, \ , < . - . .

I hope this explanation makes any sense. Here goes nothing.
Below is an image of the code, with the IP's paths highlighted in various colors.

The IP starts on the red path, where it hits the following instructions:

'0: Push the number 0 to the stack
<: Change the direction of control flow
i: Get a character from STDIN and push it to the stack; pushes -1 on EOF
>: Branch on the sign of the top of the stack

If the value is negative, EOF was read, and the IP continues on the green path:

e: Pop from the stack, and push 1 << value. This is the UB: 1 << -1 is undefined. At least on x64, it evaluates to 0.
.: No-op
!: Print the top of the stack as a decimal integer
,: Pop from the stack
i: Attempt to read from STDIN again (always sees EOF on this path)
@: End program

The ,i aren't strictly necessary on this code path, but they're harmless to leave in.
If a character was successfully read, control flow continues on the blue path:

"0: Push the value of the character '0' (i.e. 48) to the stack
-: Pop two values from the stack and push their difference
..: No-ops
e: Pop from the stack and push 1 << value
|: Redirect control flow
".,: Push the value of the character '.' and immediately pop it, effectively a no-op
2: Duplicate the top of the stack
.: Another no-op
\: Redirect control flow
'2: Push the number 2 to the stack
..: Even more no-ops
j: The indexing function. After this, the stack contains { seen, i, i, seen } (from the C code above), in that order.
.: Yet another no-op
&: Pop two values from the stack and push a & b (bitwise and)
(: Decrement the top of the stack. If seen & i is 0, the top of the stack is now negative; otherwise, it's still positive
.: Yep, still a no-op
>: Branch

If i and seen have any bits in common, the IP follows the yellow path; otherwise, the IP follows the magenta path.
The yellow path contains a harmless r (bitwise or) instruction, before the IP hits @ and the program ends.
On the magenta path, the IP continues as follows:

<: Redirect control flow
,: Pop from the stack
\: Redirect control flow
#: Ignore the next instruction (j)
r: Pop two values from the stack and push a | b (bitwise or)
|: Redirect control flow
<: Redirect control flow, merging with the red path

From which it reads the next character from STDIN, and continues until it either reads the same character twice or reads EOF.
Disassembly
I recently added a --disassemble flag to the interpreter. The output is fairly straightforward if you understand the syntax:
0.0:    PSI #0
0.2:    GTC
0.3:    BNG 2.0
1.0:    PSC '0' ; 0x30
1.1:    SUB
1.4:    EXP
1.6:    PSC '.' ; 0x2e
1.7:    POP
1.8:    DUP
1.11:   PSI #2
1.14:   IDX
1.16:   AND
1.17:   DEC
1.19:   BNG 4.0
        JMP 3.0
2.0:    EXP
2.2:    PTI
2.3:    POP
2.4:    GTC
2.5:    EXT
3.1:    IOR
3.2:    EXT
4.1:    POP
4.4:    IOR
4.7:    JMP 0.2

C (87)
Since I can't win, I'll go for efficiency.
Function code:
int u(uint32_t d){short s=0,f;while(d){f=1<<d%10;if(s&f)return 0;s|=f;d/=10;}return 1;}

Oh, and since I still can't comment on other people's posts -- I'd like to say that this was a neat solution, even if inaccurate when it "overflows".

70  bytes

Maybe you won't believe me, but int is shorter than short :)

Mathematica, 35 25 characters
(27 if the function needs a name.)
Unequal@@IntegerDigits@#&

EDIT: Saved 8 characters thanks to belisarius!

Unequal @@ IntegerDigits@# & could do, I think

@belisarius oh nice, I was looking for something like that but couldn't find it (and didn't think that chained ≠ would compare non-adjacent elements). Thanks, that shortens this a lot!

You don't have to give it a name, right? Unequal@@IntegerDigits@#& is 25 characters.

@Akater true, I can't see a requirement for the name in the challenge. Thanks!

Ruby (24 bytes)
Use a regular expression to match "some character, followed by zero or more characters, then the same character".
->(s){!!(s !~/(.).*\1/)}

If truthy or falsy values are accepted, rather than literal true or false, then we get 20 characters:
->(s){s !~/(.).*\1/}

-2 bytes by omitting the parentheses around the function parameter. Also, presumably your 20 byte version used to not return literal true / false in a previous version of Ruby, but in modern Ruby it does: Try it online!

R, 53 51 48 34 Bytes
function(n)!grepl("(.).*\\1",n,,T)

Try it online!
Convert to a string and split.  Convert to a table of counts minus 1, sum and negate
Inspired by Most common number answer by Alex and suggestion by Hugh.
A couple saved, thanks to @plannapus
One more from @Gregor
And a couple from making it an anonymous function
Now with wonderful regex goodness thanks to @J.Doe.   This looks for any single char in the number that matches itself else where in the string.  The grepl command returns a logical that is then returned.  Perl style regexes is set to True.

You can also convert to string using paste0 instead of toString and save 2 characters.

You can use paste instead of paste0 to save one more character.

45 bytes using utf8ToInt

@J.Doe: even better ! :)

Used a different approach. 35 bytes with regex.

@J.Doe The regex approach can be shorter: 29 bytes. Or 24 bytes with R v4.1.0+.

R (70, 60, 53, 52)
Thank you all for the useful comments! Your comments are incorporated in the answer.
### Version 70 chars
f=function(x)!any(duplicated(strsplit(as.character(x),split="")[[1]]))

### Version 60 chars
f=function(x)all(table(strsplit(as.character(x),"")[[1]])<2)

### Version 53 chars
f=function(x)all(table(strsplit(paste(x),"")[[1]])<2)

### Version 52 chars
f=function(x)all(table(strsplit(c(x,""),"")[[1]])<2)

f(48778584)
f(17308459)

@plannapus, you are right. I got confused about "base 10 representation".

Using table and comparing against 0 instead of duplicated might save some characters

And I think you could leave the split parameter unnamed. I'm just on my phone so can't check easily but I believe it is the second parameter of strsplit so you could use positional instead of named arguments to save characters

And since you already take the first element of the result of strsplit why not coercing x to a character using c(x,"")? f=function(x)all(table(strsplit(c(x,""),"")[[1]])<2) is 1 character shorter :)

J (9)
Assumes the value to be tested is in variable b (I know this can be made into a function, but don't have a clue on how. J is confusing. Any help on this is appreciated) Thanks Marinus!
(-:~.)@":

Checks if the lenght of the string rep of the number with all the duplicates removed is the same as the lenght of the regular string rep.

For a function you can do (-:~.)@":.

@marinus Oh wow, that's even shorter than I thought. Thanks!

HI, I found and posted a shorter J solution:
-:~.&.":

FRACTRAN, 15 fractions, 83 (or 32) bytes
This beats Sp3000's 38-fraction solution.
$$\frac25,\frac{875}{88},\frac78,\frac{25{\cdot}17^c}{92},\frac14,\frac{15}{38},\frac{69}{2},\frac{23}{17},\frac{19}{3^b},\frac43,\frac{7}{23},\frac{26}{19},\frac{11}{7^c},\frac{1}{91},\frac{8}{11}$$
The initial state is \$3^n\cdot 13\cdot 23\$. It halts at \$1\$ if every digit in the base-\$b\$ representation of \$n\$ occurs fewer than \$c\$ times, and at some other value otherwise. Plug in \$b=10, c=2\$ to get the answer to the challenge as posed.
The final state is actually \$13^{k - \mathrm{wt}_c\left(\sum c^{d_i}\right)}\$, where \$d_1\cdots d_k\$ are the base-\$b\$ digits of \$n\$, and \$\mathrm{wt}_c\$ is the base-\$c\$ digit sum. Adding a power of \$c\$ increases the digit sum by \$1\$ if there is no carry, and doesn't increase it if there is a carry, so the final state is \$1\$ iff each digit occurs fewer than \$c\$ times.
The length of the \$b=10, c=2\$ version is 83 bytes in the decimal coding (2/5,875/88,...) that seems to be standard here. With a more efficient coding (Elias δ), it's 32 bytes.
There's a fast online interpreter here. I see no way to encode a program in the URL, so you'll have to copy-paste this:
2%5 875%88 7%8 25*17^2%92 1%4 15%38 69%2 23%17 19%3^10 4%3 7%23 26%19 11%7^2 1%91 8%11

Then enter, e.g., [3,48778584],[13,1],[23,1] as the input.

Mathematica (20 19)
(22 21 if function needs a name)
Max@DigitCount@#<2&

or
Max@DigitCount@#|1&

where | ist entered as [Esc]divides[Esc]

Nice. I forgot DigitCount existed, and wrote a solution based on conversion to strings. Yours is much better.

Haskell, 34 bytes
import Data.List
((==)=<<nub).show

Try it online!

Brachylog, 1 byte
≠

Try it online!

JavaScript, 22 bytes
s=>!s[new Set(s).size]

Try it online

R, 66 65 characters
f=function(x)!sum(duplicated((x%%10^(i<-1:nchar(x)))%/%10^(i-1)))

Separate the digits using integer division and modulo, then check if they are duplicates.
Usage:
> f(48778584)
[1] FALSE
> f(17308459)
[1] TRUE

Or, as @MickyT suggested, for 63 characters:
f=function(x)!anyDuplicated((x%%10^(i<-1:nchar(x)))%/%10^(i-1))

You could use anyDuplicated rather than sum and duplicated for 2 more

POSIX sh and egrep (47, 43, 40)
f()([ ! `echo $1|egrep '([0-9]).*\1'` ])

[-1 char]: Use ! instead of -z with test - Thanks DigitalTrauma
[-1 char]: Use `CODE` instead of $(CODE) - Thanks DigitalTrauma
[-2 chars]: Use fold -1 instead of grep -o .1 - Thanks DigitalTrauma.
[-3 chars]: Check for repeated digits with a backreferenced regular expression.

If POSIX compliance is not important echo PARAM | can be replaced by <<<PARAM, reducing the functions length to 37:
f()([ ! `egrep '([0-9]).*\1'<<<$1` ])

Usage:
$ if f 48778584; then echo true; else echo false; fi
false
$ if f 17308459; then echo true; else echo false; fi
true

1 The fold -N notation is deprecated in some versions of fold.

f()(! [ \fold -1<<<$1|sort|uniq -d` ])` down to 38 by my count

@DigitalTrauma: Good stuff thanks for sharing. I find that the tested command must be quoted, otherwise test croaks on it when uniq -d returns more than one line. So the shortest non-POSIX version is 40 characters. I know about the [ ! notation, but I am suprised that ! [ also works, do you know why that is?

Ah I was using bash.  So I guess its longer if you want POSIX conformance.

Haskell:
 import Data.List

 all ((== 1) . length) . group . sort . show

A little late to the party, but since you're importing Data.List anyway I'd suggest nub, which removes duplicates from a List. (\x->nub x==x).show

You didnt use pl... main = interact $ show . ap (==) nub . show

C99, 59 chars
a(x){int r=1,f[10]={};for(;x;x/=10)r&=!f[x%10]++;return r;}

C99 doesn't have implicit int, technically.

Not just "technically", it was specifically and intentionally removed. This is a syntax error in C99, and aside from a required diagnostic, syntax errors are in the same category as undefined behaviour (explicitly disallowed in the question): if an implementation accepts this, the standard makes no requirements whatsoever about the program's behaviour.

58 bytes

Groovy (36 chars)
f={s="$it" as List;s==s.unique(!1)}

Tested it using:
println f(args[0].toInteger())

'false' can be golfed via '1==0' or possibly something more clever. Good answer

@MichaelEaster 0>1 is shorter.

@ace Yes, though !1 works too...

@ace, MichaelEaster, thx for the help :-)

@WillP as suggested by MichaelEaster, use !1 instead.

@ace, my mistake, thanks again, you both!

C, 58 bytes
f;a(x){for(f=0;x;x/=10)f+=1<<x%10*3;return!(f&920350134);}

Can keep a tally of up to 7 identical digits before rolling over.
in test program (it's easier to see how it works with the constant in octal)
a(x){int f=0;for(;x;x/=10)f+=1<<x%10*3;return!(f&06666666666);}

main(){
scanf("%d",&r);
printf("%o\n",a(r));}

If you happen to have a large power of 2 handy the constant can be calculated like f&(1<<30)/7*6

I think the comment by @xfix was intended for my post instead of yours? You didn't actually used int main(int) in your answer...

Having external information that doesn't count towards the code byte/char count is obviously not allowed. I suggest you remove the first version (53 bytes).

Please see my comment in the edit summary.

I voted to reject the edit, but I agree that the counts look wrong. I make them 67 and 63 (61).

My edit was rejected by other users. Please re-evaluate it.

@2501 Back in 2014 we were still thrashing out the rules here and cheeky answers were common. You're right my original answer wouldn't be acceptable now, so I've accepted your version of the code. I have however kept the info about how it works - this site has always been about sharing ideas and I think code should always come with an explanation (not just a score.) I see what you were trying to do but I also agree with the rejection. I'd forgotten this answer - thanks for highlighting. But it would have been better to leave a comment. See  https://codegolf.meta.stackexchange.com/q/1615/15599

I agree. If the random generator generates more than 7 identical digits in a row it produces a false positive?

@2501 yes, if there are eight 1's it will roll over and be indistinguishable from one 2. There's only so much info that can be stored in a single int. With larger variables you could use the constant (1<<40)/15*14 instead of (1<<30)/7*6 for up to 15 identical digits, or (1<<50)/31*30. for upto 31 identical digits.  It's a fault of the question that it doesn't say what the largest input you can expect is.

Java ( 131 59 57)
57 characters:
removed ^ and $ as @n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳ suggested
boolean u(int n){return !(n+"").matches(".*(.).*\\1.*");}

59 characters (works also with negative numbers!):
boolean u(int n){return !(n+"").matches("^.*(.).*\\1.*$");}

79 78 characters (thanks @n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳ ):
Use for loop to save a few charachers and use int as a boolean array.
Use & instead of && to save 1 character (It turns out that java allows it).
boolean u(int n){for(int x=0;n>0&(x>>n%10&1)==0;n/=10)x|=1<<n%10;return n==0;}

131 characters (returns true for negative numbers):
boolean u(int n){int[] p=new int[]{2,3,5,7,11,13,17,19,32,29};double a=9001312320D;while(n>0){a/=p[n%10];n/=10;}return (long)a==a;}

with comments:
boolean unique(int n){
    int[] p=new int[]{2,3,5,7,11,13,17,19,32,29};//list of 10 first primes
    double a=9001312320D;//10 first primes multiplied
    while(n>0){
        a/=p[n%10];//divide by (n%10+1)th prime
        n/=10;//divide n by 10, next digit
    }
    return (long)a==a;//if a is integer then n has all digits unique
}

And answer that is technically correct (character count includes only the function, not global variables), but I think it's cheating, 29 characters:
boolean u(int i){return m[i];}

m[] is boolean array that contains correct answers for all 32-bit integers.

"^.*(.).*\\1.*$" You can drop ^ and $. They are implied by matches()

The 2nd approach can be done by using 10 bits in an int as a boolean array, which will eliminate the need for the prime table.

I know it's been three years, but if you remove the space between return! in the shortest answer, you can get to 56 bytes.

-1 byte

J (8)
Competely sepertae from my previous answer.
*/@~:@":

J, 8 bytes
-:~.&.":

Explanation:
         ": - converts the integer to a string
       &.   - "under" conjuction - uses the result from ": as operand to ~.
               then applies the inverse to the result, so converts the string back to integer
    ~.      - removes duplicates
  -:        - matches the operands

So, it first converts the number to a string, removes the duplicates and converts the resulting string to a number. Then the original number is matched against the transformed one.
In fact it is a hook of two verbs: -: and ~.&.":
┌──┬──────────┐
│-:│┌──┬──┬──┐│
│  ││~.│&.│":││
│  │└──┴──┴──┘│
└──┴──────────┘

Try it online!

Add++, 7 bytes
L,BDdq=

Try it online!

Julia, 25 bytes
the best I could come up with was the same as one of the top voted answers
n->10^length(Set("$n"))>n

Try it online!

Vyxal Ṡ, 3 bytes
U∑=

Try it Online!

Vyxal, 2 bytes
Þu

Try it Online!

PowerShell - 26
!($args|sls '(.)(?=.*\1)')

Perl 6 (19 bytes)
{.comb.uniq==.comb}

.comb splits a string into characters (for example, 42.comb gives "4", "2"). .uniq removes all non-unique characters. .comb characters in string (originally I used .chars, but .comb is shorter). == converts lists into number of elements in it, and compares the numbers. When . is used without object before, $_ which is default function parameter is assumed. {} are function literals.

k4 (8)
  {x=.?$x}48778584
0b
  {x=.?$x}17308459
1b

inspired by a combination of the J and Golfscript answers

C, 76
This is no where near winning, but I'll post it anyway just to show an alternative approach.
c;i;a[99];main(){while(~(c=getchar()))a[c]++;for(;i<99;)a[i++]>1&&puts("");}

Prints a new line if false, prints nothing if true.

This program has an undefined behavior. The correct signatures for main are int main(int, char **) or int main(void). int main(int) is not valid.

@xfix I assume main() is ok then?

Yes, it's fine. It means the same thing as main(void) (when used in definition, in declaration it declares a function with unknown parameter list).

Javascript 73 chars
function f(n){return !~(n+'').split('').sort().join('').search(/(\d)\1/)}

Befunge 98, 17 bytes
This is a non-competing answer because Befunge does not have functions.
~:1g1`j@1\1p3j@.1

Prints a 1 if the number's digits are all unique; otherwise, it just ends.
This works by accessing a cell in the Funge space whose x coordinate is the ASCII value of the character inputted (takes input character by character) and whose y coordinate is 1. If the digit has not been seen before, the value of the cell is 32 (space character). If that is so, I set the value to 1.
As a bonus, this works for non-numbers as well.

Python, 40
f=lambda x:len(str(x))==len(set(str(x)))

The built-in set removes the duplicates, so if the length of a thing and the length of his set are equal, the thing does not have repeated elements.

Python 2.7  114  106 bytes
First golf, and this is no way going to win :P
def d(a):
    f=[];
    for i in str(a):
        if i in f:return False
        f.append(i)
    return True

Kinda want to see how other people would improve this :)
EDIT: With ProgramFOX's comments:
def d(a):
    f=[];
    for i in str(a):
        if i in f:return 1<0
        f+=[i];
    return 0<1

return True can be shortened to something like 0<1. And f.append(i) can be shortened to f+=[i].

You're welcome! Also, you can save one more character by dropping the ; after f+=[i]. It is not necessary there.

Ugh... Too much php :)

Burlesque, 2 bytes
Using the Unique built-in:
blsq ) 17308459U_
1
blsq ) 48778584U_
0

Go, 138 bytes
Bad language choice.
run it like uniqchars 112345678
package main
import(."fmt"
."os"
."strings")
func main(){s:=Args[1]
f:=true
for _,e:=range s{if Count(s,string(e))>1{f=false}}
Println(f)}

This is post 65536 on the site! That's 2^16.

PARI/GP, 26 bytes
n->d=digits(n);#d==#Set(d)

Try it online!

Japt v2.0a0, 5 3 2 bytes
Takes input as a string.
¶â

Try it

Python 3, 29 bytes
lambda x:10**len({*str(x)})>x

Inspired on this answer in Python 2; for Python 3 to only lag behind 2 by one byte is pretty rare :)

C# (Visual C# Interactive Compiler), 28 bytes
i=>(i+"").ToDictionary(c=>c)

Try it online!
This lambda uses presence or absence of an exception to determine whether a number has unique digits. If a digit occurs more than once, a duplicate key exception will be thrown when converting the string to a dictionary.

Braingolf, 12 bytes
dlMulMve1:0|

Try it online!
Explanation
dlMulMve1:0|  Implicit input from args

d             Split into digits
 lM           Push length of stack to next stack
   u          Keep only first occurrence of each unique digit
    lM        Push length of stack to next stack
      v       Switch to next stack
       e      If top 2 items are equal
        1      - Push 1
         :    Else
          0    - Push 0
           |  EndIf

              Implicit output of top of stack

x86-16 machine code, 11 bytes
FC 51 AC 8B FE F2 AE 59 E0 F7 C3

Listing:
    SEARCH:
FC      CLD                 ; string direction forward
51      PUSH CX             ; save loop counter
AC      LODSB               ; load next digit from SI into AL, advance SI
8B FE   MOV  DI, SI         ; DI is offset of next digit
F2/ AE  REPNZ SCASB         ; search until match, ZF=1 if found
59      POP  CX             ; restore loop counter
E0 F7   LOOPNZ SEARCH       ; loop until match found or CX is 0
C3      RET                 ; return to caller
        ENDM

Callable function, input as digit array at DS:SI, length in CX.  Output ZF=0 if unique, ZF=1 if not unique.
Test program in IBM PC DOS that reads input from command line args, displays T or F:

Perl 6, 12 bytes
{!/(.).*$0/}

Try it online!

Jelly, 3 bytes
DQƑ

Try it online!
How it works
DQƑ - Main link. Takes n on the left
D   - Convert to digits
  Ƒ - Is it unchanged under:
 Q  -   Deduplication?

Husk, 4 bytes
S=ud

Try it online!
S           # Hook: S fgx means f x(gx)
 =          # are they equal:
            # x (implied by S)
            # and
  u         # unique elements of x
   d        # when x is the decimal digits of the input

Pyth, 2 bytes
q{

Try it online!

Zsh, 28 24 bytes
If output is 0, the digits are unique. Otherwise, there are dupes
<<<$[$#1-${#${(us::)1}}]

Try it Online!
28 bytes

Regex (ECMAScript / Perl / PCRE / Python / .NET), 66 61 bytes
^(?!((?=(x{10})*(x*))(^|(?=(x*)(\5{9}x*))\6)+){2}\B\2*\3$)|^$

Takes its input in unary, as the length of a string of xs.
Try it online! - ECMAScript
Try it online! - Perl
Try it online! - PCRE
Try it online! - Python
Try it online! - .NET
This regex apparently does not work in Java, Boost, or Ruby. The reasons are unknown as of yet.
^                          # tail = N = input number
(?!                        # Assert that there is no way for the below to match
    (
        (?=
            (x{10})*(x*)   # \2 = 10; \3 = tail % 10
        )
        (
            ^              # Allow the loop to iterate once without doing
                           # anything iff this is the first iteration of the
                           # main loop.
        |
            (?=
                (x*)       # \5 = floor(tail / 10)
                (\5{9}x*)  # \6 = tool to make tail = \5
            )\6            # tail = \5
        )+                 # Execute the above loop an arbitrary positive
                           # number of times.
    ){2}                   # Execute the above loop exactly twice, so that \3
                           # will contain the value it had at the beginning of
                           # the loop's second iteration.

    \B                     # Assert that we aren't at the beginning or end, or
                           # that N==0; the latter "or" part is undesirable,
                           # because it prevents this main algorithm from being
                           # able to match N==0, but even still, using "(?!^|$)"
                           # would be longer than "\B" and "|^$" combined.
    # Note that if (x{10})* repeated zero times, \2 will be a non-participating
    # capture group (unset). In ECMAScript this means it will behave as if \2=0.
    # In all other flavors, it means \2* will only be able to repeat zero times,
    # because \2 alone won't match anything. But this doesn't matter, since if
    # it was only able to match zero times before, it wouldn't be able to match
    # more than zero times now, anyway.
    \2*\3$                 # Assert tail % 10 != \3
)
|^$                        # Match N==0, which the main algorithm above can't.

See also my decimal regex answer. I feel that this unary version is more interesting, especially since unary is like a native integer data format for regex, whereas decimal is like passing an integer as a string, but it's definitely worth presenting decimal versions as well.

Wouldn't something naive like ^(?!0.*0|...|9.*9) be shorter? Haven't thought hard about this and obviously you have, so probably I'm missing something.

@Thomas You're thinking of a regex that takes its input in decimal format. My regex takes it in unary, which is like a native integer format for regex. I have, however, now made a separate post taking decimal input.

Ahhhhh sorry I missed that. That is next level voodoo for sure!

See also my unary regex answer. Although other posts have already used a regex that take decimal input, this post provides a unified presentation, and outgolfs some of the previous posts (including a language in which there wasn't previously any regex post).
Regex (ECMAScript or better), 13 bytes
^(?!(.)+.*\1)

Takes its input in decimal. Returns a match for numbers with all-unique digits.
Try it online!
Regex (ECMAScript or better), 7 bytes
(.).*\1

Takes its input in decimal. Returns a non-match for numbers with all-unique digits.
Try it online!
\$\large\textit{Anonymous functions}\$
R v3.5.2, 29 bytes
pryr::f(!grepl('(.).*\\1',n))

Try it online!
Uses the same regex as MickyT's R answer, but ,,T is unnecessary (the regex doesn't need to run in PCRE mode) and omitting it saves 3 bytes. Using pryr's lambda syntax saves another 2 bytes.
R v4.1.0+, 24 bytes
\(n)!grepl('(.).*\\1',n)

Attempt This Online!
PHP, 35 bytes
fn($n)=>!preg_match('/(.).*\1/',$n)

Try it online!
Java, 33 bytes
n->!(n+"").matches("(.)+.*\\1.*")

Try it online!
This uses a regex 1 byte shorter than barteks2x's answer.
Perl, 19 bytes
sub{pop!~/(.).*\1/}

Try it online!
Ruby, 23 bytes
->n{n.to_s !~/(.).*\1/}

Takes an integer as input. Returns a native boolean, true if the digits are unique.
Try it online!
Ruby, 18 bytes
->s{s !~/(.).*\1/}

Takes a string as input. Returns a native boolean, true if the digits are unique.
This is identical to John Feminella's 20 byte answer except for removing the unnecessary parentheses surrounding the function parameter, saving 2 bytes.
\$\large\textit{Full programs}\$
Retina, 12 bytes
A`(.).*\1
^.

Try it online!
PHP, 37 bytes
<?=!preg_match('/(.).*\1/',$argv[1]);

Try it online!
Perl, 16 bytes
say<>!~/(.).*\1/

Try it online!
This uses a regex 1 byte shorter than Tal's answer. Another 2 bytes are saved by using say (requiring Perl v5.010+) instead of print.

Arturo, 27 26 21 bytes
$=>[=unique<=digits&]

Try it
-1 byte from abusing Arturo's hidden stack features. >:)
-5 bytes from using a tacit function and using the dup operator over the function.
Checks whether the list of digits of the input number is equal to itself when uniquified.

K (ngn/k), 13 bytes
{(#t)=#?t:$x}

Try it online!
I think there's a way this one could be a train...
Explanation:
{(#t)=#?t:$x}  Main function. x is input
          $x   Convert x to string
        t:     Assign it to variable t
       ?       Unique
      #        Length
     =         Equal to
 (#t)          The length of t

Excel, 47 bytes
=LET(a,ROW(1:10)-1,COUNT(SEARCH(a&"*"&a,A1))=0)

Input in cell A1.

This could be 43 bytes using =ROWS(UNIQUE(MID(A1,ROW(A:A),1)))=LEN(A1)+1 perhaps. Unless the input is 1048576 characters long =)

@JvdV Excellent construction!

Thunno, \$ 6 \log_{256}(96) \approx \$ 4.94 bytes
dDZUA=

Attempt This Online!
Explanation
dDZUA=  # Implicit input
dD      # Cast to digits and duplicate
  ZU    # Uniquify this list
    A=  # Are they equal?
        # Implicit output

Julia 1.0, 23 18 bytes
~x=allunique("$x")

Try it online!
-5 bytes thanks to MarcMush: replace digits(x) with "$x"

-5 bytes: allunique("$x")

Haskell, 32 bytes
(\s->s==[x|x<-s,y<-s,x==y]).show

Try it online!
Repeats each character once per each character that equals it, and checks that this gives the original digits string.

Cobra - 109
def f(n) as bool
    l=0
    m=n.toString
    for i in m,for j in m,if i==j,l+=1
    return if(l>m.length,false,true)

Makes me wish that LINQ would work properly in Cobra.

PHP - 44 33
var_dump(max(count_chars($n))<2);

Or Proper function 42 Characters
function(){return max(count_chars($n))<2;}

UPDATE : Thanks for @scrblnrd3 pointed out for shorter solution.

You could cut out a few chars by doing <2 instead of the ternary operator

<2 in PHP, DO you have some reference page, how it used in php as I never seen this.

I mean you could use var_dump(max(count_chars($n))<2); instead

<?=max(count_chars($argn))<2); 30+1 bytes: run as pipe with -F, prints 1 for true, nothing for false

C# 72 69 67 characters (no libraries needed)
for(;d>0;d/=10)for(int f=d/10;f>0;f/=10)if(d%10==f%10) return true;

Ungolfed:
for (; d > 0; d /= 10)
    for (int f = d / 10; f > 0; f /= 10)
        if (d % 10 == f % 10)
            return true;

I'm just using simple maths here.(i.e. number 1231):

Take the last digit (1)
Iterate through the quotient (123)
If the number is equal to our digit (1), then return true
3 == 1, 2 == 1, 1 == 1 - found it!

Ruby(47 characters)
->(x){x.to_s.chars.sort.uniq.size==x.to_s.size}

Example usage
->(x){x.to_s.chars.sort.uniq.size==x.to_s.size}[10]
=> true

Julia - 29 28
f(n)=unique("$n")=="$n".data

Old version:
f(n)=join(unique("$n"))=="$n"

C# (44 - 64)
Func
As a lambda (44):
y=>!(y+"").GroupBy(x=>x).Any(x=>x.Count()>1)

alt lambda (also 44):
y=>(y+"").GroupBy(x=>x).All(x=>x.Count()==1)

As a Func (63):
Func<int, bool> f=y=>(y+"").GroupBy(x=>x).All(x=>x.Count()==1);

As a method (64):
bool f(int y){return (y+"").GroupBy(x=>x).All(x=>x.Count()==1);}

COBOL 66 with Object Cobol extensions
Microfocus Cobol (721 659 592)
       method-id u.
       local-storage section.
       77  i pic s9(9) comp.
       77  c pic 9 occurs 10 value 0.
       77  g pic 9.
       01  s pic 9(9).
       01  t redefines s pic 9 occurs 9.
       linkage section.
       77  n pic s9(9) comp.
       77  d pic x.
       88  f value is 'y'.
       procedure division using by value n returning d.
           move n to s. move 'n' to d. perform p varying i from 1 by 1 until i greater than 9 or f. goback.
       p.  move t (i) to g. if c (g) is not zero then move 'y' to d. add 1 to c (g).
       end method.

Hmmm, I think I should go back to pitch & putt :(
EDIT: OMGZ I CAN USE LOWER CASE!!!

Extended BrainFuck: 100
not included the unnecessary linefeed.
{a>[>>]}>>,10-[38-[-&a+[<<]>]&a>[[-]3<[-<<]<+2>&a>]
+3<[-<<]>,10-]<+<([-]>-|"false"[-])>(-|"true"[-])

Usage:
%> beef ebf.bf < unqiue.ebf > unqiue.bf
%> echo 48778584 | beef unique.bf
-> false
%> echo 17308459 | beef unique.bf
-> true

VBA (145)
Function jkl(f As String) As Boolean
For i = 1 To Len(f)
jkl = InStr(1, f, Left(Mid(f, i), 1)) <> i
If jkl = True Then Exit Function
Next
End Function

Calling the function and output with opposite of the result:
Sub jj()
Dim f As String
f = "1234256789"
MsgBox Not (jkl(f))
End Sub

C - 62
int m[10];f(int a){while(m[a%10]++?0:a/=10);return m[a%10]<2;}

I've included the count of the globally declared array (which ensures initialisation to 0).
As a bonus, here is a much shorter technically correct answer:
f(int a){return 1}

The question does not state that non-unique digits should return false.  Therefore I claim the current lead for C code with 18 characters, although I expect to be beaten by a scripting language with an answer like:
1

Welcome to Programming Puzzles and Code Golf.  I think the OP states quite clearly that a number with duplicate digits should return false.  Perhaps you could explain why you think differently?  And explain how an undefined function performs the requested task, and how a singly character can do so in any scripting language.

@David Wilkins One of the examples returns false; the actual OP just states that unique digits should return true, which the C program I added in jest certainly does.

Also, if I knew golfscript, for example, I would have written a function returning true in that rather than describing an unspecified "scripting language"

PHP 74 Chars
<?php $a=str_split($argv[1]);var_dump(count($a)==count(array_unique($a)));

VB.NET - 189 184
Function U(I As Integer) As Boolean
    U = True
    Dim D(9)
    Dim S = I.ToString
    For Each E As Char In S
        If IsNumeric(E) Then If D(Val(E)) + 1 > 1 Then U = False Else D(Val(E)) += 1
    Next
End Function

First code-golf attempt. I'm aware it's an unsuitable language and poor result, but I wanted to try.

I counted 189 characters even without necessary whitespace. Please be aware that, unless explicitly stated in the question, we usually count necessary whitespaces in answers. However, you can reduce your source size by removing unnecessary whitespaces (spaces around assignment operators, indentations etc) and using one-character identifier names, e.g. U instead of Unique, i instead of IA etc. Also, I cannot test it now but I think you can skip the type definitions of your variables/function (i.e. using only Dim D(9),i()=I.ToString.ToCharArray)

So your first line may become something like Function U(I). Your function can then return integers 0 and 1 instead of false/true. Then your second line can be changed to U=1 and your Return False can be changed to U=0. Finally, I'm not sure whether it works but perhaps making IA a string instead of a char array can save you a lot of bytes.

I used an online tool out of laziness, I may have to write a character-counting function instead. Do you count line returns and tabs as characters?

Visual Studio 2012 religiously enforces spacing and indentation, even correcting it before beginning a debug - I don't see a way I can cut them out.

Also, how do I count bytes in code? Sorry, I looked in Meta and the Help Centre but I couldn't find an answer.

Online tools should be sufficient, and this seems to be giving a correct count. As for automatic spacing and indentation, Visual Studio should have some settings that allows you to turn it off (see here). Line returns and tabs all count as one each.

Thank you for the character counter link, though the tool calculates 219 characters for the current code, which is off your initial count. Do line returns and tabs make up one byte, or character?

@Ace, what did you use to highlight the syntax?

Click on "edit" to see what I've done.

Clojure - (42 - 52)
As a named function (52):
(defn f[i](let[s(str i)](=(count s)(count(set s)))))

As an anonymous function (42):
#(let[s(str %)](=(count s)(count(set s))))

Scala
Cheating with library functions (29/12 characters):
def t(i:String)=i==i.distinct

Scala version of the GolfScript version (36/19 characters):
def t(i:String)=i.intersect(i).size>0

Doing the counting work manually (91/74 characters):
def t(i:String)=(Map.empty[Char,Int]/:i)((m,c)=>m+(c->(m.getOrElse(c,0)+1))).forall(_._2<2)

Haskell (41)
import Data.List
f x=show x==nub(show x)

About 23 characters shorter than the other Haskell answer and a fair bit more intuitive I think.  Basically the same process but using Haskell's built-in list functions is much easier and shorter.

I don't think you're required to count the last newline.

F# - 82
let f i =
    let s = i.ToString()
    s |> Set.ofSeq|> Seq.length = s.Length;;

C 151
Bytes = 181 or 151 without newline chars.
Program keeps a tally of digits and exits if greater than 1.
#include <stdio.h>
int i,j[10],r;
int main()
{
scanf("%d",&i);
do{
r=i%10;
j[r]++;
if(j[r]>1){printf("false");return 0;}
i/=10;
}while(i);
printf("true");
return 0;
}

C# 72 characters
var a=i.ToString().ToCharArray();
return a.Distinct().Count()==a.Count();

".ToCharArray()" is unnecessary since there's String.Distinct.

I think that not including the required using System.Linq; in your character count is cheating a bit. @helix That's Enumerable.Distinct, not String.Distinct. MSDN is a bit confusing by showing extension methods too. But indeed, ToCharArray() is not necessary.

you could also do i+"" instead of i.ToString(). But this question is asking for a function, you just gave 2 lines of code

Julia, 44
f(n)=(d=digits(n);length(Set(d))==length(d))

This doesn't work - it only returns true if n is one digit long, as length(Set(d))=1 for any integer. For the same approach idea, perhaps use unique(d)==d?

true

julia> f(1234566)
false
``` It seems to work. ```julia> length(Set(1,2))
2``` Perhaps the definition of `length(x::Set)` changed recently? I'm running 0.3 prerelease.

That might make a difference - I'm running 0.2.1. I get length(Set(1,2))=2, but length(Set([1,2]))=1.

C++ 82
this code is at least legitimate
int a(uint32_t i,uint32_t r=0,uint32_t h=0)
{return i?r&h?0:a(i/10,r|h,1<<i%10):1;}        // thanks to DreamWarrior

C 47
this works if you compile it in debug mode or provide two more arguments set to 0
a(i,r,h){return i?r&h?0:a(i/10,r|h,1<<i%10):1;}

Regular Expression 17 bytes
^(?:(.)(?!.*\1))*$

Original expression taken from https://stackoverflow.com/a/12870549.

Clojure, 23
#(=(distinct x)(seq x))

Usage: (#(=(distinct x)(seq x)) "23563462464543")

Candy, 13 bytes
This is a late post, but...
(k&{1k1.|0})0

Invokation with -I , which is actually for string parameters.
The long form:
while    # while we are still consuming characters from the stack
  setSP  # pop the next stack-id from the stack.  It's the ord of the digit
  stackSz  # test for empty stack
  if
    digit1 setSP  # goto stack #1, and push the true indicator on
    digit1
    retSub        # and halt
  else
    digit0    # mark the stack as having been visited
  endif
endwhile
digit0    # push the false indicator if we got this far

Prolog, 49 bytes
Code:
p(N):-number_codes(N,L),sort(L,S),msort(L,T),S=T.

Explained:
p(N):-number_codes(N,L), % Convert int to list (of charcodes)
      sort(L,S),         % Sort list and remove duplicates
      msort(L,T),        % Sort list and keep duplicates
      S=T.               % Check if lists are equal

Example:
p(48778584).
false

p(17308459).
true

05AB1E, 2 bytes
ÙQ

Try it online!
-1 thanks to Kaldo

{   # Sort.
 ¥  # Consecutive differences.
  P # Product.

Works on negatives, though OP never specified...

ÙQ for 2 bytes.

rSNBATWPL, 45 bytes
n~(d=1;rdc{norm{n}sort<}$a~b~(d=d*a!b;b);d)

A (probably golfable) approach, which looks for duplicate characters. Instead of a costly cast.string, I use norm, which applies Unicode normalization, which is a no-op here. I use rdc as an expensive hack to iterate over pairs. The most important part of the solution is d=d*a!b (I use d=d*... rather than d*=... since *= requires whitespace to prevent ambiguity), which multiplies d (initially 1) by a!b, which after being cast to  an int will be 1 only if a and b aren't equal.

Thunno 2, 2 bytes
U=

Attempt This Online!
Explanation
U=  # Implicit input
U   # Uniquify the input
 =  # Does it equal the input?
    # Implicit output

convey, 355 bytes
          1-}  1-}  1-}  1-}  1-}  1-}  1-}  1-}  1-}  1-}
>>vv<">>~>>?;~>>?;~>>?;~>>?;~>>?;~>>?;~>>?;~>>?;~>>?;~>>?;}
^ ;<1@>]3 >>!3 >>!3 >>!3 >>!3 >>!3 >>!3 >>!3 >>!3 >>!3 >>!
,{>">"   >#v0 >#v0 >#v0 >#v0 >#v0 >#v0 >#v0 >#v0 >#v0 >#v0
.10|>#>>"@^>#"@^>#"@^>#"@^>#"@^>#"@^>#"@^>#"@^>#"@^>#"@^>#]
_<<<<%10>=0 1>=1 1>=2 1>=3 1>=4 1>=5 1>=6 1>=7 1>=8 1>=9 1

Try it online!
I don't believe that this was the more optimal solution in convey, but it's cool to see it running at least (You can watch all the process in the "Try it online" link):

Pascal, 142 bytes
This function requires a processor compliant with Extended Pascal, ISO standard 10206.
In particular the card function must be available.
function f(x:integer):Boolean;var d:set of 0..9;w:integer;begin d:=[];w:=0;repeat d:=d+[x mod 10];x:=x div 10;w:=w+1 until x=0;f:=w=card(d)end

Ungolfed:
    type
        { This will permit a proper `function` domain restriction. }
        integerNonNegative = 0..maxInt;

    { Returns `true` if `x` as decimal number contains no duplicate digits. }
    function hasUniqueDecimalDigits(x: integerNonNegative): Boolean;
        var
            { The decimal digits that appear in `x`. }
            digits: set of 0‥9 value [];
            { The total width of a decimal representation of `x`. }
            width:  integer    value 0;
        begin
            { If there are as many distinct decimal `digits` as
              the total `width` of the decimal number,
              we can tell that no digit appears twice. }
            repeat
            begin
                digits ≔ digits + [x mod 10];
                x      ≔ x div 10;
                width  ≔ width + 1;
            end
            until x = 0;
            { `card` returns the cardinalty of a set,
              that is the number of members in a set. }
            hasUniqueDecimalDigits ≔ card(digits) = width;
        end;

Perl, 63ish
$ echo 48778584| perl -F// -alpe '$"="";$_= 0<"@{[map {$a{$_}++} @F]}"?"false":"true"'
false
$ echo 17308459| perl -F// -alpe '$"="";$_= 0<"@{[map {$a{$_}++} @F]}"?"false":"true"'
true

authors: n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳

authors: александр зайтонов

authors: ღიმილა ღიმილა

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


text:
Write a hello world GUI program that closes itself after three seconds
Please read the rules, and the bold areas as well.
Write a program in any language, so long as it has GUI support for a window system (cannot be text-consoles, etc., and must be a GUI/toolkit/window).
The program must say hello world in any manner (splash image, menu bar, status bar, title, video, message box, other widget stuff, etc.), so long as a GUI-compliant window appears and shows this text for three seconds. The person who can code this in the least amount of code used, counted in bytes, will take the cake.

The comments here have degraded into a pointless argument. Please refrain from extended discussion in the comments; if necessary, you may use chat instead. All comments have been purged.

It doesn't matter where the argument came from - all users should avoid participating in disputes that are clearly noise or going nowhere.

Does it have to be "Hello world" or can it be "Hello_world"?

Also, must it exit gracefully?

you don't specify how the program has to be run? for instance does it have to be started up by itself or can it be something loaded up in a already running environment?

So what's the etiquette for accepting answers on code golfing questions? This question has been open for ~ four months.

Possible duplicate of "Hello, World!"

Does the GUI window need to close, or is it enough that the words 'hello world' are replaced?

Is outputting "hllowrld" acceptable?

Unix shell, 31 characters
xmessage -timeout 3 hello world

This program requires the xmessage(1) utility from X.Org. It uses the traditional black-and-white X Athena Widgets (Xaw).

Grrr...I was going to post one using timeout and zenity but it was longer...

@BenjiWiebe There is a zenity answer by n.1 at http://codegolf.stackexchange.com/a/28451/4065

You can save 1 byte: timeout 3 xmessage hello world

@GlennRanders-Pehrson I can't do that, because my machine has no timeout command. Maybe someone else can post a new answer that uses it?

Shell and gedit - 27 characters
timeout 3 gedit Hello World

If Hello World needs to be displayed as a single string, then its 28 characters:
timeout 3 gedit Hello\ World

timeout utility runs a command for the duration specified. It ensures that gedit runs for 3 seconds, assuming minimal startup time.
Any editor can be used in place of gedit. If a shorter named editor is used like gvim, the length can be reduced by 1 or more characters.
Using an editor initially thought of by user80551.

Escape the space, use Hello\ World

@user80551 The question requires "Hello World" to be displayed in any manner, so that shouldn't be necessary.

Technically, that would make this Hello <space> <close icon> <Document icon> World

Can you confirm if kate would work instead of gedit?

@user80551 Dont have KDE installed, but going by Kate's man page, there doesnt seem to be any reason why it shouldn't work.

@user80551: It does work in kate, although the display looks a bit different.

@IlmariKaronen I think that's because it's creating two separate documents. Did you escape the space i.e. Hello\ World instead of Hello World?

@user80551: No I did not. Obviously, with an escaped space it would appear on one line (but then you lose the one-char advantage over gedit).

Applescript, 45 bytes:
Not often Applescript is one of the shorter answers:
display alert "hello world" giving up after 3

Paste into the Applescript Editor and run, or run using osascript at the command line:
osascript -e 'display alert "hello world" giving up after 3'

HTML+Javascript, 73 60 characters
<script>setTimeout("open('','_self','');close()",3e3)</script>Hello world

This works in Chrome, but may not be portable to other browsers.
Suggestions from the comments take this further:
<body onload=open('',name=setTimeout(close,3e3))>Hello world

That's a lot of golfing I saw. I saw this go from 108 chars down to 73. Suddenly, the whole code is visible.

@Quincunx: You missed the first few iterations then. :)

That's because I was busy posting my own code. :-)

For some reason, I see the string for much longer than 3 seconds (it doesn't close).

I tried in Firefox and IE and they both have stronger restrictions on web pages closing their own windows.

I'm using chrome. I also tried jsfiddle.

<body onload=open('','_self'),setTimeout(close,3e3)>Hello world seems to save a few more characters.

-1 more byte from @Ventero 's version: <body onload=open('',name=0),setTimeout(close,3e3)>Hello world

You have an edit suggestion from user3082537: save two chars by <body onload=open('',name=setTimeout(close,3e3))>Hello world

Can't you just do <body onload=setTimeout(close,3e3))>Hello world or am I missing something here?

@Danny Only windows that have been explicitly opened with open can be closed by calling close on them.

@Ventero oh. It worked for me in IE9 and Chrome. Guess they aren't following the rules.

@Danny It doesn't work in Chrome for me (after removing the extra )): Scripts may close only the windows that were opened by it..

@Ventero odd, I'm on 35.0.1916.114 m and it works. Maybe I have a setting somewhere that is allowing it.

shell script, 31
Not sure whether it qualifies. Requires notify-send. Works at least on Ubuntu 12.04.
notify-send -t 3000 Hello world

Probably not since it isn't a GUI compliant window. Unfortunately, using zenity is much longer.

Its 34 chars with gedit - http://codegolf.stackexchange.com/a/28425/8766

I believe that a window with no window decorations is still a window. Here in Enlightenment, the notification also has an X button to close it (but no other window decorations).

shell + gedit / geany, 34
gedit Hello\ World&sleep 3;kill $!

This assumes that gedit pops up instantly since the 3 seconds are counted from the start of issuing the command. Could be smaller if there's a GUI text editor shorter than gedit.
geany works too for the same number of chars, just s/gedit/geany/g

EDIT: Using timeout is shorter. https://codegolf.stackexchange.com/a/28477/8766
EDIT2: Can anyone confirm if this works with kate ?

meld , 32
If exactly Hello World is not required, then meld can be used.
meld Hello World&sleep 3;kill $!

Nice idea, gedit tries to open a file with this name even if there's no file.

If you use gvim it will need only 33 chars

Its 27 chars using timeout http://codegolf.stackexchange.com/a/28477/8395

@avall   For some weird reason, the actually gvim process is getting started after 3 PIDs so it isn't getting killed. See http://pastebin.com/5PVgf9fm

Good answer. I tried Kate,it gives error: QDBusConnection.

reboot saves a character compared to kill $!

@Daniel halt would be shorter but I don't know if being destructive is allowed. Also, it requires root permissions so we either need to assume that we are root or use sudo which costs more (and needs the user to type the password).

Sorry, I was trying to be humorous.  I was assuming the user has root permissions.

@Daniel No need to be sorry, this site is based on the most evil devious twisting of the rules to make your code shorter.

VBScript, 58
WScript.CreateObject("WScript.Shell").Popup"Hello world",3

Tcl - 32 bytes
I noticed that some of these submissions, like the shell or javascript ones, allow you to type the code into the console. If that's the case I can shorten it to:
wm ti . hello\ world;af 3000 exi

Must be typed into the console after running wish. Meaning, run wish without arguments which will give you a REPL console and then type the code above. This makes use of the fact that tcl can be lenient and autocomplete command/function names but only in interactive mode. So that af actually exectues the after command and exi executes exit. I wanted to use ex but my system has the ex editor installed.

Original submission - 36 bytes
wm ti . hello\ world;after 3000 exit

Run using wish instead of tclsh.

Python (pygame), 87
import pygame.display as d,time
d.set_mode()
d.set_caption('Hello world')
time.sleep(3)

Not working on OSX, doesn't show window...

@BritishColour it should, perhaps it's too small? Try changing the size to [999,999]

Still not working, the window isn't even appearing...

@BritishColour Well it definitely works for me. See here. Perhaps it was showing up at the background or something?

What does the d.set_mode([200,9]) do? If it is just to make the window big enough, I don't think it is necessary (provided a window appears).

@Quincunx set_mode is needed to make the window appear. But it turns out the dimensions are not needed. Thanks.

It's interesting how our code is basically identical, but uses a different module. tkinter turns out to be shorter.

Use from pygame.display import *

52 51 chars with Mathematica
(Hope it counts as a GUI-compliant.)
NotebookClose/@{CreateDialog@"Hello world",Pause@3}

R, 44
x11(ti="Hello World");Sys.sleep(3);dev.off()

PowerShell - 63 52
(new-object -c wscript.shell).popup('Hello World',3)

GTK+, 47 45
zenity --info --text=Hello\ World --timeout=3

Old version (score 47):
zenity --info --title="Hello World" --timeout=3

For some reason, zenity display a text which can be translated as All update are done.

Just to add some extra info, All updates are complete. is what I get in English.

You can reduce one character by changing --title to --text

You can change "Hello World" to Hello\ World

Thanks AsheeshR and kernigh, I have 2 less characters with your help.

Visual FoxPro - 23 characters
WAIT"hello world"TIME 3

This abuses the fact that VFP allows to not to put a space between the string to be printed (which I just discovered) and that it allows to shorten every keyword to up to its first 4 characters.
Ungolfed version:
WAIT "hello world" TIMEOUT 3

Batch (24)
msg/time:3 * hello world

Tested on Windows 7, but should work on any NT-based version of Windows, assuming you have MSG.EXE in your System32 folder.
EDIT: Apparently MSG.EXE is not available by default on home versions of Windows. On Windows 7, for example, this is only available in the Ultimate or Business editions. However, you can copy the file over to your System32 folder and get it to work. (You must also copy over the appropriate MSG.EXE.MUI file to get proper error messages, but my "script" works without them.)
You have to install software for most of these other responses to work, too, so I don't think that should be a disqualifier.

Why won't this call a program named time:3 in a folder called msg in the current directory?

@cat Windows uses \.

@jimmy wow that was a year ago. i'm just used to writing / on all platforms now oops

@jimmy23013 But Windows supports / too

@MilkyWay90 Windows supports / in some places, but in cmd, /xxx is interpreted as an argument.

Java, 136 bytes
class F{public static void main(String[]a)throws Exception{new java.awt.Frame("Hello World").show();Thread.sleep(3000);System.exit(0);}}

Displays the message Hello World as the title of a frame. After 3 seconds, the program closes.
Looks like this:

Drag it bigger:

Expanded code (ie readable):
class F {

    public static void main(String[] a) throws Exception {
        new java.awt.Frame("Hello World").show();
        Thread.sleep(3000);
        System.exit(0);
    }

}

You can use enum instead of class to save another character.

@Riking it doesn't work.

Really? I could've sworn I actually used that once... Dang.

@Riking http://codegolf.stackexchange.com/questions/6671/tips-for-golfing-in-java#comment59425_6689

C# 101 151
This will for sure not be the shortest answer (since there are already other good answers being way shorter) but codegolf.SE needs a lot more C# contributions in my opinion!
using t=System.Threading;class P{static void Main(){using(t.Tasks.Task.Run(()=>System.Windows.MessageBox.Show("hello world"))){t.Thread.Sleep(3000);}}}

C# 121
An alternative based on Bob's answer, but with WPF instead of WinForms:
class P{static void Main(){new System.Windows.Window(){Title="hello world"}.Show();System.Threading.Thread.Sleep(3000);}}

Saves 3 characters thanks to the shorter namespace ...

You need to include the using declarations in the character count. Alternatively, you could leave them out but then you'd have to do things like System.Windows.Forms.MessageBox.Show (slightly fewer characters if it's only a single use). As your code currently is, it won't compile or run.

Well, I just assumed it was not neccesary because I see a lot of answers in C, C++, C#, Java etc without any using/imports/whatever. I will edit it, though. BTW, is there some explicit rule on this? Sure it would compile and run with the right compile settings and/or compiler. (e. g. resolving using directives on compile time, as long as they can be resolved distinct)

The consensus seems to be that you need to: http://meta.codegolf.stackexchange.com/questions/383/should-imports-includes-count-in-golf http://meta.codegolf.stackexchange.com/questions/19/should-non-standard-compiler-flags-be-included-in-character-counts http://meta.codegolf.stackexchange.com/questions/84/shebangs-yes-or-no

It is a little grey - for example, I had to add a reference to System.Windows.Forms.dll, which is part of the msbuild config/the compile command line. However, the general consensus seems to be that when a full program is requested, using/import/#include/etc. where necessary for the code to compile and run are required, and attempting to use compiler command line tricks to dodge that is bad.

I will keep that in mind. Thank you for the references.

bash + ImageMagick (36 bytes)
timeout 3 display label:Hello\ world

Tested on Ubuntu 14.04 LTS and on Fedora 20.
Nicer-looking, but 10 bytes larger:
timeout 3 display -size 800 label:Hello\ world

CMD / Batch - 33 Bytes
I believe the window that the Windows CMD terminal runs in counts as GUI compliant.
start "Hello world" cmd /csleep 3

If you don't have the sleep command on your system - then you can use timeout which comes default in Windows 7. For two more bytes.
start "Hello world" cmd /ctimeout 3

Starts a new CMD window with the title "Hello World" (NOT displayed in the terminal itself, but as the title of the GUI window that the terminal runs in), this window will close as soon as all parsed commands have executed - so after sleep 3 or timeout 3 has completed.
The window looks like this -

Note; start runs the given commands in a new window - not the window that you are running the above commands from.

Changing it to cmd "Hello world" cmd /ctimeout 3 puts Hello world in the title bar for 3 seconds, but that probably doesn't count.

I wouldn't think it does, because it doesn't spawn a new window. The question says a GUI-compliant window appears (appears being the key word), implying that it has to display a new window. Good idea though.

start "Hello world" You sir, are a genius.

C, 151 characters
#include<allegro.h>
main(){textout_ex(screen,font,"Hello World",0,0,7,set_gfx_mode('SAFE',8,8,install_timer(),
allegro_init()));rest(3e3);}END_OF_MAIN()

Not the smallest answer. I like it though.

Good job.                  &#32&#32&#32&#32

How does that even compile? 'SAFE' isn't a single char.

@heinrich5991 SAFE is likely defined in allegro.h as a single character.

@AdamDavis C evaluates macros in character constants?

No macro, it's really just a 32-bit integer written as four bytes in what's called multi-character constant notation, a too-clever-for-its-own-good way to write four-byte tag strings. Apple used it for file type magic numbers once. Compilers nowadays support it but emit a warning. Example for nonbelievers

Autohotkey, 22 Bytes
msgbox,,hello world,,3

Ahk's msgbox is pretty powerful and has a built-in timeout option.

1 year late lol

Red, 49 bytes
view[text"hello world"rate 0:0:3 on-time[unview]]

Perl 5, 47
Using Perl/Tk:
perl -MTk -e'alarm 3;tkinit-title,"Hello World!";MainLoop'
#     123    45678901234567890123456789012345678901234567

It seems that the Tk module is required.

Yes, of course you need some GUI toolkit. I choose Tk because of tkinit().

I count 44 bytes. Are you counting the -MTk flag as well?

@slebetman Yes I count that as 3 chars, I added the count to the post.

@Matthias: maybe you should add it to the title language as Perl 5 + Tk. I tested it and was surprised to see that Perl 5 is not sufficient to run it.

@n.1 I added it below the title with a link to the CPAN documentation of the Tk module. None of the perl core modules is a GUI module, therefore you always have to install external modules. Sorry, this was clear to me (as I am working with perl quite often), but you are right, it is surprising for those who work in other languages.

Perl on Windows (56)
use Win32;fork?kill+sleep+3,$$:Win32'MsgBox"Hello World"

Use '-MWin32' to save four bytes

Processing, 77
int x=millis();void draw(){text("Hello world",0,9);if(millis()>x+3e3)exit();}

Screenshot:

Edit 1: Y position of the text can be 9 instead of 10, like noted by @ace.
Edit 2: 3000 can be represented as 3e3 to shave one character off, also noted by @ace

Using 9 for Y position instead of 10 works for me.

Just edited the code. Thanks!

Just noticed you can use 3e3 instead of 3000 to save one more char

QML - 98 bytes
Here's the code. Works on all supported platforms (including Android and iOS):
import QtQuick 1.0;Text{text:"Hello world";Timer{interval:3000;onTriggered:Qt.quit();running:1>0}}

I don't know QML, but can you change true into 1 or 1>0?

@ace qml wants boolean, so 1 didn't work for me, but as you suggested, 1>0 works fine  thanks a bunch, squeezed one more byte

Rebol View (r3gui), 49
view/no-wait[title"hello world"]wait 3 unview/all

Ungolfed:
view/no-wait [title "hello world"]
wait 3
unview/all

PowerShell, 72 49
saps -pa notepad "Hello World"|%{sleep 3;kill $_}

Thanks to @joey for continued golfing

saps -pa notepad "Hello World"|%{sleep 3;kill $_} would be quite a bit shorter.

Python with turtle module (69 66 bytes)
import turtle as t,time
t.title("Hello World")
t.fd(1)
time.sleep(3)

Note that if you run this in an interactive console, you don't need the t.fd(9) line. However, for some reason when running this non-interactively, the title doesn't change unless you run the extra line.
Edit (66 bytes)
import turtle as t
t.title("Hello World")
t.ontimer(t.fd(1),3000)

PureBasic, 91 chars
Okay, it's not the shortest, it will never win, but I still gotta support my favourite BASIC dialect :-)
OpenWindow(0,9,9,99,99,"")
TextGadget(0,0,0,99,99,"Hello World")
Delay(3000)
CloseWindow(0)

APL (40)
X.Close⊣⎕DL 3⊣'X'⎕WC'Form' 'Hello World'

39: X.Close⊣⎕DL⍴⍕'X'⎕WC'Form' 'Hello World'

Lua + LÖVE, 67 bytes
l=love l.window.setTitle"hello world"l.timer.sleep(3)l.event.quit()

Java, 153 bytes
interface a{static void main(String[]A){new Thread(()->javax.swing.JOptionPane.showMessageDialog("Hello world")).start();Thread.sleep(3000);throw null;}}

Points to null three seconds after popping up a quite ugly window with the text "Hello world" on it.

SmileBASIC, 23 bytes
DIALOG"hello world",,,3

APL (Dyalog APL), 36 bytes
⎕EX(⎕DL 3)⊢⎕A⎕WC'Form' 'hello world'

⎕A  uppercase Alphabet (the only legal name which can be written with two characters)
⎕WC Window Create (and return name of)
'Form' 'hello world' a GUI form with appropriate caption
⊢ yield the form's name while ignoring the result of
(⎕DL 3) Delaying 3 seconds (the ignored result is the elapsed time)
⎕EX Expunge the form (thus making it disappear)
This only works on Windows.

C (MSVC) + Windows API, 130 119
-11 thanks to @EasyasPi
#include<windows.h>
main(){GetProcAddress(LoadLibrary("user32.dll"),"MessageBoxTimeoutA")(0,"Hello World",0,0,0,3000);}

Never thought the Windows API could get this short! Many thanks to this Stack Overflow answer for documenting the undocumented MessageBoxTimeoutA function.

-11 bytes if you use main() instead of WinMain(..), and use LoadLibrary instead of LoadLibraryA.

Ruby [with Shoes] (44 chars)
Shoes.app{para "Hello world";every(3){exit}}

C# 124
Far from the shortest :(
class P{static void Main(){new System.Windows.Forms.Form(){Text="Hello World"}.Show();System.Threading.Thread.Sleep(3000);}}

Bash with xterm, 34
Uses the title of an xterm window to display "Hello World". Does close after 3 seconds.

xterm -T Hello\ World -e sleep\ 3

If displaying Hello_World (without a space) is allowed, you can save one char (xterm -T Hello_World -e sleep\ 3).

I'm curious if you could get this to work with rxvt to shave off a byte.

Legacy C/Xt/Motif (240)
Super old-school entry!
Link with -lXm -lXt -lX11, order matters.
Also curious if this works on other *nix platforms, because the XFlush is me subverting what I'm supposed to do (enter the application loop) in order that I don't have to install a timer to shut down after 3 seconds (and consume more characters).
#include <Xm/XmAll.h>
int main(int n,char **v){XtAppContext c;Widget t=XtVaAppInitialize(&c,"h",NULL,0,&n,v,NULL,NULL);XtVaSetValues(t,XmNtitle,"Hello World",XmNminWidth,300,NULL);XtRealizeWidget(t);XFlush(XtDisplay(t));sleep(3);return 0;}

TCL, 52 bytes
label .l -text Hello\ World
pack .l
after 3000 exit

You can save bytes if you nest label into pack as: pack [label .l -text Hello\ World]

JavaScript (51)
Some old JavaScript methods that still exist because they existed in Netscape 2. document.write replaces the page with a string. setTimeout calls a function after given time (in miliseconds). close closes the window. Doesn't work in Firefox JS console, but it works when imported with <script> or in other browsers' JavaScript consoles.
document.write("Hello world")
setTimeout(close,3e3)

Cobra - 180
use System.Windows.Forms
use System.Threading
class M
    def main
        Thread(ref .w).start
        Thread.sleep(3000)
        Environment.exit(0)
    def w
        MessageBox.show("hello world")

Python 3, 83 72 bytes
from tkinter import*
f=Tk()
f.wm_title("Hello World")
f.after(3000,exit)

Save bytes by using tkinter.
The old method added a Label to the frame. This method sets the title of the frame to Hello World. f.after(3000,exit) runs exit() after 3000 milliseconds have passed.

Same idea, different module: turtle has less bytes. =D http://codegolf.stackexchange.com/a/28548/14506

Factor, 128 bytes
[ f T{ world-attributes { title "" } } clone "Hello world" <label> >>gadgets open-window* 3 seconds sleep close-window ] with-ui

05AB1E + Message permission, 39 bytes
'‚«™’ÿ.¬•"ÄÖ/€º:3 * Ÿ™ ‚ï"’.E

'‚«™’...’.E  # trimmed program
         .E  # evaluate...
    ’...’    # "ÿ.shell\"msg/time:3 * hello world\""...
             # (implicit) with ÿ replaced by...
'‚«          # "system"...
   ™         # in title case...
         .E  # as Elixir code

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

System.shell"..."  # trimmed program
System.shell       # execute shell command...
            "..."  # literal

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

msg/time:3 * ...  # trimmed program
msg               # show message...
             ...  # literal...
   /time:         # that closes after...
         3        # literal...
   /time:         # seconds...
           *      # to all users

if it requires msg.exe, then you need to add that along with the language name.

Ruby - 136 bytes
Using FXRuby :
require'fox16';include Fox;a=FXApp.new;timeout=a.addTimeout(3000)do|s|a.exit;end;a.create;FXMessageBox.error(a,MBOX_OK,'','Hello World')

Javascript (ECMAScript) + jQuery
65 Script + 23 Html = 88 Characters
Html
<div id='a'>Hello World

Script
e=$('#a'),d='dialog',x=e[d]();setTimeout(B=n=>{x.remove()},3000)

All-in-one (105 Characters)
<div id='a'>Hello World<script>e=$('#a'),d='dialog',x=e[d]();setTimeout(B=n=>{x.remove()},3000)</script>
Fiddle
 <div id="a">Hello World
 <script>
   e=$("#a"),
   d='dialog',
   x=e[d]();
   setTimeout(B=n=>{x.remove()},3000)
 </script>

VB.NET Winforms, 167
Private Sub Form2_Shown(sender As Object, e As System.EventArgs) Handles Me.Shown
    Me.Text = "hello world"
    System.Threading.Thread.Sleep(3000)
    End
End Sub

based on ace suggestion the new code is
NOW 100 Characters
 Sub f() Handles Me.Shown
Me.Text = "hello world"
System.Threading.Thread.Sleep(3000)
End
End Sub

You can golf it down a lot more. Start by reducing whitespace (e.g. use one space instead of 4 spaces for indentation, remove the spaces between the assignment operator). Try using single character identifiers, e.g. Sub F(s As Object,e As System.EventArgs)Handles Me.Shown (not sure whether you can replace sender). Try to remove Private and see if that works.

@ace you are correct, the new code is                      Sub f() Handles Me.Shown
Me.Text = "hello world"
System.Threading.Thread.Sleep(3000)
End
End Sub

Linux Shell, 54
echo "hello world">f;firefox f;sleep 3;killall firefox

I tried "timeout 3 firefox Hello\ world" and it appeared to work, but then the next time I started firefox it reset itself to factory settings.

HTML/JavaScript (81)
<body onload="setTimeout(function(){document.body.innerHTML=''},3e3)">Hello World

Tcl/Tk, 15+11=26
after 3000 exit

If I name the file "Hello world.tcl", I will automatically get the "Hello world" text as the window's title:

Unless you count the file name as part of your score, this violates this standard loophole.

@cairdcoinheringaahing: fixed. I added the byte count of the file name without the .tcl part

Vala + gtk+-3.0, 144 bytes
void main(string[]a){Gtk.init(ref a);var w=new Gtk.Window();w.title="hello world";w.show();Timeout.add(3000,()=>{Process.exit(0);});Gtk.main();}

First Vala program, first GTK program.
The title is hello world, but the default window size causes it to clip on my window manager.

void main(string[] args)
{
    // Initialize GTK
    Gtk.init(ref args);
    // Create a new window
    var win = new Gtk.Window();
    // Set the title
    win.title = "hello world";
    // Set the window to show
    win.show();
    // Set a timeout to exit the program after 3 seconds
    Timeout.add(3000, () => { Process.exit(0); });
    // Enter the main GTK loop to show the window
    Gtk.main();
}

source: Stack Exchange

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

authors: ə̷̶̸͇̘̜́̍͗̂̄︣͟

sort: votes


text:
Lowest-Base Palindrome
Given a number \$n\$, write a program that finds the smallest base \$b ≥ 2\$ such that \$n\$ is a palindrome in base \$b\$. For example, an input of \$28\$ should return the base \$3\$ since \$28_{10} = 1001_3\$. Although \$93\$ is a palindrome in both base \$2\$ and base \$5\$, the output should be \$2\$ since \$2<5\$.
Input
A positive integer \$n < 2^{31}\$.
Output
Return the smallest base \$b ≥ 2\$ such that the base \$b\$ representation of \$n\$ is a palindrome. Do not assume any leading zeros.
Samples (input => output):

\$11 \to 10\$
\$32 \to 7\$
\$59 \to 4\$
\$111 \to 6\$

Rules
The shortest code wins.

I think base should be limited.

No, I mean the base to check. For example, I can check up to base 10, or I can check up to base 36, which uses 0-9a-z. And I can even check up to base 127 which uses ASCII characters. You should limit base to check up.

@Snack: What's the problem with higher bases? Independently of the choice of symbols, a base 1000 number will either be a palindrome or not.

Oh, I got it. Sorry.

Are you asking for a function, or a full program?, And does it have to take command-line input or can I hardcode it?, Is the output printed or returned?

@Ourous: A function. Hardcoding is fine. Output is returned.

Interesting anecdote: n in base n-1 is always 11 for n >= 2 and thus a palindrome is always possible.

@Cruncher: n can be 1 and 2 is not a base 1 palindrome. However, every positive n is a base n + 1 palindrome.

possible duplicate of Determine if an integer is a palindrome in a given radix (base)

@Dennis How is 2 not a base 1 palindrome? It's 11. Or II, or 2 of whatever symbol you use. Actually all base 1 numbers are palindromes. And I said n >= 2, because I don't know what on earth base 0 would be.

@DigitalTrauma definitely related. Shaky whether it's a dupe or not

@Cruncher: I didn't consider 1 a valid base. OK, there's apparently a unary number system, but the question rules base 1 out.

@Dennis Everyone knows unary! You've been doing it with your fingers since you learned to count! Anyway, my comment was more of an aside. I was going to say n >= 3, but since it was mathematically true for n=2, I decided to strengthen it a bit.

@Cruncher: Exactly! That's why I did not provide an upper bound for the base.

This is OEIS A016026.

CJam, 19 bytes / GolfScript, 23 bytes
q~:N;1{)_N\b_W%=!}g

or
~:N;1{).N\base.-1%=!}do

Try it online:

CJam
GolfScript

Examples
$ cjam base.cjam <<< 11; echo
10
$ cjam base.cjam <<< 111; echo
6
$ golfscript base.gs <<< 11
10
$ golfscript base.gs <<< 111
6

How it works
q~:N;   # Read the entire input, interpret it and save the result in “N”.
1       # Push 1 (“b”).
{       #
  )     # Increment “b”.
  _N\   # Duplicate “b”, push “N” and swap.
  b     # Push the array of digits of “N” in base “b”.
  _W%   # Duplicate the array and reverse it.
  =!    # Compare the arrays.
}g      # If they're not equal, repeat the loop.

For GolfScript, q~ is ~, _ is ., b is base, W is -1 and g is do.

GolfScript, 20 characters
~:x,2>{x\base.-1%=}?

A different approach with GolfScript other than Dennis'. It avoids the costly explicit loop in favour of a find operator. Try online.
~:x        # interpret and save input to variable x
,2>        # make a candidate list 2 ... x-1 (note x-1 is the maximum possible base)
{          # {}? find the item on which the code block yields true
  x\       # push x under the item under investigation
  base     # perform a base conversion
  .-1%     # make a copy and reverse it
  =        # compare reversed copy and original array
}?

Clever! However, this does not work if x = 1 or x = 2. Both are single-digit, base x + 1 palindromes, so x)) should fix it.

Mathematica, 67 66 bytes
g[n_]:=For[i=1,1>0,If[(d=n~IntegerDigits~++i)==Reverse@d,Break@i]]

Can't really compete with GolfScript here in terms of code size, but the result for 232 is basically returned instantly.

Nice. The function doesn't have to be named though, does it? Could you just use an unnamed function?

(Also, is it possible to use PalindromeQ for the reverse check?)

Japt, 12 9 bytes
Unless I've missed a trick (it's late!), this should work for all numbers up to and including at least 2**53-1.
In my (admittedly limited and entirely random) testing, I've gotten results up to base 11601 310,515(!) so far. Not too shabby when you consider JavaScript only natively supports bases 2 to 36.
@ìX êê}a2

Try it

Thanks to ETH for pointing out something new to me that saved 3 bytes and increased the efficiency considerably.

Explanation
Implicit input of integer U.
@     }a2

Starting with 2, return the first number that returns true when passed through the following function, with X being the current number
ìX

Convert U to an array of base X digits.
êê

Test if that array is a palindrome.

Yes. Blame the beer for that balls up! :D 2) Nice; never knew N.ì(n) could handle bases greater than 36. Thanks for that.

Yeah, the base-36 alphabet doesn't matter for N.ì(n) since we're using raw integers ;-)

JavaScript, 88 bytes
f=function(n){for(a=b='+1';a^a.split('').reverse().join('');a=n.toString(++b));return+b}

Ungolfed:
f = function(n) {
    for(a = b = '+1'; // This is not palindrome, but equals 1 so we have at least one iteration
        a ^ a.split('').reverse().join(''); // test a is palindrome
        a = n.toString(++b));
    return+b
}

J - 28 char
#.inv~(-.@-:|.@)(1+]^:)^:_&2

Explained:

#.inv~ - Expand left argument to the base in the right argument.
(-.@-:|.@) - Return 0 if the expansion is palindromic, and 1 otherwise.
(1+]^:) - Increment the right argument by one if we returned 1, else take no action.
^:_ - Repeat the above incrementing until it takes no action.
&2 - Prepare the right argument as 2, making this a function of one argument.

Examples:
   #.inv~(-.@-:|.@)(1+]^:)^:_&2 (28)
3
   #.inv~(-.@-:|.@)(1+]^:)^:_&2 every 93 11 32 59 111  NB. perform on every item
2 10 7 4 6
   #.inv~(-.@-:|.@)(1+]^:)^:_&2 every 1234 2345 3456 4567 5678 6789
22 16 11 21 31 92

2+1 i.~[#.inv"*(-:|.@)~2+i. for 27 bytes. (Don't want to post it separately. I will just leave it here.)

@randomra I would count that as 29 because trains need parens to be used inline; mine saves a character by having a conjunction at the top level.

I think the majority's stand on scoring is the paren-less counting with any unnamed function though there is always an argument about this. Anyway, I will leave it here and everybody can choose how he/she scores it. :)

Python 2, 79 bytes
def f(n,b=2):
 l=[];m=n
 while m:l+=m%b,;m/=b
 return(l==l[::-1])*b or f(n,b+1)

Try it online!
-1 bytes thanks to 97.100.97.109
I'm not sure what input/output format the question wanted. I wrote a function. The code uses an optional input b to track the current base it's testing. The while loops converts the number to a list of digits in base b.
The last line returns b if l is a palindrome, and recursively tries the next b otherwise. The index-by-Boolean trick doesn't work here because it would cause both options to be evaluated regardless of the Boolean, and the recursion would never bottom out.

So this will not work with arbitrarily high bases right? If the lowest base that a number has a palindrome is like 10000 then you'll get a stack overflow?

@Cruncher It depends of the implementation of Python. It will overflow when run with CPython, but not with Stackless Python, which does tail call optimization and so has no recursion limit (though I haven't actually tested it).

82 bytes.

@97.100.97.109 Thanks, it turns out avoiding the and is even shorter

Javascript, 105 bytes
function f(n){for(var b=2,c,d;d=[];++b){for(c=n;c;c=c/b^0)d.push(c%b);if(d.join()==d.reverse())return b}}

JSFiddle: http://jsfiddle.net/wR4Wf/1/
Note that this implementation also works correctly for large bases. For example, f(10014) returns 1668 (10014 is 66 in base 1668).

This is nice. You can even s/var b=2,c,d/b=d=2/ to gain 6 more bytes ;)

R, 122 95 bytes
function(n)(2:n)[sapply(2:n,function(x){r={};while(n){r=c(n%%x,r);n=n%/%x};all(r==rev(r))})][1]

Three-year old solution at 122 bytes:
f=function(n)(2:n)[sapply(sapply(2:n,function(x){r=NULL;while(n){r=c(n%%x,r);n=n%/%x};r}),function(x)all(x==rev(x)))][1]

With some explanations:
f=function(n)(2:n)[sapply(
                    sapply(2:n,function(x){ #Return the decomposition of n in bases 2 to n
                                 r=NULL
                                 while(n){
                                     r=c(n%%x,r)
                                     n=n%/%x}
                                     r
                                     }
                           ),
                    function(x)all(x==rev(x))) #Check if palindrome
                   ][1] #Return the first (i. e. smallest) for which it is

Bash + coreutils, 100 bytes
for((b=1;b++<=$1;)){
p=`dc<<<${b}o$1p`
c=tac
((b<17))&&c=rev
[ "$p" = "`$c<<<$p`" ]&&echo $b&&exit
}

Uses dc to do base formatting.  The tricky thing is dc's format is different for n > 16.
Testcases:
$ ./lowestbasepalindrome.sh 11
10
$ ./lowestbasepalindrome.sh 32
7
$ ./lowestbasepalindrome.sh 59
4
$ ./lowestbasepalindrome.sh 111
6
$

Husk, 11 9 bytes
ḟoS=↔`B⁰2

Thanks @Zgarb for -2!
Try it online!
Explanation
ḟ(      )2  -- find least number ≥ 2 that satisfies:
     `B⁰    --   convert input to base (` flips arguments)
  S=↔       --   is palindrome (x == ↔x)

Note: Pyth is newer than this question, so this answer is not eligible to win.
Pyth, 10 bytes
fq_jQTjQT2

Try it here.

Scala, 83 bytes
def s(n:Int)=(for(b<-2 to n;x=Integer.toString(n,b);if(x==x.reverse))yield(b)).min

Mathematica 42 bytes
A variation of Martin Ender's entry. Makes use of IntegerReverse (made available in version 10.3) which dispenses with IntegerDigits.
(i=2;While[#~IntegerReverse~i !=#,i++];i)&

05AB1E, 8 bytes
¼[¼¾вÂQ#

Try it online!

Perl 5, 84 + 1 (-p) = 85 bytes
$\=1;{++$\;my@r;$n=$_;do{push@r,$n%$\}while$n=int$n/$\;@t=@r;map$_-pop@t&&redo,@r}}{

Try it online!

JavaScript 72 bytes

F=(n,b=2)=>eval(`for(t=n,a=c="";t;t=t/b|0)a=t%b+a,c+=t%b`)^a?F(n,b+1):b

console.log(F(11) == 10)

console.log(F(32) == 7)

console.log(F(59) == 4)

console.log(F(111) == 6)

Java 8, 103 bytes
n->{int b=1,l;for(String s;!(s=n.toString(n,++b)).equals(new StringBuffer(s).reverse()+""););return b;}

Explanation:
Try it here.
n->{                          // Method with integer as both parameter and return-type
  int b=1,                    //  Base-integer, starting at 1
      l;                      //  Length temp integer
  for(String s;               //  Temp String
      !(s=n.toString(n,++b))  //   Set the String to `n` in base `b+1`
                              //   (by first increase `b` by 1 using `++b`)
       .equals(new StringBuffer(s).reverse()+"");
                              //   And continue looping as long as it's not a palindrome
  );                          //  End of loop
  return b;                   //  Return the resulting base integer
}                             // End of method

Jelly, 8 bytes
2b@ŒḂ¥1#

Try it online!
How it works
2b@ŒḂ¥1# - Main link. Takes an integer n on the left
     ¥   - Group the previous 2 links into a dyad f(b, n):
 b@      -   Convert n to base b
   ŒḂ    -   Is palindrome?
2     1# - Count up b = 2, 3, 4, ... returning the first b that's true under f(b, n)

Ruby, 43 bytes
-1 byte thanks to Steffan
->n{(2..).find{d=n.digits _1
d==d.reverse}}

Attempt This Online!

n.digits(_1) => n.digits _1

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

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