function newImprovedCombo($data, $colRules, $noOfRows, $noOfCols, $startTime, &$counter = 0, $group = array(), $val = null, $i = 0)
{
    if (isset($val)) {
        array_push($group, $val);
    }
    if ($i >= count($data)) {
        $counter++;
        if ($counter >= 1000000) {
            if ($counter % 1000000 == 0) {
                echo $counter . " (" . (microtime_float() - $startTime) . ")" . PHP_EOL;
                exit;
            }
        }
        $pool = new My();
        $pool->start();
        // if(checkSuccess($group, $colRules, $noOfRows, $noOfCols)) {
        // 	echo "<div style=\"float:right\">Solution Found<br />";
        // 	$endTime = microtime_float();
        // 	echo "END:".$endTime."<br />";
        // 	echo "START:".$startTime."<br />";
        // 	echo " - Time taked ".($endTime - $startTime)."</div>";
        // 	exit;
        // }
    } else {
        foreach ($data[$i] as $v) {
            newImprovedCombo($data, $colRules, $noOfRows, $noOfCols, $startTime, $counter, $group, $v, $i + 1);
        }
    }
}
Пример #2
0
 public static function release_lockfile()
 {
     $f3 = \Base::instance();
     $lock_file = realpath($f3->get('FILE')) . ".lock";
     $pid = self::get_lock_file();
     if ($pid == getmypid() or !self::isrunning($pid, FALSE)) {
         if (is_file($lock_file) && unlink($lock_file)) {
             My::function_debug(__CLASS__, __FUNCTION__, "OK!");
             return TRUE;
         } else {
             My::function_debug(__CLASS__, __FUNCTION__, "{$lock_file} could NOT be released, check permissions etc....", "error");
             return FALSE;
         }
     }
     if ($pid) {
         My::function_debug(__CLASS__, __FUNCTION__, "{$lock_file} not mine and still running. My pid=" . getmypid() . ".", "warn");
         return TRUE;
     }
     My::function_debug(__CLASS__, __FUNCTION__, "{$lock_file} does not exist. Nothing to release...");
     return TRUE;
 }
Пример #3
0
        return SearchHelper::getForums($fIds);
    }
    function onCommonSetConfig($data)
    {
        $settings = array();
        if (is_array($data) && $data) {
            foreach ($data as $key => $val) {
                if (substr($key, 0, 3) != 'my_') {
                    continue;
                }
                $settings[] = "('{$key}', '{$val}')";
            }
            if ($settings) {
                DB::query("REPLACE INTO " . DB::table('common_setting') . " (`skey`, `svalue`) VALUES " . implode(',', $settings));
                require_once DISCUZ_ROOT . './source/function/function_cache.php';
                updatecache('setting');
                return true;
            }
        }
        return false;
    }
}
$siteId = $_G['setting']['my_siteid'];
$siteKey = $_G['setting']['my_sitekey'];
$timezone = $_G['setting']['timeoffset'];
$language = $_SC['language'] ? $_SC['language'] : 'zh_CN';
$version = $_G['setting']['version'];
$myAppStatus = $_G['setting']['my_app_status'];
$mySearchStatus = $_G['setting']['my_search_status'];
$my = new My($siteId, $siteKey, $timezone, $version, CHARSET, $language, $myAppStatus, $mySearchStatus);
$my->run();
Пример #4
0
?>
			<!-- END -->

			<!-- Main menu -->
				<?php 
include 'include/menu.php';
?>
			<!-- END -->

			<!-- Main content -->
			<div id="content">
				<h1>Settings</h1>

				<?php 
include 'include/include_my_settings.php';
$Settings = new My();
$Settings->Settings();
?>

				<form class="globalForms noPadding" action="" method="post">
					<table class="globalTables leftAlign noHover" cellpadding="0" cellspacing="0">
						<tbody>
							<tr>
								<td class="boldText">
									First Name
								</td>
								<td>
									<input name="firstname" type="text" class="medium" value="<?php 
