コード例 #1
0
ファイル: function.php プロジェクト: pezzabros/Loki
function addNewConcept()
{
    global $conn;
    $log = "";
    $num_images_pending = ew_ExecuteScalar("select count(*) from training_concepts WHERE (id_training_concepts_status \t = 4)");
    echo "{$num_images_pending} training concepts to add<br>";
    if ($num_images_pending) {
        $image_to_download = EW_FLICKR_IMAGE_DOWNLOADED;
        $rs = $conn->Execute("SELECT * from training_concepts WHERE (id_training_concepts_status \t = 4 ) ");
        $rs->MoveFirst();
        while (!$rs->EOF) {
            $pid = $rs->fields('processId');
            echo "<br> Il concetto " . $rs->fields('name') . " con pid: {$pid} ha terminato il processing";
            $name = $rs->fields('name');
            $bow_svm_models = EW_SHOTANALYZER_PATH . "/data/BoWNew/bow_svm_models.txt";
            append_txt($name . "," . $name . "/", $bow_svm_models);
            $file_bow_synonyms = EW_SHOTANALYZER_PATH . "/data/BoWNew/bow_synonyms.txt";
            append_txt($name, $file_bow_synonyms);
            $conn->Execute("UPDATE training_concepts  set id_training_concepts_status = 5 WHERE id = '" . $rs->fields('id') . "'");
            $rs->MoveNext();
        }
    }
}
コード例 #2
0
ファイル: solrProxy.php プロジェクト: pezzabros/Loki
// More info about this object at www.troywolf.com/articles
if (!($h = new http())) {
    header("HTTP/1.0 501 Script Error");
    echo "proxy.php failed trying to initialize the http object";
    exit;
}
$h->url = $proxy_url;
$h->postvars = $_POST;
if (!$h->fetch($h->url)) {
    header("HTTP/1.0 501 Script Error");
    echo "proxy.php had an error attempting to query the url";
    exit;
}
// Forward the headers to the client.
$ary_headers = split("\n", $h->header);
//
foreach ($ary_headers as $hdr) {
    header($hdr);
}
// Send the response body to the client.
echo $h->body;
//$xml=$h->body;
//writing log
append_txt("\n\n" . date('c') . '\\n' . $h->log, 'log.txt');
function append_txt($string, $file_txt)
{
    $file = fopen($file_txt, "a");
    fseek($file, 0);
    fputs($file, $string . "\n");
    fclose($file);
}