text:
Write a Program in Disguise
The challenge is to create a program that solves any one of the HQ9+ problems while looking like another language.
Note: This is not a golf challenge.
Rules:

The program must perform one of the following tasks when run.

Print "Hello, World!"
Print its entire source.
Print the lyrics to "99 Bottles of Beer on the Wall" (as seen here).

At first glance the program should look like another language.

Grading

Working program that satisfies the rules. +3
Bonus points if the "other language" can be run (syntax valid). +1
Even more points if the "other language" can do something useful. +3
Lots of bonus points for the program being valid (and useful) in even more languages. +5 for each language over 2.

How are they graded?  You need an objective criterion. Check here: http://codegolf.stackexchange.com/help/on-topic

Okay, I'm adding a points system.

So... you're looking for a polyglot?

Yes.  But with emphasis on "hiding" the features of all but one language to an extent.

print ("Hello, World"); by itself will run in a lot of languages

What about the HQ9+ problem "increment the counter by one"? :P

I kinda deemed that boring, but if you come up with something interesting I'm sure people will enjoy it :D

T-SQL
Print 'Hello, World!' -- she said.

Looks like English.

Ruby + C + Whitespace.
This program is C but looks like (and runs as) Ruby.  I also managed to throw some whitespace in there.
C prints its own source (not quite a quine unfortunately).  Ruby prints 99 bottles of beer and whitespace says hello.
#include <stdio.h>
#define def int
#define beer main(int i){char b[1024];
#define print(v) print(int v){
#define end ;}
#define if(x) fputs(b,stdout); fgets(b,1024,f); if(x){
#define else ;} else{
#define puts
#define print
#define open(fn) FILE *f = fopen(fn,"r");
#define while(x) fgets(b,1024,f); while(!feof(f)){

def beer
    # define beer

    open("test.c")

   i=100;

    while ( i >= 0 )
        if ( i > 0 )
            print "#{i} bottle#{i==1&&''||'s'} of beer on the wall, "
            puts  "#{i} bottle#{i==1&&''||'s'} of beer."
            print "Take one down and pass it around, "
            puts  "#{i-1} bottle#{i==2&&''||'s'} of beer on the wall."
            puts
        else
            puts "No more bottles of beer on the wall, no more bottles of beer."
            puts "Go to the store and buy some more, 99 bottles of beer on the wall."
        end
        i -= 1
    end

    return 0
end

beer

And since SO isn't very nice to ws here is a link.

Golfscript / HQ9+
9

A Golfscript quine that doubles as an HQ9+ program that prints the lyrics to 99 bottles of beer.
I know this isn't a golf challenge, but I couldn't resist the desire to answer this with one character.

And I was silly enough to assume HQ9+ couldn't look like another language :D

Yes! And crazily it looks lie the number "9".

Also prints 9 in html but unfortunately that is not considered a quine.

C++/Python
#include <iostream>

#define print(a) int main() {std::cout << a << std::endl;}

print("Hello, World!")

Will run in Python (both 2.x and 3.x) and compile in C++ to print (with carriage return):

Hello, World!