if (isset($_POST['submit'])) {
    echo $_POST['firstname'];
} else {
Пример #5
0
 public static function dump_errors()
 {
     if (self::$exit_code) {
         return;
     }
     if (is_array(error_get_last())) {
         \Base::instance()->get("FP")->error(error_get_last());
         self::$exit_code = 64;
     }
 }
Пример #6
0
 public static function mysql_query($sql, $line = false)
 {
     self::mysql_connect();
     if ($line) {
         $sql = trim($sql) . " " . "#----{$line}";
     }
     $result = self::$my->exec($sql);
     My::log(str_replace("#----", "#", self::$my->log()) . " rows=" . count($result));
     if ($result === FALSE) {
         trigger_error("{$sql} falied");
     }
     return $result;
 }
Пример #7
0
<?php

class My extends Thread
{
    public function run()
    {
    }
}
$my = new My();
var_dump($my->start());
Пример #8
0
 /**
  * Overload delete() method
  *
  * @param Int $id
  * @return Boolean
  */
 public function delete($id = 0)
 {
     $orm_instance = ORM::factory('used_coupon')->where('cpn_id', $id)->delete_all();
     Mycpn_promotion::instance()->delete_by_couponid($id);
     return parent::delete($id);
 }
Пример #9
0
<?php

define('IN_MYOP', TRUE);
error_reporting(E_ERROR | E_PARSE);
require_once './define.php';
require_once './function.php';
require_once API_ROOT . '/class/My.class.php';
require_once API_ROOT . '/class/APIErrorResponse.class.php';
require_once API_ROOT . '/class/APIResponse.class.php';
require_once API_ROOT . '/class/MyBase.class.php';
//所有URL的后面都不带“/”
define('SITE_PATH', getcwd());
define('MYOP_URL', getmyopurlInApi());
define('UC_URL', MYOP_URL);
define('SITE_URL', substr(MYOP_URL, 0, -(strlen(APPS_DIR_NAME) + strlen(MYOP_DIR_NAME) + 2)));
define('PUBLIC_URL', SITE_URL . '/public');
//系统配置
$_SITE_CONFIG = array();
refreshConfig();
//漫游平台的全局变量
$_MY_GLOBAL = array();
$_MY_GLOBAL['timestamp'] = time();
//个人空间
$space = array();
$server = new My();
$response = $server->parseRequest();
echo $server->formatResponse($response);
Пример #10
0
 /**
  * @covers            \SebastianBergmann\My\My::__construct
  * @covers            \SebastianBergmann\My\My::prints
  * @uses              \SebastianBergmann\My\My     
  */
 public function test1()
 {
     $xx = new My();
     $tt = $xx->prints("hello");
     $this->assertEquals('hello', $tt);
 }
Пример #11
0
 /**
  * add doc
  */
 public function add($data)
 {
     $id = parent::add($data);
     if ($id) {
         //order和ID初始赋同样的值
         $doc = ORM::factory('doc', $id);
         $doc->save();
         //$this->clear_uris();
         return $id;
     } else {
         return false;
     }
 }
Пример #12
0
 /**
  * GET /my/tasks
  * 自分のタスク一覧を取得する.
  * @TODO ページネーション未対応.
  *
  * 引数0:assigned_by_account_id タスクの依頼者のアカウントID.
  * 引数1:status タスクのステータス. (open, done)
  */
 public function fetchMyTasks()
 {
     $query_parameters = array('assigned_by_account_id' => isset($this->args[0]) ? $this->args[0] : null, 'status' => isset($this->args[1]) ? $this->args[1] : null);
     $query_parameters = self::filteringParameters($query_parameters);
     $this->loadModel('Chatwork.My');
     $results = My::get(array('action' => '/tasks', 'query_parameters' => $query_parameters));
     $this->out(print_r($results, true));
 }