Giter VIP home page Giter VIP logo

boinc-field-mod's People

Contributors

grctest avatar mercosity avatar

Watchers

 avatar  avatar  avatar

boinc-field-mod's Issues

/html/ops/team_export.php --> Verify change works

/html/ops/team_export.php

Simply added a field to the export, untested & may be unable to access $project_rain table?

"<team>
   <name>".escape($team->name)."</name>
   <url>".escape($team->url)."</url>
   <type>$team->type</type>
   <name_html>".escape($team->name_html)."</name_html>
   <description>
".escape($team->description)."
    </description>
   <country>$team->country</country>
   <id>$team->id</id>
   <user_email_munged>$user_email_munged</user_email_munged>
   <user_name>".escape($user->name)."</user_name>
   <user_country>".escape($user->country)."</user_country>
   <user_postal_code>".escape($user->postal_code)."</user_postal_code>
   <user_bitshares>".escape($project_rain->bitshares)."</user_bitshares>
   <user_url>".escape($user->url)."</user_url>
</team>
"

/py/BOINC/database.py

/py/BOINC/database.py

Reference User section

class User(DatabaseObject):
    _table = DatabaseTable(
        table = 'user',
        columns = [ 'create_time',
                    'email_addr',
                    'name',
                    'authenticator',
                    'country',
                    'postal_code',
                    'total_credit',
                    'expavg_credit',
                    'expavg_time',
                    'global_prefs',
                    'project_prefs',
                    'teamid',
                    'venue',
                    'url',
                    'send_email',
                    'show_hosts',
                    'posts',
                    'seti_id',
                    'seti_nresults',
                    'seti_last_result_time',
                    'seti_total_cpu',
                    'signature',
                    'has_profile',
                    'cross_project_id',
                    'passwd_hash',
                    'email_validated',
                    'donated'
                    ])

Guesstimated implementation

  • Change: 'project_rain' to the db name defined in the '/db/schema.sql'
  • Change: 'bitshares' to the rebranded term.
class Project_Rain(DatabaseObject):
    _table = DatabaseTable(
        table = 'project_rain',
        columns = [ 'authenticator',
                    'cross_project_id',
                    'bitshares'
                    ])

boinc_db.h

class DB_USER : public DB_BASE, public USER {
public:
    DB_USER(DB_CONN* p=0);
    DB_ID_TYPE get_id();
    void db_print(char*);
    void db_parse(MYSQL_ROW &row);
    void operator=(USER& r) {USER::operator=(r);}
};

struct DB_USER_ : public DB_BASE, public PROJECT_RAIN {
public:
    DB_PROJECT_RAIN(DB_CONN* p=0);
    DB_ID_TYPE get_id();
    void db_print(char*);
    void db_parse(MYSQL_ROW &row);
    void operator=(PROJECT_RAIN& r) {PROJECT_RAIN::operator=(r);}
};

Investigate changing:

  • struct -> class ?
  • DB_USER_ -> DB_USER_DATA

/sched/db_dump.cpp

/sched/db_dump.cpp

DbDump Readme

"This program generates XML files containing project statistics."
"It should be run once a day as a periodic task in config.xml."
"For more info, see https://boinc.berkeley.edu/trac/wiki/DbDump"
"Usage: %s [options]"
"Options:"
"    --dump_spec filename          Use the given config file (use ../db_dump_spec.xml)"
"    [-d N | --debug_level]        Set verbosity level (1 to 4)"
"    [--db_host H]                 Use the DB server on host H"
"    [--retry_period H]            When can't connect to DB, retry after N sec instead of terminating"
"    [-h | --help]                 Show this"
"    [-v | --version]              Show version information",

DbDump write_user reference segment

void write_user(USER& user, FILE* f, bool /*detail*/) {
    char buf[1024];
    char cpid[MD5_LEN];

    char name[2048], url[2048];
    xml_escape(user.name, name, sizeof(name));
    xml_escape(user.url, url, sizeof(url));

    safe_strcpy(buf, user.cross_project_id);
    safe_strcat(buf, user.email_addr);
    md5_block((unsigned char*)buf, strlen(buf), cpid);

    fprintf(f,
        "<user>"
        " <id>%lu</id>"
        " <name>%s</name>"
        " <country>%s</country>"
        " <create_time>%d</create_time>"
        " <total_credit>%f</total_credit>"
        " <expavg_credit>%f</expavg_credit>"
        " <expavg_time>%f</expavg_time>"
        " <cpid>%s</cpid>",
        user.id,
        name,
        user.country,
        user.create_time,
        user.total_credit,
        user.expavg_credit,
        user.expavg_time,
        cpid
    );
    if (strlen(user.url)) {
        fprintf(f,
            " <url>%s</url>",
            url
        );
    }
    if (user.teamid) {
        fprintf(f,
            " <teamid>%lu</teamid>",
            user.teamid
        );
    }
    if (user.has_profile) {
        fprintf(f,
            " <has_profile/>"
        );
    }
    fprintf(f,
        "</user>"
    );
}
  • Create rain equivelant of write_user
    • 'USER& user' -> Custom equivelant?
    • Able to import 'USER& user' AND 'RAIN& rain', or will we only be able to export from one table at a time? No joins?
      • We may need to include more info in our schema, such as RAC and TotalCredit, if we cannot import 2 table contents..
      • New concern: We will need to get the BOINC server updating both the user and rain tables for total_credit and expavg_credit. An update function is likely in the db files.
  • Reducing the size of the xml extract by minimizing the field names.
    • user -> u
    • total_credit -> trac
    • expavg_credit -> rac
  • If XML validation isn't being performed during the dump, we could potentially switch to an alternative to xml to further reduce the filesize of dumped files. JSON for example.
  • We check that the user has provided the information we want to scrape, if they haven't then they aren't included in the xml dump - further reducing the file size.
void write_rain(RAIN& rain, USER& user, FILE* f, bool /*detail*/) {
    char buf[1024];
    char cpid[MD5_LEN];
    safe_strcpy(buf, user.cross_project_id);
    safe_strcat(buf, user.email_addr);
    md5_block((unsigned char*)buf, strlen(buf), cpid);

    if (user.rain) {
    fprintf(f,
        "<u>"
        " <id>%lu</id>"
        " <trac>%f</trac>"
        " <rac>%f</rac>"
        " <cpid>%s</cpid>"
        " <rain>%s</rain>"
        "</u>",
        user.id,
        user.total_credit,
        user.expavg_credit,
        cpid,
        rain.data
    );
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.