[ALG] Spaghetti topic

Pagina: 1
Acties:

  • Genoil
  • Registratie: Maart 2000
  • Laatst online: 12-11-2023
Elke coder kent het, het resultaat van wekenlang gepiel om iets maar aan de praat te krijgen. Vaak resulteert dat de meest idiote brij. Post hier je een paar regels van je meest brilliante brij. Ik zag dit net tussen m'n code staan:
code:
1
2
3
4
5
6
                $html = GetForumFormHTML();
                $html.= "<iframe name='poster' frameBorder='0'  width='0' height='0'></iframe>";
                SUB_JS_Do("var forum = parent.forum");
                ?> if (forum) { forum.setAttribute("html","<? echo $html ?>") ;<?
                SUB_JS_Do("leftlist = parent.parent.main.document.getElementById('leftlist')");
                ?>leftlist.innerHTML = "\n"+ "<? echo $html; ?>" + "\n";}<?

rara wat doet dit? ;)

  • Wirf
  • Registratie: April 2000
  • Laatst online: 12-09 14:39
laatst nog (ok, niet echt brei, maar wel stom):
code:
1
2
3
4
5
6
7
8
9
10
11
12
port_out(CONTROL,port_in(CONTROL) | 0x01);
port_out(CONTROL,port_in(CONTROL) | 0x01);
port_out(CONTROL,port_in(CONTROL) | 0x01);
port_out(CONTROL,port_in(CONTROL) | 0x01);
port_out(CONTROL,port_in(CONTROL) | 0x01);
port_out(CONTROL,port_in(CONTROL) | 0x01);
port_out(CONTROL,port_in(CONTROL) & 0xFE);
port_out(CONTROL,port_in(CONTROL) & 0xFE);
port_out(CONTROL,port_in(CONTROL) & 0xFE);
port_out(CONTROL,port_in(CONTROL) & 0xFE);
port_out(CONTROL,port_in(CONTROL) & 0xFE);
port_out(CONTROL,port_in(CONTROL) & 0xFE);

werd:
code:
1
2
3
4
5
6
7
8
9
int delay = 6;

for (int i = 0; i < delay; i++) {
     port_out(CONTROL,port_in(CONTROL) | 0x01);
}

for (int i = 0; i < delay; i++) {
     port_out(CONTROL,port_in(CONTROL) & 0xFE);
}

De bikkels mogen raden wat voor een programma het is ;)

Heeft sinds kort zijn wachtwoord weer terug gevonden!


  • RedRose
  • Registratie: Juni 2001
  • Niet online

RedRose

Icebear

PHP:
1
<?if ($useradd == "1") {    #count number of cols in feuser#            #first check the number of columns#                global $sqlhost,$sqlusername,$sqlpassword;                $sqlsettingsdb="settings";                sqlconnect ($sqlhost,$sqlusername,$sqlpassword,$sqlsettingsdb);                    $colquery=("Select * FROM feuser WHERE feuserid='1'");            $ressettings=mysql_query($colquery);                $sqlerror=mysql_error();                    if ($sqlerror) {                    echo $sqlerror;                    }        $colnumber=mysql_num_fields($ressettings);        $extrainputs=($colnumber-6);        for ($tel = 0;; $tel++) {        if ($tel == $extrainputs) {        break;        }        $extrafields.=",'no'";        }        $i=0;    #while1#        while ($i < $numberoftotaladd) {            #select data from this userid#            global $sqlhost,$sqlusername,$sqlpassword;            $sqlsettingsdb="settings";            sqlconnect ($sqlhost,$sqlusername,$sqlpassword,$sqlsettingsdb);                            $sqlgetputuser=("SELECT userid,username,password,display_name,emailadr FROM user WHERE userid='".$putuserid[$i]."'");            $ressqlgetputuser=mysql_query($sqlgetputuser);                $sqlerror=mysql_error();                if ($sqlerror) {                echo $sqlerror;                }            #while2#                        while ($putuserarray=mysql_fetch_array($ressqlgetputuser)) {                #do the insert#                $sqluserinfe=("INSERT INTO feuser VALUES ('','".$putuserid[$i]."','".$putuserarray['username']."','".$putuserarray['password']."','".$putuserarray['display_name']."','".$putuserarray['emailadr']."'".$extrafields.")");                $resuserinfe=mysql_query($sqluserinfe);                $sqlerror=mysql_error();                if ($sqlerror) {                echo $sqlerror;                }                #then set rights#                $rightcol=($thissiteid."_".$thisshortname);                $sqlsetferights=("UPDATE feuser SET ".$rightcol."='yes' WHERE userid='".$putuserid[$i]."'");                $ressetferights=mysql_query($sqlsetferights);                $sqlerror=mysql_error();                if ($sqlerror) {                echo $sqlerror;                }            #end while2#            }        $i++;        #end while1#?>

Ik lig helemaal dubbel ... het allereerste serieuze ooit geschreven.

al die globals en while loops LOL

Sundown Circus


  • Orphix
  • Registratie: Februari 2000
  • Niet online
* Orphix heeft gezocht maar niks gevonden ...
toch wel apart, ik heb genoeg stukken van wazige code zonder comments e.d. maar dat is niet echt spaghetti code.
Ik denk dat het een gewoonte van me is om in te springen en met een OO omgeving kom je al snel op meerdere functie-aanroepen uit zodat het ook niet snel een enorm blok is.

Nu heb ik ook niet enorm oude code hier staan dus misschien dat daar wel wat in stond :)