Perl, 7 points
99 <?php
for($i='no more',$_="`\2l\";7hF'`-{9\17p\t\2ZY\14fE\25T\133J`\35l\"76~\x3";
99>${2}="$i bottle".(${$i+=1}<'))'?+s?:s:!'((').' of beer';
${3}="
Take one down and pass it around, ${1}.

".ucfirst("${1}, ${2}.${3}"))${1}=$i||${2}?"${2} on the wall":'?;\'';
print substr("${1}, ${2}.${3}".
($_^"jE\3\2OXH2O\5\15\10M$_").", ${2} on the wall.",3,13*$i*$i);

This is a Perl program that prints Hello, World!.
Score breakdown:

Follows all rules: +3
Is valid syntax in another language: +1
Does something interesting in the other langauge: +3

Sidenote:
Once you know what it does it might seem 'obvious' where it's hanging out, but this is a dupe.
The following:
$_="`\2l\";7hF'`-{9\17p\t\2ZY\14fE\25T\133J`\35l\"76~\x3";
print$_^"jE\3\2OXH2O\5\15\10M$_"

will output:
Go to the store and buy some moreET[J`l"76~

JavaScript, 7 points

/******

Hello, World!

*******

This is my awesome Hello World page

*******

Look I can make images I'm so good at HTML:

These are the things this page has:

Bold

Italics

Images

Lists

I like random characters! That's what this page will finish with:

;37!&$89]"]0(!)89^!&8*/81+-0;h

When run in JavaScript, produces "Hello, World!"
When viewed as HTML, looks like this:

Scoring

Working program that satisfies the rules +3
Other language syntax is valid +1
Other language does something useful (you can put any HTML you want in there) +3

Subtle! This assumes that the implementation evaluating it prints out the completion value of the last statement to stdout, though.

@FireFly yes, that's what eval and all consoles do.

eval doesn't print it to stdout; it returns it as the result of the function call expression. But yeah, I'm just nitpicking; sorry. :p

The following prints "Hello,World" (and a random table) in HTML and "Hello, World!" in Whitespace.

<title>
Hello,World!
</title>

Hello,World!

Summary

Year
Revenue

2012
$100,000

HTML5!

You can find a version of "99 Bottles" here http://www.99-bottles-of-beer.net/language-whitespace-154.html

PHP, HQ9+, Brainfuck and Bash (23 points, I think)
Looks like PHP, but...
Abuse of STDERR redirection and quotes.
what the >&_@ is a "<?php
//Boring, really ( ;[ ). This just prints Hello World!"
echo "Hello, World!"; //]&> are random characters that I like putting in"
?>" program?

This runs and does things in all the languages listed, but looks like (slightly weird) PHP code.
In Bash, it merely prints "Hello, World!" (creating junk files along the way).
In HQ9+, it prints Hello World a few times (once for every occurence of H or h).
In Brainfuck, it is a "cat program" - it reads from standard input and outputs its input to standard output (><,[.,]>>).
In PHP, it prints some text:

what the >&_@ is a "Hello, World!" program?

Bash Explanation
>&_@ is disguised as harmless text substituting a curse, but it is in fact a redirection of STDERR to the file _@, so that Bash doesn't complain that what is not a valid program. It also eats the is a <?php bit and the first comment.
The first comment has a quote at the end (the quotes are there to prevent <?php from being run). echo "Hello, World!"; runs normally in both languages. The next comment serves to hide another quote, and there is an output redirection from STDERR to the file are, to eat the message " //: Is a directory".
Since the closing ?> is in quotes, it doesn't get run, and gets eaten along with the second comment and the bit after it.

JavaScript, 3p

yay

hi
   /// heading

lol
    /// content

Masquerades the output of a misconfigured web server, as (something that at first glance looks like) PHP+HTML mess.
This started out small but grew bigger as I tried to make it less obvious what it does (when evaluated as JS)... it might've become more obfuscated than the task intended, sorry about that.  Anyway, the main thing I wanted to include was my trick for embedding (a subset of) HTML such that it's also valid JavaScript code, which is what you see at the end of the code.
Edit: oh, I should mention, when run in a website context the code alerts "hello world".

Aha I love the dollar sign vars.  The javascript html is also really cool.

Hehe, the trick with the javascript HTML is that < and > are comparisons, /.../ is a regex literal (hence the triple-slashes for comments..) and JS doesn't care one bit about the types.

Python/PHP/Lua/Perl/Perl 6/Ruby/JavaScript/HQ9+ (37 points)
print("Hello, World!")

This looks like "Hello, World" in Python, but it's actually a quine written in PHP. It also works in JavaScript (SpiderMonkey), Lua, HQ9+, Perl, Perl 6 and Ruby, for bonus points.

JavaScript/Python 3/PHP/Lua/Brainfuck/bash
This looks like... Umm... Obfuscated PHP?
#!,[.,]
echo = --[[0] ] [0][0] //1#>/dev/null;echo Hello, World!;exit # ]]0
--[[0] ] [0][0] //1#<?php for ($i = 99; $i > 1;) { printf("%d bottles of beer on the wall, %d bottles of beer.\nTake one down and pass it around. %d bottle%s of beer on the wall.\n\n", $i, $i, --$i, ($i != 1 ? "s" : "")); } print("1 bottle of beer on the wall, 1 bottle of beer.\nTake on e down and pass it around. No more bottles of beer on the wall.\n\nNo more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more. 99 bottles of beer on the wall.\n"); die(); ?>
2//2; print("Hello world!"); exit();"""
console.log("Hello, World!");/*]]
f = io.open(arg[0])
print(f:read("*a"))
--[[*///]]--"""

If you run it in bash, JavaScript or Python it'll print "Hello, World!"
If you run it in Lua, it'll print the script's source code (if provided as the first argument to lua).
If you run it in PHP it'll print the lyrics of 99 bottles of beer
If you run it as Brainfuck, it'll work like cat.

Score: 27

Follows the rules: 3
Other language can run: 1
Does something useful: 3 (cat program)
Also works in JS/Python 3/Lua/bash: 20

I hope I'm not bending the rules too much :)

Java written in C++
#include <stdio.h>

typedef char* String;

class P{
public:
    static void println(String s){
        puts(s);
    }
};

class S{
public:
    P out;
};

int main()
{
    S System;
    System.out.println("Hello world!");
    return 0;
}

Score 3 points.

print `open(__file__).read()`, 1000 // len('''
/* Calculate code conciseness score for some random JavaScript */

function print() {
    console.log('Hello, world!');
}


text:
How random is the Gettysburg Address
Your program must print out the Gettysburg Address.
I copied this text from Wikipedia:

Four score and seven years ago our fathers brought forth on this continent a new nation, conceived in liberty, and dedicated to the proposition that all men are created equal.
  Now we are engaged in a great civil war, testing whether that nation, or any nation so conceived and so dedicated, can long endure. We are met on a great battlefield of that war. We have come to dedicate a portion of that field, as a final resting place for those who here gave their lives that that nation might live. It is altogether fitting and proper that we should do this.
  But, in a larger sense, we can not dedicate, we can not consecrate, we can not hallow this ground. The brave men, living and dead, who struggled here, have consecrated it, far above our poor power to add or detract. The world will little note, nor long remember what we say here, but it can never forget what they did here. It is for us the living, rather, to be dedicated here to the unfinished work which they who fought here have thus far so nobly advanced. It is rather for us to be here dedicated to the great task remaining before us—that from these honored dead we take increased devotion to that cause for which they gave the last full measure of devotion—that we here highly resolve that these dead shall not have died in vain—that this nation, under God, shall have a new birth of freedom—and that government of the people, by the people, for the people, shall not perish from the earth.

There are two different tests:

You may use system decompression software
No using system decompression software

Additionally, none of the words in the Address can appear in plain text in your code (with a non-alpha character before and after). Shortest code wins. Good luck!

What do you mean by "There are two different tests"? Are we supposed to use system decompression software? Or not to use it?

Also it adds litte to nothing new in comparison to other compression quests.

Make one program that uses them, and one that doesn't.

I'm adding that you cannot have plain text of any words  in the address in code.

how important is punctuation? specifically, the hyphens?

@smcg Running into encoding issues?

yes, I couldn't encode the hyphens in my solution, so I replaced them with ", " instead

Tcl, 759, no compression
puts [encoding convertt unicode 潆牵猠潣敲愠摮猠癥湥礠慥獲愠潧漠牵映瑡敨獲戠潲杵瑨映牯桴漠桴獩挠湯楴敮瑮愠渠睥渠瑡潩Ɱ挠湯散癩摥椠楬敢瑲ⱹ愠摮搠摥捩瑡摥琠桴牰灯獯瑩潩桴瑡愠汬洠湥愠敲挠敲瑡摥攠畱污潎⁷敷愠敲攠杮条摥椠牧慥⁴楣楶慷Ⱳ琠獥楴杮眠敨桴牥琠慨⁴慮楴湯牯愠祮渠瑡潩潳挠湯散癩摥愠摮猠敤楤慣整Ɽ挠湡氠湯湥畤敲敗愠敲洠瑥漠牧慥⁴慢瑴敬楦汥景琠慨⁴慷⹲圠慨敶挠浯潴搠摥捩瑡潰瑲潩景琠慨⁴楦汥Ɽ愠⁳楦慮敲瑳湩汰捡潦⁲桴獯桷敨敲朠癡桴楥⁲楬敶⁳桴瑡琠慨⁴慮楴湯洠杩瑨氠癩⹥䤠⁴獩愠瑬杯瑥敨⁲楦瑴湩湡牰灯牥琠慨⁴敷猠潨汵潤琠楨⹳䈠瑵湩愠氠牡敧⁲敳獮ⱥ眠慣潮⁴敤楤慣整敷挠湡渠瑯挠湯敳牣瑡ⱥ眠慣潮⁴慨汬睯琠楨⁳牧畯摮桔牢癡敭Ɱ氠癩湩湡敤摡桷瑳畲杧敬敨敲慨敶挠湯敳牣瑡摥椠ⱴ映牡愠潢敶漠牵瀠潯⁲潰敷⁲潴愠摤漠⁲敤牴捡⹴吠敨眠牯摬眠汩楬瑴敬渠瑯ⱥ渠牯氠湯敲敭扭牥眠慨⁴敷猠祡栠牥ⱥ戠瑵椠⁴慣敮敶⁲潦杲瑥眠慨⁴桴祥搠摩栠牥⹥䤠⁴獩映牯甠⁳桴楬楶杮慲桴牥潴戠敤楤慣整敨敲琠桴湵楦楮桳摥眠牯桷捩桴祥眠潨映畯桧⁴敨敲栠癡桴獵映牡猠潮汢⁹摡慶据摥瑉椠⁳慲桴牥映牯甠⁳潴戠敨敲搠摥捩瑡摥琠桴牧慥⁴慴歳爠浥楡楮杮戠晥牯獵琭慨⁴牦浯琠敨敳栠湯牯摥搠慥敷琠歡湩牣慥敳敤潶楴湯琠桴瑡挠畡敳映牯眠楨档琠敨⁹慧敶琠敨氠獡⁴畦汬洠慥畳敲漠敤潶楴湯琭慨⁴敷栠牥楨桧祬爠獥汯敶琠慨⁴桴獥敤摡猠慨汬渠瑯栠癡楤摥椠慶湩琭慨⁴桴獩渠瑡潩Ɱ甠摮牥䜠摯桳污慨敶愠渠睥戠物桴漠牦敥潤⵭湡桴瑡朠癯牥浮湥⁴景琠敨瀠潥汰ⱥ戠⁹桴数灯敬潦⁲桴数灯敬桳污潮⁴数楲桳映潲桴慥瑲⹨]

This isn't the shortest, but it's the only real answer that fulfills the no plaintext words in code rule. So it wins.

Tcl winning! YES!

Mathematica 40
Note: Not to be taken as a serious answer.  ;)
Just for fun:
ExampleData@{"Text","GettysburgAddress"}

Four score and seven years ago, our fathers brought forth upon this
continent a new nation: conceived in liberty, and dedicated to the
proposition that all men are created equal. Now we are engaged in a
great civil war...testing whether that nation, or any nation so
conceived and so dedicated. . . can long endure. We are met on a
great battlefield of that war. We have come to dedicate a portion of
that field as a final resting place for those who here gave their
lives that this nation might live. It is altogether fitting and
proper that we should do this. But, in a larger sense, we cannot
dedicate...we cannot consecrate... we cannot hallow this ground. The
brave men, living and dead, who struggled here have consecrated it,
far above our poor power to add or detract. The world will little
note, nor long remember, what we say here, but it can never forget
what they did here. It is for us the living, rather, to be dedicated
here to the unfinished work which they who fought here have thus far
so nobly advanced. It is rather for us to be here dedicated to the
great task remaining before us...that from these honored dead we take
increased devotion to that cause for which they gave the last full
measure of devotion... that we here highly resolve that these dead
shall not have died in vain...that this nation, under God, shall have
a new birth of freedom...and that government of the people, by the
people, for the people, shall not perish from this earth.

"none of the words in the Address can appear in plain text in your code" I can see an a in your code ;-)

@Howard You may be right.

I mean with a space before and after.

It may or may not be worth noting that the punctuation is slightly different in this version. I'm not sure that that should disqualify it, though.

Even the words vary from version to version.  See http://www.abrahamlincolnonline.org/lincoln/speeches/gettysburg.htm

This is by no means a "Just for fun" or otherwise invalid answer.

Python 2.7, no decompression, 962 characters
"eJxlVEGO2zAM/AofYOQRPbTopacCPdMWbQsri6kk28jvOxTjbNpegliiyJnhkF91L1QnLUKcA1U5JNNDuFTiRcluZ26r4Hssui9ro1lLW0kztTVWmjS3mCU3YspyUuYWNQ92Pkk8JFDMlOIopT2GXiNIiBM33DRFDqF70bvWaO/wzciUEm3AwUA1Femx8nvndKMfetIp/UbywovnZ1osjKZ4xEQnl4GaVOBa6FzF4HviC5wWIHk8P6nqG9qugn6CBBMGAUUqyWEvcqNfXn+TZipctUduLckcJQXS2esBSQ9f+QAT3cQoX6nx8g4pDcEV319DJYiP/5kTlSeNe+JJTHoEahXQUgItocVSg2EsUPmQ6one2NIWrWt2eaPvjdAzTk0Xl2WOrec32taHSyloXFfdwSVob/SNvuxtcLETlwWBVXKVwUJNoqztRe2vQ2hbZSr/Hq/oMprZTbTAWjnc6CfcMBZjhPYPhvnCFoQhjLGurezLktAq4z9c2l414AfAnBkdHhU35uC7qv2cRk6JQzADBGmFp+ZFTy2gekYYL0Xro0FE8ozA3vsim2wwMSA81eHHE8C4Q9TmvDA+xboEdT0SIj8oRAd76W9t3Gv3vlMcqPQhGwzfKG8j0nv8nJM9wxOxrjgG3g8UiNPqFUyY2cezv1jdFShiSsDPWcf0APWDYfRwAfGqLzy9dn//34y6xxvXD5OCgQOijDLb4tjr8LRv0c2i4c9VIZ1430yuxh8C89g01358qM+7+tOJ9+r+fmN1eRuGq8i+97XAFUNoE3PlGF6OdeqwO6hicDT1596FKo6lmu+eBsR1iL5BDlAarmAoc20K2BICfVOYz1/2V77qxtgX4QzeIkE3X289xwLrlbzZWuyzjSUnek/mlsdfnz7Rn9+f8DCK6PVLU8JObuvtD0gQCHY=".decode('base64').decode('zlib')
For fun, Python 2.7, no decompression, 1470 characters
"Sbhe fpber naq frira lrnef ntb bhe snguref oebhtug sbegu ba guvf pbagvarag n arj angvba, pbaprvirq va yvoregl, naq qrqvpngrq gb gur cebcbfvgvba gung nyy zra ner perngrq rdhny. Abj jr ner ratntrq va n terng pvivy jne, grfgvat jurgure gung angvba, be nal angvba fb pbaprvirq naq fb qrqvpngrq, pna ybat raqher. Jr ner zrg ba n terng onggyrsvryq bs gung jne. Jr unir pbzr gb qrqvpngr n cbegvba bs gung svryq, nf n svany erfgvat cynpr sbe gubfr jub urer tnir gurve yvirf gung gung angvba zvtug yvir. Vg vf nygbtrgure svggvat naq cebcre gung jr fubhyq qb guvf. Ohg, va n ynetre frafr, jr pna abg qrqvpngr, jr pna abg pbafrpengr, jr pna abg unyybj guvf tebhaq. Gur oenir zra, yvivat naq qrnq, jub fgehttyrq urer, unir pbafrpengrq vg, sne nobir bhe cbbe cbjre gb nqq be qrgenpg. Gur jbeyq jvyy yvggyr abgr, abe ybat erzrzore jung jr fnl urer, ohg vg pna arire sbetrg jung gurl qvq urer. Vg vf sbe hf gur yvivat, engure, gb or qrqvpngrq urer gb gur hasvavfurq jbex juvpu gurl jub sbhtug urer unir guhf sne fb aboyl nqinaprq. Vg vf engure sbe hf gb or urer qrqvpngrq gb gur terng gnfx erznvavat orsber hf—gung sebz gurfr ubaberq qrnq jr gnxr vapernfrq qribgvba gb gung pnhfr sbe juvpu gurl tnir gur ynfg shyy zrnfher bs qribgvba—gung jr urer uvtuyl erfbyir gung gurfr qrnq funyy abg unir qvrq va inva—gung guvf angvba, haqre Tbq, funyy unir n arj ovegu bs serrqbz—naq gung tbireazrag bs gur crbcyr, ol gur crbcyr, sbe gur crbcyr, funyy abg crevfu sebz gur rnegu.".encode('rot13')

Very unorginal. But it works. +1

also I'm fooling around with other python encodings... currently they seem to be a bit lossy with the gettysburg address

the rot13 solution contains " or " which is in the original text.

Perl, 932 bytes (no system decompression)
This entry is not a UTF-8-encoded file. Perl 5 uses 8-bit characters as its default character set for scripts. Since the website does use UTF-8, I'm posting a base64-encoded version of my submission:
c3ViIGJ7JCRfP2IoQCQkXyk6cHJpbnQgZm9yQF99c3ViIGF7JHtjaHIoKX09W3BvcCxwb3BdZm9y
IDE0OS4uMjU1OyZifWEiRpjQY/P71K123iB5Zepz3GfAmOthxHO7ctivvfog9fbBynTy3vlhlneq
98qg16LMaWL8dHn31JvounLCb3O/5tth/yCuIKZj7PHvZXF1/eNOsiDgpt6cZ6LcIJpj12lsIHfq
93S2peFlxNtuzvfa8Hmq0MDKoNfv1HPA0WW3zcz12d5kdezjV/ump/n13CCaYvF0bGVmaWWfx9t3
6uNX+8VjuPvoINH7YSBw87Ugx9tmaWVst8/c6/L9IOxzpXBsYWP7vfZvc/vhwMic6fplaXLM17bb
1W7OIG1pr5dlncH96GdlxOu/pdRwcsL82+BzaNifZG/25+NC/vfy3MzqZ/zQ3nOe0Z7KrWNy8Z68
svbBZ3LYbmTjVGj7Yr7prveXxtSkt+Fv0HRydWdnbO/d5cXKrWNy8e+/92bq3GJv6ZggcG/acLL8
s9xk+NrudL5jdONUaPt38593af/Mv3Rs+25vdOVu2mz12eynbWL8IOH04HNhyd3lYv4gafnNlnb8
6/NnZfnh9PqV3/jdZZ3n69rD4pfyZ/e+xPfou/ubyOjidW5m8udo73fzayDhaWNo9pXhb+vYr8jF
+sPr6tBv0mJsedxkdvCgZJ3BvsTr2sOzu/vIm+jimnTPayDsbWHyxmJlvfvDmWZyuPa2+2j18++k
+OB0YWv78mPsz+/udm+1s9tjYcP7ZtrhaWNo9pWc6fr7bM/5ZnX/IKfPdXL7xyDudm+1meDIaGm5
bMnsc29s6dX6tvuk+KvLxd+iIHZh8pn656r3dW5k/CBHb7erIMVhlne7aXL6IMfr7GVkuC3U1Wdv
dvxurvnHo2J5o72jq8tw/Odo63K44mXq+i5sbHR1bGFyZSBlaHQgdCBkICz6IG5v+WFyb25pdGFu
YfhlZWRuIGVyZiByYft2b3RzafVp92VhaCAu+/Zod/t3aWRuZfxoYSD09iDzIGd1b3ZpY9/0+vjw
8dZv7dPucyBzYebx8GNsIPnS9WMgefvdZm/Z8unk/PpzdXBvIOcgb3RpYXLzZv/kYiBw4mhnbW/3
ZHNl5nTCZeggd2/lbLS6+bnebWVzzeC8c87trOX07GVt++rGdGHusbDy70njZWP4bMup+aFhZ+/R
qGfVLXLY12xl7cllIj1+Ly4vZ3M=

This is what the script looks like with the non-ASCII characters replaced with question marks, and some line breaks added for readability:
sub b{$$_?b(@$$_):print for@_}sub a{${chr()}=[pop,pop]for 149..255;&b}
a"F??c????v? ye?s?g???a?s?r???? ????t???a?w???????ib?ty?????r?os???a? ? ?c???equ??N? ????
g?? ?c?il w??t???e??n????y????????s??e??????du??W?????? ?b?tlefie???w??W??c??? ??a p?? ??
fiel?????? ?s?plac???os???????eir?????n? mi??e????ge?????pr????sh??do???B??????g???s?????
cr??????gr?nd?Th?b??????????o?truggl??????cr????f??bo?? po?p????d???t?ct?Th?w??wi???tl?no
t?n?l????mb? ???sa???b? i???v???ge????????e????????g???????????unf??h?w?k ?ich???o???????
???o?bly?dv??d???????????????t?k ?ma??be????fr????h??????tak??c????vo???ca??f??ich??????l
??fu? ??ur?? ?vo????hi?l??sol???????????? va??????und? Go?? ?a?w?ir? ???ed?-??gov?n????by
?????p??h?r??e??.lltulare eht t d ,? no?aronitana?eedn erf ra?votsi?i?eah .??hw?widne?ha
?? ? guovic???????o???s sa???cl ???c y??fo??????supo ? otiar?f??b p?hgmo?dse?t?e? wo?l???
??mes???s??????em???ta?????I?ec?l????ag???g?-r??le??e"=~/./gs

As @Howard mentioned, this doesn't add much to previous kolmogorov-complexity golf challenges. My encryption scheme, sometimes referred to as "re-pair compression" is one I've used before so I won't go into details again here. In short, it's not a very efficient compression scheme, but it has the advantage of requiring very little code for the decompressor. The compressed string itself occupies 638 characters. (The period near the start of the third-to-last line is where the compressed string ends in the source code quoted above.) The remaining 214 characters of the string is the compression dictionary, leaving 80 characters that make up the Perl script proper.

I asked this to confirm my long-held suspicion that the   Gettysburg Address was written by a computer, now I see it was:)

Technically this has the word "for"

source: Stack Exchange

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

sort: votes


text:
Parse IRC into XML
Here's an example IRC log (this will be your program's input):
[01:00] == User [*****] has joined #Channel
[01:00] == ChanServ [ChanServ@services.] has left #Channel []
[01:00] == mode/#Channel [+o User] by ChanServ
[01:00] <Bot> Welcome, User!
[01:01] <User> Hello bot
[01:02] <Bot> Hi there
[01:38] <OtherUser> I like pie
[01:38] <User> Me too :D
[19:58] <@Mod> I am a mod!!!1!!11!
[19:59] <User> That's fascinating

Your task is to parse that into XML, like this (this will be your program's output):
<irc>
  <message type='event'>
    <text>User [*****] has joined #Channel</text>
    <time>01:00</time>
  </message>
  ...
  <message type='chat'>
    <user>Bot</user>
    <text>Welcome, User!</text>
    <time>01:00</time>
  </message>
  ...
</irc>

Further specification:

must be well-formed XML (except for the XML declaration at the top), whitespace/indentation unnecessary
you don't have to worry about escaping; >, <, etc. will never appear in messages
messages can be in two forms:

[{hh:mm}] <{username}> {message}

this should be parsed as:
<message type='chat'>
  <user>{username}</user>
  <text>{message}</text>
  <time>{hh:mm}</time>
</message>

[{hh:mm}] == {message}

this should be parsed as:
<message type='event'>
  <text>{message}</text>
  <time>{hh:mm}</time>
</message>

XML consists of a single irc element with zero or more message elements in it
order of the elements within the message element don't matter, but order of message elements does
input and output can be any reasonable method (i.e. stdin and stdout, reading from/writing to files, etc.) but input cannot be hardcoded
this is code-golf so shortest code wins

XML cannot be valid unless it refers to a specific DTD, which you have not provided. Perhaps you should only specify that it be well-formed?

How about using XML libraries/built-in functions in languages that have them? Is that allowed?

@marinus why not? I used Nokogiri in the Google-scraping task.

@KevinReid Okay, I have edited the question.

@marinus They are not explicitly disallowed, so yes.

Reviving the dead here:  How did this question get so few views, and 3 downvotes?  Does nobody like xml or something?

GolfScript, 140 characters
{.@+'<>'1/*@+\'</>'2/*+}:^;n%{" "/(1>5<'''time'^\(.'='>{;'event'}{1>-1<'''user'^@+\'chat'}if`' type='\+\' '*'''text'^@+\'message'^}%'''irc'^

I meant to use a language, especially designed for xml processing. Input/output is STDIN/STDOUT. You can remove a few chars by replacing '' with n but that makes the output more unreadable.
Output for the example given above (online):
<irc><message type="event"><text>User [*****] has joined #Channel</text><time>01:00</time></message><message type="event"><text>ChanServ [ChanServ@services.] has left #Channel []</text><time>01:00</time></message><message type="event"><text>mode/#Channel [+o User] by ChanServ</text><time>01:00</time></message><message type="chat"><text>Welcome, User!</text><user>Bot</user><time>01:00</time></message><message type="chat"><text>Hello bot</text><user>User</user><time>01:01</time></message><message type="chat"><text>Hi there</text><user>Bot</user><time>01:02</time></message><message type="chat"><text>I like pie</text><user>OtherUser</user><time>01:38</time></message><message type="chat"><text>Me too :D</text><user>User</user><time>01:38</time></message><message type="chat"><text>I am a mod!!!1!!11!</text><user>@Mod</user><time>19:58</time></message><message type="chat"><text>That's fascinating</text><user>User</user><time>19:59</time></message></irc>

Tcl, 268
I believe Perl would be better for the job, but who cares.
puts <irc>[regsub -all -line {^\[([^\]]*)\] == (.*$)} [regsub -all -line {^\[([^\]]*)\] <([^>]*)> (.*)} [gets stdin] {<message type='chat'><user>\2</user><text>\3</text><time>\1</time></message>}] {<message type='event'><text>\2</text><time>\1</time></message>}]</irc>

