Changes between Version 9 and Version 10 of BossaExampleOne


Ignore:
Timestamp:
Feb 12, 2008, 11:36:04 AM (16 years ago)
Author:
davea
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • BossaExampleOne

    v9 v10  
    3030
    3131Visit http://a.b.c/test_ops/bossa_ops.php,
    32 and create an application with short name "ellipse".
     32and create an application with short name "bossa_example".
     33
     34The application is define by three scripts in~/projects/test/html/:
     35
     36 * '''ops/bossa_example_workgen.php''': this generates more jobs.
     37 * '''user/bossa_example_display.php''': show a job, and handle user response.
     38 * '''inc/bossa_example_backend.php''': compare and handle completed jobs.
     39
     40We'll go through these scripts and explain how they work.
     41To develop your own Bossa applications you'll need to write corresponding scripts.
    3342
    3443== A script to generate jobs ==
    3544
    3645First, let's generate some jobs.
    37 We'll do this with a PHP script, html/ops/bossa_test.php: copy this from
    38 [source:/trunk/boinc/html/ops/bossa_test.php html/ops/bossa_test.php].
     46We'll do this with a PHP script, [source:/trunk/boinc/html/ops/bossa_example_workgen.php html/ops/bossa_example_workgen.php].
    3947
    4048The first part of this script is code for generating an image;
     
    7886}}}
    7987
    80 This function creates one job.
    81 It does the following:
     88This function creates one job, as follows:
    8289
    8390 * Choose a name for the job, and a name for the corresponding image file.
     
    119126looks up the application in the database, and creates some jobs.
    120127You can invoke this by visiting
    121 '''http://a.b.c/test_ops/bossa_test.php?make_jobs=10'''.
     128'''http://a.b.c/test_ops/bossa_example_workgen.php?make_jobs=10'''
     129(or use the link on the http://a.b.c/test_ops/bossa_ops.php).
    122130
    123131== Displaying jobs ==
    124132
    125 Next we'll need a script that displays a job to a volunteer,
    126 and handles their response.
    127 This uses a PHP script, html/user/ellipse_display.php: copy this from
    128 [source:/trunk/boinc/html/user/bossa_example.php html/user/bossa_example.php].
     133Next we'll explain the script that displays a job to a volunteer
     134and handles their response: [source:/trunk/boinc/html/user/bossa_example.php bossa_example_display.php].
    129135{{{
    130136function show_job($bj, $bji) {
     
    132138    $img_url = $info.url;
    133139    echo "
    134         <form method=get action=ellipse_display.php>
     140        <form method=get action=bossa_example_display.php>
    135141        Click on the center of the ellipse.
    136142        If you don't see one, click here:
     
    166172}}}
    167173
    168 The script calls '''Bossa::script_init()''' to get objects describing
     174The script calls '''Bossa::script_init()''' to get PHP objects describing
    169175the user, the job, and the job instance.
    170176
     
    181187
    182188Finally, we need to specify how results are handled.
    183 This is specified in "html/inc/ellipse_handler.inc".
     189This is specified in [source:/trunk/boinc/html/inc/bossa_example_backend.inc bossa_example_backend.inc].
    184190
    185191This defines two functions, which must have names '''X_compare''' and '''X_handle'''
     
    188194The first function compares two instances and decides if they are compatible:
    189195{{{
    190 function ellipse_compare($r1, $r2) {
     196function bossa_example_compare($r1, $r2) {
    191197    if ($r1->have_ellipse) {
    192198        if ($r2->have_ellipse) {
     
    208214i.e. a consensus set has been found:
    209215{{{
    210 function ellipse_handle($bj, $c) {
     216function bossa_example_handle($bj, $c) {
    211217    $res = $c[0];
    212218    if ($res->have_ellipse) {