function load_lang_file() { global $install_lang; $GLOBALS["find_install_lang"] = array(); // Make sure the languages directory actually exists. if (file_exists(dirname(__FILE__) . '/language/install_lang/')) { // Find all the "Install" language files in the directory. $dir = dir(dirname(__FILE__) . '/language/install_lang/'); while ($entry = $dir->read()) { if (substr($entry, 0, 8) == 'install.' && substr($entry, -4) == '.php') { $GLOBALS["find_install_lang"][$entry] = ucfirst(substr($entry, 8, strlen($entry) - 12)); } } $dir->close(); } // Didn't find any, show an error message! if (empty($GLOBALS["find_install_lang"])) { step("Installation ERROR!", "ERROR!", "*"); echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"; echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">"; echo "<head>"; echo "<meta http-equiv=\"content-type\" content=\"text/html; charset=ISO-8859-1\" />"; echo "<title>" . $GLOBALS["btit_installer"] . " " . $GLOBALS["current_btit_version"] . " - Language Error</title>"; echo "<link rel=\"stylesheet\" href=\"style/xbtit_default/main.css\" type=\"text/css\" />"; echo "</head>"; echo "<body style=\"font-family: sans-serif;\"><div style=\"width: 600px;\">"; echo "<p>A critical language error has occurred.</p>"; echo "<p>This installer was unable to find the installer's language file or files. They should be found under:</p>"; echo "<div style=\"margin: 1ex; font-family: monospace; font-weight: bold;\">/language/install_lang/</div>"; echo "<p>In some cases, FTP clients do not properly upload files with this many folders. Please double check to make sure you <span style=\"font-weight: 600;\">have uploaded all the files in the distribution</span>.</p>"; echo "<p>If you continue to get this error message, feel free to <a href=\"http://www.btiteam.org/smf/index.php/\">look to us for support</a>.</p>"; echo "</div>"; die; } // Override the language file? if (isset($_GET["lang_file"])) { $_SESSION["install_lang"] = $_GET["lang_file"]; } elseif (isset($GLOBALS["HTTP_GET_VARS"]["lang_file"])) { $_SESSION["install_lang"] = $GLOBALS["HTTP_GET_VARS"]["lang_file"]; } else { $_SESSION["install_lang"] = "install.english.php"; } // Make sure it exists, if it doesn't reset it. if (!isset($_SESSION["install_lang"]) || !file_exists(dirname(__FILE__) . '/language/install_lang/' . $_SESSION["install_lang"])) { // Use the first one... list($_SESSION["install_lang"]) = array_keys($GLOBALS["find_install_lang"]); // If we have english and some other language, use the other language. We Americans hate english :P. if ($_SESSION["install_lang"] == "install.english.php" && count($GLOBALS["find_install_lang"]) > 1) { list($_SESSION["install_lang"]) = array_keys($GLOBALS["find_install_lang"]); } } // And now include the actual language file itself. require_once dirname(__FILE__) . '/language/install_lang/' . $_SESSION["install_lang"]; }
protected function execute(InputInterface $input, OutputInterface $output) { $outputFile = realpath($input->getArgument('storage')); $size = (int) $input->getOption('size'); $length = (int) $input->getOption('length'); $path = $input->getOption('path'); $recursive = $input->getOption('recursive'); $c1 = $input->getOption('c1'); $c2 = $input->getOption('c2'); $storage = new FileStorage($outputFile, 'r'); $crawler = new FileCrawler($path, $recursive); $structure = new QuadraticHashTable($storage, $size, $length); $structure->hashWithModifiers($c1, $c2); $start = microtime(true); $n = 0; $crawler->walk(function ($file) use($structure, $output, &$n) { $n++; step(); $node = $structure->search($file); step(); if ($node === null) { step(); return $output->writeln("<error>{$file} was not found!</error>"); } step(); $count = $structure->value($node); step(); if ($count > 1) { step(); return $output->writeln("<info>{$file} occurs {$count} times</info>"); } step(); return $output->writeln("{$file} occurs only once"); }); $time = microtime(true) - $start; $steps = step(); $output->writeln(str_repeat('-', 15)); $output->writeln(sprintf('Executed in %.3f µs', $time)); $output->writeln("Steps executed {$steps}"); $output->writeln("For {$n} files"); }
<?php if (isset($_POST['str'])) { echo "<br><br><br><hr>"; $string = $_POST['str']; $cnf = $_POST['cnf']; echo "<h1>CNF</h1>"; echo cetakCNF($cnf); echo "<h1>String</h1>"; echo cetakSTR($string); echo "<h1>CYK</h1>"; echo cetakCYK(cyk($string, $cnf)); step($string, $cnf); } function cetakSTR($data) { $result = ""; for ($i = 0; $i < count($data); $i++) { if ($i == 0) { $result .= $data[$i]; } else { $result .= ", " . $data[$i]; } } return $result; } function cetakCNF($data) { $result = ""; for ($i = 0; $i < count($data); $i++) { if ($data[$i][0] != "") {
} step('Authorized'); $authorization = new \TaxCloud\Request\Authorized($apiLoginID, $apiKey, '123', $cartID, $cartItems, $orderID, date("c")); try { $client->Authorized($authorization); } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; } step('Captured'); $capture = new \TaxCloud\Request\Captured($apiLoginID, $apiKey, $orderID); try { $client->Captured($capture); } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; } step('Authorized With Capture'); $lookup = new \TaxCloud\Request\Lookup($apiLoginID, $apiKey, '123', $cartID + 1, $cartItems, $originAddress, $destAddress); $client->Lookup($lookup); $authcap = new \TaxCloud\Request\AuthorizedWithCapture($apiLoginID, $apiKey, '123', $cartID + 1, $orderID + 1, date("c"), date("c")); try { $client->AuthorizedWithCapture($authcap); } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; } step('Returned'); $return = new \TaxCloud\Request\Returned($apiLoginID, $apiKey, $orderID + 1, $cartItems, date("c")); try { $client->Returned($return); } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; }
$tmp = ($https ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . dirname(dirname($_SERVER['PHP_SELF'])); $tmp = str_replace('\\', '/', $tmp); if (substr($tmp, -1) === '/') { $tmp = substr($tmp, 0, strlen($tmp) - 1); } define('DIAMONDMVC_URL', $tmp); unset($tmp); define('DS', DIRECTORY_SEPARATOR); require_once DIAMONDMVC_ROOT . '/lib/fns.php'; require_once DIAMONDMVC_ROOT . '/config.php'; require_once DIAMONDMVC_ROOT . '/lib/class_database.php'; $step = 1; if (isset($_REQUEST['step'])) { $step = intval($_REQUEST['step']); } step($step); function step($step) { switch ($step) { case 1: step1(); break; case 2: step2(); break; case 3: step3(); break; default: noStep(); }
private function hash($name) { step(); $result = 0; for (step(), $i = 0; step(), $i < 3; step(), $i++) { step(); $char = @ord($name[$i]); step(); $result += $char * pow(256, $i); } step(); return $result % $this->size; }
step('Deleting the database'); $db->Delete(); step('Deleting the test instance(s)'); $ilist = $dbaas->InstanceList(); while ($inst = $ilist->Next()) { if ($inst->name == INSTANCENAME) { info('Deleting %s', $inst->id); $inst->Delete(); } } /** * Cleanup */ step('Deleting the test network(s)'); $list = $cloudservers->NetworkList(); while ($network = $list->Next()) { if ($network->label == NETWORKNAME) { info('Deleting: %s %s', $network->id, $network->label); $network->Delete(); } } step('FINISHED at %s in %d seconds', date(TIMEFORMAT), time() - $start); info('Remember to manually delete the volume and snapshot created'); exit; /** * Callback for the WaitFor() method */ function dotter($obj) { info('...waiting on %s/%-12s %4s', $obj->Name(), $obj->Status(), isset($obj->progress) ? $obj->progress . '%' : 0); }
session_start(); include_once 'ressources/class.templates.inc'; include_once 'ressources/class.main_cf.inc'; include_once 'ressources/class.ldap.inc'; include_once 'ressources/class.users.menus.inc'; include_once 'ressources/class.artica.inc'; include_once 'ressources/class.user.inc'; include_once 'ressources/class.mimedefang.inc'; include_once 'ressources/class.ini.inc'; if (isset($_GET["script"])) { script(); exit; } if (isset($_GET["step"])) { step(); exit; } if (isset($_GET["SaveSettings"])) { SaveSettings(); exit; } if (isset($_GET["Cancel"])) { Cancel(); exit; } function Cancel() { $sock = new sockets(); $sock->SET_INFO("SmtpWizardFinish", 1); }
} function step($grid) { $new = $grid; for ($j = 0; $j < 100; $j++) { for ($k = 0; $k < 100; $k++) { $on = countOn($grid, $j, $k); if ($grid[$j][$k] === 0 && $on === 3) { $new[$j][$k] = 1; } else { if ($grid[$j][$k] === 1 && $on != 3 && $on != 2) { $new[$j][$k] = 0; } } } } return $new; } for ($l = 0; $l < 100; $l++) { $lights = step($lights); $lights[0][0] = $lights[0][99] = $lights[99][0] = $lights[99][99] = 1; } //light visualization foreach ($lights as $i) { echo '<br>'; for ($l = 0; $l < 100; $l++) { echo $i[$l] == 1 ? '#' : '.'; } echo '<br>'; } echo array_sum(array_map('array_sum', $lights));
$AuthOnly->setInv('123'); $AuthOnly->setTranType('AuthOnly'); $response = $AuthOnly->execute(); echo "Transaction Response: {$response->getTransactionResponse()}\r\n"; echo "AVS Response: {$response->getAVSResponse()}\r\n"; echo "AVS Code: {$response->getAVSCode()}\r\n"; echo "AVS Message: {$response->getAVSMessage()}\r\n"; echo "CVV2 Response: {$response->getCVV2Response()}\r\n"; echo "CVV2 Code: {$response->getCVV2Code()}\r\n"; echo "CVV2 Message: {$response->getCVV2Message()}\r\n"; echo "Transaction ID: {$response->getTransactionID()}\r\n"; $transactionid = $response->getTransactionID(); $Auth2Sale = new \EPN\Transaction\Auth2Sale($ePNAccount, $RestrictKey, $transactionid, '3.00'); $response = $Auth2Sale->execute(); print_r($response->getResponse()); step('AuthDel'); $AuthOnly = new \EPN\Transaction\CardNotPresent($ePNAccount, $RestrictKey, '4111111111111111', '05', '17', '4.00', '1600 Pennsylvania Ave NW', '20500', '1', '722'); $AuthOnly->setInv('123'); $AuthOnly->setTranType('AuthOnly'); $response = $AuthOnly->execute(); echo "Transaction Response: {$response->getTransactionResponse()}\r\n"; echo "AVS Response: {$response->getAVSResponse()}\r\n"; echo "AVS Code: {$response->getAVSCode()}\r\n"; echo "AVS Message: {$response->getAVSMessage()}\r\n"; echo "CVV2 Response: {$response->getCVV2Response()}\r\n"; echo "CVV2 Code: {$response->getCVV2Code()}\r\n"; echo "CVV2 Message: {$response->getCVV2Message()}\r\n"; echo "Transaction ID: {$response->getTransactionID()}\r\n"; $transactionid = $response->getTransactionID(); $AuthDel = new \EPN\Transaction\AuthDel($ePNAccount, $RestrictKey, $transactionid); $response = $AuthDel->execute();
} if (function_exists('instheader')) { instheader(); } if (empty($dbcharset) && in_array(strtolower($charset), array('gbk', 'big5', 'utf-8'))) { $dbcharset = str_replace('-', '', $charset); } $action = $_POST['action'] ? $_POST['action'] : $_GET['action']; if (is_writeable('./inc/config.inc.php')) { $writeable['config'] = result(1, 0); $write_error = 0; } else { $writeable['config'] = result(0, 0); $write_error = 1; } step($action); header2(); if (!$action) { ?> <tr><td> <?php $msg = ''; $curr_os = PHP_OS; if (!function_exists('mysql_connect')) { $curr_mysql = $lang['unsupport']; $msg .= "<li>{$lang['mysql_unsupport']}</li>"; $quit = TRUE; } else { $curr_mysql = "<strong class=\"green\">" . $lang['support'] . "</strong>"; } if (function_exists('apache_get_version')) {
* Relies upon environment variable settings — these are the same environment * variables that are used by python-novaclient. Just make sure that they're * set to the right values before running this test. */ define('AUTHURL', RACKSPACE_US); define('USERNAME', $_ENV['OS_USERNAME']); define('TENANT', $_ENV['OS_TENANT_NAME']); define('APIKEY', $_ENV['NOVA_API_KEY']); /** * numbers each step */ function step($msg, $p1 = NULL, $p2 = NULL, $p3 = NULL) { global $STEPCOUNTER; printf("\nStep %d. %s\n", ++$STEPCOUNTER, sprintf($msg, $p1, $p2, $p3)); } function info($msg, $p1 = NULL, $p2 = NULL, $p3 = NULL) { printf(" %s\n", sprintf($msg, $p1, $p2, $p3)); } define('TIMEFORMAT', 'r'); step('Authenticate'); $rackspace = new \OpenCloud\Rackspace(AUTHURL, array('username' => USERNAME, 'apiKey' => APIKEY)); step('Connect to the Compute Service'); $compute = $rackspace->Compute('cloudServersOpenStack', 'DFW'); step('List Extensions'); $arr = $compute->Extensions(); foreach ($arr as $item) { printf("%18s %s\n", $item->alias, $item->description); } exit;
define('TENANT', $_ENV['OS_TENANT_NAME']); define('APIKEY', $_ENV['NOVA_API_KEY']); define('VOLUMENAME', 'SampleVolume'); define('VOLUMESIZE', 100); define('SERVERNAME', 'CBS-test-server'); /** * numbers each step */ function step($msg, $p1 = NULL, $p2 = NULL, $p3 = NULL) { global $STEPCOUNTER; printf("\nStep %d. %s\n", ++$STEPCOUNTER, sprintf($msg, $p1, $p2, $p3)); } function info($msg, $p1 = NULL, $p2 = NULL, $p3 = NULL) { printf(" %s\n", sprintf($msg, $p1, $p2, $p3)); } define('TIMEFORMAT', 'r'); step('Authenticate'); $rackspace = new \OpenCloud\Rackspace(AUTHURL, array('username' => USERNAME, 'apiKey' => APIKEY)); step('Connect to the Compute Service'); $compute = $rackspace->Compute('cloudServersOpenStack', 'DFW'); step('List servers & attachments'); $slist = $compute->ServerList(); while ($server = $slist->Next()) { info('%s', $server->Name()); $alist = $server->VolumeAttachmentList(); while ($attachment = $alist->Next()) { printf(" %s Device: %s\n", $attachment->id, $attachment->device); } }
<?php session_start(); include_once('ressources/class.templates.inc'); include_once('ressources/class.main_cf.inc'); include_once('ressources/class.ldap.inc'); include_once('ressources/class.users.menus.inc'); include_once('ressources/class.artica.inc'); include_once('ressources/class.user.inc'); include_once('ressources/class.mimedefang.inc'); include_once('ressources/class.ini.inc'); if(isset($_GET["script"])){script();exit;} if(isset($_GET["step"])){step();exit;} if(isset($_GET["SaveSettings"])){SaveSettings();exit;} if(isset($_GET["Cancel"])){Cancel();exit;} function Cancel(){ $sock=new sockets(); $sock->SET_INFO("SmtpWizardFinish",1); } function page_0(){ $html=" <p class=caption>{wizard_smtp_intro}</p>"; echo BuildPage('{welcome_first_wizard}',$html); }
?> " size="3" maxlength="3" /></td></tr> <tr><td class="header">Limit for Latest Torrents block:</td><td class="lista"><input type="text" name="last10limit" value="<?php echo $GLOBALS["block_last10limit"]; ?> " size="3" maxlength="3" /></td></tr> <tr><td class="header">Limit for Most Popular Torrents block:</td><td class="lista"><input type="text" name="mostpoplimit" value="<?php echo $GLOBALS["block_mostpoplimit"]; ?> " size="3" maxlength="3" /></td></tr> <?php tr("Save configuration (Press next when ready)", "<input type='submit' name='save' value='Next >>'>\n", 1); print "</form>"; } elseif ($action == 'step3') { step("SQL Dump. Powered by BigDump", "Sql", "3"); include_once 'bigdump.php'; } elseif ($action == 'step4') { step("Administrator Setup", "Admin Setup", "4"); dbconn(true); print "<form method='post' action='" . $_SERVER["SCRIPT_NAME"] . "'><input type='hidden' name='action' value='save_admin'>"; ?> <tr><td class="header">Desired username:</td><td align="left" class="lista"><input type="text" size="40" name="wantusername" /><br /><font class="small">Allowed Characters: (a-z), (A-Z), (0-9)</font></td></tr> <tr><td class="header">Pick a password:</td><td align="left" class="lista"><input type="password" size="40" name="wantpassword" /></td></tr> <tr><td class="header">Enter password again:</td><td align="left" class="lista"><input type="password" size="40" name="passagain" /></td></tr> <tr><td class="header">Email address:</td><td align="left" class="lista"><input type="text" size="40" name="email" /> <tr><td colspan="2" align="center" class="lista"><font color="red"><b>All Fields are required!</b><p></font><input type="submit" value="Sign up! (PRESS ONLY ONCE)" style='height: 25px'></td></tr></form> <?php } print "</table></body></html>"; ob_end_flush();
{ global $STEPCOUNTER; printf("\nStep %d. %s\n", ++$STEPCOUNTER, sprintf($msg, $p1, $p2, $p3)); } function info($msg, $p1 = NULL, $p2 = NULL, $p3 = NULL) { printf(" %s\n", sprintf($msg, $p1, $p2, $p3)); } define('TIMEFORMAT', 'r'); step('Authenticate'); $rackspace = new \OpenCloud\Rackspace(AUTHURL, array('username' => USERNAME, 'apiKey' => APIKEY)); step('Connect to the VolumeService'); $cbs = $rackspace->VolumeService('cloudBlockStorage', 'DFW'); step('Snapshotting volumes'); $list = $cbs->VolumeList(); while ($vol = $list->Next()) { info('Volume: %s [%s] size=%d', $vol->display_name, $vol->display_description, $vol->size); $snap = $cbs->Snapshot(); // empty snapshot object info(' Creating snapshot'); //setDebug(TRUE); $snap->Create(array('display_name' => $vol->Name() . 'Snapshot-' . time(), 'volume_id' => $vol->id, 'force' => TRUE)); setDebug(FALSE); } step('DONE'); exit; // callback for WaitFor function dot($server) { printf("\r\t%s %s %3d%% %s", $server->id, $server->name, $server->progress, $server->status); }
private function fix($value, $length) { step(); return str_pad(substr($value, 0, $length), $length, ' '); }
function run_step($step, $is_submit = false) { require PATH . "steps/{$step['id']}.php"; $result = step($is_submit); return $result; }
return array($out_i, $out_g); } function gradient($data, $parameters) { $learn_rate = 0.01; $hypothesis = hypothesis($parameters[0], $parameters[1]); $deriv = deriv($data, $hypothesis); $score = score($data, $hypothesis); $parameters[0] = $parameters[0] - $learn_rate * $deriv[0]; $parameters[1] = $parameters[1] - $learn_rate * $deriv[1]; // Create a new hypothesis to test our score $hypothesis = hypothesis($parameters[0], $parameters[1]); if ($score < score($data, $hypothesis)) { return false; } return $parameters; } $parameters = array(0, 0); $min = null; do { list($minParams, $min) = step($data, $parameters, $min); } while ($minParams != null && ($parameters = $minParams)); var_dump($parameters); echo "====================\n"; $parameters = array(1, 3); $last_parameters = false; do { $last_parameters = $parameters; $parameters = gradient($data, $parameters); } while ($parameters != false); var_dump($last_parameters);