public function appControllerLoad() { $TestModel = new TestModel(); $list = $TestModel->getList(); json_return($list); test(); }
function do_action($glob) { for ($i = 0; $glob['list_action'][$i]; $i++) { if ($glob['list_action'][$i]['done'] == 0) { $action_name = $glob['list_action'][$i]['nom_action']; if (substr($action_name, 0, 2) == "b_") { $glob['list_action'][$i]['done'] = 1; $glob['list_action'][$i]['waiting_answer'] = 1; $glob = call_user_func($action_name, $glob); $glob['big'] = 1; $glob = update_actions($glob); return $glob; } else { $glob['list_action'][$i]['done'] = 1; $glob['list_action'][$i]['waiting_answer'] = 0; $glob = call_user_func($action_name, $glob); $glob['big'] = 0; $glob = update_actions($glob); return $glob; } } } print_r($glob); test("action end " . $glob['total_action']); // Devrait jamais arrive la aff_error_code("end done"); return $glob; }
function content_567fc7c430caf3_85180294($_smarty_tpl) { echo test(array('p1' => 'ab', 'p2' => 'asd', 'p3' => 'ddd', 'p4' => 'qwe'), $_smarty_tpl); ?> <?php }
function allTests($communicator) { global $NS; echo "testing type names... "; flush(); $a = $NS ? constant("_and\\_array::_as") : constant("and_array::_as"); $b = $NS ? eval("return new _and\\_xor();") : eval("return new and_xor();"); test($b->_abstract == 0); test($b->_clone == 0); test($b->_private == 0); test($b->_protected == 0); test($b->_public == 0); test($b->_this == 0); test($b->_throw == 0); test($b->_use == 0); test($b->_var == 0); $p = $communicator->stringToProxy("test:tcp -p 10000"); $c = $NS ? eval("return _and\\functionPrxHelper::uncheckedCast(\$p);") : eval("return and_functionPrxHelper::uncheckedCast(\$p);"); $d = $NS ? eval("return _and\\diePrxHelper::uncheckedCast(\$p);") : eval("return and_diePrxHelper::uncheckedCast(\$p);"); $e = $NS ? eval("return _and\\echoPrxHelper::uncheckedCast(\$p);") : eval("return and_echoPrxHelper::uncheckedCast(\$p);"); $e1 = new echoI(); $f = $NS ? eval("return _and\\enddeclarePrxHelper::uncheckedCast(\$p);") : eval("return and_enddeclarePrxHelper::uncheckedCast(\$p);"); $f1 = new enddeclareI(); $g = $NS ? eval("return new _and\\_endif();") : eval("return new and_endif();"); $h = $NS ? eval("return new _and\\_endwhile();") : eval("return new and_endwhile();"); $i = $NS ? constant("_and\\_or") : constant("and_or"); $j = $NS ? constant("_and\\_print") : constant("and_print"); $j = $NS ? constant("_and\\_require_once") : constant("and_require_once"); echo "ok\n"; }
function just_do_it($flag) { test(); if ($flag < 10) { usleep(2 * 1000 * 1000); } }
function main($x) { for ($i = 0; $i < 10; $i++) { test($x, $x); } return test($x, $x); }
function start() { $neuralNetwork = new NeuralNetworkHopfield(9); $trainingDatas = prepareTrainingDatas(); $neuralNetwork->learn($trainingDatas); test($neuralNetwork); }
function learn(NeuralNetwork $neuralNetwork, array $trainingDatas) { /* @var $trainingDatas TrainingData[] */ test($neuralNetwork); $historicErrors = []; $i = 0; while (true) { $errors = []; /*?> <table style=""><tr> <th>dane</th> <th>wynik</th> <th>spodziewany</th> <th>błąd</th> </tr><?php*/ foreach ($trainingDatas as $trainingData) { /*?><tr><?php*/ $result = $neuralNetwork->calculate($trainingData->getData()); $error = $neuralNetwork->getError($result, $trainingData->getExpectedResult()); $errors[] = $error; /*?><td><?php foreach($trainingData->getData() as $v) { echo round($v, 2).' '; } ?></td><?php ?><td><?= round($result[0], 2) ?></td><?php ?><td><?= round($trainingData->getExpectedResult()[0], 2) ?></td><?php ?><td><?= round($error, 2) ?></td><?php ?><td><?php*/ $neuralNetwork->correctWeights($result, $trainingData->getExpectedResult()); /*?></td><?php ?></tr><?php*/ } // if ($i % 5000 == 0) { // test($neuralNetwork); // } /*?></table><?php*/ // test($neuralNetwork); // echo '<div style="width: '.(avg($errors) * 1000).'px; height: 1px; background: #666;"></div>'; // echo '<b>'.round(avg($errors), 3).'</b><br>'; if (avg($errors) < 0.01) { return; } $i++; if ($i > 1) { $lastHistoricErrors = array_slice($historicErrors, -50); if (avg($lastHistoricErrors) > avg($historicErrors)) { $historicErrors = []; $i = 0; test($neuralNetwork); $neuralNetwork->rerandomizeWeights(); //test($neuralNetwork); } } $historicErrors[] = avg($errors); if ($i == 100000) { echo 'break'; break; } shuffle($trainingDatas); } }
function content_55f55f40447242_10092157($_smarty_tpl) { $_smarty_tpl->properties['nocache_hash'] = '2180455f55f4037d769_80171613'; ?> title: <?php echo $_smarty_tpl->tpl_vars['title']->value; ?> <br> content: <?php echo $_smarty_tpl->tpl_vars['content']->value; ?> <br> <?php echo myfun(); ?> <br> <?php echo date("Y-m-d"); ?> <br> <?php echo test(array('size' => "10", 'color' => "red", 'num' => "5", 'content' => "222"), $_smarty_tpl); ?> <br> <?php }
/** * Update content of a default page. * * If $tag parameter is an array, it just passes elements of this array one by one to itself. * The value 'HomePage' is a special one: it will be replaced by the configured value $config['root_page']. * The content of the page is read at a file named with $tag, located in setup/default_pages. * @param mixed $tag string or array of strings * @param resource $dblink * @param mixed $config * @param string $lang_defaults_path mandatory: validated directory for language-specific default pages * @param string $lang_defaults_fallback_path mandatory: validated directory for default pages in system default language * @access public * @return void * @todo avoid recursion: make a single tag into an array of one and then just loop over the tags */ function update_default_page($tag, $dblink, $config, $lang_defaults_path, $lang_defaults_fallback_path, $note = '') { if (is_array($tag)) { foreach ($tag as $v) { update_default_page($v, $dblink, $config, $lang_defaults_path, $lang_defaults_fallback_path, $note); } return; } $filename = $tag; if ($tag == '_rootpage') { $tag = $config['root_page']; $filename = 'HomePage'; } $admin_users = explode(',', $config['admin_users']); $admin_main_user = trim($admin_users[0]); //$txt_filepath = $lang_defaults_path.$filename.'.txt'; $php_filepath = $lang_defaults_path . $filename . '.php'; if (!file_exists($php_filepath) || !is_readable($php_filepath)) { $php_filepath = $lang_defaults_fallback_path . $filename . '.php'; } if (file_exists($php_filepath) && is_readable($php_filepath)) { ob_start(); include_once $php_filepath; $body = ob_get_contents(); ob_end_clean(); //$body = implode('', file($txt_filepath)); mysql_query('update ' . $config['table_prefix'] . 'pages set latest = "N" where tag = \'' . $tag . '\'', $dblink); test(sprintf(__('Adding/Updating default page %s' . '...'), $tag), @mysql_query('insert into ' . $config['table_prefix'] . 'pages set tag=\'' . $tag . '\', body = \'' . mysql_real_escape_string($body) . '\', user=\'WikkaInstaller\', owner = \'' . $admin_main_user . '\', time=now(), latest =\'Y\', note = \'' . mysql_real_escape_string($note) . '\'', $dblink), '', 0); // @@@ pick up any page-specific ACL here (look in both $lang_defaults_path and $lang_defaults_fallback_path) } else { test(sprintf(__('Adding/Updating default page %s' . '...'), $tag), false, sprintf(__('Default page not found or file not readable (%s, %s, %s)'), $tag, $php_filepath, $lang_defaults_path), 0); } }
function main($a) { try { test(...$a); } catch (Exception $e) { } }
function allTests() { global $NS; echo "testing Slice predefined macros... "; flush(); if ($NS) { $d = new Test\_Default(); test($d->x == 10); test($d->y == 10); $nd = new Test\NoDefault(); test($nd->x != 10); test($nd->y != 10); $c = new Test\PhpOnly(); test($c->lang == "php"); test($c->version == Ice\intVersion()); } else { $d = new Test_Default(); test($d->x == 10); test($d->y == 10); $nd = new Test_NoDefault(); test($nd->x != 10); test($nd->y != 10); $c = new Test_PhpOnly(); test($c->lang == "php"); test($c->version == Ice_intVersion()); } echo "ok\n"; }
public function pageEntry($inPath) { /* */ SError::$CONSOLE = true; /* */ SError::$LOG = false; /* */ SError::$LOGFILE = "/tmp/tmp_serror.log"; echo $DDJFK; function test($B) { test2($B); } function test2($a) { echo "{$B}.{$a}"; //throw new Exception("D2D"); //throw new Exception("DD"); } echo "D"; test("FJKE", "E"); throw new Exception("DD"); echo "D"; //test("B","c"); }
function move_to_yaml() { $sql = SQL::current(); if (!($attrs = $sql->select("post_attributes", "*", array("name" => array("unclean_tags", "clean_tags"))))) { return; } function parseTags($tags, $clean) { $tags = explode(",", preg_replace("/\\{\\{([^\\}]+)\\}\\}/", "\\1", $tags)); $clean = explode(",", preg_replace("/\\{\\{([^\\}]+)\\}\\}/", "\\1", $clean)); return array_combine($tags, $clean); } $tags = array(); foreach ($attrs->fetchAll() as $attr) { if ($attr["name"] == "unclean_tags") { $tags[$attr["post_id"]]["unclean"] = $attr["value"]; } else { $tags[$attr["post_id"]]["clean"] = $attr["value"]; } } if (empty($tags)) { return; } foreach ($tags as $post_id => $tags) { $yaml = YAML::dump(parseTags($tags["unclean"], $tags["clean"])); echo _f("Relocating tags for post #%d...", array($post_id), "tags"); echo test($insert = $sql->replace("post_attributes", array("name" => "tags", "value" => $yaml, "post_id" => $post_id)), _f("Backup written to %s.", array("./_tags.bak.txt"))); if (!$insert) { return file_put_contents("./_tags.bak.txt", var_export($tags, true)); } } echo __("Removing old post attributes...", "tags") . test($sql->delete("post_attributes", array("name" => array("unclean_tags", "clean_tags")))); }
function learn(NeuronSigmoidal $neuron, array $trainingDatas) { /* @var $trainingDatas TrainingData[] */ test($neuron); $i = 0; while (true) { $errors = []; foreach ($trainingDatas as $trainingData) { $result = $neuron->calculate($trainingData->getData()); $error = $neuron->getError($result, $trainingData->getExpectedResult()); $errors[] = abs($error); $neuron->correctWeights($result, $trainingData->getExpectedResult()); } // echo avg($errors).'<br>'; if (avg($errors) < 0.05) { break; } // if ($i % 10 == 0) // test($neuron); $i++; if ($i == 100) { break; } } // echo '<pre>'.print_r($neuron->getWeights(), true).'</pre>'; // echo '<pre>'.print_r($neuron->getBetaWeight(), true).'</pre>'; echo avg($errors) . '<br>'; echo $i . '<br>'; }
function test_get_arg(string $type, array $extra_args) { $cnt = count($extra_args) + func_num_args() - 1; for ($i = -1; $i <= $cnt; ++$i) { test('gen_func_get_arg_' . $type, array_merge(array_slice(func_get_args(), 2), array($i), $extra_args)); } }
function count_posts() { global $wpdb; //$raw_values = $_POST['val']; $values = $_POST['val']; $controls = $_POST['ctrl']; /*for ($i=0;$i<count($raw_values);$i++) { $raw_value_name_parts = explode("-",$raw_values[$i][name]); if( count($raw_value_name_parts) == 3 && count($controls) >= ($raw_value_name_parts[2]-1) ) { if($controls[$raw_value_name_parts[2]][value] != "") $separator= "-"; else $separator=""; $controls[$raw_value_name_parts[2]][value].=$separator .$raw_values[$i][value]; } } */ for ($i = 0; $i < count($controls); $i++) { $controls[$i][value] = $values[$i][value]; } $q = test($controls); $c = $wpdb->get_var($q); echo $c; die; }
function allTests($communicator) { global $NS; echo "testing setACM/getACM... "; flush(); $ref = "communicator:default -p 12010"; $com = $communicator->stringToProxy($ref)->ice_uncheckedCast("::Test::RemoteCommunicator"); $adapter = $com->createObjectAdapter(-1, -1, -1); $initData = $NS ? eval("return new Ice\\InitializationData;") : new Ice_InitializationData; $initData->properties = $communicator->getProperties()->clone(); $initData->properties->setProperty("Ice.ACM.Timeout", "1"); $initData->properties->setProperty("Ice.ACM.Client.Timeout", "15"); $initData->properties->setProperty("Ice.ACM.Client.Close", "4"); $initData->properties->setProperty("Ice.ACM.Client.Heartbeat", "2"); $testCommunicator = $NS ? eval("return Ice\\initialize(\$initData);") : Ice_initialize($initData); $proxy = $testCommunicator->stringToProxy($adapter->getTestIntf()->ice_toString())->ice_uncheckedCast( "::Test::TestIntf"); $proxy->ice_getConnection(); $CloseOnIdleForceful = $NS ? constant("Ice\\ACMClose::CloseOnIdleForceful") : constant("Ice_ACMClose::CloseOnIdleForceful"); $CloseOnInvocationAndIdle = $NS ? constant("Ice\\ACMClose::CloseOnInvocationAndIdle") : constant("Ice_ACMClose::CloseOnInvocationAndIdle"); $HeartbeatOnIdle = $NS ? constant("Ice\\ACMHeartbeat::HeartbeatOnIdle") : constant("Ice_ACMHeartbeat::HeartbeatOnIdle"); $HeartbeatOnInvocation = $NS ? constant("Ice\\ACMHeartbeat::HeartbeatOnInvocation") : constant("Ice_ACMHeartbeat::HeartbeatOnInvocation"); $acm = $proxy->ice_getCachedConnection()->getACM(); test($acm->timeout == 15); test($acm->close == $CloseOnIdleForceful); test($acm->heartbeat == $HeartbeatOnIdle); $proxy->ice_getCachedConnection()->setACM(Ice_Unset, Ice_Unset, Ice_Unset); $acm = $proxy->ice_getCachedConnection()->getACM(); test($acm->timeout == 15); test($acm->close == $CloseOnIdleForceful); test($acm->heartbeat == $HeartbeatOnIdle); $proxy->ice_getCachedConnection()->setACM(20, $CloseOnInvocationAndIdle, $HeartbeatOnInvocation); $acm = $proxy->ice_getCachedConnection()->getACM(); test($acm->timeout == 20); test($acm->close == $CloseOnInvocationAndIdle); test($acm->heartbeat == $HeartbeatOnInvocation); $adapter->deactivate(); $testCommunicator->destroy(); echo "ok\n"; echo "shutting down... "; flush(); $com->shutdown(); echo "ok\n"; }
function allTests($communicator) { echo "testing stringToProxy... "; flush(); $ref = "d:default -p 12010"; $db = $communicator->stringToProxy($ref); test($db != null); echo "ok\n"; echo "testing checked cast... "; flush(); $d = $db->ice_checkedCast("::Test::D"); test($d != null); test($d == $db); echo "ok\n"; echo "testing non-facets A, B, C, and D... "; flush(); test($d->callA() == "A"); test($d->callB() == "B"); test($d->callC() == "C"); test($d->callD() == "D"); echo "ok\n"; echo "testing facets A, B, C, and D... "; flush(); $df = $d->ice_checkedCast("::Test::D", "facetABCD"); test($df != null); test($df->callA() == "A"); test($df->callB() == "B"); test($df->callC() == "C"); test($df->callD() == "D"); echo "ok\n"; echo "testing facets E and F... "; flush(); $ff = $d->ice_checkedCast("::Test::F", "facetEF"); test($ff != null); test($ff->callE() == "E"); test($ff->callF() == "F"); echo "ok\n"; echo "testing facet G... "; flush(); $gf = $ff->ice_checkedCast("::Test::G", "facetGH"); test($gf != null); test($gf->callG() == "G"); echo "ok\n"; echo "testing whether casting preserves the facet... "; flush(); $hf = $gf->ice_checkedCast("::Test::H"); test($hf != null); test($hf->callG() == "G"); test($hf->callH() == "H"); echo "ok\n"; return $gf; }
function main() { test(); fb_rename_function('foo', 'baz'); test(); fb_rename_function('bar', 'foo'); test(); }
private function loader($className) { echo 'Trying to load ', $className, ' via ', __METHOD__, "()\n"; if ($className == "testCore") { var_dump("myClass expect"); test(); } }
function main() { $a = array(); $a['g'] =& $a; test($a); test($GLOBALS); var_dump(compact($a)); }
function main() { $o1 = test(); $o2 = test(); $hash1 = spl_object_hash($o1); $hash2 = spl_object_hash($o2); var_dump($hash1 !== $hash2); }
function main() { try { test(new X()); } catch (Exception $e) { echo "Exception\n"; } }
function main() { $x[] = 1; fb_intercept('bar', 'baz', 'fiz'); for ($i = 0; $i < 10000; $i++) { test('bar', $x); } var_dump('done'); }
function add_signature_updated_at() { if (!SQL::current()->query("SELECT signature FROM __comments")) { echo __("Adding signature column to comments table...", "comments") . test(SQL::current()->query("ALTER TABLE __comments ADD signature VARCHAR(32) DEFAULT '' AFTER status")); } if (!SQL::current()->query("SELECT updated_at FROM __comments")) { echo __("Adding updated_at column to comments table...", "comments") . test(SQL::current()->query("ALTER TABLE __comments ADD updated_at DATETIME DEFAULT '0000-00-00 00:00:00' AFTER created_at")); } }
function allTests($communicator) { global $Ice_sliceChecksums; $ref = "test:default -p 12010"; $base = $communicator->stringToProxy($ref); test($base); $checksum = $base->ice_checkedCast("::Test::Checksum"); test($checksum); // // Verify that no checksums are present for local types. // echo "testing checksums... "; flush(); test(count($Ice_sliceChecksums) > 0); foreach($Ice_sliceChecksums as $i => $value) { test(!strpos($i, "Local")); } // // Get server's Slice checksums. // $d = $checksum->getSliceChecksums(); // // Compare the checksums. For a type FooN whose name ends in an integer N, // we assume that the server's type does not change for N = 1, and does // change for N > 1. // foreach($d as $i => $value) { $n = 0; preg_match("/\\d+/", $i, $matches); if($matches) { $n = (int)$matches[0]; } test(isset($Ice_sliceChecksums[$i])); if($n <= 1) { test($Ice_sliceChecksums[$i] == $d[$i]); } else { test($Ice_sliceChecksums[$i] != $d[$i]); } } echo "ok\n"; return $checksum; }
function test() { static $count = 0; $count++; echo $count; if ($count < 10) { test(); } $count--; }
function searchUser($token, $expected) { $js = test('searchUser', ['token' => $token, 'attrs' => 'uid', 'maxRows' => 5]); $r = json_decode($js); if ($r === NULL) { fail("searchUser {$token}", "invalid response\n{$js}"); } $got = map_obj_attr($r, 'uid'); expectToBe(json_encode($got), $expected, "searchUser {$token}"); }
/** * template function */ public function _test_() { try { test(); $this->fail("Exception not raised."); } catch (Exception $expected) { $this->assertPattern("()", $expected->getMessage()); return; } }