Not sure if anyone would be interested in this quick script I threw together but I figured I'd post it to see if anyone would like to see it released:
http://andrew.ericbarch.com/~eric
All you have to do is point it to the directories where your F@H unitinfo.txt is located and it will parse it and display the info (with the choosing of your label).
It's only 50 lines of code, so it's not a whole lot...but if there's enough interest I'll consider putting up the source code for download.
What does everyone think?
EDIT:
I'm going to go ahead and release the source (please post cool mods and updates you make...I know the script is super basic right now.)
Source Code:
http://andrew.ericbarch.com/~eric/index.php.txt
PHP Driven Stats
Moderator: Site Moderators
PHP Driven Stats
Last edited by ericbarch on Fri Nov 28, 2008 10:28 pm, edited 2 times in total.
-
- Site Moderator
- Posts: 6349
- Joined: Sun Dec 02, 2007 10:38 am
- Location: Bordeaux, France
- Contact:
Re: PHP Driven Stats
Simple and efficient
Just a little question : how do you host your stats ? Do you need a local webserver ? or do you have to upload to host the results somewhere ?
Just a little question : how do you host your stats ? Do you need a local webserver ? or do you have to upload to host the results somewhere ?
Re: PHP Driven Stats
It's just hosted on a local apache webserver for simplicity...but if you wanted to use 1 server as your "stat" server you could always have your machines just auto-FTP the unitinfo.txt files to the stat server and have that machine generate the progress page with PHP.
-
- Posts: 363
- Joined: Tue Feb 12, 2008 7:33 am
- Hardware configuration: Running exclusively Linux headless blades. All are dedicated crunching machines.
- Location: SE Michigan, USA
Re: PHP Driven Stats
Nicely done Eric
Re: PHP Driven Stats
In case this gets popular and for efficiency sake, I'd suggest switching to a stylesheet rather than inline styles. That would reduce the amount of text sent to the client.
gj n1
gj n1
Re: PHP Driven Stats
I went ahead and did a stylesheet for you...
- break tags are now closed (helps when coding in XSL...all tags must be closed...a good habit to get into)
- since I assume you're doing some math to calculate the white part of the progress bars, I left that style inline so you can drop in the % complete number
- specifying a font color for the .bar class is redundant (since your body text is white and so is the text in the progress bar) but it'll make it easier to change it in the future (if needed)
- got rid of a bunch of < span > tags that weren't being used (in the "Core x" lines and other places). The span tags weren't being closed, so I knew they weren't used at all.
Only ~9% reduction in size, but stylesheets make changing the look so much easier plus the PHP code will be easier to edit (less HTML mixed in with the PHP). For example, to change the color of the progress bars, you now have to change only one thing, not the same thing in four places.
- break tags are now closed (helps when coding in XSL...all tags must be closed...a good habit to get into)
- since I assume you're doing some math to calculate the white part of the progress bars, I left that style inline so you can drop in the % complete number
- specifying a font color for the .bar class is redundant (since your body text is white and so is the text in the progress bar) but it'll make it easier to change it in the future (if needed)
- got rid of a bunch of < span > tags that weren't being used (in the "Core x" lines and other places). The span tags weren't being closed, so I knew they weren't used at all.
Only ~9% reduction in size, but stylesheets make changing the look so much easier plus the PHP code will be easier to edit (less HTML mixed in with the PHP). For example, to change the color of the progress bars, you now have to change only one thing, not the same thing in four places.
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>F@H Stats</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
<meta http-equiv="refresh" content="60">
<style type="text/css">
<!--
body {background-color:#000000; font-family:arial; font-size:12px; color:#FFFFFF;}
.header {font-size:28px; font-weight:bold;}
.box {width:300px; background-color:#CCCCCC;}
.bar {background-color:#0000CC; color:#FFFFFF;}
.uptime {font-size:13px;}
.footer {font-size:10px;}
-->
</style>
</head>
<body>
<div class="header">F@H Stats - PHP Edition</div>
<br /><br />
<b>Core 1</b><br />Name: p896_p53longpeptides_GB
<br />Download time: October 20 07:29:30
<br />Due time: December 6 07:29:30
<br /><div class="box"><div class="bar" style="width:51px;"> 17%</div></div><br /><b>Core 2</b><br />Name: p896_p53longpeptides_GB
<br />Download time: October 19 23:46:49
<br />Due time: December 5 23:46:49
<br /><div class="box"><div class="bar" style="width:120px;"> 40%</div></div><br /><b>Core 3</b><br />Name: p895_p53peptides_gb
<br />Download time: October 19 23:59:43
<br />Due time: December 3 23:59:43
<br /><div class="box"><div class="bar" style="width:153px;"> 51%</div></div><br /><b>Core 4</b><br />Name: p895_p53peptides_gb
<br />Download time: October 20 04:13:21
<br />Due time: December 4 04:13:21
<br /><div class="box"><div class="bar" style="width:108px;"> 36%</div></div><br /><span class="uptime"> 09:22:57 up 4 days, 14:12, 0 users, load average: 4.00, 3.99, 3.91</span><br />
<span class="footer">Page auto-refreshes every 60 seconds. Engine by <a href="http://ericbarch.com">Eric Barch</a>.</span>
</body>
</html>
Re: PHP Driven Stats
Sweet, thanks for the suggestions. I've implemented most of it now and I'm going to go ahead and release the source (please post cool mods and updates you make...I know the script is super basic right now.)
Here's the working demo:
http://andrew.ericbarch.com/~eric/index.php
Source Code:
http://andrew.ericbarch.com/~eric/index.php.txt
Here's the working demo:
http://andrew.ericbarch.com/~eric/index.php
Source Code:
http://andrew.ericbarch.com/~eric/index.php.txt