Folding@Home Stats currently unavailable


View unanswered posts | View active topics It is currently Sat May 18, 2013 4:20 pm









Reply to topic  [ 10 posts ] 
 b0rg installer 
Author Message
User avatar

Joined: Sat Oct 29, 2005 4:27 pm
Posts: 393
Location: Cleveland, Ohio, USA
Post b0rg installer
a while ago i started to work on a b0rg installer. i found out that the config file has to be a binary file in order to work. i didnt kno how to do this in c++ so i took a break. here is what i had come up with. let me know if u have any suggestions.

Code:
// b0rg.cpp : written by goliathdrakken
//hack-a-day fah b0rg installer

#include "stdafx.h"
#include <fstream>
#include <windows.h>
using namespace std;


// Use to change the divisor from Kb to Mb.

#define DIV 1024
// #define DIV 1

char *divisor = "K";
// char *divisor = "";

// Handle the width of the field in which to print numbers this way to
// make changes easier. The asterisk in the print format specifier
// "%*ld" takes an int from the argument list, and uses it to pad and
// right-justify the number being formatted.
#define WIDTH 6



void main(int argc, char *argv[])
{
  ofstream fout;
  ofstream log;
  int x;
  int big;
  MEMORYSTATUS stat;

  GlobalMemoryStatus (&stat);

  log.open ("install.log");

  printf ("Welcome to the hack-a-day folding@home installer.\n\n");
  log << "Welcome to the hack-a-day folding@home installer.\n\n";
  printf ("There are %*ld total %sbytes of physical memory.\n",
          WIDTH, stat.dwTotalPhys/DIV/DIV, divisor);
  log << "There are %*ld total %sMbytes of physical memory.\n",
         WIDTH, stat.dwTotalPhys/DIV/DIV, divisor;

  if (stat.dwTotalPhys/DIV/DIV < 450)
   {
   big=0;
   printf ("Based on your memory size F@H will install with\n");
   log << "Based on your memory size F@H will install with\n";
   printf ("large work units DISABLED.\n\n");
   log << "large work units DISABLED.\n\n";
   }
  else
   {
   big=1;
   printf ("Based on your memory size F@H will install with\n");
   log << "Based on your memory size F@H will install with\n";
   printf ("large work units ENABLED.\n\n");
   log << "large work units ENABLED.\n\n";
   }

  fout.open ("client.cfg");
  fout << "[settings]" << endl;
  log << "[settings]" << endl;
  fout << "username=goliathdrakken" << endl;
  log  << "username=goliathdrakken" << endl;
  fout << "team=44851" << endl;
  log << "team=44851" << endl;
  fout << "asknet=no" << endl;
  log << "asknet=no" << endl;
  if (big = 0)
   {fout << "bigpackets=no" << endl;
    log << "bigpackets=no" << endl;}
  else
   {fout << "bigpackets=yes" << endl;
    log << "bigpackets=yes" << endl;}
  fout << "machineid=1" << endl;
  log << "machineid=1" << endl;
  fout << "local=11" << endl << endl;
  log << "local=11" << endl << endl;
  fout << "[http]" << endl;
  log << "[http]" << endl;
  fout << "active=no" << endl;
  log << "active=no" << endl;
  fout << "host=localhost" << endl;
  log << "host=localhost" << endl;
  fout << "port=8080" << endl;
  log << "port=8080" << endl;
  fout << "usereg=yes" << endl << endl;
  log << "usereg=yes" << endl << endl;
  fout << "[power]" << endl;
  log << "[power]" << endl;
  fout << "battery=yes" << endl << endl;
  log << "battery=yes" << endl << endl;
  fout << "[core]" << endl;
  log << "[core]" << endl;
  fout << "checkpoint=5" << endl << endl;
  log << "checkpoint=5" << endl << endl;

  system("pause");
}



The thing i liked about this script is it detected the system ram and it made the config file accordingly. i also want to have it check for hyperthreading and multipule cpu's.

_________________
Image
Image


Last edited by goliathdrakken on Wed Nov 02, 2005 11:15 am, edited 1 time in total.



Tue Nov 01, 2005 8:00 pm
Profile WWW


User avatar

Joined: Tue Nov 01, 2005 11:37 am
Posts: 1639
Location: South Bend / Mishawaka, IN
Post 
looks good, cept my c++ is hella rusty.

I use Java more. :P

_________________
“In the destructive element immerse!”


Wed Nov 02, 2005 1:08 am
Profile ICQ YIM WWW
User avatar

Joined: Sat Oct 29, 2005 4:27 pm
Posts: 393
Location: Cleveland, Ohio, USA
Post 
i originally had started this in java, however i could not find a method of detecting system ram without using 3 pages of code. so i resorted to trusty olde c++. and plus i already knew how to manipulate files using c++ and i didnt feel like learning another language just for one project. but now that i ran into a dead end w/ the config file im back to step one.

_________________
Image
Image


Wed Nov 02, 2005 1:52 am
Profile WWW

Joined: Fri Oct 28, 2005 8:37 pm
Posts: 47
Location: elgin.il
Post 
Nice, except a 5 minute checkpoint increases file fragmentation, switching it back to 15 generally is better.
Maybe also a couple pre-compiled binaries for people to use too?

Don't take this the wrong way just offering suggestions.


Wed Nov 02, 2005 9:43 am
Profile WWW
User avatar

Joined: Sun Oct 30, 2005 9:44 am
Posts: 528
Location: UK
Post 
It wont compile in Dev C++ so there is a bug in it.

_________________
Image
Image


Thu Nov 03, 2005 11:21 am
Profile
User avatar

Joined: Sat Oct 29, 2005 4:27 pm
Posts: 393
Location: Cleveland, Ohio, USA
Post 
do you have all the include files, like stdafx.h? This was created in studio .net so mostlikely u dont have all the necessary header files.

_________________
Image
Image


Thu Nov 03, 2005 11:38 am
Profile WWW
User avatar

Joined: Sun Oct 30, 2005 9:44 am
Posts: 528
Location: UK
Post 
Where do i get the files? Microsoft?

_________________
Image
Image


Thu Nov 03, 2005 11:38 am
Profile
User avatar

Joined: Sat Oct 29, 2005 4:27 pm
Posts: 393
Location: Cleveland, Ohio, USA
Post 
do you have all the include files, like stdafx.h? This was created in studio .net so mostlikely u dont have all the necessary header files.

_________________
Image
Image


Thu Nov 03, 2005 11:41 am
Profile WWW
User avatar

Joined: Thu Oct 27, 2005 12:39 pm
Posts: 4517
Location: Cleveland, Ohio, USA
Post 
It can't be that broken as my compiled version works just fine.

All it needs is to be implemented into a script of some sort that uses its output to make decisions based on computer specs.

_________________
[img:468:100]http://img386.imageshack.us/img386/4585/shinerbockbf4.gif[/img]
(1.21 gigawatts) / (88 miles per hour) = 30757874 newtons


Thu Nov 03, 2005 11:48 am
Profile WWW
User avatar

Joined: Sun Oct 30, 2005 9:44 am
Posts: 528
Location: UK
Post 
Thats what I thought (the errors were all NT subsystem based im running XP
)

_________________
Image
Image


Thu Nov 03, 2005 12:33 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 10 posts ] 

Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.