Example #1
0
 private function run_list()
 {
     $task_id = element('task', $this->query_string);
     $setup_id = element('setup', $this->query_string);
     $implementation_id = element('flow', $this->query_string);
     $uploader_id = element('uploader', $this->query_string);
     $run_id = element('run', $this->query_string);
     if ($task_id == false && $setup_id == false && $implementation_id == false && $uploader_id == false && $run_id == false) {
         $this->returnError(510, $this->version);
         return;
     }
     if (is_safe($task_id) && is_safe($setup_id) == false && is_safe($implementation_id) == false && is_safe($uploader_id) == false && is_safe($run_id) == false) {
         $this->returnError(511, $this->version);
         return;
     }
     $where_task = $task_id == false ? '' : ' AND `r`.`task_id` IN (' . $task_id . ') ';
     $where_setup = $setup_id == false ? '' : ' AND `r`.`setup` IN (' . $setup_id . ') ';
     $where_uploader = $uploader_id == false ? '' : ' AND `r`.`uploader_id` IN (' . $uploader_id . ') ';
     $where_impl = $implementation_id == false ? '' : ' AND `i`.`id` IN (' . $implementation_id . ') ';
     $where_run = $run_id == false ? '' : ' AND `r`.`rid` IN (' . $run_id . ') ';
     $where_total = $where_task . $where_setup . $where_uploader . $where_impl . $where_run;
     $sql = 'SELECT r.rid, r.uploader, r.task_id, d.did AS dataset_id, d.name AS dataset_name, r.setup, i.id, i.name AS flow_name ' . 'FROM run r LEFT JOIN task_inputs t ON r.task_id = t.task_id AND t.input = "source_data" LEFT JOIN dataset d ON t.value = d.did , algorithm_setup s, implementation i ' . 'WHERE r.setup = s.sid AND i.id = s.implementation_id ' . $where_total;
     $res = $this->Run->query($sql);
     if ($res == false) {
         $this->returnError(512, $this->version);
         return;
     }
     if (count($res) > 10000) {
         $this->returnError(513, $this->version, 'Size of result set: ' . count($res) . '; max size: 10000. ');
         return;
     }
     $this->xmlContents('runs', $this->version, array('runs' => $res));
 }
Example #2
0
function eight_queens($n)
{
    global $length;
    global $queen;
    for ($i = 0; $i < $length; $i++) {
        $queen[$n] = $i;
        if (is_safe($n)) {
            if ($n == $length - 1) {
                print_queen();
            } else {
                eight_queens($n + 1);
            }
        }
    }
}
Example #3
0
 function all_wrong($run_ids)
 {
     if (is_safe($run_ids) == false) {
         die('run id input not safe. ');
     }
     $runs = $this->Run->getWhere('`rid` IN (' . $run_ids . ')');
     if (count($runs) == 0) {
         die('no runs found.');
     }
     $task_id = $runs[0]->task_id;
     $command = 'java -jar ' . $this->evaluation . ' -f "all_wrong" -t ' . $task_id . ' -r ' . $run_ids . $this->config;
     $this->Log->cmd('API Splits::all_wrong(' . $run_ids . ')', $command);
     if (function_enabled('system')) {
         header('Content-type: text/plain');
         system(CMD_PREFIX . $command);
     } else {
         die('failed to generate arff file: php "system" function disabled. ');
     }
 }
Example #4
0
 public function xsd($filename, $version)
 {
     if (is_safe($filename) && file_exists(xsd($filename, $this->controller, $version))) {
         header('Content-type: text/xml; charset=utf-8');
         echo file_get_contents(xsd($filename, $this->controller, $version));
     } else {
         $this->error404();
     }
 }
Example #5
0
 private function _openml_runs()
 {
     $task_id = $this->input->get_post('task_id');
     $setup_id = $this->input->get_post('setup_id');
     $implementation_id = $this->input->get_post('implementation_id');
     if ($task_id == false && $setup_id == false && $implementation_id == false) {
         $this->_returnError(510);
         return;
     }
     if (is_safe($task_id) == false || is_safe($setup_id) == false || is_safe($implementation_id) == false) {
         $this->_returnError(511);
         return;
     }
     $where_task = $task_id == false ? '' : ' AND task_id IN (' . $task_id . ') ';
     $where_setup = $setup_id == false ? '' : ' AND setup IN (' . $setup_id . ') ';
     $where_impl = $implementation_id == false ? '' : ' AND implementation_id IN (' . $implementation_id . ') ';
     $sql = 'SELECT r.rid, r.uploader, r.task_id, r.setup, s.implementation_id, s.setup_string ' . 'FROM run r, algorithm_setup s WHERE r.setup = s.sid ' . $where_task . $where_setup . $where_impl;
     $res = $this->Run->query($sql);
     if ($res == false) {
         $this->_returnError(512);
         return;
     }
     $this->_xmlContents('runs', array('runs' => $res));
 }