PHP Center
http://phpcenter.eu/
Foorumi teema printimine


Foorumid Programmeerimine PHP & MySQL Ülesanded Konkurss: Hello, world
Autor Postitus
muidumeez
Ignorantia non est
argumentum

Postitusi: 3864
Tase: Administraator
Olek: Offline

27.01.2006 23:12:39
Konkurss: Hello, world

Nonii, raffas.

Et siis vahepeal ka natuke asja. Teatud tegelastega (fax, andoro) sattusin MSN-is jutlema ja mõtlesin välja, et vahetevahel võiks teha pisikese konkursi, aga mitte tavalise konkursi.

Konkursi sisuks on kirjutada programm, mis kuvab brauseri aknas teksti Hello World!.

Aga ... Konkursi võidab see, kes suudab selle kõige jaburamalt üles ehitada.

Lisatingimused:
1) PHP versioon ei ole määrav, okei, PHP3-s ei pea töötama
2) Programm peaks töötama nii, et tehes copy-paste, saab selle kohe oma masinas tööle ajada.

Muid tingimusi ei näe (esialgu). Oma šedöövrid võite postitada loomulikult siia, hiljem siis saab neid hinnata ka.

Mõned samasuguse tegevuse kohta lingid ka:

http://www.infiltec.com/j-h-wrld.htm
http://www.roesler-ac.de/wolfram/hello.htm

laurik
_/<

Postitusi: 847
Tase: 8
Olek: Offline

28.01.2006 06:55:59
RE: Konkurss: Hello, world

Tere ka minupoolt siis :P
PHP kood:


<?php

$url 
array(
    
'/'    => 'tere'
);

$jura = new jura($url);
$jura->annatuld();


class 
jura {
    var 
$urls;
    var 
$param;

    function 
jura($urls) {
        
$this->urls = (array)array_reverse($urls);
        if(isset(
$_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
            
$this->param $_SERVER['QUERY_STRING'];
        } else {
            
$this->param '/';
        }
    }

    function 
annatuld() {
        foreach(
$this->urls as $muster=>$tegu)
        {
            
$muserdis '|^'.($muster).'$|';
            if(
preg_match($muserdis$this->param$para))
            {
                
$this->kyta($tegu$para);
                return;
            }
        }
        
$this->_k6nge('i really dont know what to do :C');
    }

    function 
kyta($class$params) {
        if (
class_exists($class)) {
            
$myclass = new $class;
            
$method strtolower($_SERVER['REQUEST_METHOD']);
            
$methods get_class_methods(get_class($myclass));

            if(
in_array($method$methods))
                
$myclass->$method($params);
            else
                
$this->_k6nge('executing of '.$method.' failed''method not found');
        } else {
            
$this->_k6nge('initialization of *'.$class.'* failed!''class not found');
        }
    }

    function 
_k6nge($text$title="error") {
        
$html "<html><head><title>$title</title></head><body>
    <h1>$title</h1> <h3>$text</h3></body></html>"
;
        exit(
$html);
    }
}

class 
tere {
    function 
get() {
        
$kama array(257,85,114,121,121,98,32,74,98,101,121,113,33);
        
$tere array();
        while(
$m2rk next($kama)) {
            
$tere[] = chr($m2rk);
        }
            
        echo 
str_rot13(join(''$tere));
    }
}

?>



e:
tingmuslause mitmele reale..
e2:
semikoolon..
e3:
siin üks cli skript :X
http://www.phppatterns.com/docs/design/hello_world_in_patterns
e4:
heredoc stringi kopeerides-kleepides asi ei töötanud.. asendasin tavaliste jutumärkidega

q2boy
OOP!

Postitusi: 400
Tase: 6
Olek: Offline

28.01.2006 12:24:30
RE: Konkurss: Hello, world

Sain oma koodi ka valmis. Võibolla ei ole nii jabur nagu lauriku oma, aga noh ikkagi.

PHP kood:

<?php
error_reporting
(E_ALL);

$alpha_low 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk';
$alpha_big 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJK';

$echo_txt 'B8|L5|L12|L12|L15|SPACE|B23|L15|L18|L12|L4|!';

$echo_ex explode('|'$echo_txt);

$text array();

foreach(
$echo_ex as $key => $val)
{

    if(
$val != 'SPACE' and $val != '!')
    {
        
$sub $val{0};

        if(
$sub == 'B')
        {
            
$exploud explode('B'$val);
            
$text[] = $alpha_big{$exploud['1']-1};
        }
        if(
$sub == 'L')
        {
            
$exploud explode('L'$val);
            
$text[] = $alpha_low{$exploud['1']-1};
        }
    }
    else
    {
        if(
$val == 'SPACE')
        {
            
$text[] = ' ';
        }
        if(
$val == '!')
        {
            
$text[] = '!';
        }
    }
}

$t_count count($text);

for(
$i 0;$i <= $t_count-1$i++)
{
    echo 
$text[$i];
}

?>



Näide!

monte

Postitusi: 11
Tase: 2
Olek: Offline

29.01.2006 00:49:57
RE: Konkurss: Hello, world

irwwwwwwww - vat see on andekas idee :p  katsun ka midagi valmis kribada. kusjuures - vastused sellele teemale näitavad iga vastanud programeerija mentaliteeti ja suhtumist ja maalimavaadet . kirjutada jaburalt "hello world" - that's a REAL CHALLENGE ....

laurik
_/<

Postitusi: 847
Tase: 8
Olek: Offline

29.01.2006 03:41:30
RE: Konkurss: Hello, world

PHP kood:

<?php
    $h 
gethostbyaddr('216.92.108.222');
    
$e split('-'$h);
    
$l array_map('ucfirst'$e);
    
$l join(' '$l);
    for(
$o=0;$o<strlen($l);$o++)
    {
        if(
ord($l{$o}) != 46)
        {
            echo 
$l{$o};
        }
        else
        {
            echo 
'!';
            break;
        }
    }
?>



Nota bene: script vajab töötamiseks toimivat internetiühendust

fax
Upsakas kontoritarve

Postitusi: 1195
Tase: 9
Olek: Offline

29.01.2006 21:12:10
RE: Konkurss: Hello, world

Midagi matemaatika huvilistele ;)
PHP kood:

<?php

++$dataptr;
$dataset[$dataptr] += 9;