Verwijderd

Topix is een en al spaghetticode! :+

  • chem
  • Registratie: Oktober 2000
  • Laatst online: 27-08 13:53

chem

Reist de wereld rond

Op donderdag 07 maart 2002 07:13 schreef GSMboy het volgende:
Topix is een en al spaghetticode! :+
hoe weet jij dat :?

edit: na een tijdje zoeken, het ergste wat ik kon vinden:
** viel wel mee eigenlijk, verder zoeken... ***

Klaar voor een nieuwe uitdaging.


  • Basszje
  • Registratie: Augustus 2000
  • Laatst online: 11-09 08:17

Basszje

Reisvaap!]

Dit is 1 (!) query in ASP .. Ranzig dus :)
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"SELECT DISTINCT" & _
     " client_id, client_naam,client_relatie,client_contact,client_email,client_telefoon1 " & _
     "FROM " & _
     " tbl_client,  " & _
     " tbl_client_access,  " & _
     " tbl_groep_user,  " & _
     " tbl_user  " & _
     "WHERE " & _
    "client_id in " & _
    " (select client_id from tbl_client where client_relatie like '" & zoekstring & "%' OR upper(client_naam) like '" & ucase(zoekstring) & "%') AND " & _
     " tbl_client.client_id   = tbl_client_access.client_id AND " & _
     "( client_id in ( select client_id from tbl_client_access inner join tbl_user on " & _
     " tbl_client_access.identity_id = tbl_user.user_id where identity_type = " & user_identity & _
        " and not access_right = " & deny_right & " AND user_id = " & get_user_id & ")" & _ 
    " or client_id in ( select client_id from tbl_client_access inner join tbl_groep_user on " & _ 
      " tbl_client_access.identity_id = tbl_groep_user.groep_id where identity_type = " & group_identity & _
      " AND tbl_groep_user.user_id = " & get_user_id & " and client_id not in ( " & _ 
      " select client_id from tbl_client_access where identity_type = " & user_identity & _ 
      " and access_right = " & deny_right & " and identity_id = " & get_user_id & ")))"

Beware of listening to the imposter; you are undone if you once forget that the fruits of the earth belong to us all, and the earth itself to nobody.


  • MindWarp
  • Registratie: Februari 2001
  • Laatst online: 27-08 14:40