Every task that can be solved with 2 regsub is boring.

 R 254 characters
cat("<irc>",gsub("\\[(.*)\\] <(.*)> (.*)","<message type=\\'chat\\'><user>\\2</user><text>\\3</text><time>\\1</time></message>",gsub("\\[(.*)\\] == (.*)","<message type=\\'event\\'><text>\\2</text><time>\\1</time></message>",scan(,"",se="\n"))),"</irc>")

Very simple solution: take input as newline-separated stdin, apply two gsub to it (one for events, one for chats) and output.
Example output with example input from question:
<irc> <message type='event'><text>User [*****] has joined #Channel</text><time>01:00</time></message <message type='event'><text>ChanServ [ChanServ@services.] has left #Channel []</text><time>01:00</time></message <message type='event'><text>mode/#Channel [+o User] by ChanServ</text><time>01:00</time></message <message type='chat'><user>Bot</user><text>Welcome, User!</text><time>01:00</time></message <message type='chat'><user>User</user><text>Hello bot</text><time>01:01</time></message <message type='chat'><user>Bot</user><text>Hi there</text><time>01:02</time></message <message type='chat'><user>OtherUser</user><text>I like pie</text><time>01:38</time></message <message type='chat'><user>User</user><text>Me too :D</text><time>01:38</time></message <message type='chat'><user>@Mod</user><text>I am a mod!!!1!!11!</text><time>19:58</time></message <message type='chat'><user>User</user><text>That's fascinating</text><time>19:59</time></message </irc>