while(
$dataset[$dataptr]) {
    --
$dataptr;
    
$dataset[$dataptr] += 8;
    ++
$dataptr;
    --
$dataset[$dataptr];
}

--
$dataptr;
$out chr($dataset[$dataptr]);

++
$dataptr;
$dataset[$dataptr] += 7;

while(
$dataset[$dataptr]) {
    --
$dataptr;
    
$dataset[$dataptr] += 4;
    ++
$dataptr;
    --
$dataset[$dataptr];
}

--
$dataptr;
++
$dataset[$dataptr];
$out .= chr($dataset[$dataptr]);

$dataset[$dataptr] += 7;
$out .= chr($dataset[$dataptr]);

$out .= chr($dataset[$dataptr]);

$dataset[$dataptr] += 3;
$out .= chr($dataset[$dataptr]);

$dataset[$dataptr] = 0;
++
$dataptr;
$dataset[$dataptr] += 8;

while(
$dataset[$dataptr]) {
    --
$dataptr;
    
$dataset[$dataptr] += 4;
    ++
$dataptr;
    --
$dataset[$dataptr];
}

--
$dataptr;
$out .= chr($dataset[$dataptr]);

++
$dataptr;
$dataset[$dataptr] += 11;

while(
$dataset[$dataptr]) {
    --
$dataptr;
    
$dataset[$dataptr] += 8;
    ++
$dataptr;
    --
$dataset[$dataptr];
}

--
$dataptr;
--
$dataset[$dataptr];
$out .= chr($dataset[$dataptr]);

$dataset[$dataptr] -= 8;
$out .= chr($dataset[$dataptr]);

$dataset[$dataptr] += 3;
$out .= chr($dataset[$dataptr]);

$dataset[$dataptr] -= 6;
$out .= chr($dataset[$dataptr]);

$dataset[$dataptr] -= 8;
$out .= chr($dataset[$dataptr]);

$dataset[$dataptr] = 0;
++
$dataptr;
$dataset[$dataptr] += 8;

while(
$dataset[$dataptr]) {
    --
$dataptr;
    
$dataset[$dataptr] += 4;
    ++
$dataptr;
    --
$dataset[$dataptr];
}

--
$dataptr;
++
$dataset[$dataptr];
$out .= chr($dataset[$dataptr]);

$dataset[$dataptr] = 10;
$out .= chr($dataset[$dataptr]);

print(
$out);

?>



siku
tavaline rott

Postitusi: 612
Tase: 7
Olek: Offline

30.01.2006 09:00:16
RE: Konkurss: Hello, world

Lisan ka enda lolluse siis siia:)
PHP kood:


<?
class 
t2hed
{
    var 
$t2hekesed;
    
    function 
t2hed()
    {
        for(
$i=0;$i<=256;$i++)
        {
            
$this->t2hekesed[]=chr($i);
        }
    }
    
    function 
t2ht_olemas($t2ht)
    {
        return 
in_array($t2ht,$this->t2hekesed);
    }
    
    function 
kuva_t2ht($t2ht)
    {
        echo(
$t2ht);
    }
}

class 
say_something
{
    var 
$t2hemasin;
    var 
$lause;
    
    function 
say_something($lause)
    {
        
$this->t2hemasin=new t2hed();
        
$this->lause=$lause;
        
$this->say();
    }
    
    function 
say_word($word)
    {
        
$wordlenght=strlen($word);
        for(
$i=0;$i<=$wordlenght;$i++)
        {
            if(
$this->t2hemasin->t2ht_olemas($word{$i}))
            {
                
$this->t2hemasin->kuva_t2ht($word{$i});
            }
        }
    }
    
    function 
say()
    {
        
$words=explode(" ",$this->lause);
        foreach(
$words as $word)
        {
            
$this->say_word($word);
        }
    }
}

$misasja=new say_something("Hello World!");
?>        



mosse
PHP süsteeme orjame

Postitusi: 116
Tase: 5
Olek: Offline

31.01.2006 17:34:09
RE: Konkurss: Hello, world

Teen siis suht mõttetu lähenemise :P
Ühesõnaga, pole õeldud et asi peab olema pikk... lühike ja loll võib ka olla :D

PHP kood:


//set.ini FAILI SISU ALGUS\\
;
Hello World
;
[
string]
my_word 'Hello, World!'
//set.ini FAILI SISU LÕPP\\

#INI fail
$ini 'set.ini';

#Vaatame kas teksti fail on olemas, kui ei siis väljastame veateate
if (!file_exists($ini)) die('<h1>Ei leitud seadete '.$ini.' faili<h1>');

#Teeme seaded loetavaks
extract(parse_ini_file($iniTRUE));

#Väljastame
echo $string['my_word'];



mosse
PHP süsteeme orjame

Postitusi: 116
Tase: 5
Olek: Offline

31.01.2006 21:33:30
RE: Konkurss: Hello, world

Tegin siis ühe veel, lähtudes date() funkstioonist :P

PHP kood:

<?php

class hello_world {
    var 
$str;

    function 
hello_world()
    {
        
$this->add_to_string($this->get("H"));
        
$this->add_to_string($this->get("E"));
        
$this->add_to_string($this->get("L"));
        
$this->add_to_string($this->get("L"));
        
$this->add_to_string($this->get("O"));
        
$this->add_to_string($this->get("W"));
        
$this->add_to_string($this->get("O"));
        
$this->add_to_string($this->get("R"));
        
$this->add_to_string($this->get("L"));
        
$this->add_to_string($this->get("D"));
        print(
$this->order_word($this->str));
    }
    
    function 
add_to_string($value)
    {
        
$this->str.=$value;
        return 
TRUE;
    }
    
    function 
get($letter)
    {
        
$start 1138734770;
        
$finish 1203016370;
        while(
$start $finish) {
            
$name '0'.strtolower(date('l',$start));
            
$pos strpos(strtolower($name), strtolower($letter));
            if(
$pos==TRUE) {
                return 
$name{$pos};
                
$start $start 2;
            } else {
                
$name date('F',$start);
                
$pos strpos(strtolower($name), strtolower($letter));
                if(
$pos==TRUE) {
                    return 
$name{$pos};
                    
$start $start 2;
                }
            }
            
$start $start 86400;
        }
    }
    
