* This file is part of LibreNMS. * * @package librenms * @subpackage graphing * @copyright (C) 2006 - 2012 Adam Armstrong */ $start = microtime(true); if (isset($_GET['debug'])) { $debug = true; ini_set('display_errors', 1); ini_set('display_startup_errors', 0); ini_set('log_errors', 0); ini_set('error_reporting', E_ALL); } else { $debug = false; ini_set('display_errors', 0); ini_set('display_startup_errors', 0); ini_set('log_errors', 0); ini_set('error_reporting', 0); } $init_modules = array('web', 'graphs'); require realpath(__DIR__ . '/..') . '/includes/init.php'; rrdtool_initialize(false); require $config['install_dir'] . '/html/includes/graphs/graph.inc.php'; rrdtool_close(); if ($debug) { echo '<br />'; printf("Runtime %.3fs", microtime(true) - $start); echo '<br />'; printStats(); }
foreach ($output as $i => $statblock) { printf('%02X | %02d %03d %03d %03d %03d %03d %03d | %02X %02X %02X %02X %02X' . PHP_EOL, $i, $statblock['Level'], $statblock['HP'], $statblock['MP'], $statblock['Attack'], $statblock['Defense'], $statblock['Agility'], $statblock['Intelligence'], $statblock['ComboAbility1'], $statblock['ComboAbility2'], $statblock['ComboAbility3'], $statblock['ComboAbility4'], $statblock['ComboAbility5']); } } function printUnknown($file) { fseek($file, 0x6a616); $output = []; $totals = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; for ($i = 0; $i < 32; $i++) { for ($j = 1; $j < 100; $j++) { $output[$i][$j] = ord(fgetc($file)); } } echo 'LV | 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ' . PHP_EOL; echo '------------------------------------------------------------------------------------------------------------------------------------' . PHP_EOL; for ($i = 1; $i < 100; $i++) { printf('%02d | ', $i); foreach ($output as $k => $levelarray) { $totals[$k] += $levelarray[$i]; $totals[$k] = min($totals[$k], 999); printf('%02d ', $levelarray[$i]); } echo PHP_EOL; } echo '------------------------------------------------------------------------------------------------------------------------------------' . PHP_EOL; vprintf('TOT| %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d', $totals); } printStats($file); printMoveReqs($file); printUnknown($file);
return $index; } $index++; } #echo str_replace("<", "\n<", $doc->saveXML()); exit; $notfound[] = $title; return -1; } $dbr = wfGetDB(DB_MASTER); $limit = isset($argv[0]) ? $argv[0] : 1000; $res = $dbr->query("SELECT page_title from page where page_is_redirect=0 and page_namespace=0 order by rand() limit {$limit};"); $total = $indexed = 0; while ($row = $dbr->fetchObject($res)) { $t = Title::makeTitle(NS_MAIN, $row->page_title); if (!$t) { continue; } $ret = search($t, "site:wikihow.com"); if ($ret > 0) { $indexed++; } if ($ret > -2) { $total++; } echo "{$ret}\t" . number_format($total / $limit * 100, 2) . "%\t{$t->getFullURL()}\n"; } echo "NOT FOUND:\n"; printStats($notfound); echo "FOUND:\n"; printStats($found); echo "{$total}\t{$indexed}\t" . number_format($indexed / $total * 100, 2) . "%\n";
/** * Shows a list of all the deputies, sorted by the percentage of presence * in votes. */ function showSenatePresencePercentage($sortby, $order) { global $cid; if ($sortby != 'percent' && $sortby != 'seconds' && $sortby != 'idparty' && $sortby != 'name') { $sortby = 'percent'; } if ($order != 'desc' && $order != 'asc') { $order = 'asc'; if ($sortby == 'percent') { $order = 'desc'; } if ($sortby == 'name') { $order = 'asc'; } } if ($sortby == 'idparty') { $sortby .= ' ' . $order . ', percent'; } $sql = "SELECT sen.id, sen.name, sen.name_diacritics, sen.idm, " . "sen.timein, sen.timeout, sen.motif, sen.idperson, " . "votes.possible, votes.percent, " . "belong.idparty, " . "cand.url as dep_url, " . "colleges.url as col_url, " . "res.winner, res.difference, res.reason, " . "agg.total, agg.college " . "FROM senat_2004_senators AS sen " . "LEFT JOIN senat_2004_votes_agg AS votes " . "ON votes.idperson = sen.idperson " . "LEFT JOIN senat_2004_belong_agg AS belong " . "ON belong.idperson = sen.idperson " . "LEFT JOIN alegeri_2008_candidates AS cand " . "ON cand.idperson = sen.idperson " . "LEFT JOIN alegeri_2008_colleges as colleges " . "ON cand.college_id = colleges.id " . "LEFT JOIN results_2008_candidates AS res on cand.name = res.nume " . "LEFT JOIN results_2008_agg AS agg ON res.college = agg.college " . "WHERE timeout = 0 " . "ORDER BY {$sortby} {$order}"; $sdep = mysql_query($sql); $numVotes = getSenatorsNumberOfVotes(); $count = 1; $stats = initStatsObject(); $norder = $order == 'asc' ? 'desc' : 'asc'; ?> <table class=bigtable width=900> <tr class=header><td></td><td> <a href=?cid=<?php echo $cid; ?> &sort=name&order=<?php echo $norder; ?> >Senator</a></td> <td> <a href=?cid=<?php echo $cid; ?> &sort=percent&order=<?php echo $norder; ?> >Procent de voturi<br>la care a fost prezent</a> <br>începând cu Sep 2007</td> <td> <a href=?cid=<?php echo $cid; ?> &sort=idparty&order=<?php echo $norder; ?> >Partid</a></td> <td>Reales</td></tr> <?php while ($rdep = mysql_fetch_array($sdep)) { echo "<tr>"; echo "<td align=right>" . $count++ . ".</td>"; echo "<td> " . "<a href=\"?cid=9&id=" . $rdep['idperson'] . "\">" . $rdep['name_diacritics'] . "</a>"; // ----------------- now print the times in office, if need be // ------------------ vote percentages $timein = $rdep['timein'] / 1000; $timeout = $rdep['timeout'] / 1000; echo "<br><span class=\"small gray\">"; // 1076994000 = 17 dec 2004 if ($timein != 1076994000 || $timeout != 0) { echo date("M Y", $timein) . " - " . ($timeout == 0 ? 'prezent' : date("M Y", $timeout)); echo $rdep['motif'] != "" ? "(" . $rdep['motif'] . ")" : ""; } echo getEuroParliamentString($rdep['id'], 1); echo "</span></td>"; $sum = $rdep['possible'] * $rdep['percent']; $candidateVotes = $rdep['possible']; $percent = $rdep['percent']; $class = "blacktext"; if ($percent < 0.5) { $class = "red"; } if ($percent < 0.3) { $class = "brightred"; } echo "<td><span class={$class}>" . floor(10000 * $percent) / 100 . " %</span>"; if ($candidateVotes != $numVotes) { echo "<br><span class=\"small gray\"> din " . $candidateVotes . " voturi</span>"; if ($awayVotes != 0) { echo "<br>Pentru {$awayVotes} a fost europarlamentar"; } echo "</td>"; } echo "<td>"; $parties = getPartiesForSenator($rdep['id']); echo getPartyName($parties[0]['name']); if (sizeof($parties) > 1) { echo '<br><span class="gray small">'; for ($i = 1; $i < sizeof($parties); $i++) { echo "<b>" . getPartyName($parties[$i]['name']) . "</b> până în " . date("M Y", $parties[$i]['t'] / 1000); if ($i != sizeof($parties) - 1) { echo "<br>"; } } echo '</span>'; } echo "</td>"; echo "<td>" . getReElectedString($rdep) . "</td>"; echo "</tr>"; $stats = countStats($stats, $rdep, $percent); } echo "</table>"; printStats($stats); }
</tr> <tr><td colspan=3>download video</td></tr> <tr > <td > <?php echo printStats("download video (in)", $download_video_in, 10, 30, 50); ?> </td> <td > <?php echo printStats("download video (out)", $download_video_out, 10, 30, 50); ?> </td> <td> </td> </tr> </table> </div> <script> var wrap = document.getElementById("wrap"); wrap.setAttribute( "style" , "" );