Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

shii-chan

Name: Anonymous 2007-08-05 21:00 ID:72JngXBm

shii-chan is the most advanced peice of software on the planet

Name: Anonymous 2007-08-05 21:02 ID:04KROJJV

It's a piece of s- alright.

Name: Anonymous 2007-08-05 21:05 ID:2cvWVfGC

>>1
have you even READ SICP???

Name: Anonymous 2007-08-05 21:10 ID:nD6s330s

We should rewrite it as a Java servlet!

Name: Anonymous 2007-08-05 21:26 ID:04KROJJV

>>4

That'll probably improve it..

Name: Anonymous 2007-08-05 21:40 ID:knGxxeKT

I opened up the source for Shiichan for kicks and I swear my eyes started bleeding. Not only is the source unbelievably messy (MIXING TABS AND SPACES SHOULD BE A CAPITAL CRIME), but it incorporates some of the stupidest coding practices I've ever seen.

Prime example of idiocy:
foreach ($postarray as $apost) {
    list($start,$end) = explode('-',$apost);
     if (strpos($start,'l') === 0) {$start = ($numposts - intval(substr($start,1)))+1; $end = $numposts;}
    if ($start < 1) $start = 1;
    if ($end == "") if (strstr($apost,"-")) $end = $numposts; else $end = $start;
    if ($end > $numposts) $end = $numposts;
    if ($start > $numposts) $start = $numposts;>     if ($start <= $end) {
      for ($i = $start; $i <= $end; $i++) {>          list($name, $trip, $date, $message, $id, $ip) = explode("<>", $thread[$i]);>          if ($trip) $trip = "#".$trip;>          if ($isitreadphp) $return .= PrintPost($i, $name, $trip, $date, $id, $message, $postfile, 1, $boardname);
         else $return .= PrintPost($i, $name, $trip, $date, $id, $message, $postfile, $threadid, $boardname);>       }>     } else {>           for ($i = $start; $i >= $end; $i--) {
       if ($end < 1) $end = 1; if ($start > $numposts) $start = $numposts;
         list($name, $trip, $date, $message, $id, $ip) = explode("<>", $thread[$i]);
         if ($trip) $trip = "#".$trip;>          if ($isitreadphp) $return .= PrintPost($i, $name, $trip, $date, $id, $message, $postfile, 1, $boardname);
         else $return .= PrintPost($i, $name, $trip, $date, $id, $message, $postfile, $threadid, $boardname);
       }
    }
}

JESUS. FUCKING. CHRIST.

Name: Anonymous 2007-08-05 21:53 ID:vyxSGZbz

>>6
Please post your algorithm for comparison

Name: Anonymous 2007-08-05 22:18 ID:04KROJJV

>>6

Uh oh, looks like you pissed someone off!

Name: Anonymous 2007-08-05 22:19 ID:7jbhvlLP

Not >>6, but for starters I would break the code in many little functions. Instead of 

if ($end > $numposts) $end = $numposts;

what about something like

$end = min($end, $numposts)

I don't know php (is this php?), maybe you could write something like
notMoreThan($end, $numposts)
or
makeBetween($end, 1, $numposts)
since there are some underchecks as well.

If you see, this function I'm proposing appears repeteadly in the code.
 if ($start < 1) $start = 1;
 if ($end > $numposts) $end = $numposts;
 if ($start > $numposts) $start = $numposts; (which btw appears twice, god knows why)
if ($end < 1) $end = 1;

Name: Anonymous 2007-08-05 22:21 ID:knGxxeKT

>>7

If I could figure out what the fuck it's trying to do I'd come up with a much better solution, but the near total lack of comments or documentation means I'd have to spend way more than I'm willing to spend to actually decipher this shit. I can tell you right now I'd use a database instead of a flat text file for this, probably powered by SQLite to retain the benefits of flat text storage. The query for that section of code would probably look something like this:

   SELECT p.name, p.trip, p.date, p.message, p.postfile, p.ip,
          p.threadid, b.boardname
   FROM Posts p
   JOIN Threads t ON (p.threadid = t.id)
   JOIN Boards b ON (t.boardid = b.id)
   WHERE p.threadid = ?
   ORDER BY p.id ASC

Name: Anonymous 2007-08-05 22:31 ID:Heaven

>>7
How about using a better language. And making a separate function that parses the post query string into an array of post ids. And getting rid of the fucking duplicate code.

Oh fuck, OOP is so 90s!
PrintPost($i, $name, $trip, $date, $id, $message, $postfile, 1, $boardname);

OH SHIT SQL IS TOO SLOW BETTER USE EXPERT OPTIMIZED FLAT FILES
http://dis.4chan.org/prog/subject.txt

Name: Anonymous 2007-08-05 23:04 ID:7jbhvlLP

no need for oop. abstract data types, or just RECORDS/STRUCTS/ASSOCLIST/HASHTABLE, will suffice.

Name: Anonymous 2010-11-27 1:37

Don't change these.
Name: Email:
Entire Thread Thread List