    function 
order_word($str
    {
        
$str strtoupper($str);
        
$len strlen($str);
        
$val1 substr($str,0,$len/2);
        
$val2 substr($str,$len/2,$len/2);
        return 
$val1.', '.$val2.'!';
    }
}    

$hello_world = new hello_world;

?>



xsvenson
Nonoh, mis toimub?

Postitusi: 204
Tase: 5
Olek: Offline

02.02.2006 13:32:04
RE: Konkurss: Hello, world

minu nägemus asjast
näide on siin -> http://www.planc.ee/m1sterx/stuff.php
kõige paremini vaadeldav IE või operaga
ja olen täheldanud probleeme opera ja FF'i töös antud scriptiga

kood ise selline

edit: tahaks ära märkida, et borowse'rite erinevuse ja kasutuses oleva serveri tehniliste võimaluste tõttu võib antud script jätta "pooliku" või "katkise" mulje... Samas kui seda refreshida siis mingi versioon võiks/peaks ka korralik olema

PHP kood:


<html>
<
script language="javascript" type="text/javascript">
var 
up;
var 
counter =0;
var 
speed 40;
var 
running 0;
var 
stop_count 45;
function 
startApp() 
{
    
//document.getElementById("debug").innerHTML="startApp called";
    
counter 0;
    if(
running == 0)
    {
        
UpRepeat(); 
        
running 1;
    }
}
function 
stopApp()
{
    
running 0;
    
clearTimeout(up);
    
//document.getElementById("debug").innerHTML="timeout done";    
}
function 
UpRepeat() 
{
    
//document.getElementById("counter").value=counter;
    
callServer();
    
up=setTimeout("UpRepeat()",speed);
    
counter++;
}

var 
xmlHttp false;
    try 
    {
        
xmlHttp = new XMLHttpRequest();
    }
    catch (
trymicrosoft
    {
        try 
        {
            
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        } 
        catch (
othermicrosoft
        {
            try 
            {
                
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            } 
            catch (
failed
            {
                
xmlHttp false;
            }
        }
    }
    
    if (!
xmlHttp)
    {
        
alert("Error initializing XMLHttpRequest!: " failed);
    }
    
function 
callServer() 
{
    var 
url "ajax_backend.php?id="+counter;
    
xmlHttp.open("GET"urltrue);
    
xmlHttp.onreadystatechange updatePage;
    
xmlHttp.send(null);
}

function 
updatePage()
{
    
    var 
response xmlHttp.responseText;
    if (
xmlHttp.readyState == 4
    {
        if(
xmlHttp.status == "200")
        {
            
str response.split("|");
            if(
str[0]=="x")
            {
                
stopApp();
                return;
            }
            
//document.getElementById("news").innerHTML = "x="+str[0]+";y="+str[1]+";dx="+str[2]+";dy="+str[3];
            
document.getElementById("div"+counter).style.left=str[0]+"px";
            
document.getElementById("div"+counter).style.top=str[1]+"px";
            
document.getElementById("div"+counter).style.width=str[2]+"px";
            
document.getElementById("div"+counter).style.height=str[3]+"px";
        }
        else
        {
            
alert("error: " +xmlHttp.statusText);
        }
        
    }
}
</script>
<style>
.div {overflow:hidden;position:absolute;background-color:black;width:1px;height:1px;border:1px solid black;}
</style>
<body onload="javascript:startApp();">
<!--<input type="button" value="display" onclick="javascript:startApp();">-->
<!--<input type="button" value="stop" onclick="javascript:stopApp();">-->
<br><span id="debug"></span>
<br><span id="news"></span>
<!--<br><input type="text" id="counter"></span>-->
<?php

for($i =0$i<305$i++)
{
    echo 
'<div id="div'.$i.'" class="div"></div>';
}
?>
</body>
</html>


PHP kood:


<?php
class Ajax
{
    var 
$coords array();
    function 
addElement($x,$y,$dx=1,$dy=1)
    {
        
$element array("x"=>$x,"y"=>$y,"dx"=>$dx,"dy"=>$dy);
        
$this->coords[]=$element;
    }
    
    function 
get($id)
    {
        if(
$id>= count($this->coords))
        {
            return 
"x|x|x|x";
        }
        return 
implode("|",$this->coords[$id]);
    }
}


ning
(to be continued ....)

xsvenson
Nonoh, mis toimub?

Postitusi: 204
Tase: 5
Olek: Offline

02.02.2006 13:35:15
RE: Konkurss: Hello, world

PHP kood:


$myStuff = new Ajax();

$myStuff->addElement(60,114,2,3);
$myStuff->addElement(59,111,2,3);
$myStuff->addElement(59,114,1,2);
$myStuff->addElement(60,110);
$myStuff->addElement(61,109);
$myStuff->addElement(62,108);
$myStuff->addElement(63,107,3,1);
$myStuff->addElement(66,106,9,1);
$myStuff->addElement(70,107,4,4);
$myStuff->addElement(69,111,4,3);
$myStuff->addElement(69,110);
$myStuff->addElement(68,114,4,4);
$myStuff->addElement(67,118,4,4);
$myStuff->addElement(66,122,4,3);
$myStuff->addElement(65,125,4,3);
$myStuff->addElement(64,128,4,2);
$myStuff->addElement(55,132,3,2);
$myStuff->addElement(56,134,6,1);
$myStuff->addElement(58,133,1,1);
$myStuff->addElement(61,133,3,1);
$myStuff->addElement(62,132,3,1);
$myStuff->addElement(63,131,3,1);
$myStuff->addElement(64,130,3,1);
$myStuff->addElement(81,133,4,1);
$myStuff->addElement(77,130,4,4);
$myStuff->addElement(78,127,4,3);
$myStuff->addElement(79,123,4,3);
$myStuff->addElement(79,126,3,1);
$myStuff->addElement(80,120,4,2);
$myStuff->addElement(80,122,3,1);
$myStuff->addElement(81,116,3,4);
$myStuff->addElement(79,117,2,2);
$myStuff->addElement(71,118,3,2);
$myStuff->addElement(74,118,5,1);
$myStuff->addElement(94,104,3,3);
$myStuff->addElement(88,104,6,1);
$myStuff->addElement(90,103,5,1);
$myStuff->addElement(93,105);
$myStuff->addElement(84,108,1,10);
$myStuff->addElement(82,113,2,3);
$myStuff->addElement(85,107,1,8);
$myStuff->addElement(86,106,1,6);
$myStuff->addElement(87,105,1,4);
$myStuff->addElement(88,105,1,2);
$myStuff->addElement(89,105,1,1);
$myStuff->addElement(83,11,1,2);

$myStuff->addElement(96,124,2,1);
$myStuff->addElement(98,123,3,1);
$myStuff->addElement(99,122,3,1);
$myStuff->addElement(100,121,4,1);
$myStuff->addElement(101,120,4,1);
$myStuff->addElement(102,114,3,6);
$myStuff->addElement(105,115,1,4);
$myStuff->addElement(101,116);
$myStuff->addElement(100,114,2,2);
$myStuff->addElement(98,115,2,1);
$myStuff->addElement(97,116,2,1);
$myStuff->addElement(96,117,2,1);
$myStuff->addElement(95,118,2,1);
$myStuff->addElement(94,119,3,2);
$myStuff->addElement(93,121,3,2);
$myStuff->addElement(92,123,4,2);
$myStuff->addElement(91,125,5,1);
$myStuff->addElement(91,126,4,4);
$myStuff->addElement(91,130,5,2);
$myStuff->addElement(92,132);
$myStuff->addElement(93,132,4,2);
$myStuff->addElement(96,131);
$myStuff->addElement(97,131,2,2);
$myStuff->addElement(99,130,2,2);
$myStuff->addElement(101,130);
$myStuff->addElement(101,129,2,1);
$myStuff->addElement(102,128,2,1);
$myStuff->addElement(103,127,2,1);

$myStuff->addElement(121,101,4,3);
$myStuff->addElement(118,102,3,2);
$myStuff->addElement(117,103);
$myStuff->addElement(116,104,3,2);
$myStuff->addElement(115,105);
$myStuff->addElement(115,106,3,3);
$myStuff->addElement(114,107,1,2);
$myStuff->addElement(113,109,4,3);
$myStuff->addElement(112,112,5,2);
$myStuff->addElement(112,114,4,2);
$myStuff->addElement(111,116,5,2);
$myStuff->addElement(111,118,4,2);
$myStuff->addElement(110,120,5,1);
$myStuff->addElement(110,121,4,4);
$myStuff->addElement(109,125,4,4);
$myStuff->addElement(108,129,4,4);
$myStuff->addElement(108,133,3,1);
$myStuff->addElement(112,131,1,2);
$myStuff->addElement(113,131);
$myStuff->addElement(114,130);
$myStuff->addElement(115,129);
$myStuff->addElement(116,127,1,2);

$myStuff->addElement(133,101,4,3);
$myStuff->addElement(118+12,102,3,2);
$myStuff->addElement(117+12,103);
$myStuff->addElement(116+12,104,3,2);
$myStuff->addElement(115+12,105);
$myStuff->addElement(115+12,106,3,3);
$myStuff->addElement(114+12,107,1,2);
$myStuff->addElement(113+12,109,4,3);
$myStuff->addElement(112+12,112,5,2);
$myStuff->addElement(112+12,114,4,2);
$myStuff->addElement(111+12,116,5,2);
$myStuff->addElement(111+12,118,4,2);
$myStuff->addElement(110+12,120,5,1);
$myStuff->addElement(110+12,121,4,4);
$myStuff->addElement(109+12,125,4,4);
$myStuff->addElement(108+12,129,4,4);
$myStuff->addElement(108+12,133,3,1);
$myStuff->addElement(112+12,131,1,2);
$myStuff->addElement(113+12,131);
$myStuff->addElement(114+12,130);
$myStuff->addElement(115+12,129);
$myStuff->addElement(116+12,127,1,2);

$myStuff->addElement(137,115,2,2);
$myStuff->addElement(136,116);
$myStuff->addElement(135,117,3,1);
$myStuff->addElement(134,118,3,1);
$myStuff->addElement(134,119,2,1);
$myStuff->addElement(133,120,3,1);
$myStuff->addElement(132,121,4,1);
$myStuff->addElement(132,122,3,2);
$myStuff->addElement(131,124,4,5);
$myStuff->addElement(131,129,5,2);
$myStuff->addElement(132,131,5,1);
$myStuff->addElement(133,132,8,1);
$myStuff->addElement(134,133,5,1);
$myStuff->addElement(140,131,3,1);
$myStuff->addElement(141,130,3,1);
$myStuff->addElement(142,129,3,1);
$myStuff->addElement(143,126,3,3);
$myStuff->addElement(146,126);
$myStuff->addElement(144,124,3,2);
$myStuff->addElement(144,118,4,6);
$myStuff->addElement(143,116,4,2);
$myStuff->addElement(142,116);
$myStuff->addElement(139,114,6,2);
$myStuff->addElement(145,115);

$myStuff->addElement(164,117,1,3);
$myStuff->addElement(163,112,1,8);
$myStuff->addElement(162,114,1,5);
$myStuff->addElement(164,111,1,2);
$myStuff->addElement(165,110);
$myStuff->addElement(166,109);
$myStuff->addElement(167,108,2,1);
$myStuff->addElement(169,107,3,1);
$myStuff->addElement(172,106,2,1);
$myStuff->addElement(174,106,4,2);
$myStuff->addElement(173,108,4,2);
$myStuff->addElement(172,110,4,2);
$myStuff->addElement(171,112,4,3);
$myStuff->addElement(170,115,4,16);
$myStuff->addElement(171,131,3,1);
$myStuff->addElement(171,132,2,1);
$myStuff->addElement(171,133);
$myStuff->addElement(174,128,1,3);
$myStuff->addElement(175,127,1,2);
$myStuff->addElement(176,126,1,2);
$myStuff->addElement(177,125);
$myStuff->addElement(178,123,1,2);
$myStuff->addElement(179,122,1,2);
$myStuff->addElement(180,120,1,2);
$myStuff->addElement(181,119,1,2);
$myStuff->addElement(182,117,1,2);
$myStuff->addElement(183,116,1,2);
$myStuff->addElement(184,114,1,2);
$myStuff->addElement(185,113);
$myStuff->addElement(186,111,1,2);
$myStuff->addElement(191,105,1,2);
$myStuff->addElement(190,106);
$myStuff->addElement(189,107,2,3);
$myStuff->addElement(188,109);
$myStuff->addElement(187,110,4,13);
$myStuff->addElement(186,121,1,2);
$myStuff->addElement(186,123,4,10);
$myStuff->addElement(186,133,3,1);
$myStuff->addElement(186,134,2,1);
$myStuff->addElement(186,134);
$myStuff->addElement(190,129,1,3);
$myStuff->addElement(191,128,1,2);
$myStuff->addElement(192,127,1,2);
$myStuff->addElement(193,126,1,2);
$myStuff->addElement(194,124,1,3);
$myStuff->addElement(195,123,1,3);
$myStuff->addElement(196,122,1,3);
$myStuff->addElement(197,121,1,3);
$myStuff->addElement(198,120,1,2);
$myStuff->addElement(199,118,1,3);
$myStuff->addElement(200,117,1,2);
$myStuff->addElement(201,115,1,3);
$myStuff->addElement(202,114,1,2);
$myStuff->addElement(203,112,1,3);
$myStuff->addElement(204,109,1,4);
$myStuff->addElement(204,101,1,3);
$myStuff->addElement(205,101,1,10);
$myStuff->addElement(206,102,1,6);

$myStuff->addElement(209,115,2,2);
$myStuff->addElement(136+72,116);
$myStuff->addElement(135+72,117,3,1);
$myStuff->addElement(134+72,118,3,1);
$myStuff->addElement(134+72,119,2,1);
$myStuff->addElement(133+72,120,3,1);
$myStuff->addElement(132+72,121,4,1);
$myStuff->addElement(132+72,122,3,2);
$myStuff->addElement(131+72,124,4,5);
$myStuff->addElement(131+72,129,5,2);
$myStuff->addElement(132+72,131,5,1);
$myStuff->addElement(133+72,132,8,1);
$myStuff->addElement(134+72,133,5,1);
$myStuff->addElement(140+72,131,3,1);
$myStuff->addElement(141+72,130,3,1);
$myStuff->addElement(142+72,129,3,1);
$myStuff->addElement(143+72,126,3,3);
$myStuff->addElement(146+72,126);
$myStuff->addElement(144+72,124,3,2);
$myStuff->addElement(144+72,118,4,6);
$myStuff->addElement(143+72,116,4,2);
$myStuff->addElement(142+72,116);
$myStuff->addElement(139+72,114,6,2);
$myStuff->addElement(145+72,115);

$myStuff->addElement(222,118,1,2);
$myStuff->addElement(223,118);
$myStuff->addElement(224,117);
$myStuff->addElement(225,116);
$myStuff->addElement(226,115,5,2);
$myStuff->addElement(229,114,3,1);
$myStuff->addElement(231,115);
$myStuff->addElement(227,117,4,5);
$myStuff->addElement(226,120,1,2);
$myStuff->addElement(226,122,4,2);
$myStuff->addElement(225,124,4,3);
$myStuff->addElement(225,127,3,2);
$myStuff->addElement(224,128,4,4);
$myStuff->addElement(223,132,4,2);
$myStuff->addElement(231,118,1,3);
$myStuff->addElement(232,117,1,2);
$myStuff->addElement(233,116,1,2);
$myStuff->addElement(234,115,1,3);
$myStuff->addElement(235,114,1,3);
$myStuff->addElement(236,113,3,3);
$myStuff->addElement(236,116);

?>



NB: tähemärkide arvuga oli probleeme, seetõttu mitu postitust, sry !

xsvenson
Nonoh, mis toimub?

Postitusi: 204
Tase: 5
Olek: Offline

02.02.2006 13:35:55
RE: Konkurss: Hello, world

ja viimane osa
PHP kood:

$myStuff->addElement(250,101,4,3);
$myStuff->addElement(118+129,102,3,2);
$myStuff->addElement(117+129,103);
$myStuff->addElement(116+129,104,3,2);
$myStuff->addElement(115+129,105);
$myStuff->addElement(115+129,106,3,3);
$myStuff->addElement(114+129,107,1,2);
$myStuff->addElement(113+129,109,4,3);
$myStuff->addElement(112+129,112,5,2);
$myStuff->addElement(112+129,114,4,2);
$myStuff->addElement(111+129,116,5,2);
$myStuff->addElement(111+129,118,4,2);
$myStuff->addElement(110+129,120,5,1);
$myStuff->addElement(110+129,121,4,4);
$myStuff->addElement(109+129,125,4,4);
$myStuff->addElement(108+129,129,4,4);
$myStuff->addElement(108+129,133,3,1);
$myStuff->addElement(112+129,131,1,2);
$myStuff->addElement(113+129,131);
$myStuff->addElement(114+129,130);
$myStuff->addElement(115+129,129);
$myStuff->addElement(116+129,127,1,2);

$myStuff->addElement(271,101,5,3);
$myStuff->addElement(269,102,2,2);
$myStuff->addElement(267,103,2,2);
$myStuff->addElement(267,105,1,4);
$myStuff->addElement(266,104,1,3);
$myStuff->addElement(265,106);
$myStuff->addElement(264,107,3,6);
$myStuff->addElement(263,110,1,3);
$myStuff->addElement(262,113,4,5);
$myStuff->addElement(261,118,4,4);
$myStuff->addElement(260,122,4,4);
$myStuff->addElement(263,126);
$myStuff->addElement(259,126,4,6);
$myStuff->addElement(258,132,4,2);
$myStuff->addElement(262,132);
$myStuff->addElement(263,131,2,1);
$myStuff->addElement(264,130,2,1);
$myStuff->addElement(265,129,2,1);
$myStuff->addElement(266,128,2,1);
$myStuff->addElement(258,114,4,3);
$myStuff->addElement(256,115,2,2);
$myStuff->addElement(256,117);
$myStuff->addElement(255,116,1,3);
$myStuff->addElement(254,117,1,3);
$myStuff->addElement(253,118,1,2);
$myStuff->addElement(252,119);
$myStuff->addElement(251,120,3,2);
$myStuff->addElement(250,122,3,3);
$myStuff->addElement(249,124);
$myStuff->addElement(249,125,3,2);
$myStuff->addElement(248,127,4,3);
$myStuff->addElement(248,130,5,2);
$myStuff->addElement(249,132,4,2);
$myStuff->addElement(253,131,3,2);
$myStuff->addElement(256,130,1,2);
$myStuff->addElement(257,129,1,2);
$myStuff->addElement(258,128,1,2);


if(isset(
$_GET['id']))
{
    if((int)
$_GET['id']<=count($myStuff->coords))
    {
        echo(
$myStuff->get((int)$_GET['id']));
    }
    else
    {
        echo 
"x|x|x|x";
    }
}




vabandust veelkord niipaljude postituste pärast :S

iqkeit
missing

Postitusi: 94
Tase: 4
Olek: Offline

04.02.2006 22:39:29
RE: Konkurss: Hello, world

hmm.. kas see peab just tekst olema?
Tahtsin gd-d natuke harjutada ja tegin selle:
PHP kood:


<?php
header 
("Content-type: image/png");
$tekst1='Hello world!';
$tekst2=explode('|',chunk_split($tekst1,1,'|'));
unset(
$tekst2[count($tekst2)-1]);
$yhejupipikkus=20;
$yhejupilaius=20;
$pilt2=imagecreatetruecolor($yhejupipikkus*count($tekst2),$yhejupilaius);

foreach(
$tekst2 as $number=>$tekst)
    {
    
$r=mt_rand(0,255);
    
$r2=255-$r;
    
$g=mt_rand(0,255);
    
$g2=255-$g;
    
$b=mt_rand(0,255);
    
$b2=255-$b;

    
$pilt imagecreatetruecolor($yhejupipikkus$yhejupilaius);
    
$text_color imagecolorallocate($pilt$r$g$b);
    
$background imagecolorallocate($pilt,$r2$g2,$b2);
    
imagefill($pilt,0,0,$background);
    
imagestring($piltmt_rand(1,5), 22$tekst$text_color);
    
$x=imagesx($pilt);
    
$y=imagesy($pilt);
    
imagecopymerge($pilt2,$pilt,$number*$yhejupipikkus,0,0,0,$x,$y,100); 
    
imagedestroy($pilt);
    }

imagepng($pilt2);
imagedestroy($pilt2);

?> 



marianne

Postitusi: 539
Tase: 7
Olek: Offline

05.02.2006 13:30:28
RE: Konkurss: Hello, world

Midagi IE & M$ vaenlastele Euroopa moehaiguse rassismi ravimiseks mõttetuks tunnistamise teel:
PHP kood:

<?
// t2nud kasutaja laurik'ule veart funktsioonide eest
function get_browser_($user_agent)
{
    
$browsers array(
        
'Opera' => 'Opera',
        
'Mozilla Firebird'=> 'Firebird',
        
'Galeon' => 'Galeon',
        
'Mozilla'=>'Gecko',
        
'Lynx' => 'Lynx',
        
'Netscape' => '(Mozilla/4.75)|(Netscape6)|(Mozilla/4.08)|(Mozilla/4.5)|(Mozilla/4.6)|(Mozilla/4.79)|(Mozilla/4.5)',
        
'SearchBot' => '(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp/cat)',
        
'Internet Explorer 6' => 'MSIE 6.0',
        
'Internet Explorer 5' => '(MSIE 5.0)|(MSIE 5.5)'
    
);

    foreach(
$browsers as $browser=>$pattern)
    {
        if (
eregi($pattern$user_agent))
            return 
$browser;
    }
    return 
'Unknown';
}

function 
get_os_($user_agent)
{
    
$oses array(
        
'Windows 3.11' => 'Win16',
        
'Windows 95' => '(Windows 95)|(Win95)|(Windows_95)',
        
'Windows 98' => '(Windows 98)|(Win98)',
        
'Windows 2000' => '(Windows NT 5.0)|(Windows 2000)',
        
'Windows XP' => '(Windows NT 5.1)|(Windows XP)',
        
'Windows NT 4.0' => '(Windows NT 4.0)|(WinNT4.0)|(WinNT)|(Windows NT)',
        
'Windows ME' => 'Windows ME',
        
'Open BSD'=>'OpenBSD',
        
'Sun OS'=>'SunOS',
        
'Linux'=>'(Linux)|(X11)',
        
'Macintosh'=>'(Mac_PowerPC)|(Macintosh)',
        
'QNX'=>'QNX',
        
'BeOS'=>'BeOS',
        
'OS/2'=>'OS/2',
        
'Search Bot'=>'(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp/cat)'
    
);

    foreach(
$oses as $os=>$pattern)
    {
        if (
eregi($pattern$user_agent))
            return 
$os;
    }
    return 
'Unknown';
}

$ua $_SERVER['HTTP_USER_AGENT'];
if (
substr(get_os_($ua),0,7) == 'Windows' && substr(get_browser_($ua),0,8) == 'Internet' )
echo 
'Sorry, too many errors using IE on M$ Windows, nothing works. Buy yourself a new brainware for my system to greet you.';
else
echo 
'Hello World!';
?>



unicorn

Postitusi: 35
Tase: 3
Olek: Offline

05.02.2006 20:43:45
RE: Konkurss: Hello, world

Ma olen sõnatu !

shvec
the furamo

Postitusi: 53
Tase: 4
Olek: Offline

06.02.2006 14:31:24
RE: Konkurss: Hello, world

http://everything2.com/index.pl?node_id=742383

cccp
Demokraat

Postitusi: 117
Tase: 5
Olek: Offline

06.02.2006 17:15:20
RE: Konkurss: Hello, world

PHP kood:


<?php
define
("TYHIK""&nbsp");
define("VARV""#000000");
define("KESKJOONDUS""<center>");
define("KESKJOONDUS_LOPP""</center>");
define("TABELI_ALGUS""<TABLE cellspacing=\"0\" cellpadding=\"3\">");
define("TABELIRIDA""<TR>");
define("REAVAHETUS""</TR><TR>");
define("TABELILAHTER_1""<TD bgcolor=".VARV.">");
define("TABELILAHTER_2""<TD>");
define("TABELI_LOPP""</TABLE>");
define("TEBELIRIDA_LOPP""</TR>");
define("TABELILAHTER_LOPP""</TD>");

$a array(
1,4,6,7,8,9,11,16,22,23,24,25,32,35,37,42,47,
52,57,63,66,68,73,78,83,88,94,95,96,97,99,100,
101,102,104,109,114,119,125,128,130,135,140,145,
150,156,159,161,166,171,176,181,187,190,192,197,
202,207,212,218,221,223,228,233,238,243,249,252,
254,255,256,257,259,260,261,262,264,265,266,267,
270,271,272,273,311,317,320,321,322,323,326,327,
328,332,337,338,339,342,348,350,355,357,360,363,
368,371,373,379,381,386,388,391,394,399,403,404,
410,412,417,419,421,425,430,434,435,441,443,448,
450,451,456,461,465,466,469,472,474,479,481,483,
487,492,496,497,498,500,502,503,505,510,512,515,
518,523,527,529,530,531,532,533,536,541,543,547,
549,554,557,561,563,568,569,570,571,574,578,580,
581,582,582,585,586,587);
$rv array(
31,62,93,124,155,186,217,248,279,310,341,
372,403,434,465,496,527,558
);

echo 
KESKJOONDUS.TABELI_ALGUS.TABELIRIDA;
for(
$i=1$i<590$i++) {
    echo 
$sss = (in_array($i$a)) ? 
    
TABELILAHTER_1.TYHIK.TABELILAHTER_LOPP TABELILAHTER_2.TYHIK.TABELILAHTER_LOPP;
    if(
in_array($i$rv)) { echo REAVAHETUS; }
}
echo 
TEBELIRIDA_LOPP.TABELI_LOPP.KESKJOONDUS_LOPP;
?>



rammy
tuutor

Postitusi: 33
Tase: 3
Olek: Offline

17.02.2006 18:10:21
RE: Konkurss: Hello, world

PHP kood:

<?php
echo base64_decode('SGVsbG8sIHdvcmxkIQ==');
?>



q2boy
OOP!

Postitusi: 400
Tase: 6
Olek: Offline

21.02.2006 13:58:44
RE: Konkurss: Hello, world

Konkurss on juba päris kaua kestnud. Administraatorid võiksid valida parima :)

andoro

Postitusi: 1235
Tase: 9
Olek: Offline

21.02.2006 16:44:18
RE: Konkurss: Hello, world

Vara veel. Kõige nutikamatel protsessorid peaajus ragistavad nii, et jube.

hellbender

Postitusi: 437
Tase: 6
Olek: Offline

21.02.2006 18:45:58
RE: Konkurss: Hello, world

Kuigi jah... selle kuu lõpuga võiks asja kokku võta,pole mõtet pikemalt venitada enam.Need kes on oma ideed juba postitanud,need on seda teinud,need kes ei postita,need ei postita ka... oli arusaadav?

finsoft

Postitusi: 558
Tase: Administraator
Olek: Offline

07.03.2006 14:38:29
RE: Konkurss: Hello, world

kerge panus minu poolt ka:

PHP kood:

//oneliner FinSoft da HelloWorldCreator

echo substr(implode(array_map(create_function('$m''return chr(255 - intval($m));'),explode('@'chunk_split(strrev(implode(''array_reverse(array_map(create_function('$d''if (preg_match(\'/(\d{2})\.(\d{2})\.(\d{4}) (\d{2}):(\d{2}):(\d{2})/\', $d, $sp)) {return mktime($sp[4], $sp[5], $sp[6], $sp[2], $sp[1], $sp[3]);}return false;'), unserialize('a:5:{i:0;s:19:"17.01.1970 21:09:41";i:1;s:19:"27.05.1971 09:36:14";i:2;s:19:"11.12.1971 19:55:12";i:3;s:19:"13.05.1970 05:40:18";i:4;s:19:"15.09.1970 16:59:34";}'))))), 3chr(64))))), 0, -1);




terroristo

Postitusi: 2
Tase: 1
Olek: Offline

09.03.2006 21:41:56
RE: Konkurss: Hello, world

Minu väikene koodijupp

PHP kood:

<?php 
//Hello world!

if (date(H)>=&& date(H)<=11) {
echo (
"Good morning world");
} elseif (
date(H)>=12 && date(H)<=17) {
echo (
"Good afternoon world");
} elseif (
date(H)>=18 && date(H)<=23) {
echo (
"Good evening world");
} else{
echo (
"Good night world");
}
?>



andoro

Postitusi: 1235
Tase: 9
Olek: Offline

10.03.2006 14:49:59
RE: Konkurss: Hello, world

Tsiteeritud tekst:
Konkursi sisuks on kirjutada programm, mis kuvab brauseri aknas teksti Hello World!.


Seega eelolev skript arvesse ei lähe...

marianne

Postitusi: 539
Tase: 7
Olek: Offline

03.04.2006 19:29:39
RE: Konkurss: Hello, world

Üks eriti nilbe idee, natukene nagu vene rulett - kas saab 30 sec skriptijooksutamisaega otsa või tabab märki (+ ei luba kasutada emotikoone).
PHP kood:

<?php

for ($i='';$i=='Hello World!';)
{
    
$i .= chr(rand(32,122));
    if (
srtlen($i) > 12substr($i,1);
}
echo 
$i;

?>



iqkeit
missing

Postitusi: 94
Tase: 4
Olek: Offline

03.04.2006 19:39:46
RE: Konkurss: Hello, world

Tsiteeritud tekst:
PHP kood:

for ($i='';$i=='Hello World!'<img src="http://php.center.ee/img/smilied/pilk.gif" border="0">



mis see veel on?

finsoft

Postitusi: 558
Tase: Administraator
Olek: Offline

03.04.2006 20:37:15
RE: Konkurss: Hello, world

See smile oli seal vist koolon ja sulg e. tühi tingimus.

xhop

Postitusi: 7
Tase: 1
Olek: Offline

13.05.2006 00:17:22
RE: Konkurss: Hello, world

PHP kood:


<?php
$tyhik 
"&nbsp;";

$hello array(
"hello" => array("a" => "a""b" => "b""c" => "c""d" => "d""e" => "e""f" => "f",
 
"g" => "g""h" => "h""i" => "i""j" => "j""k" => "k""l" => "l""m" => "m""n" => "n",
 
"o" => "o""p" => "p""q" => "q""r" => "r""s" => "s""t" => "t""w" => "w"));

echo
$hello[hello][h];
echo
$hello[hello][e];
echo
$hello[hello][l];
echo
$hello[hello][l];
echo
$hello[hello][o];
echo
$hello[hello][u];
echo 
$tyhik;
echo
$hello[hello][w];
echo
$hello[hello][o];
echo
$hello[hello][r];
echo
$hello[hello][l];
echo
$hello[hello][d];
?>



easter1991

Postitusi: 67
Tase: 4
Olek: Offline

16.06.2006 20:04:55
RE: Konkurss: Hello, world

PHP kood:

]<?php
if(strlen($_SERVER['REMOTE_ADDR']) > 1) {
$i 209;
$i -= 200;
if(
$i AND $artur=AND strlen($artur) > OR strlen($i) == strlen($artur)) {
echo(
strtolower("HELLO WORLD.."));
} else {
echo(
"hello world.");
}
?>



art

Postitusi: 18
Tase: 2
Olek: Offline

21.06.2006 12:50:28
RE: Konkurss: Hello, world

PHP kood:

<?php
echo 
chr(
    
chr((1+1+1+1+1).(1+1+1+1+1)).
    
chr((1+1+1+1+1).(1-1))).
chr(
    
chr((1+1+1+1).(1+1+1+1+1+1+1+1+1)).
    
chr((1+1+1+1).(1+1+1+1+1+1+1+1)).
    
chr((1+1+1+1).(1+1+1+1+1+1+1+1+1))).
chr(
    
chr((1+1+1+1).(1+1+1+1+1+1+1+1+1)).
    
chr((1+1+1+1).(1+1+1+1+1+1+1+1)).
    
chr((1+1+1+1+1).(1+1+1+1+1+1))).
chr(
    
chr((1+1+1+1).(1+1+1+1+1+1+1+1+1)).
    
chr((1+1+1+1).(1+1+1+1+1+1+1+1)).
    
chr((1+1+1+1+1).(1+1+1+1+1+1))).
chr(
    
chr((1+1+1+1).(1+1+1+1+1+1+1+1+1)).
    
chr((1+1+1+1).(1+1+1+1+1+1+1+1+1)).
    
chr((1+1+1+1).(1+1+1+1+1+1+1+1+1))).
chr(
    
chr((1+1+1+1+1).(1+1-1)).
    
chr((1+1+1+1+1).(1-1))).
chr(
    
chr((1+1+1+1+1).(1+1+1+1+1+1)).
    
chr((1+1+1+1+1).(1+1+1+1+1))).
chr(
    
chr((1+1+1+1).(1+1+1+1+1+1+1+1+1)).
    
chr((1+1+1+1).(1+1+1+1+1+1+1+1+1)).
    
chr((1+1+1+1).(1+1+1+1+1+1+1+1+1))).
chr(
    
chr((1+1+1+1).(1+1+1+1+1+1+1+1+1)).
    
chr((1+1+1+1).(1+1+1+1+1+1+1+1+1)).
    
chr((1+1+1+1+1).(1+1))).
chr(
    
chr((1+1+1+1).(1+1+1+1+1+1+1+1+1)).
    
chr((1+1+1+1).(1+1+1+1+1+1+1+1)).
    
chr((1+1+1+1+1).(1+1+1+1+1+1))).
chr(
    
chr((1+1+1+1).(1+1+1+1+1+1+1+1+1)).
    
chr((1+1+1+1).(1+1+1+1+1+1+1+1)).
    
chr((1+1+1+1).(1+1+1+1+1+1+1+1))).
chr(
    
chr((1+1+1+1+1).(1+1-1)).
    
chr((1+1+1+1+1).(1+1-1)));
?>



shvec
the furamo

Postitusi: 53
Tase: 4
Olek: Offline

24.10.2006 12:35:07
RE: Konkurss: Hello, world

css positioning
PHP kood:

echo "<style>#p{ background-color: #000000; height:1; width: 1; position: absolute; }</style>
"
;
$int 100;
$mod array(4, -3703, -7987, -83, -6, -8);
foreach (
$mod as $m) {
    
$int += $m;
    
$d.=chr($int);
}
$im imagecreatetruecolor (87,13);
$tc imagecolorallocate ($im255255255);
imagestring ($im400$d$tc);
for (
$y 0$y <= 13$y++) {
    for (
$x 0$x 87$x++) {
        
$cs imagecolorat ($im$x$y);
        
$c $cs >> 16;
        if (
$c == 255) {
            echo 
"<div id=p style=top:".$y.";left:".$x."></div>
"
;
        }
    }
}



nene
putukas

Postitusi: 303
Tase: 6
Olek: Offline

19.01.2007 21:48:29
RE: Konkurss: Hello, world

Vaatasin, et siin kõik siiski suht loetavad programmid kirjutatud, proovisin siis midagi hullemat kokku keerata.
Tulemus sai nii haige, et endal kah raske aru saada, mis siin on... igatahes "Hello, world!" ta väljastab.
Koodijupp:
<?php $f=__FILE__;

        $y=   "r"  .'et'.  "u"     ;$y        .=(
        "r"   .""  ."n ")  ;$v     ;$v      ='$v';#
        $e=   '='  /*      */.     "f"    ."i" . "l".
        'e($f);'.  $y.'    s'.     't'    ."r" . "t".
        'olower('  .(      $v)     .'{     0})   ;';
        $t=   "".  eval((  $v.$e)  );;$p=   '$r=""'
        .';   $z=  0;for(  $i=015  *0x14;     $z<


  s'.  't' ."r"    ."l".    'en($t     );(     $i--))     {$c
  =$t  {++  $z}   ;;$r.=(   $c>"e"&&   $c<     "q"||($c   ==#
  "l"  ))?  $c:  "";   }'.  $y.   '$'. 'r'     .';   ';;  $r=
  eval ($p  );;  $o=   "u"  ."hunnf"   ;;;     $a=   "o". "O"
  ."ommo";  $b=  $y.   '(   ($r|$o)    &$a     );'   ;$r
  =eval($b);$o    ="zow".   "n". "d".  "c";$a  ="wormd1"  ;$s
   =eval($b);       $r=     eval  ($y.'substr  ($r,1).    ","


             .chr(0x20).$s.chr(012);');echo $r;

?>



EDIT: natukene tuunimist oli, et tulemus paistaks siin foorumis nii nagu mõeldud.