Ruby: 186 characters
BEGIN{puts"<irc>"}
END{puts"</irc>"}
sub(/.(.{5}). (<(.+?)>|==) (.+)/){"<message type='#{$3?:chat:"event"}'>#{$3?"<user>#{$3}</user>":""}<text>#{$4}</text><time>#{$1}</time></message>"}

Sample run:
bash-4.1$ ruby -p irc2xml.rb < irc.txt
<irc>
<message type='event'><text>User [*****] has joined #Channel</text><time>01:00</time></message>
<message type='event'><text>ChanServ [ChanServ@services.] has left #Channel []</text><time>01:00</time></message>
<message type='event'><text>mode/#Channel [+o User] by ChanServ</text><time>01:00</time></message>
<message type='chat'><user>Bot</user><text>Welcome, User!</text><time>01:00</time></message>
<message type='chat'><user>User</user><text>Hello bot</text><time>01:01</time></message>
<message type='chat'><user>Bot</user><text>Hi there</text><time>01:02</time></message>
<message type='chat'><user>OtherUser</user><text>I like pie</text><time>01:38</time></message>
<message type='chat'><user>User</user><text>Me too :D</text><time>01:38</time></message>
<message type='chat'><user>@Mod</user><text>I am a mod!!!1!!11!</text><time>19:58</time></message>
<message type='chat'><user>User</user><text>That's fascinating</text><time>19:59</time></message>
</irc>

Test run:
bash-4.1$ ruby -p irc2xml.rb < irc.txt | xmlstarlet val -
- - valid

You have to remove ==  from the event text.

Oops. Missed that. Thank you, @Howard.

Sed: 183 180 characters
1i<irc>
s!.(.{5}). (.*)!\2<time>\1</time>!
Ta
s!<(.+?)> (.*)!chat\n\2<user>\1</user>!
ta
s!== !event\n!
:a
s!(.+)\n([^<]+)!<message type='\1'><text>\2</text>!
a</message>
$a</irc>

Sample run:
bash-4.1$ sed -rf irc2xml.sed < irc.txt
<irc>
<message type='event'><text>User [*****] has joined #Channel</text><time>01:00</time>
</message>
<message type='event'><text>ChanServ [ChanServ@services.] has left #Channel []</text><time>01:00</time>
</message>
<message type='event'><text>mode/#Channel [+o User] by ChanServ</text><time>01:00</time>
</message>
<message type='chat'><text>Welcome, User!</text><time>01:00</time><user>Bot</user>
</message>
<message type='chat'><text>Hello bot</text><time>01:01</time><user>User</user>
</message>
<message type='chat'><text>Hi there</text><time>01:02</time><user>Bot</user>
</message>
<message type='chat'><text>I like pie</text><time>01:38</time><user>OtherUser</user>
</message>
<message type='chat'><text>Me too :D</text><time>01:38</time><user>User</user>
</message>
<message type='chat'><text>I am a mod!!!1!!11!</text><time>19:58</time><user>@Mod</user>
</message>
<message type='chat'><text>That"s fascinating</text><time>19:59</time><user>User</user>
</message>
</irc>

Test run:
bash-4.1$ sed -rf irc2xml.sed < irc.txt | xmlstarlet val -
- - valid

You omitted the message type from your output.

Ouch. I'm not on top today. Thanks again, @Howard.

Awk: 203 characters
BEGIN{print"<irc>"}END{print"</irc>"}{gsub(/\[|\]/,"",$1)
$2=gsub(/<|>/,"",$2)?"<user>"$2"</user>":""
$1="<message type='"($2?"chat":"event")"'><time>"$1"</time>"
$3="<text>"$3
$0=$0"</text></message>"}1

Sample run:
bash-4.1$ awk -f irc2xml.awk < irc.txt
<irc>
<message type='event'><time>01:00</time>  <text>User [*****] has joined #Channel</text></message>
<message type='event'><time>01:00</time>  <text>ChanServ [ChanServ@services.] has left #Channel []</text></message>
<message type='event'><time>01:00</time>  <text>mode/#Channel [+o User] by ChanServ</text></message>
<message type='chat'><time>01:00</time> <user>Bot</user> <text>Welcome, User!</text></message>
<message type='chat'><time>01:01</time> <user>User</user> <text>Hello bot</text></message>
<message type='chat'><time>01:02</time> <user>Bot</user> <text>Hi there</text></message>
<message type='chat'><time>01:38</time> <user>OtherUser</user> <text>I like pie</text></message>
<message type='chat'><time>01:38</time> <user>User</user> <text>Me too :D</text></message>
<message type='chat'><time>19:58</time> <user>@Mod</user> <text>I am a mod!!!1!!11!</text></message>
<message type='chat'><time>19:59</time> <user>User</user> <text>That"s fascinating</text></message>
</irc>

Test run:
bash-4.1$ awk -f irc2xml.awk < irc.txt | xmlstarlet val -
- - valid

Perl: 168 characters
BEGIN{say"<irc>"}END{say"</irc>"}/.(.{5}). (<(.+?)>|==) (.+)/;say"<message type='",$3?chat:event,"'>",$3&&"<user>$3</user>","<text>$4</text><time>$1</time></message>"

Sample run:
bash-4.1$ perl -nE 'BEGIN{say"<irc>"}END{say"</irc>"}/.(.{5}). (<(.+?)>|==) (.+)/;say"<message type='"'"'",$3?chat:event,"'"'"'>",$3&&"<user>$3</user>","<text>$4</text><time>$1</time></message>"' < irc.txt
<irc>
<message type='event'><text>User [*****] has joined #Channel</text><time>01:00</time></message>
<message type='event'><text>ChanServ [ChanServ@services.] has left #Channel []</text><time>01:00</time></message>
<message type='event'><text>mode/#Channel [+o User] by ChanServ</text><time>01:00</time></message>
<message type='chat'><user>Bot</user><text>Welcome, User!</text><time>01:00</time></message>
<message type='chat'><user>User</user><text>Hello bot</text><time>01:01</time></message>
<message type='chat'><user>Bot</user><text>Hi there</text><time>01:02</time></message>
<message type='chat'><user>OtherUser</user><text>I like pie</text><time>01:38</time></message>
<message type='chat'><user>User</user><text>Me too :D</text><time>01:38</time></message>
<message type='chat'><user>@Mod</user><text>I am a mod!!!1!!11!</text><time>19:58</time></message>
<message type='chat'><user>User</user><text>That's fascinating</text><time>19:59</time></message>
</irc>

Test run:
bash-4.1$ perl -nE 'BEGIN{say"<irc>"}END{say"</irc>"}/.(.{5}). (<(.+?)>|==) (.+)/;say"<message type='"'"'",$3?chat:event,"'"'"'>",$3&&"<user>$3</user>","<text>$4</text><time>$1</time></message>"' < irc.txt | xmlstarlet val -
- - valid

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


text:
Produce the most digits of an irrational number with only 64 KB of memory
Constraints:

Calculate any notable irrational number such as pi, e, or sqrt(2) to as many decimal digits as possible. If using a number not mentioned in the list above, you must cite how and where this number is used.
The memory used to store data in variables that the program reads from at any time in its computation may not exceed 64 kilobytes (216 = 65 536 bytes). However, the program may output as much data as it likes, provided it does not re-read the outputted data. (Said re-reading would count toward the 64 KB limit.)
The maximum size for code (either source or object code can be measured) is also 64 kilobytes. Smaller code is allowed, but does not provide more memory for computation or a better score.
The program must not accept any input.
Any format for output is allowed, as long as the digits are represented in decimal. Only the fractional portion of the number will be taken into account, so both 3.14159... and 14159... are both equivalent answers, the latter one being represented as "the fractional part of pi".
The number of decimal digits past the decimal point that your program outputs is your score. Highest score wins.

Mathematica 17684 ascii digits MemoryConstrained[N[Pi, 17684], 2^16], not very clever, just a baseline

I meant to warn against library functions for calculating the number, but forgot. i.e. when calculating sqrt(2) all library functions except sqrt are allowed.

Well, that stupid one doesn't use any library function. In fact, it doesn't use any function except for chopping the result. Not all languages are created equal.

Do you mean that maximum internal RAM usage is 2^16 bytes, or do you mean maximum memory usage total, of any type? Because if you meant the latter, an upper bound already exists that you can't get any finer than about 19728 digits because the output buffer alone will take that much memory.

mostly the former, in that your output does not count against your memory usage, but it can not be read back in during the main program.

Oh, okay then. My answer works, in that case.

Python - 1010157831 digits
This solution depends on a bending of the rules that doesn't count function return output as "used memory".
import sys

def trunc_factstring(n):
    return (factstring(n-1) * (n-1))[:-1] + "1"

def factstring(n):
    return "0" if n == 0 else factstring(n-1) * n

sys.stdout.write("0.")
a = 0
while True:
    a += 1
    sys.stdout.write(trunc_factstring(a))

Prints 0.1100010000000000000000010000..., the Liouville constant, until the program runs out of memory.
At any number a = n, the number of decimal places outputted is n!. Unlike my last solution, this one would run out of total memory before a reached even 100.
According to Wolfram Alpha, 2524288! is about 1010157831.

Kudos to @Cruncher for reminding me to do this. :P

As This challenge was Inspired by an account I read about Involving calculating Pi on an early computer where there was an improvement to the alogarithm where he switched from using two variables that were half the size of memory to one that could use all (or almost all) the memory, you are hereby fined 75% memory, but you are still in the lead. Congratulations.

Due to the way factorials work, you can just divide the top exponent by 4 to get the number of digits you can print out with one quarter of the available memory.

@Cruncher I said memory, not score which has a more significant impact.

In terms of how this analogizes to the early computer, imagine the computer printing out numbers on a tape, and you using a tape copier to copy the printed output rather than making the computer print out more things.

Python - 10157831 digits
import sys

sys.stdout.write("0.")
a = 0
while True:
    a += 1
    sys.stdout.write(str(a))

Prints 0.1234567891011121314151617181920..., which is the Champernowne constant in base 10, until the program runs out of memory.
When the program's counter a reaches a specific number x, it has printed out at least x digits (as every number has at least one digit), and more on the order of x log x digits. For x = 1010000, the binary data required to represent a would be about 4.1 kilobytes, which is well below the allotted limit.
Interesting to note - any computer running this program would run out of total memory long before it ever printed off even 10100 digits (let alone 1010000), due to there only being about 1080 particles in the observable universe and only about 1021 bytes of memory available for storage on all of Earth's data computing devices.
Wolfram Alpha says that the total number of digits printed is actually about 4.09776347957... × 10157831, assuming we can get all the way to 2524288 - 1 without running into memory issues with the bignum storage.

what happens when a wraps around? does it go negative or throw an exception?

Python integers go on forever.

If you don't believe me, try running print 2 ** 524288 - 1 in a Python shell, which is the largest number that can be represented raw in 64 KB of memory.

@JoeZ. If you want even more output use the binary representation.

The problem specified decimal, I believe.

Oh, apparently it didn't. Ah well, I cleaned the problem up a bit and that was one of the changes I made, since it was pretty obvious that's what @hildred intended.

+1. I was going to do something similar with "0.10110111011110111110 ... "

That would run out of memory faster, though, as you'd need to keep two counters. Although if we're not counting temporary output storage as memory usage (because it's output), you could pull some trickery with multiplying strings.

Python, infinitely many digits.
This computes a decimal expansion of the surreal number ε*x where x is the Champernowne constant.
from sys import stdout

stdout.write('0.')
while 1:
    stdout.write('0')
a = 0
stdout.write('.')
while 1:
    a += 1
    stdout.write(`a`)

also...
Sage, 0 digits
The bad news is that Sage's memory footprint is significantly larger than 64k.  The good news is that I have a provably optimal solution.
#this is a comment

By the time the computer runs out of memory, it'll only have printed a decimal equivalent to 0.

@JoeZ. not so!  it'll print infinitely many zeros before it starts consuming memory. After that, it prints out about 10^157831 characters of Champernowne. (also... this is a joke)

I meant by the time the computer runs out of total memory, not just memory that counts toward the 64 KB limit. :P

(And yeah, eventually I realized. :S)

Nice problem abuse.

PEP/8 - 1.29 * 10129049 ≈ 10↑↑2.71 digits
; BIGINT IS A LITTLE ENDIAN ~~BINARY CODED DECIMAL~~ BASE 10,000 NUMBER (1 WORD -> 0-10K)
; INDEX and INTLEN are ptr's, so INDEX++; needs to increse INDEX by 2

INC:      ANDX 0, I        ; INDEX = 0;
INCLOOP:  LDA BIGNUM, X    ; ...
          ADDA 1, I        ; ...
          STA BIGNUM, X    ; BIGNUM[INDEX]++;
          CPA 10, I        ; if (BIGNUM[INDEX] != 10){
          BRNE PRINT       ;     goto PRINT;
          ANDA 0, I        ; ...
          STA BIGNUM, X    ; BIGNUM[INDEX] = 0;
          CPX INTLEN, D    ; ...
          BRNE NOADLEN     ; if (INDEX == INTLEN){
          LDA INTLEN, D    ;     ...
          ADDA 2, I        ;     ...
          STA INTLEN, D    ;     INTLEN++;}
NOADLEN:  ADDX 2, I        ; INDEX++;
          BR INCLOOP       ; goto INC;

PRINT:    LDX INTLEN, D    ; INDEX = INTLEN;
          ADDX 2, I        ; INDEX++;
PRINLOOP: SUBX 2, I        ; INDEX--;
          DECO BIGNUM, X   ; print("%d", BIGNUM[INDEX]);
          CPX 0, I         ; if (INDEX != 0)
          BRNE PRINLOOP   ;     goto PRINLOOP;

          BR INC         ; goto INC

          ;LDA INTLEN, D    ; ...
          ;CPA 32, I        ; if (INTLEN < 32)
          ;BRLT INC         ;     goto INC
          ;STOP             ; STOP

INTLEN:  .WORD 0
BIGNUM:  .BLOCK 0x0010 ; BASICALLY THE REST OF RAM,
                       ; BUT THE COMPILER DOES NOT LIKE BIG NUMBERS
.END

Prints 0.1234567891011121314151617181920..., which is the Champernowne constant in base 10, until the program runs out of memory.
PEP/8 is an interesting language, not just to say that I don't think it's ever been used on codegolf before. It's an assembly language used for teaching students the basics. It contains only low-level word operation, lacking even multiplication. I implemented a big num, containing only print and increment functionality, and let it feed on all of RAM. Pep8 limits itself to 64K, for all of it's code, heap, stack, and 'OS'. I can fit up to 10K in a single Word without having to do any conversion to base 10. Addresses past 0XFC50 (in the OS section) are not writeable, though this seems to be undocumented behavior.
For the number of digits, there are 9 1-length digits, 90 2-length, 900 3-length, meaning if you output digits of up to length N, you output is approx (10^N)/9 + N(10^N) digits total.

Mathematica - 1,139,793 digits
MemoryConstrained[x=0;While[True,WriteString[$Output, ++x]],2^16]

Prints the Champernowne constant, until the program reaches 64K of memory usage. Instead of any theory, I just ran it, and piped it to a file.
Mathematica has some quirks, the first I noticed is that I could not verify
Dr. belisarius's 17684 digit output. So I'll assume that Mathematica has some sort of system-dependence. The other quirk I noticed is that byte sizes take large steps.
MaxMemoryUsed[N[Sqrt[2], 17118]]

Takes 7600 bytes, and
MaxMemoryUsed[N[Sqrt[2], 17119]]

Takes 66696 bytes.

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


text:
Encode as many ASCII characters as possible in a single tweet
Yet another compression challenge... but it could still be interesting...

Rules

Write a program that reads a string of printable ASCII characters, and outputs that string (or most of it) compressed in a tweet-sized message.
Write a program that reads the encoded message and outputs the original message (or most of it)
External libraries are allowed, internet connection isn't allowed.

Judging

80 pts: properly encode/decode 400 printable ASCII characters
(since 400 ASCII characters == 2,800 bits == 140 UTF-16 characters)
+20 pts: properly handle end-of-string when the input is different than 400 chars
(encoder's input === decoder's output)
+20 pts: code golfing.
(20pts for the one who does the shortest code that is worth 100pts)
+infinity pts: properly encode/decode more than 400 printable ASCII characters (+1 point for each char encoded over 400)

Tests
Here are 400 random chars for the 100 pts challenge:
)!"k-;~|L?=`j'*VBcZ;$'LbRv?:8n.[fc2'"d.Qa>$Sv*)K2Ukq(Xh^9MJ>WeeKVy:FP}^9octSYSxHx%uqpM%51dAVUl$x5S4hG[\2(SN3'BGEt9(`|\jo >xd'k]F6wf"4a<SXLiFTR(4c]J$,uy;N9*f\c19Ww<~|WYY;vR<:#@86JhPRSg$9:wnVPpB\f3uvGWXDa>O%qcXo=q^%#e|9+j''6Rk=i&N5]U]zbvLDu%pz,=A}qZ+T^s/1V,_$-INH).BB].:GPQGwUe({oDT&h\Dk\L$d-T_,.#A4x nPY(zYgU&[W)T~hvta_n4,vCvBDl|KWUlUdqvNB_;#6b35$<g|f[%z(pgICW*E!?@xAS/Q^\@`#bm~fA1n@sbrR~uAUcw!9x:u/PN

Here are 10,000 random chars for the infinity points challenge:
EiAJ}%15Wl5#yc&xD38}>aU6B6zl@XB||'VS@AN<Q=h1OpeiTXTC"1Tx>WH?kG9Jl(%JN'?tXtjZiNS}vmpR+Qg7R2E4e4GiN'BXc9cKRDWUJW-.UeZ/Cd{=O7L<s\ ;7w?6|XmC*5M@ Tm(kdv}^\tm:NlQYfSl&a`Nw y;M\Jy~0I3iGJXbfJW*P{I\{.^/OY,\'} Kx#S-1V<P7)3L&rVV,p=s8\?Ni(qFM[t%o qId;%C}j6QHY2kj`'Kb6k}; 3jeROHj:P.r2S?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E|:=F]zTEG)bvICQ{lfI[p9:2hQD*<!^4"qQU7P7B1)i/u$*{v:{lH&C<!i3{;}yK_#qyZxeDgyE#hc<wSy3gd0!O'x<!{gTB:}P-!Kf@bEBZs[X>.+^x+wS;w!?!OJ~]fMH`K?-'1Ur_eK\:G)&>QVy"1eb9Ie?]UF17J<(Vt`2k6,?G=hG6h\T5KkDAwE$eV+|/W3m8$Ai|+E/w.]h*#\8Yi;WX-]*PBo,X'X@64KZ'4u_k~%Uwvrrkbo-g"vb@2gO}"garNwf&,V/!-43,figAwI9"=%jMtTQSBIOA%wI"1/S3sGLT/ExFbG1n(Qx6h4Edk"C+#Mv.{%h"C'[bM}wTw)*G,h\3dX6g!.T=ATKgpBuIh%<KZQ<#pvd9X?"tp6^)mB4Uf"~4\Q/wU0sUEQ!pejIR-irWQ;ul|Tyl}FH pF>1`vms#,Pl[Ex{XKy6$*s

Note that compressions don't work very well on random data. Seems like a stupid challenge for me because encoding random 400 chars into 140 chars is not possible in general.

Can you explain "400 ASCII characters == 2800 bits == 140 UTF-16 characters"? The first equivalence is ok (albeit pessimistic given that the requirement is only to encode printable ASCII), but the second requires that a UTF-16 character be able to store 20 bits. I think you're misunderstanding something about surrogates.

FWIW Twitter counts Unicode codepoints after NFC normalisation. However, if we're talking true Unicode that limits to the defined codepoints, of which there are just short of 2^16.75, so ignoring the overcounting due to normalisation's non-injective nature 140 codepoints is only enough for 356.9 printable ASCII characters.

Assuming @PeterTaylor's analysis is correct, you may want to consider changing every instance of 400 in your post with 356.

@primo, I state that that's an optimistic calculation. The actual calculation would be a lot more complex, so I think that this question needs serious rethinking and am voting to close it.

Hi, thanks for your comments! As far as I know, a tweet can contain 140 UTF-16 characters. An UTF-16 character can be composed of two surrogates. Each surrogate can encode 10 bits of data (http://en.wikipedia.org/wiki/UTF-16)

So: a tweet can contain 140 UTF-16 characters == 280 UTF-16 surrogates == 2800 bits == 400 x 7 bits == 400 plain ASCII characters. I'm sure it works because I implemented it here (in JavaScript): http://jsfiddle.net/BfHD2/1/. That's the easy part of the challenge. The real goal is to use the "printable chars" rule to encode more chars.

You're either underestimating or overestimating, depending on how much of the spec you want to violate. If you'll merrily accept any code point in the theoretical Unicode range, even if it's undefined, and ignoring normalisation, then 140 code points is 2940 bits. If you want to stay strictly inside the Unicode spec and respect Twitter's use of NFC, 140 valid code points is strictly less than 140 * log(110187) / log (2) =~ 2344.9 bits.

Well...  you can ignore my mention of "400 chars" if you disagree with it. (I can change the rules if you want). The idea of the challenge is just to have a valid tweet that can be decoded in as many printable ASCII chars as possible...

If the data is completely random, this is literally impossible.

possible duplicate of Compress programs

@Doorknob: Not really. The input is random ASCII and the output is some kind of UTF-16.

@minitech hmm, in that case, since the OP did not say what the output format should be, this is underspecified and I am voting to close.


text:
Hello World window
Create a window that says hello world inside and nothing else. You can not have any ok or cancel buttons inside. It must be just a plain window that says hello world. I do not care about the contents of the window frame or how the window looks, but inside it must say hello world only.
Example:

Shortest code wins.
EDIT: I am sorry Johannes Kuhn the window has to actually stay there, it may not close right away. I didn't think of this scenario and as such didn't account for this.
EDIT 2: We currently have 3 tied answers (20 characters). Any suggestions of who should be the winner is welcome.

Does the window have to be large enough to display the text when it pops up, or is it okay to require the user to resize the window?

It doesn't have to be large enough to display the text, it just has to be a window, meaning just be this container looking thing that has text and does not close until it is told to.

I can make it as short as Sven's, but with OK and Cancel buttons :(

Looks like there's a Bash answer at 19 now.

Can I do a VB 6 solution with a label with "Hello World"? 0 code solution?

I think this post has reached the point where community decides. Post it, and lets see what the solution itself is. I mean it is impossible to have 0 code I believe since at least Hello World would go in somewhere. Nor am I good at VB to know what exactly you mean.

Do the answers in this answer not qualify?

I think this post has actually reached the point of pointlessness. The challenge was ill-defined enough that some people (whether joking or not) seem to think Hello World can be claimed as an answer for HTML/HTA. Some answers do nothing but output to the console, without actually creating a new window, in certain cases.

@Iszi I value your opinion, just tell me what to change and how then I shall do so. My english sucks, and that causes my ideas to be projected incorrectly, so I am always listening. However at this point I believe that I can't change requirement except not accept any answers that simply show hello world in notepad and expect it to be accepted.

@Quillion I agree that it's really too late to change the requirements. I'm not sure really how to restrict the requirements in a way that prevents the current problems without being overly restrictive/verbose, though.

I suggest adding some circles next time. HTML/Bash will have a hard time to draw them (forbid external images, force the circle to have at least a random width). Real toolkits shouldn't have a big problem with that requirements. And BTW: My echo Hello World answer was a try to exploit the rules. As such, I had do defend it.

Submitted Windows Batch at 18 chars: http://codegolf.stackexchange.com/a/25100/571 This beats the 19 char bash one, but not the debated 16 bash one.

Can the "Hello World" text be the title bar text?

@sergiol no the rule is that inside of the window it should say hello world, title doesn't count

bash 20 19 chars
Thanks @manatwork for the useless space after -p!
read -pHello\ World

In action:
echo 'read -pHello\ World' >/tmp/helloworld.sh
chmod +x /tmp/helloworld.sh

Than double click from file manager:

And see:

Having bash as default shell.
19 16
As question stand for only Hello World and Nothing else, the window have to stay but nothing like print text only once or so on, I think this match requirement too!
yes Hello\ World

There is only 16 chars.
echo >/tmp/helloworld.sh 'yes Hello\ World'

With same procedure this give:

The space after -p seems to be optional. By the way, which file manager are you using?

Seems like GNOME to me.

Yes, it's Gnome, but this have to work quite same under KDE, FVvm or else... I don't like this but if answer based on powershell or batch under windows, could be accepted, also this have to be accepted too.

@F.Hauri Giving in to the dark side as well, I see?

I think the "choose run in terminal" part should count as, at the very least, 1 byte. Similar to the rules about options passed to interpreters when running some codegolf solution.

Ok, if you add 1 byte, but accept my 16 chars answer ( +1 -> 17 ) ;-)

@Bakuriu Depending on personal usages, you could configure you window manager to not ask and run alway under some shell or terminal of your choice... (I think it's default under MS-Window)

@F.Hauri Yes, you could also create an alias to avoid speciying the options for the interpreter, but this doesn't meant that you aren't simply launching a program, but you are "giving it some help" opening a new window for him. With a complex enough configuration you can solve almost any problem in a few bytes, putting the rest of the programs into "configuration" options.

@Bakuriu like installing HQ9+ interpreter, adding .hq9+ as mime capacity: running HQ9+ in a terminal windows. So the challenge could be dropped to 1 byte. This answer was based on previous answers, using [tag:batch] or [tag:powershell] and running an OS which use this kind of trick by default.

@F.Hauri Ok, now keep the window open please.

@JohannesKuhn Are you crazy! There is no more than 2°C outer! It's too cold!!

Windows Command Prompt, 26
echo Hello World>.hta&.hta

This is awesome. Bonus points for spawning two windows?

@Gusdor What do you mean? I only see one spawned window here.

@Iszi I made the assumption that the batch file was run from desktop, not typed. Whoops!

@Gusdor I think that's why he called it "Windows Command Prompt" instead of "Batch". Otherwise, it'd lose to Johannes' answer anyway.

@Iszi: They’re nearly equivalent, no?

To do it properly in Batch, you'd need to add an @ to the start so the command isn't echoed.

@Iszi: This opens a new window, so it doesn’t matter whether the command is echoed in a different one…

R, 23
plot(1,m="Hello World")

This opens a plot window.

+1. You can shorten sub= into s= thanks to partial matching however.

@plannapus Thanks, good idea! I modified my code.

Sven, this doesn't print "hello world inside and nothing else" :) I was participating in a similar challenge and it had to be done differently, see http://codegolf.stackexchange.com/a/19807/2800

@Tomas This challenge is different. From the question: "I do not care about the contents of the window frame".

Well, but this is not about the frame, but also the text - axis label "index", the numbers etc..

@Tomas I'm not sure. The OP's reaction to my Matlab answer was: "Yeah plot window is fine :) as long as it is window, I do not care".

@Tomas One could also use frame();text(.5,1,"Hello World!") to a window generate with Hello World! only. This is similar to you PNG-related answer.

Dyalog APL (20)
⎕SM←'Hello World'1 1

Picture:

Special characters!?! HAXXX!

HTML (kinda), 17
data:,Hello World

Paste that into your browser's address bar.
Javascript, 25
open("data:,Hello World")

This uses your browser's window.open and a data uri.
A Data URIs's mime-type and charset default to text/plain;charset=US-ASCII when omitted.
Javascript, 19
eval($("s").text())

This one only works when this answer is the top (or accepted) answer and it is run on THIS stackoverflow page (via your JavaScript console). :-)
open("data:,Hello World");

Funny trick. But sadly it depends on the ordering of the posts, which may vary.

Well, it'll work as long as it is the accepted answer (and the Question doesn't have an "")

