${'bing' . $i} = array();
    readFromFile(${'bing' . $i}, $bingDirectory, $fileName);
    //getMetrics
    getMetrics($mainMetrics, $goldStandardArr, "bing", $query, $queryNumber, ${'bing' . $i});
    ${'blekko' . $i} = array();
    readFromFile(${'blekko' . $i}, $blekkoDirectory, $fileName);
    //getMetrics
    getMetrics($mainMetrics, $goldStandardArr, "blekko", $query, $queryNumber, ${'blekko' . $i});
    ${'google' . $i} = array();
    readFromFile(${'google' . $i}, $googleDirectory, $fileName);
    //getMetrics
    getMetrics($mainMetrics, $goldStandardArr, "google", $query, $queryNumber, ${'google' . $i});
    ${'aggregated' . $i} = array();
    readFromFile(${'aggregated' . $i}, $aggregatedDirectory, $fileName);
    //getMetrics
    getMetrics($mainMetrics, $goldStandardArr, "aggregated", $query, $queryNumber, ${'aggregated' . $i});
    ${'weighted' . $i} = array();
    readFromFile(${'weighted' . $i}, $weightedDirectory, $fileName);
    //getMetrics
    getMetrics($mainMetrics, $goldStandardArr, "weighted", $query, $queryNumber, ${'weighted' . $i});
}
//Call Function to calculate the Mean Average Precision
getMaps($mapScores, $mainMetrics);
//DISPLAY THE RESULTS
displayMetrics($mainMetrics, $mapScores);
//function in metrics.php
//WRITE THE METRICS SCORES TO FILES
writeToFile($mainMetrics, "metrics/evaluationScores", "mainMetrics");
writeToFile($mapScores, "metrics/evaluationScores", "mapScores");
//WRITE THE METRICS TO CSV FILE
writeToCSV($mainMetrics, $mapScores, "metrics/evaluationScores", "combinedMetrics");
예제 #2
0
function getMapsCount($userId)
{
    return count(getMaps($userId));
}
예제 #3
0
 function purgStatistics($days)
 {
     if ((int) $days == 0) {
         return false;
     }
     $maps_id = array();
     $maps = getMaps($this->users_id);
     foreach ($maps as $map) {
         $maps_id[] = $map['id'];
     }
     if (count($maps_id) == 0) {
         return $records;
     }
     $res = pg_query($this->stats_db, " DELETE \n\t\t\t\t\t\t\tFROM statistics_maps_view \n\t\t\t\t\t\t\t\tWHERE maps_id IN (" . implode(",", $maps_id) . ") AND \n\t\t\t\t\t\t\t\tviewed_at < (NOW() - INTERVAL '" . $days . " days')") or die("Database Error");
     return pg_affected_rows($res);
 }
예제 #4
0
            $fileSource = "http://ndbserver.rutgers.edu/";
        } else {
            $tmpfile == null;
        }
    }
    if ($tmpfile == null) {
        $_SESSION['bgjob']['newModel'] = null;
    } else {
        $id = addModelOrEnsemble($tmpfile, strtolower("{$code}.pdb"), $_SESSION['bgjob']['isCnsFormat'], $_SESSION['bgjob']['ignoreSegID'], false);
        if (isset($_SESSION['bgjob']['xray'])) {
            addXraydata(strtolower($code), $id);
        }
        // Clean up temp files
        unlink($tmpfile);
        if (preg_match('/^[0-9A-Z]{4}$/i', $code) && ($_SESSION['bgjob']['eds_2fofc'] || $_SESSION['bgjob']['eds_fofc'])) {
            getMaps($code);
        }
    }
} else {
    // Remove illegal chars from the upload file name
    $origName = censorFileName($_SESSION['bgjob']['origName'], array("pdb", "ent", "xyz", "mtz"));
    $fileSource = "local disk";
    if (isset($_SESSION['bgjob']['tmpPdb'])) {
        $id = addModelOrEnsemble($_SESSION['bgjob']['tmpPdb'], $origName, $_SESSION['bgjob']['isCnsFormat'], $_SESSION['bgjob']['ignoreSegID'], true);
        // Clean up temp files
        unlink($_SESSION['bgjob']['tmpPdb']);
    } elseif (isset($_SESSION['bgjob']['tmpMtz'])) {
        addMtz($_SESSION['bgjob']['tmpMtz'], $origName);
        // Clean up temp files
        unlink($_SESSION['bgjob']['tmpMtz']);
    }
예제 #5
0
    $maps = array();
    //$r = ceil(strlen($map)/$width);
    for ($i = 0; $i < strlen($map); $i += 3) {
        $ss = substr($map, $i, 3);
        $maps[] = $ss;
    }
    return $maps;
}
class response
{
    var $map;
    var $moves;
}
if (strlen($map) == $width * $width) {
    $p_row = findRow($map, $width, "p");
    $p_column = findColumn($map, $width, "p");
    $w_row = findRow($map, $width, "w");
    $w_column = findColumn($map, $width, "w");
    $f_row = findRow($map, $width, "f");
    $f_column = findColumn($map, $width, "f");
    $move1 = findDirection($p_row, $p_column, $w_row, $w_column);
    $move2 = findDirection($w_row, $w_column, $f_row, $f_column);
    $all_move = array_merge($move1, $move2);
    //print_r($all_move);
    header('Content-type: application/json');
    $maps = getMaps($map, $width);
    $response = new response();
    $response->map = $maps;
    $response->moves = $all_move;
    echo json_encode($response);
}
예제 #6
0
파일: 119.php 프로젝트: rudiedirkx/Games
<?php

