Page 1 of 1

Folding@home Live Statistics Update

Posted: Wed Aug 29, 2012 5:08 am
by Torque
Umm you may want to go here viewforum.php?f=14 and talk to some of the other 3rd party stats devolipers Harlem, MtM, smoking2000 and UncleFungus. They can probably answer the questions you have since they have been working with F@H stats fro quite a while. Although I have not seen MtM around for a while.
(Grandpa_01)
http://hardforum.com/showthread.php?t=1713498
Hi!

I'm a new member and I want to ask for help refering to javascript coding. My aim is to create a counter, which displays the current Grand Score of my team at any time. I want to implement the code on websites to give all the users a greater overview of their current work and a cool experience of our contribution. I'm pretty sure, this is interesting for several other teams.

I've already finished the core ideas, but don't know how to set up the javascript...

Start of programming:
1) get system time of Operating System (exact hours, minutes, seconds)
2) get the value of "Report generated on" (source code: row 78, extract from http://fah-web.stanford.edu/cgi-bin/mai ... teamnum=33)
3) calculate the time difference between 1) and 2) => This is the actual expiration after the Report has been generated (the value must always be smaller than around 1 hour, because of the hourly update!). You have to pay attention to the differnt time zones...
4) get the value of the 3-hour-update amount (source code: row 342, extract from http://kakaostats.com/t.php?t=33)
5) calculate the PPS variable (PPS=points per second) => PPS = (3-hour-update amount from kakao stats)/(3600*3)
6) get the value of "Grand Score" (hourly updated by Stanford) (source code: row 96, extract from http://fah-web.stanford.edu/cgi-bin/mai ... teamnum=33)
7) Current Grand Score = "Grand Score" [extracted from 6)] + PPS [calculated @ 5)] * (time difference in seconds) [calculated @ 3)]

I'm pretty sure, that the Current Grand Score won't always display the 100% correct amount of points. But if the hourly updates are quite equal, the Current Grand Score is a very cool tool and the approximation is okay! The more stable the 3-hour-update amount, the more correct the approximation.

This is for Team 33. The other teams just have to change the URLs and it will work fine, too.

There are still a few problems, but I don't know how to solve them. For example the CSS, to beautify the numbers.
I think, it would make more sense to add commas after each 3 numbers. So you can distinguish between the thousands, millions,...
Feel free to start coding and contacting me.

Thanks a lot for ideas and your help!
- Torque -

This is a very early sample of the code (see below):

<html>
<body>


<style type="text/css">
<!--

.nummer{
font-family:Verdana,sans-serif;
font-weight:bold;
font-size:120px;
color: #808080;
border:none;
text-align:center;
width:280px;
background:#F0F4FF;
}

.tabelle {
border:1px solid #0090E0;
height:250px;
width:300px;
background:#F0F4FF;
}

.tabelle td{
border:1px solid #0090E0;
margin:10px;
background:#F0F4FF;
}

-->
</style>





<script>

var PPS = 0.345755544;
var c = 100

function startCount()
{
var timer = setInterval(count,1000);

}
function count()
{
var el = document.getElementById('counter');
var currentNumber = parseFloat(el.innerHTML);
el.innerHTML = (Math.round((currentNumber+PPS) * 100) / 100) + c;

}

</script>
<body onload="startCount();">


Current Grand Score:
<div id="counter"> 0 </div>



<form name="tabelle td">
<input class="nummer" type="text" id="Anzeige" value="0"> </form>



</body>
</html>

Re: Folding@home Live Statistics Update

Posted: Fri Sep 21, 2012 3:24 pm
by smoking2000
2) You don't want to scrape the CGI teampage, use the static version instead.

4) You don't want to scrape the Kakao stats either, the XML API from Extreme OverClocking is a better choice. Also, what "3-hour-update amount", the linked webpage doesn't show any.

I would suggest you move the stats parsing to a server side script which does all the calculations and stores the values in a JSON file. This file can be requested from Javascript to fill in the counter template.

Re: Folding@home Live Statistics Update

Posted: Fri Sep 21, 2012 4:38 pm
by bruce
The suggestions from smoking2000 are particularly important. In the past, scripts and/or programs have parsed the Stanford statistics for "live" data and have been blocked because of the cumulative load placed on those servers by "everybody" running the script. Limits had to be placed on programs that over-used the stats server, including blocking access for overuse. Your proposed program goes a long way toward limiting the number of accesses to the live stats, but smoking2000's suggestions would make your program even more respectful of the server resources needed to supply the requested data.