Lol. I have to upvote for your optimism.

Can you explain how this will work please? I am using chrome and have tried running it on the console, but I get Unexpected token ILLEGAL. Do you have to be top answer for this to work?

Yes, it needs to be the top answer for it to work. OR I could just edit the question itself to include the required <s>open("data:,Hello World");</s> HTML, but that might be cheating a little bit too much. :-p

As for how it works: StackExchange uses jQuery ($). I use jQuery to get all of the <s> elements on the page (I used "" because it was allowed by Markdown and short). Then I use text() to get the first element's text. Finally I use JavaScript's eval to evaluate/execute that string.

Upvote for the first javascript solution.

Powershell, 23
'Hello World'>.hta;.hta

Nice! Beats my "real" solution, and is only 3 characters longer than the shortcut method. Though, it's arguable that this isn't really much better than just using Hello World alone and calling it HTML - since that's almost exactly what you've done. You've just used PowerShell to build and execute it.

Matlab, 30 27 20
title('Hello World')

Are plot windows allowed? It does not have any buttons inside.

Yeah plot window is fine :) as long as it is window, I do not care

figure('name','Hello World') is shorter

@magu_ Good idea. But I suppose it's against the rule "a window that says hello world inside".

@SvenHohenstein Hm, maybe. To say at least something usefull: you don't need the (1) necessarly. Making the code 3 characters smaller.