// PICROSS
require __DIR__ . '/inc.functions.php';
$g_arrMaps = getMaps();
if (!($level = getLevelFromInput($map))) {
    $level = getLevel();
    $map = prepareMap($g_arrMaps[$level]);
}
$levelName = $level == 999 ? hashMap($map) : $level;
if (isset($_POST['cheat'])) {
    header('Content-type: text/json');
    exit(strtr(json_encode(array('map' => $map['map'])), ['x' => 1, '_' => 0]));
}
?>
<!doctype html>
<html>

<head>
	<meta name="viewport" content="width=device-width, initial-scale=1" />
	<title>PICROSS <?php 
echo $levelName;
?>
</title>
	<link rel="stylesheet" href="119.css" />
</head>

<body>
	<table id="picross">
		<thead>
			<tr>
예제 #7
0
파일: rg2api.php 프로젝트: AtleH/rg2
function handleGetRequest($type, $id)
{
    validateCache($id);
    $output = array();
    //rg2log("Type ".$type."|ID ".$id);
    switch ($type) {
        case 'events':
            if (file_exists(CACHE_DIRECTORY . "events.json")) {
                $output = file_get_contents(CACHE_DIRECTORY . "events.json");
            } else {
                // FALSE = don't include stats in output
                $output = getAllEvents(FALSE);
                @file_put_contents(CACHE_DIRECTORY . "events.json", $output);
            }
            break;
        case 'stats':
            if (file_exists(CACHE_DIRECTORY . "stats.json")) {
                $output = file_get_contents(CACHE_DIRECTORY . "stats.json");
            } else {
                // TRUE = do include stats in output
                $output = getAllEvents(TRUE);
                @file_put_contents(CACHE_DIRECTORY . "stats.json", $output);
            }
            break;
        case 'courses':
            if (file_exists(CACHE_DIRECTORY . "courses_" . $id . ".json")) {
                $output = file_get_contents(CACHE_DIRECTORY . "courses_" . $id . ".json");
            } else {
                $output = getCoursesForEvent($id);
                @file_put_contents(CACHE_DIRECTORY . "courses_" . $id . ".json", $output);
            }
            break;
        case 'results':
            if (file_exists(CACHE_DIRECTORY . "results_" . $id . ".json")) {
                $output = file_get_contents(CACHE_DIRECTORY . "results_" . $id . ".json");
            } else {
                $output = getResultsForEvent($id);
                @file_put_contents(CACHE_DIRECTORY . "results_" . $id . ".json", $output);
            }
            break;
        case 'maps':
            $output = getMaps();
            break;
        case 'tracks':
            if (file_exists(CACHE_DIRECTORY . "tracks_" . $id . ".json")) {
                $output = file_get_contents(CACHE_DIRECTORY . "tracks_" . $id . ".json");
            } else {
                $output = getTracksForEvent($id);
                @file_put_contents(CACHE_DIRECTORY . "tracks_" . $id . ".json", $output);
            }
            break;
        case 'lang':
            $output = getLanguage($id);
            break;
        case 'splitsbrowser':
            $output = getSplitsbrowser($id);
            break;
        default:
            rg2log("Get request not recognised: " . $type . ", " . $id);
            $output = json_encode("Request not recognised.");
            break;
    }
    if ($type == 'splitsbrowser') {
        echo $output;
    } else {
        // output JSON data
        header("Content-type: application/json");
        echo "{\"data\":" . $output . "}";
    }
}
/**
 * ShopEx licence
 *
 * @copyright  Copyright (c) 2005-2013 ShopEx Technologies Inc. (http://www.shopex.cn)
 * @license  http://ecos.shopex.cn/ ShopEx License
 */
function theme_widget_goodscat(&$setting, &$render)
{
    $cat_list = getMaps();
    return $cat_list;
}