stukje LaTeX:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
\textbf{Skelet s = } 
\>\{(MEUBELS;\{GEB,SRT,AJAAR,VJAAR,AANT\}),\\
\>(MSOORT;\{MSRT,LEV,NPRIJS\}),\\
\>(KAMER;\{MSRT,KNR,GEB\}),\\
\>(INRCHTNG;\{INR,KSRT,KOMSCH,MSRT,AANT\}),\\
\>(ARBO;\{ANR,AOMSCH,APRIJS,NMW,KNR,GEB,JAAR\})\}
\end{tabbing}
\pmn
\textbf{\underline{Attribute constraints:}}
\begin{tabbing}
aaaaaaaaaaaaaa\=aaaaaaaaaaaaaaaaaaaaaaaa\=aaaaaaaaaaaaaaaa \kill 
\bf{Definities:} \>\>\bf{Toelichting:} \\
MEUBELS =\> \{(KNR ; Chs(10)),\>Kamernummer. \\
\>(GEB ; Chs(30)),\>Gebouw. \\
\>(MSRT ; Chs(30)),\>Meubelsoort. \\
\>(AJAAR ; $\mathbb{N}$ -\{0\}),\>Aanschafjaar.\\
\>(VJAAR ; $\mathbb{N}$ -\{0\}), \>Vervangingsjaar.\\
\>(AANT ; $\mathbb{N}$ -\{0\})\}; \>Aantal\\
\\MSOORT =\> \{MSRT ; Chs(30)),\>Meubelsoort.\\
\>(LEV ; Chs(50)),\>Leverancier. \\
\>(NPRIJS ; $\mathbb{N}$ -\{0\})\}\>Nieuwprijs.\\
\\KAMER =\>\{(KSRT ; Chs(30)),\>Kamersoort.\\
\>(KNR ; Chs(10)),\>Kamernummer.\\
\>(GEB ; Chs(30))\};\>Gebouw.\\
\\INRCHTNG =\>\{(INR ; Chs(30)),\>Standaardinrichting.\\
\>\{(KSRT ; Chs(30)),\>Kamersoort.\\
\>(KOMSCH ; Chs(50)),\>Omschrijving kamer.\\
\>(MSRT ; Chs(30)),\>Meubelsoort.\\
\>(AANT ; $\mathbb{N}$ -\{0\});\>Aantal.\\
\\ARBO =\>\{(ANR ; $\mathbb{N}$ -\{0\}),\>ARBO-nummer.\\
\>(AOMSCH; Chs(50)),\>Omschrijving.\\
\>(APRIJS; $\mathbb{N}$),\>Prijs van ARBO.\\
\>(NMW; Chs(50)),\>Naam medewerker.\\
\>(KNR ; $\mathbb{N}$ -\{0\}),\>Kamernummer.\\
\>(GEB ; Chs(30));\>Gebouw.\\
\>(JAAR ; $\mathbb{N}$-\{0\})\},\>Jaar.\\
\end{tabbing}
\pmn
\textbf{\underline{Tuple-constraints:}}\pmn
TMEUBELS = \{ t $\in\Pi$(MEUBELS) $|$ t(VJAAR) $\geq$ t(AJAAR)\};\\
TKAMER = \{t $\in\Pi$ KAMER\};\\
TMSOORT = \{t $\in\Pi$ MSOORT\};\\
TINRCHTNG = \{t $\in\Pi$ INRCHTNG\};\\
TARBO = \{t $\in\Pi$ ARBO\};
\pmn
\textbf{\underline{Table-constraints:}}\pmn
WKAMER = \{ T $\subseteq$ TMEUBELS $|$ \{KNR,GEB\} is u.i. in T\};\\
WMEUBELS = \{ T $\subseteq$ TMEUBELS\};\\
WMSOORT = \{ T $\subseteq$ TMSOORT $|$ {MSRT} is u.i. in T \};\\
WINRCHTNG = \{ T $\subseteq$ TINRCHTNG \};\\
WARBO = \{ T $\subseteq$ TARBO $|$ {ANR} is u.i. in T \};
\pmn

If it ain't broke, you're not trying! - Red Green


  • whoami
  • Registratie: December 2000
  • Laatst online: 19:37
Ik code geen spaghetti, ik eet het alleen maar.

https://fgheysels.github.io/


  • pimlie
  • Registratie: November 2000
  • Laatst online: 08-09 00:36
hehe, ik kan altijd wel lachen om van die string namen waaraan je kan zien dat iemand het gehad heeft. Zoiets als $kom_maar_op en $je_mag_door of $pimlie >:)

Verwijderd

Op donderdag 07 maart 2002 22:18 schreef pimlie het volgende:
hehe, ik kan altijd wel lachen om van die string namen waaraan je kan zien dat iemand het gehad heeft. Zoiets als $kom_maar_op en $je_mag_door of $pimlie >:)
$bla doet het ook altijd erg goed... :) ooit is mijn docent vreselijk gaan flippen toe ik een var $fluit had genoemd...

  • Soultaker
  • Registratie: September 2000
  • Laatst online: 15:13
Op vrijdag 08 maart 2002 00:12 schreef dj_delta het volgende:
ooit is mijn docent vreselijk gaan flippen toe ik een var $fluit had genoemd...
Ik ken dan weer een docent die zijn variabelen en parameters bij voorkeur 'Peter' (want zo heet hij) en 'Appelsientje' (vraag 't me niet) noemt.

  • CubicQ
  • Registratie: September 1999
  • Laatst online: 19:38
he, die ken ik :)

Maar goed, dat zijn wiskundige 'dummy'-variabelen (spreek uit op z'n Duits), dat is toch wat anders dan variabelen in een programmeertaal waarbij je de code toch wel wilt 'bewaren' en ook nog na een tijdje wilt snappen wat er staat.

  • DRvDijk
  • Registratie: Juni 2001
  • Laatst online: 08-09 17:10
Search in een van me eerdere PHP-brouwsers op $blaat, $viedz, $appol en $banan leverde in 14 PHP files 634 resultaten op >:) Okee, nu gaat het al een stuk beter, maar dat was redelijk komisch :P

  • Arzie
  • Registratie: Juni 1999
  • Laatst online: 07:44
Soultaker en CubicQ: PKH Gragert ;)

Zinoez.

  • Soultaker
  • Registratie: September 2000
  • Laatst online: 15:13
Op vrijdag 08 maart 2002 01:06 schreef Arzie het volgende:
Zinoez.
Dat is 'm!
Pagina: 1