@magu_ Thanks for the hint! I modified the code accordingly.

You don't actually need figure;

@TorbjørnT. Great idea! Thank you. This is shorter by 7 characters.

Java, 117 chars
import java.awt.*;class C{public static void main(String[]a){new Frame(){{add(new Label("Hello World"));show();}};}}

With formatting:
import java.awt.*;

class C {
    public static void main(String[] a) {
        new Frame() {
            {
                add(new Label("Hello World"));
                show();
            }
        };
    }
}

We can avoid having to explicitly declare a variable by using initializer blocks inside an anonymous subclass of Frame. Interestingly, using awt, it's just as many characters to import java.awt.*; as it is to just fully qualify both classnames.

You can call args whatever you want; a is sufficient.

@daniero thanks for the suggestion, pretty silly of me to miss that :)

s/class/enum/

like @ThomasEding hints replacing the class by enum shaves off one byte

@masterX244 That won't be syntactically correct unless a semicolon is added before the public static... to end the list of enum constants... see http://stackoverflow.com/questions/7318011/is-it-possible-to-create-an-empty-java-enum-type-with-methods. In either case you end up with the same number of characters.

@swilliams the IDE moans about it but javac accepts it (at least in .7 )

Mathematica 29 27 25
With 1 byte saved thanks to CatsAreFluffy.
DialogInput@"hello world"

CreateDialog is shorter.

Thanks. I thought CreateDialog would insert an OK button.

DialogInput is 1 byte shorter

Yes, thanks, and the curly braces are also unnecessary.

Ruby with Shoes, 28
Shoes.app{para'Hello World'}

Result:

Rebol 2, 29
view layout[txt{Hello World}]

Python 2/3, 54 characters
Capitalize the t in tkinter to make it work on Python 2.
__import__("tkinter").Label(text="Hello World").pack()

when I try that i get: AttributeError: Label instance has no attribute 'show'. However __import__("Tkinter").Label(text="Hello World").pack() gives me the desired effect.

@plannapus Actually I had copied a previous version with that error, not the correct one. Thanks.

53 bytes. Doesn't work on tio, but useful for pasting code.

Shell, 32
xmessage -buttons '' Hello World

There is a 1 character shorter way: xterm -e 'read -p Hello\ World'.

Mine would have been way shorter if I didn't have to -buttons '' :(

@Hasturkun I agree, but I had to add get rid of the buttons requirement because javascript would win with their alert or some other shortcut like that, and I felt that it would be too unfair and too plain especially to some other languages.

@Hasturkun, without the no button restriction your xmessage Hello World solution counts only 20 characters, but then Windows cmd would beat you with msg * Hello World of just 17 characters. So be grateful for the restriction. :)

ExtJS (Javascript) 44
new Ext.Window({html:'Hello world',}).show()

new Ext.Window({html:'Hello world',}).show()
<link rel="stylesheet" type="text/css"
  href="http://dev.sencha.com/deploy/dev/resources/css/ext-all.css"/>

Windows Batch, 23
@pause|echo Hello World

Opens a black window that shows Hello World, nothing else.
Now the windows stays open
There are no buttons in the window.

