LFS Stat

Discussion in 'LFSStat' started by hackerx, Oct 13, 2004.

  1. hackerx

    hackerx [dSRC] Member

  2. Ian.H

    Ian.H Administrator Staff Member

    This is looking really good H! Would be cool if you did complete it and that it could be added to our team site :D



    Regards,

    Ian
     
  3. hackerx

    hackerx [dSRC] Member

    Worked a bit today on LFS Stat, mainly cleaning up code (was real mess), and also added comparison with PB's to table. Filter/sort not working yet...

    You can take a look: LFS Stat V0.2.

    Who knows, maybe I can finish this thing after all... :smile:
     
  4. hackerx

    hackerx [dSRC] Member

    There's one stupid problem... when I read hotlaps from LFSW like this...
    Code:
      if (!$stat = @fopen ("http://www.lfsworld.net/pubstat/get_stat.php?action=hl&racer=" . str_replace (" ", "%20", $name), "r"))
        die ("ERROR: Could not get data from LFSW!");
      $lastreq = time ();
      $data = fread ($stat, 8192);
      fclose ($stat);
    ...for some unknown reason if there's more than say 140-150 hotlaps, some of them from end disappear. Weird, as this only happens on my hosting server. Home all works OK. Dunno what to think of this... bug in PHP version they have? 4.3.3 there, home I have 4.0.6.
     
  5. Ian.H

    Ian.H Administrator Staff Member

    LFSStat lookin good sir! :D

    As for the error message.. any chance that it's truncating due to a "bad char"? I always read dumps like this as binary data (I guess I did this initially to keep windoze (l)users happy and now kind of second nature).

    Here's what I use to get the hotlaps:

    PHP:
    if (!$this->_checkCache($cacheFile$this->pbHotlapCacheLifespan)) {
        
    $fp fopen('http://www.lfsworld.net/pubstat/get_stat.php?action=hl&racer=' urlencode($username), 'rb');
        if (
    is_resource($fp)) {
            while (!
    feof($fp)) {
                
    $hostData .= fread($fp512);
            }
            
    fclose($fp);
        }

        if (
    $this->_checkCacheDir($this->pbHotlapCache) and strlen($hostData) > 0) {
            
    $this->_writeHotlapCache($username$hostData);
            
    $hostData $this->_readHotlapCache($username$track$car);
        }
    } else {
        
    $hostData $this->_readHotlapCache($username$track$car);
    }
    Haven't had any problems with losing data. Running on PHP 4.3.2 here at home though.



    Regards,

    Ian
     
  6. hackerx

    hackerx [dSRC] Member

    Hmm, in hotlaps there can't be any bad chars. It seems now that data always ends at 2636 bytes.

    Anyway, thanks for reminding me there's urlencode () function. :smile:
     
  7. Ian.H

    Ian.H Administrator Staff Member

    Ahh hmm.. definitely sounds like an issue with your host.

    Out of curiousity, have you tried file_get_contents()? It won't work on your home box (>= 4.3.x IIRC) but just as a test to see if you _can_ actually retrieve all info from your host. Seems a bit of a strange one to me.



    Regards,

    Ian
     
  8. Anarchi-h

    Anarchi-h New Member

    From http://uk.php.net/fread

    Because you are opening it from the lfsworld server, it's a remote stream... If your hosting company server has a max packet size of 2636bytes (?!?) then that would explain the truncation. The rest of the data would be sitting in a packet waiting for you to collect with the next fread.

    That would also explain why Ian and I have never encountered it, and why it only happens on your hosting companies server.
     
  9. hackerx

    hackerx [dSRC] Member

  10. Ian.H

    Ian.H Administrator Staff Member

    Ahhh good catch A! Hadn't thought about that one.. scarily small packet limit if that is the case!

    H.. looking really sweet sir :D



    Regards,

    Ian
     
  11. Anarchi-h

    Anarchi-h New Member

    Happy to help :smile:
     
  12. hackerx

    hackerx [dSRC] Member

  13. hackerx

    hackerx [dSRC] Member

  14. RudiTurbo

    RudiTurbo New Member

    Hey hackerx :)
    Just checking this over a while, nice additions You've put there :)
    But non of My PB, HL/PB diff, Laps appear :)
    Also a little request, could You add the WR and hotlap difference ? ;) like You're 1.560 secs off the WR and so :)
     
  15. hackerx

    hackerx [dSRC] Member

    Fixed.
    Done. Hover mouse on WR% cell to see it.
     
  16. RudiTurbo

    RudiTurbo New Member

    Wow Great fast work :D
    BUT, Wouldnt it be possible to add another row with the WR and hotlap gaps and The Best would be to also have an opporunity to sort them by the gaps, so biggest gaps would appear on the top and so on.
    If You do that, maaan, I owe You a BIG ONE! :D
     
  17. hackerx

    hackerx [dSRC] Member

    Don't really understand now... you mean add another COLUMN maybe? Any way, as tracks are very different in length, it seems to me that comparing hotlap/WR difference between, say, FE4/GTI and FE6/LX6 doesn't make much sense? That's what WR percent is for, and that was why that difference wasn't displayed.
     
  18. RudiTurbo

    RudiTurbo New Member

    Column, row , whateva :D
    But I need this for Hotlapping My Allround rank, so I know where it is the easyest to improve. For Me 1 sec on Club and Black is kinda the same :)
    If the track is longer, there nearly always is some weaker point which You can use to get a better time and on a short track You can always get lucky for one lap, cause You have so many shots at it. So I find the Percentage kinda pointless IMO and the gap with the WR's much more important and the thing I've actually been looking for many months :)
     
  19. hackerx

    hackerx [dSRC] Member

    Aha. So it makes sense to professional hotlapper. :)

    I'll see what I can do, new LFS Stat version will hopefully ready quite soon (next week or so), I'll add that feature too then. Stay tuned.
     
  20. RudiTurbo

    RudiTurbo New Member

    Yay :)
    I'll be waitin then :)
     

Share This Page