Аналіз та дослідження зв’язків між вузлами соціальної мережі в Інтернеті
Оцінка рівня якості програмного продукту. Загальна інформація про соціальні мережі. Порівняльне дослідження мереж. Моделювання соціальної поведінки. Моделі конфліктів та теорія ігор. Інтегральні термодинамічні показники та скриптове програмування.
Рубрика | Математика |
Вид | диссертация |
Язык | украинский |
Дата добавления | 27.11.2014 |
Размер файла | 1,7 M |
Отправить свою хорошую работу в базу знаний просто. Используйте форму, расположенную ниже
Студенты, аспиранты, молодые ученые, использующие базу знаний в своей учебе и работе, будут вам очень благодарны.
}
if ($parameter[0] != ':' || strlen($parameter) < 2 || $parameter[1] == '\'')
{
log::err('SQL Parse Error. Bad placeholder name ' . $this->statement, 3, SQL_ERRORS_FILE);
throw new Exception('SQL Parse Error. Bad placeholder\'s name');
}
}
function param($parameter, & $variable, $data_type = NULL, $length = NULL, $driverOptions = array ())
{
$this->_check_param($parameter);
$this->param_lengths[$parameter] = $length;
$this->param_types[$parameter] = $data_type;
$this->params[$parameter] = & $variable;
}
function bind($parameter, $value, $data_type = NULL, $length = NULL, $driverOptions = array ())
{
$this->_check_param($parameter);
$this->param_lengths[$parameter] = $length;
$this->param_types[$parameter] = $data_type;
$this->params[$parameter] = $value;
}
function execute($input_parameters = NULL)
{
if (config::get('debug_mode'))
{
$start_time = microtime(true);
}
if ($input_parameters !== NULL)
{
$this->params = $input_parameters;
foreach ($this->params as $key => $value)
{
$this->_check_param($key);
}
}
$this->_parse_query();
$this->_inner_execute();
if (config::get('debug_mode'))
{
$span = microtime(true) - $start_time;
tracer::add('db', array('query' => $this->query, 'timespan' => $span, 'alias' => $this->db_alias, 'operation' => ''));
$span = sprintf('%.1f ms', $span * 1000);
log::sql("$this->db_alias, $span, $this->query", $start_time, microtime(true));
if ( config::get('SQL_DEBUG_IN_FLOW') || db::$debug_in_flow)
{
echo $this->query . "<br/>";
}
}
if ( config::get('db_profiler') )
{
$queries = (array)cache::get('db_profiler_queries');
$queries[$this->statement] += 1;
cache::set( $queries, 60*60*24*30, 'db_profiler_queries' );
}
return $this->query_handle;
}
public function fetch_all()
{
$rows = array();
while ($row = mysql_fetch_assoc($this->query_handle))
{
$rows[] = $row;
}
return $rows;
}
public function fetch_cols()
{
$rows = array();
while ($a = mysql_fetch_row($this->query_handle))
{
$rows[] = $a[0];
}
return $rows;
}
function _inner_execute()
{
$this->query_handle = mysql_query($this->query, $this->db_handle);
if (!$this->query_handle)
{
$this->error_code = mysql_errno($this->db_handle);
$this->error_info = mysql_error($this->db_handle);
$this->db->error_code = $this->error_code;
$this->db->error_info = $this->error_info;
$log_line = $this->get_error_line($this->db_alias);
throw new Exception('SQL Error. ' . $log_line);
}
}
function _cast_values()
{
foreach ($this->params as $key => $value)
{
switch ($this->param_types[$key])
{
case SQL_PARAM_INT :
$this->paramsTemp[$key] = $this->sqlInteger($this->params[$key]);
break;
case SQL_PARAM_ARRAY_INT :
if (!is_array($this->params[$key]))
{
trigger_error('Error cast values. Parameter must be an array. $this->statement, E_USER_ERROR);
}
foreach ($this->params[$key] as $_key => $_value)
{
$this->paramsTemp[$key][$_key] = $this->sqlInteger($this->params[$key][$_key]);
}
if (count($this->paramsTemp[$key]) > 0)
{
$this->paramsTemp[$key] = implode(',', $this->paramsTemp[$key]);
}
break;
case SQL_PARAM_ARRAY_STR :
if (!is_array($this->params[$key]))
{
die('Error cast values. Parameter must be an array');
}
$this->paramsTemp[$key] = array();
foreach ($this->params[$key] as $_key => $_value)
{
$this->paramsTemp[$key][$_key] = "'" . $this->sqlString($this->params[$key][$_key]) . "'";
}
if (count($this->paramsTemp[$key]) > 0)
{
$this->paramsTemp[$key] = implode(',', $this->paramsTemp[$key]);
}
break;
case SQL_PARAM_MATCH :
$to_encode = array("-","~","*","+","<",">","(",")");
$encoded = array("\-","\~","\*","\+","\<","\>","\(","\)");
$dummyArray = split(" ", trim(str_replace($to_encode, $encoded, $this->sqlString($this->params[$key]))));
$this->paramsTemp[$key] = "'+".implode("* +", $dummyArray)."*'";
break;
case SQL_PARAM_STR :
default :
if (isset ($this->paramLengths[$key]))
{
$this->paramsTemp[$key] = mb_substr($this->params[$key], 0, $this->paramLengths[$key], 'UTF-8');
}
else
{
$this->paramsTemp[$key] = $this->params[$key];
}
$this->paramsTemp[$key] = is_int($this->paramsTemp[$key]) ? $this->paramsTemp[$key] : "'" . $this->sqlString($this->paramsTemp[$key]) . "'";
break;
}
}
}
function errorCode()
{
return $this->errorCode;
}
function error_info()
{
return $this->errorInfo;
}
function get_error_line($db_alias)
{
if (!isset($this->db->db_params[$db_alias]['host']))
{
$host = 'undefined host';
}
else
{
$host = $this->db->db_params[$db_alias]['host'];
}
if (!isset($this->db->db_params[$db_alias]['db']))
{
$db = 'undefined db';
}
else
{
$db = $this->db->db_params[$db_alias]['db'];
}
$query = str_replace(array ("\n","\r","\t"), ' ', $this->query);
return date('Y-m-d H:i:s') . ' : [MySQL - ERROR] ' .
mysql_errno($this->db_handle) . " triggered by [" .
basename($_SERVER['PHP_SELF']) . " | " .
$operation . $db_alias."/".$host . "/" . $db . " | ". $query . " ] : " . mysql_error($this->db_handle) . "\n\n";
}
function sqlString($string, $nonDB = false)
{
if (get_magic_quotes_gpc())
{
$string = stripslashes($string);
}
return mysql_real_escape_string($string) ;
}
function sqlInteger($i, $isNegative = false)
{
$isNegative = $i < 0;
if ( $isNegative )
{
return (int)$i;
} else
{
return abs((int)$i);
}
}
}
class log
{
public static $logs = array();
public static $files = array();
public static $enable = true;
public static function enabled()
{
return config::get('log_enabled');
}
public static function msg($msg)
{
$tmp['msg'] = $msg;
return self::log_data(__FUNCTION__, $tmp);
}
public static function err($errno, $errstr = '', $errfile = '', $errline = '', $errcontext = '')
{
if (func_num_args() == 1)
{
$errstr = $errno;
}
$tmp['msg'] = $errstr;
return self::log_data(__FUNCTION__, $tmp);
}
public static function exc($e)
{
$tmp['msg'] = $e->getMessage();
$tmp['file'] = $e->getFile();
$tmp['line'] = $e->getLine();
$tmp['trace'] = $e->getTraceAsString();
return self::log_data(__FUNCTION__, $tmp);
}
public static function sql($msg)
{
$msg = str_replace("\n", " ", $msg);
$msg = str_replace("\t", " ", $msg);
$msg = str_replace(" ", " ", $msg);
self::write2file('sql', $msg);
}
public static function show($type = '')
{
$str = '';
if (!$type)
{
$tmp = self::$logs;
}
else
{
$tmp[$type] = self::$logs[$type];
}
foreach ($tmp as $type => $data)
{
if (!$data)
{
continue;
}
$str .= "<fieldset style=\"font-size:14px; border:1px solid #ccc; clear:both;\">\n<legend>".strtoupper($type)."</legend>\n<pre>\n";
foreach ($data as $d)
{
$str .= var_export($d, true);
}
$str .= "</pre>\n</fieldset>\n";
}
echo $str;
}
public static function write2file($type, $str)
{
if ( !self::enabled() )
{
return false;
}
$str .= "\n";
$files = config::get('log_files');
if ( !$fp = @fopen(self::$files[$type], 'a+') )
{
return;
}
fwrite($fp, $str);
fclose($fp);
}
public static function dump2file()
{
if ( !self::enabled() )
{
return false;
}
foreach (self::$logs as $type => $data)
{
if (!$data)
{
continue;
}
$files = config::get('log_files');
$fp = @fopen(self::$files[$type], 'a+');
if (!$fp)
{
@fclose($fp);
continue;
}
$str = '';
foreach (self::$logs[$type] as $data)
{
$str .= "MSG: ".$data['msg']."\n";
if (isset($data['time']))
{
$str .= "TIME: ".$data['time']."\n";
}
if (isset($data['file']))
{
$str .= "FILE: ".$data['file']."\n";
}
if (isset($data['line']))
{
$str .= "LINE: ".$data['line']."\n";
}
if (isset($data['trace']))
{
$str .= "TRACE: ".$data['trace']."\n";
}
$str .= "DATE: ".$data['date']."\n";
$str .= "URI: ".$data['uri']."\n";
$str .= "UID: ".$data['uid']."\n\n";
}
fwrite($fp, $str);
fclose($fp);
}
}
private static function log_data($type, $data)
{
if ( !self::$enable )
{
return;
}
if (!isset($data['msg']) || !$data['msg'])
{
$data['msg'] = 'No message specified!';
}
if (!isset($data['date']))
{
$data['date'] = date('Y-m-d H:i:s');
}
if (!isset($data['uri']) && isset($_SERVER['REQUEST_URI']))
{
$data['uri'] = $_SERVER['REQUEST_URI'];
}
if (!isset($data['uid']) && isset($GLOBALS['moifakultet_user_ID']))
{
$data['uid'] = $GLOBALS['moifakultet_user_ID'];
}
self::$logs[$type][] = $data;
return true;
}
}
class tracer
{
public static $enable = true;
private $trace = array();
public static function get_instance()
{
static $instance = null;
if (!$instance)
{
$instance = new tracer();
}
return $instance;
}
public static function add($class, $data)
{
if (self::$enable)
{
self::get_instance()->add_entry($class, $data);
}
}
public static function get($class)
{
return self::get_instance()->get_trace($class);
}
public function add_entry($class, $data)
{
if (isset($this->trace[$class]))
{
$this->trace[$class][] = $data;
}
else
{
$this->trace[$class] = array($data);
}
}
public function get_trace($class)
{
return $this->trace[$class];
}
}
Размещено на Allbest.ru
Подобные документы
Мережа Петрі як графічний і математичний засіб моделювання систем і процесів. Основні елементи мережі Петрі, правила спрацьовування переходу. Розмітка мережі Петрі із кратними дугами. Методика аналізу характеристик обслуговування запитів на послуги IМ.
контрольная работа [499,2 K], добавлен 06.03.2011Розрахунок мережі масового обслуговування. Розробка програми для обчислення характеристик. Однорідні експоненціальні мережі масового обслуговування. Рівняння глобального балансу для замкнених мереж. Декомпозиція розімкнених мереж масового обслуговування.
дипломная работа [2,9 M], добавлен 25.08.2010Дослідження предмету і сфери застосування математичного програмування в економіці. Класифікація задач цієї науки. Загальна задача лінійного програмування, деякі з методи її розв’язування. Економічна інтерпретація двоїстої задачі лінійного програмування.
курс лекций [59,9 K], добавлен 06.05.2010Загальні положення та визначення в теорії моделювання. Поняття і класифікація моделей, iмовірнісне моделювання. Статистичне моделювання, основні характеристики випадкових векторів. Описання програмного забезпечення для моделювання випадкових векторів.
дипломная работа [12,0 M], добавлен 25.08.2010Дослідження диференціального рівняння непарного порядку і деяких систем з непарною кількістю рівнянь на нескінченному проміжку. Побудова диференціальної моделі, що описується диференціальним рівнянням, та дослідження її на скінченому проміжку часу.
дипломная работа [1,4 M], добавлен 24.12.2013Дзета-функція Римана та її застосування в математичному аналізі. Оцінка поводження дзета-функції в околиці одиниці. Теорія рядів Фур'є. Абсолютна збіжність інтеграла. Функціональне рівняння дзета-функції. Властивості функції в речовинній області.
курсовая работа [329,1 K], добавлен 28.12.2010Історія розвитку математичної науки. Математичне моделювання і дослідження процесів і явищ за допомогою функцій, рівнянь та інших математичних об`єктів. Функції, їх основні властивості та графіки, множина раціональних чисел. Розв`язання типових задач.
книга [721,3 K], добавлен 01.03.2011Етапи розв'язування інженерних задач на ЕОМ. Цілі, засоби й методи моделювання. Створення математичної моделі. Побудова обчислювальної моделі. Реалізація методу обчислень. Розв’язання нелінійних рівнянь методом дихотомії. Алгоритм метода дихотомії.
контрольная работа [86,1 K], добавлен 06.08.2010Складання плану виробництва при максимальному прибутку. Введення додаткових (фіктивних) змінних, які перетворюють нерівності на рівності. Розв’язування задачі лінійного програмування графічним методом та економічна інтерпретація отриманого розв’язку.
контрольная работа [298,3 K], добавлен 20.11.2009Основні принципи і елементи комбінаторики. Теорія ймовірностей: закономірності масових випадкових подій, дослідження і узагальнення статистичних даних, здійснення математичного і статистичного аналізу. Постановка і вирішення задач економічного характеру.
курс лекций [5,5 M], добавлен 21.11.2010