I am terribly sorry but I can not accept this as a correct answer. Yes it will print hello world to the console window. However the said window will have to actually exhibit window properties such that it does not insta close. Sorry that I haven't made that clarification. I  will add it. This can cause python users to just as easily do print "Hello World"

Which would be longer by the way. By the way, now it should again meet the criteria again.

Requirement is: create a window not force window manager to create a window

@F.Hauri Ok, I'll look how to write a window manager. Until someone post that, consider all posts as violation of your requirement.

@F.Hauri Perhaps put it differently: The challenge is to "create a window" not "spawn a shell".

As the op states, it doesn't matter how the window looks. If it is a plot window or a shell window, who cares?

I absolutely agree :) now this is absolutely acceptable because it is a window and it does say hello world :) well done I love it

Just don't force me to draw in that window.

@JohannesKuhn Easy. Just save my PowerShell script as a PS1 file, then execute it from your batch file with PowerShell -Command. Make sure your PowerShell ExecutionPolicy is friendly to unsigned scripts. ;-)

Why are people downvoting this? It is a valid answer and he answered it just fine. My requirement was have a window that says hello world. And I did specify that I do not care what type of window as long as it is a window. And the language written in is shell, so what if it creates a shell window, it is still a window. It is batch property to show up that way.

At least this is currently with R the shortest answer :P

@JohannesKuhn PowerShell can still beat it. Edit coming up.

@F.Hauri I challenge you to find an API that doesn't "force" the window manager to open a window.

@Gusdor Something like PleaseOpenAWindowForMePlease?

@JohannesKuhn Bonus points for an API that sounds needy! Should it have a *.io suffix to be a 'proper' API?

Processing, 23
Based on my answer here: Make a PNG image with "Hello World!" with programming APIs, in the shortest code possible
text("HeΠo World!",9,8);

24 char non-cheating solution:
text("Hello World!",9,9);

AutoHotkey, 26
GUI,Add,Text,,Hello World!

AutoIt v3, 32
ToolTip("Hello World")
Sleep(9^9)

Wouldn't MsgBox(0,"","Hello World") be shorter?  It's 26 characters.

The requirements are to have no Ok or Cancel buttons within the window. The code you suggest has an OK button. :(

Ah balls, I missed that requirement.

HTML, 11
Hello World

Screenshot:

I guess this shouldn't count, but I think it would be interesting to see such an answer here.

I agree it shouldn't count. The same can be accomplished by loading a simple TXT file in the browser.

Your count is off, that's 20 characters.

@Iszi without HTML tags, this is really just getting rendered as a plain text file. I would argue that you can't even call it an html submission without

@Cruncher Google Chrome actually adds an HTML skeleton including a
 which contains the file's contents (you can use Chrome dev tools for verifying this behavior).

@Cruncher Well, maybe if you're using IE6, but in any modern browser, you can omit the  tags, as well as the  and  tags, and the browser will automatically fill out the "skeleton". For example, try
Hello
 in a modern browser, and it will universally render "hello" with a yellow background.

@B1KMusic Of course it will. But because your browser fixes the file you provided, doesn't mean the original was html. The very essence that it has to add all of those tags, is evidence that the original file was NOT HTML.

@Cruncher Ah, and now we get into the subject of syntax vs semantics. The file may not be HTML in a standard-compliant sense, but the end result is HTML. And since this is code golf, the whole point being to find the shortest way to do something in a given language, this answer shouldn't be disqualified for that--it should be disqualified because the window created contains content other than "Hello World". I guess what I'm getting at is: If we're going to enforce standards for HTML, why stop there? Why not enforce that C programmers use int main(void){int i = 1;} instead of main(i){}?

In other words, isn't the file extension .html enough?

@B1KMusic If I put Hello World into a .txt file and openend it in notepad, would we call that a txt submission? That is actually a better fit than this answer. The browser is the program. The browser is doing all the work. Also, all browsers interpret things differently. Could I write a browser than interprets the blank html file as the solution that I want? Then I can submit a 0 char solution for any problem.

@B1KMusic In terms of C. I would argue that it has to work on a standards-compliant compiler. Anything that relies on undefined behaviour should be disqualified. So HTML should have to fit standards as well. You can't depend on undefined behaviour of a browser to do what you want.

@Cruncher (1) If you put HTML into a .txt file, it doesn't render in a browser. Simple as that. What matters is the end result. If you type
Hello
 and the browser prints
Hello
, then it's not HTML. If the browser prints Hello, then it's HTML. Saying that HTML isn't "true code" because "the browser does all the work" is like saying "the OP-code table does all the work" when writing ASM. Why don't we all just pull out our punchcard mainframes and write machine code with switches, then?

@Cruncher (2) This is code-golf, not popularity-contest. Shortness of code matters more than code quality. That's the entire point of the challenge: pushing the boundaries of the language. Why do you think people use, for example, Esoteric languages for these challenges in the first place? Do you think they actually use those language for real world projects?

let us continue this discussion in chat

Factor, 36 code + 23 imports = 59
USING: ui ui.gadgets ; "Hello World"  "" open-window

When this is run inside the listener, the imports will be brought in automatically. You only need them to deploy a standalone executable.

Tcl/Tk, 34
pack [label .l -text Hello\ World]

PowerShell: 162 124 114 or 20

The Long Way Around
($t=($a='New-Object Windows.Forms')+".Label"|iex).Text='Hello World';($x=iex $a".Form").Controls.Add($t);$x.Show()

Since PowerShell really doesn't have any built-in GUI functionality, I'm having a hard time coming up with anything shorter than this which I feel really fits the original spirit of the challenge. (Or, at least, fits within the parameters several of us have assumed were implied.)

Changes from original:

Removed window size definition. Apparently, it's optional and the default is plenty large enough.
Incorporated changes provided by SpellingD in comments. Note: The window which spawns will hang - you'll need to kill PowerShell via Task Manager.

Alternative 20-Character Approach
Removing some assumed-implied requirements, we can also meet this challenge a-la Johannes Kuhn with this:
'Hello World';for(){}

Save as a .ps1 file. Make sure the system's ExecutionPolicy allows unsigned scripts. Right-click and select "Run with PowerShell".

Show instead of ShowDialog should do it, right?

Show() does work, but doesn't let you close the window. Which isn't a requirement!

My edit to golf this was rejected, and my code isn't sufficiently different enough to warrant making a new answer, so here's how you could golf this to 114, I guess. ($t=($a='New-Object Windows.Forms')+".Label"|iex).Text='Hello World';($x=iex $a".Form").Controls.Add($t);$x.Show()

@SpellingD Thanks. I've incorporated your changes to the "true" solution, and also added a "cheap method" which currently beats all contenders. (Except, arguably, HQ9+ of course.)

Ti84-Basic, 25
ClrHome
Disp "HELLO WORLD

Arduino, 27
Serial.print("Hello World")

Place this in void setup()
Game Maker Language, 40
show_message_ext("Hello World","","","")

I'm pretty sure this is the shortest way without adding any extension packages.

If you would accept an OK button, show_message("Hello World") is 27 characters.

Extremely necroing this one, but I have 2 (slight) remarks about your Ti84-Basic one. 1: couldn't you drop the final "? 2: Should you count it in bytes, we have a clear winner here ;)

@Synthetica Yeah. Forgot that :)

Your TI-BASIC answer does not open a window, and it outputs capital rather than lowercase letters.

Processing, 37 chars:
void draw(){text("Hello World",0,9);}

Various things used to reduce strokes:

Sketch window is spawned by default; no need to manually create it
Using draw is shorter than setup (although the text is then redrawn each frame)
Uses default size, background, fill, font, and font size
You don't actually need all 10 pixels  height for the text

C#, 93
u̶s̶i̶n̶g̶ ̶S̶y̶s̶t̶e̶m̶;̶c̶l̶a̶s̶s̶ ̶P̶r̶o̶g̶r̶a̶m̶{̶s̶t̶a̶t̶i̶c̶ ̶v̶o̶i̶d̶ ̶M̶a̶i̶n̶(̶)̶{̶C̶o̶n̶s̶o̶l̶e̶.̶O̶u̶t̶.̶W̶r̶i̶t̶e̶(̶"̶h̶e̶l̶l̶o̶ ̶w̶o̶r̶l̶d̶"̶)̶;̶C̶o̶n̶s̶o̶l̶e̶.̶R̶e̶a̶d̶K̶e̶y̶(̶)̶;̶}̶}̶

If you didn't need the screen to stay open, it'll be 81:
using System;class Program{static void Main(){Console.Out.Write("hello world");}}

As per shaming comment (so obvious, yet overlooked):
using System;class A{static void Main(){Console.Out.Write("hello world");Console.ReadKey();}}

Nice catch :)

I don't know C# much. Can you write using System.Console;? I think that would save you 6 chars

Nope ... tried that :) (I'm not THAT simpleminded :)

Does the class really need to be called Program?

What is Console.Out? This ain't Java.

@NoOneIsHere it's a dark incantation taken from here . beware the demons you might summon when using it

Isn't it just extra bytes?

Console.Write('text').

It's Console.Out.Write vs. Console.Write. Just remove Out..

@NoOneIsHere . Screw head on. Riiight... cause -> type 'out', CTRL+enter, autocompletes Console.Out.Write("stuff here"); . you're right my friend

Bash (36 chars)
xmessage -buttons "" "Hello World!"
Looks like crap, but works as requested.

The rule “inside it must say hello world only” was explicitly added to avoid so simple solutions.

ok, fixed this.

Now it's correct, but there is another problem: it became duplicate of Hasturkun's answer.

Damn, at least i've a screenshot :)

Ghostscript 50
0 0 moveto/Courier 20 selectfont(Hello World)show

Could make it 49 by using a 9-point font, but it's a little hard to read.
Can make a smaller window by invoking gs with a geometry argument for an additional 8 chars.
gs -g200x30 hello.ps

C#, 72
class P{static int Main(){System.Console.Write("hello world");for(;;);}}

Based on the answer by @Noctis. I would have suggested it as a comment if I had enough Rep.

Delphi - 73 62
uses Dialogs;begin MessageDlg('Hello World',mtCustom,[],0)end.

Edit after @manatwork and @Gareth 's suggestions. Which actually brings me to a character count of 62.

How you get that character count? The code you posted has 77 characters and the minimum to which it can me reduced is 64: uses Dialogs;begin MessageDlg('Hello World',mtCustom,[],0)end.

You need to count newlines as part of your character count. That's why many answers on this site are all on one line.

Ah, I didn't know that. I'll edit my answer.

Groovy, 68 27
Using console.
print"Hello World";for(;;);

Using Frame.
new java.awt.Frame(){{add new java.awt.Label("Hello World")}}.show()

Inspired by @swilliams Java answer.

Shell script: 56 character
convert -size 99x9 xc: -draw 'text 0,10 Hello\ World' x:

Sample output:

Quomplex, 11
Hello World

When no output (*) is defined, Quomplex outputs the program's source code.

@tac Try the web archive http://web.archive.org/web/20140625132327/http://timtechsoftware.com/?page_id=1264 I've updated the post with this link as well.

Windows batch file, 18
@set/p=Hello World

Save as a batch file, and run by double clicking. Looks just how you'd expect.

FLTK, 57 characters
Function{}{}{Fl_Window{}{}{Fl_Box{}{label{Hello World}}}}

Ungolfed:
Function {} {} {
    Fl_Window {} {} {
        Fl_Box {} {
            label {Hello World}
        }
    }
}

Sample output:

APLX, 44
'A' ⎕WI 'New' 'Document' 'text' 'Hello World'

You could probably get it down from there.

Java - 157
using DrawString
Ungolfed:
import java.awt.*;
class A extends Frame {
    public static void main(String[]a){
        new A().show();
    }
    public void paint(Graphics g)
    {
        g.drawString("Hello World",9,50);
    }
}

Golfed:
import java.awt.*;class A extends Frame{public static void main(String[]a){new A().show();}public void paint(Graphics g){g.drawString("Hello World",9,50);}}

You could save a character by changing the 50 to 9, although that would make it non-centered.

@AJMansfield Obviously I've tried that. The problem is not centring but that you actually cannot see it at all no matter how much you resize the window. 0, 0 lives at the very top left of the window, not top left of the content (which is asinine). I suppose if your OS has no title bar on the window then I can save a char.

JavaScript, 32
open('javascript:"Hello World"')

Groovy, 77
import javax.swing.*
f=new JFrame()
f.add(new JLabel("Hello World"))
f.show()

Note: the window will be super tiny and you'll need to resize it to view the text.

Why don't you resize the window after it is produced, and then add the picture of it to your posting?

import java.awt.*; and f=new Frame() and new Label I think can trim this quite a bit

Python: 20 characters
input("Hello World")

Technically would be correct right? If you save it to a script and don't call it from a shell.
Meh, I think the best python solution has been given already.

C# 87
Ungolfed:
using s = System.Console;
class C
{
    static void Main()
    {
        s.Write("Hello World");
        s.Read();
    }
}

Golfed:
using s = System.Console;class C{static void Main(){s.Write("Hello World");s.Read();}}

Window will stay open until user inputs a carriage return

you can write using s=System.Console; to save 2 bytes (I think, I'm not a C# programmer lol)

C+xcb+Cairo 2540 (82 lines)
Not exactly short. :) This is literally the PNG hello world from the Cairo docs, with just enough xcb to open a window and find the parameters needed to register the window with Cairo.
//xcr.c
//cc -o xcr $(pkg-config --cflags --libs cairo xcb xcb-icccm) xcr.c -lcairo -lxcb -lxcb-icccm
#include <stdlib.h>
#include <string.h>
#include <cairo.h>
#include <cairo-xcb.h>
#include <xcb/xcb.h>
#include <xcb/xcb_image.h>
#include <xcb/xcb_aux.h>
#include <xcb/xcb_icccm.h>

int main (int argc, char *argv[])
{
    int width = 300, height = 400;
    int scrno;
    xcb_screen_t *scr;
    xcb_connection_t *connection;
    xcb_screen_iterator_t iter;
    xcb_drawable_t win;
    unsigned int white;
    xcb_visualtype_t *visual_type;
    xcb_depth_iterator_t depth_iter;

    connection = xcb_connect(NULL,&scrno);
    iter = xcb_setup_roots_iterator(xcb_get_setup(connection));
    for (; iter.rem; --scrno, xcb_screen_next(&iter))
        if (scrno == 0)
        {
            scr = iter.data;
            break;
        }
    win = xcb_generate_id(connection);
    white = scr->white_pixel;
    xcb_create_window(connection, XCB_COPY_FROM_PARENT,
            win, scr->root,
            0, 0,
            width, height,
            5,
            XCB_WINDOW_CLASS_INPUT_OUTPUT,
            scr->root_visual,
            XCB_CW_BACK_PIXEL,
            &white);
    xcb_icccm_set_wm_name(connection, win, XCB_ATOM_STRING, 8, strlen("xcr"), "xcr");
    xcb_map_window(connection, win);
    xcb_flush(connection);

    depth_iter = xcb_screen_allowed_depths_iterator(scr);
    for (; depth_iter.rem; xcb_depth_next(&depth_iter)) {
        xcb_visualtype_iterator_t visual_iter;

        visual_iter = xcb_depth_visuals_iterator(depth_iter.data);
        for (; visual_iter.rem; xcb_visualtype_next(&visual_iter)) {
            if (scr->root_visual == visual_iter.data->visual_id) {
                visual_type = visual_iter.data;
                goto visual_found;
            }
        }
    }
visual_found: ;

    {
        cairo_surface_t *surface =
            cairo_xcb_surface_create (connection, win, visual_type, width, height);
        cairo_t *cr = cairo_create (surface);

        cairo_select_font_face (cr, "serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
        cairo_set_font_size (cr, 32.0);
        cairo_set_source_rgb (cr, 0.0, 0.0, 1.0);
        cairo_move_to (cr, 10.0, 50.0);
        cairo_show_text (cr, "Hello, world");

        cairo_surface_flush(surface);
        xcb_flush(connection);

        sleep(100);

        cairo_destroy (cr);
        //cairo_surface_write_to_png (surface, "hello.png");
        cairo_surface_destroy (surface);
    }

    xcb_disconnect(connection);
    return 0;
}

PureBasic
Console Window - 42 bytes
OpenConsole()
Print("Hello World")
Input()

If console windows are not allowed, and actual GUI windows are required:
GUI Window - 96 bytes
OpenWindow(0,0,0,99,99,"")
TextGadget(0,0,0,99,99,"Hello World")
While WindowEvent()<>13116:Wend

Windows command shell, 24 characters
Runs as is from command line or by saving to .cmd or .bat file.
start echo "Hello World"

Lua + LÖVE: 57 characters
function love.draw()love.graphics.print("Hello World")end

Sample run:
bash-4.3$ ls -l
total 4
-rw-rw-r-- 1 manatwork manatwork 57 Aug  2 13:16 main.lua

bash-4.3$ love .

Sample output:

HTML Application, 11
Hello World

Save the file as something.hta and run it. Unlike HTML viewed in a browser, an HTML Application does not add any extra chrome (e.g. adress bar) to the window.

I'd say this is about as valid as the "HTML" answer with the same code.

I know it feels that way, so I had to disguise it in my powershell and command prompt answers :) But seriously, this does what it's supposed to do, only in HTA you do the GUI in HTML, just like you'd use XAML in a WPF application. It just happens that in HTML you don't need print, echo, or quotation marks to output a string. I wonder if it would be "more valid" if I wrote .


text:
Doing shorter comparisons in PowerShell
One of the annoying bits about PowerShell, which helps amplify its disadvantage against other languages in code-golf, is that there are no symbolic comparison or logical operators.
A comparison that could be as short as this:
$x<10&&$x>5

Has to be:
$x-lt10-and$x-gt5

This bloats the code for even the simplest of comparisons by about 50% compared to many other regular scripting and programming languages, never mind any golfing languages. Even an Excel formula for a similar comparison comes up shorter by one character!
=AND(A1<10,A1>5)

Another one that really bugs me:
$x==$k&&$i>9&&$i%10!=0

Has to be:
$x-eq$k-and$i-gt9-and$i%10-ne0

Interestingly, this one's exactly as long as the comparable formula for Excel, but that's mainly due to Excel's lack of a symbolic modulus operator.
=AND(A1=B1,C1>9,MOD(C1,10)<>0)

Is there a way this can be shortened at all, or is this strictly a limitation of the language? Are there any particular scenarios to keep in mind where shortcuts can be used for joining multiple comparisons?

Use GNU/Linux's [tag:bash] instead! : (( 5 < x && x < 10)) ;-)

"Use GNU/Linux's bash instead!" - flag as offensive. ;)  (those symbols are file IO redirection and PowerShell designers didn't want to overload them anymore. It also makes all the comparators take the same format -comparator instead of having a mix like < > == -contains -in -match)

I found a semi-edge case where a multiple comparison can be shortened. This is useful when you need to test two or more variables for equality, and only return true if all tests are true.
Instead of this:
$a-eq$b-and$c-eq$d

You might be able to do this:
"$a$c"-eq"$b$d"

It's worked for me in a Pisano Period script, where I changed:
$a-eq1-and$b-eq0

To:
"$a$b"-eq10

Another example:
$a-eq'apple'-and$b-eq'orange'

Can be cut down to:
"$a$b"-eq'appleorange'

You can also use the integer-to-boolean conversion trick mentioned by Danko to check prime numbers for inequality against other prime numbers. This could also work for composite numbers, provided that none of the numbers involved are evenly divisible by any of the others.
Example:
$x-ne$y-and$x-ne$z

Can be shortened to:
$x%$y-and$x%$z

Because non-zero integers are handled as True in PowerShell, any prime numbers will return True for $x%$y if they are different and False if they are the same.

Note that [int]$x is 0(i.e. false) for all $x in the interval [-0.5, 0.5], and not 0(i.e. true) for all $x outside of the interval ([int] rounds the number).
So, to check $x -lt $m -or $x -lt $n - you can use the following:
[int]( $a * $x + $b )

where $a = 1 / ( $n - $m ) and $b = ( $m + $n ) / ( 2 * ( $m - $n ) )
For example, to check that $x is not between 3 and 5, you have $a = 1 / 2 and $b = -2 so:
[int]($x/2-2)

which is two characters shorter than
$x-lt3-or$x-gt5

To reverse the condition (i.e. to check that $x is between 3 and 5), you could:
![int]($x/2-2)

which is still shorter than
$x-ge3-and$x-le5

It may not always be possible to get a short expression - it depends, of course, on what you get for $a and $b. However, if $m = -$n then $b=0, so the expression becomes rather trivial, e.g. to check that a number is between -3 and 3 you can simply:
![int]($x/6)

Another possibility to consider is "1"[$x] which evaluates to "1" (i.e. true) if $x is rounded to -1 or 0, and "nothing" (i.e. false) otherwise. So, the expression will be true for all $x in the interval (-1.5, 0.5]. Note that -1.5 is not included in the interval, as [int]-1.5 = -2.
With this method you can shorten an expression such as $x -gt $m -and $x -le $n into:
"1"[ $a * $x + $b ]

If you do the math as above, you get: $a=-2/($m-$n) and $b=($m+3*$n)/(2*$m-2*$n).
So, for example:
$x-gt3-and$x-le5

becomes:
"1"[$x-4.5]