text:
<?php

/**
 * Configuration class (singleton). Used for managing runtime configuration information.
 *
 * @package       cake
 * @subpackage    cake.cake.libs
 * @link          http://book.cakephp.org/view/924/The-Configuration-Class
 */
class Configure extends Object {

/**
 * Current debug level.
 *
 * @link          http://book.cakephp.org/view/931/CakePHP-Core-Configuration-Variables
 * @var integer
 * @access public
 */
	var $debug = 0;

/**
 * Returns a singleton instance of the Configure class.
 *
 * @return Configure instance
 * @access public
 */
	function &getInstance($boot = true) {
		static $instance = array();
		if (!$instance) {
			if (!class_exists('Set')) {
				require LIBS . 'set.php';
			}
			$instance[0] =& new Configure();
			$instance[0]->__loadBootstrap($boot);
		}
		return $instance[0];
	}

/**
 * Used to store a dynamic variable in the Configure instance.
 *
 * Usage:
 * {{{
 * Configure::write('One.key1', 'value of the Configure::One[key1]');
 * Configure::write(array('One.key1' => 'value of the Configure::One[key1]'));
 * Configure::write('One', array(
 *     'key1' => 'value of the Configure::One[key1]',
 *     'key2' => 'value of the Configure::One[key2]'
 * );
 *
 * Configure::write(array(
 *     'One.key1' => 'value of the Configure::One[key1]',
 *     'One.key2' => 'value of the Configure::One[key2]'
 * ));
 * }}}
 *
 * @link http://book.cakephp.org/view/926/write
 * @param array $config Name of var to write
 * @param mixed $value Value to set for var
 * @return boolean True if write was successful
 * @access public
 */
	function write($config, $value = null) {
		$_this =& Configure::getInstance();

		if (!is_array($config)) {
			$config = array($config => $value);
		}

		foreach ($config as $name => $value) {
			if (strpos($name, '.') === false) {
				$_this->{$name} = $value;
			} else {
				$names = explode('.', $name, 4);
				switch (count($names)) {
					case 2:
						$_this->{$names[0]}[$names[1]] = $value;
					break;
					case 3:
						$_this->{$names[0]}[$names[1]][$names[2]] = $value;
						break;
					case 4:
						$names = explode('.', $name, 2);
						if (!isset($_this->{$names[0]})) {
							$_this->{$names[0]} = array();
						}
						$_this->{$names[0]} = Set::insert($_this->{$names[0]}, $names[1], $value);
					break;
				}
			}
		}

		if (isset($config['debug']) || isset($config['log'])) {
			$reporting = 0;
			if ($_this->debug) {
				if (!class_exists('Debugger')) {
					require LIBS . 'debugger.php';
				}
				$reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT;
				if (function_exists('ini_set')) {
					ini_set('display_errors', 1);
				}
				$callback = array('Debugger', 'getInstance');
			} elseif (function_exists('ini_set')) {
				ini_set('display_errors', 0);
			}

			if (isset($_this->log) && $_this->log) {
				if (is_integer($_this->log) && !$_this->debug) {
					$reporting = $_this->log;
				} else {
					$reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT;
				}
				error_reporting($reporting);
				if (!class_exists('CakeLog')) {
					require LIBS . 'cake_log.php';
				}
				if (empty($callback)) {
					$callback = array('CakeLog', 'getInstance');
				}
			}
			if (!empty($callback) && !defined('DISABLE_DEFAULT_ERROR_HANDLING') && class_exists('Debugger')) {
				Debugger::invoke(call_user_func($callback));
			}
			error_reporting($reporting);
		}
		return true;
	}

/**
 * Used to read information stored in the Configure instance.
 *
 * Usage:
 * {{{
 * Configure::read('Name'); will return all values for Name
 * Configure::read('Name.key'); will return only the value of Configure::Name[key]
 * }}}
 *
 * @link http://book.cakephp.org/view/927/read
 * @param string $var Variable to obtain.  Use '.' to access array elements.
 * @return string value of Configure::$var
 * @access public
 */
	function read($var = 'debug') {
		$_this =& Configure::getInstance();

		if ($var === 'debug') {
			return $_this->debug;
		}

		if (strpos($var, '.') !== false) {
			$names = explode('.', $var, 3);
			$var = $names[0];
		}
		if (!isset($_this->{$var})) {
			return null;
		}
		if (!isset($names[1])) {
			return $_this->{$var};
		}
		switch (count($names)) {
			case 2:
				if (isset($_this->{$var}[$names[1]])) {
					return $_this->{$var}[$names[1]];
				}
			break;
			case 3:
				if (isset($_this->{$var}[$names[1]][$names[2]])) {
					return $_this->{$var}[$names[1]][$names[2]];
				}
				if (!isset($_this->{$var}[$names[1]])) {
					return null;
				}
				return Set::classicExtract($_this->{$var}[$names[1]], $names[2]);
			break;
		}
		return null;
	}

/**
 * Used to delete a variable from the Configure instance.
 *
 * Usage:
 * {{{
 * Configure::delete('Name'); will delete the entire Configure::Name
 * Configure::delete('Name.key'); will delete only the Configure::Name[key]
 * }}}
 *
 * @link http://book.cakephp.org/view/928/delete
 * @param string $var the var to be deleted
 * @return void
 * @access public
 */
	function delete($var = null) {
		$_this =& Configure::getInstance();

		if (strpos($var, '.') === false) {
			unset($_this->{$var});
			return;
		}

		$names = explode('.', $var, 2);
		$_this->{$names[0]} = Set::remove($_this->{$names[0]}, $names[1]);
	}

/**
 * Loads a file from app/config/configure_file.php.
 * Config file variables should be formated like:
 *  `$config['name'] = 'value';`
 * These will be used to create dynamic Configure vars. load() is also used to
 * load stored config files created with Configure::store()
 *
 * - To load config files from app/config use `Configure::load('configure_file');`.
 * - To load config files from a plugin `Configure::load('plugin.configure_file');`.
 *
 * @link http://book.cakephp.org/view/929/load
 * @param string $fileName name of file to load, extension must be .php and only the name
 *     should be used, not the extenstion
 * @return mixed false if file not found, void if load successful
 * @access public
 */
	function load($fileName) {
		$found = $plugin = $pluginPath = false;
		list($plugin, $fileName) = pluginSplit($fileName);
		if ($plugin) {
			$pluginPath = App::pluginPath($plugin);
		}
		$pos = strpos($fileName, '..');

		if ($pos === false) {
			if ($pluginPath && file_exists($pluginPath . 'config' . DS . $fileName . '.php')) {
				include($pluginPath . 'config' . DS . $fileName . '.php');
				$found = true;
			} elseif (file_exists(CONFIGS . $fileName . '.php')) {
				include(CONFIGS . $fileName . '.php');
				$found = true;
			} elseif (file_exists(CACHE . 'persistent' . DS . $fileName . '.php')) {
				include(CACHE . 'persistent' . DS . $fileName . '.php');
				$found = true;
			} else {
				foreach (App::core('cake') as $key => $path) {
					if (file_exists($path . DS . 'config' . DS . $fileName . '.php')) {
						include($path . DS . 'config' . DS . $fileName . '.php');
						$found = true;
						break;
					}
				}
			}
		}

		if (!$found) {
			return false;
		}

		if (!isset($config)) {
			trigger_error(sprintf(__('Configure::load() - no variable $config found in %s.php', true), $fileName), E_USER_WARNING);
			return false;
		}
		return Configure::write($config);
	}

/**
 * Used to determine the current version of CakePHP.
 *
 * Usage `Configure::version();`
 *
 * @link http://book.cakephp.org/view/930/version
 * @return string Current version of CakePHP
 * @access public
 */
	function version() {
		$_this =& Configure::getInstance();

		if (!isset($_this->Cake['version'])) {
			require(CORE_PATH . 'cake' . DS . 'config' . DS . 'config.php');
			$_this->write($config);
		}
		return $_this->Cake['version'];
	}

/**
 * Used to write a config file to disk.
 *
 * {{{
 * Configure::store('Model', 'class_paths', array('Users' => array(
 *      'path' => 'users', 'plugin' => true
 * )));
 * }}}
 *
 * @param string $type Type of config file to write, ex: Models, Controllers, Helpers, Components
 * @param string $name file name.
 * @param array $data array of values to store.
 * @return void
 * @access public
 */
	function store($type, $name, $data = array()) {
		$write = true;
		$content = '';

		foreach ($data as $key => $value) {
			$content .= "\$config['$type']['$key'] = " . var_export($value, true) . ";\n";
		}
		if (is_null($type)) {
			$write = false;
		}
		Configure::__writeConfig($content, $name, $write);
	}

/**
 * Creates a cached version of a configuration file.
 * Appends values passed from Configure::store() to the cached file
 *
 * @param string $content Content to write on file
 * @param string $name Name to use for cache file
 * @param boolean $write true if content should be written, false otherwise
 * @return void
 * @access private
 */
	function __writeConfig($content, $name, $write = true) {
		$file = CACHE . 'persistent' . DS . $name . '.php';

		if (Configure::read() > 0) {
			$expires = "+10 seconds";
		} else {
			$expires = "+999 days";
		}
		$cache = cache('persistent' . DS . $name . '.php', null, $expires);

		if ($cache === null) {
			cache('persistent' . DS . $name . '.php', "<?php\n\$config = array();\n", $expires);
		}

		if ($write === true) {
			if (!class_exists('File')) {
				require LIBS . 'file.php';
			}
			$fileClass = new File($file);

			if ($fileClass->writable()) {
				$fileClass->append($content);
			}
		}
	}

/**
 * @deprecated
 * @see App::objects()
 */
	function listObjects($type, $path = null, $cache = true) {
		return App::objects($type, $path, $cache);
	}

/**
 * @deprecated
 * @see App::core()
 */
	function corePaths($type = null) {
		return App::core($type);
	}

/**
 * @deprecated
 * @see App::build()
 */
	function buildPaths($paths) {
		return App::build($paths);
	}

/**
 * Loads app/config/bootstrap.php.
 * If the alternative paths are set in this file
 * they will be added to the paths vars.
 *
 * @param boolean $boot Load application bootstrap (if true)
 * @return void
 * @access private
 */
	function __loadBootstrap($boot) {
		if ($boot) {
			Configure::write('App', array('base' => false, 'baseUrl' => false, 'dir' => APP_DIR, 'webroot' => WEBROOT_DIR, 'www_root' => WWW_ROOT));

			if (!include(CONFIGS . 'core.php')) {
				trigger_error(sprintf(__("Can't find application core file. Please create %score.php, and make sure it is readable by PHP.", true), CONFIGS), E_USER_ERROR);
			}

			if (Configure::read('Cache.disable') !== true) {
				$cache = Cache::config('default');

				if (empty($cache['settings'])) {
					trigger_error(__('Cache not configured properly. Please check Cache::config(); in APP/config/core.php', true), E_USER_WARNING);
					$cache = Cache::config('default', array('engine' => 'File'));
				}
				$path = $prefix = $duration = null;

				if (!empty($cache['settings']['path'])) {
					$path = realpath($cache['settings']['path']);
				} else {
					$prefix = $cache['settings']['prefix'];
				}

				if (Configure::read() >= 1) {
					$duration = '+10 seconds';
				} else {
					$duration = '+999 days';
				}

				if (Cache::config('_cake_core_') === false) {
					Cache::config('_cake_core_', array_merge((array)$cache['settings'], array(
						'prefix' => $prefix . 'cake_core_', 'path' => $path . DS . 'persistent' . DS,
						'serialize' => true, 'duration' => $duration
					)));
				}

				if (Cache::config('_cake_model_') === false) {
					Cache::config('_cake_model_', array_merge((array)$cache['settings'], array(
						'prefix' => $prefix . 'cake_model_', 'path' => $path . DS . 'models' . DS,
						'serialize' => true, 'duration' => $duration
					)));
				}
				Cache::config('default');
			}
			App::build();
			if (!include(CONFIGS . 'bootstrap.php')) {
				trigger_error(sprintf(__("Can't find application bootstrap file. Please create %sbootstrap.php, and make sure it is readable by PHP.", true), CONFIGS), E_USER_ERROR);
			}
		}
	}
}

/**
 * Class/file loader and path management.
 *
 * @link          http://book.cakephp.org/view/933/The-App-Class
 * @since         CakePHP(tm) v 1.2.0.6001
 * @package       cake
 * @subpackage    cake.cake.libs
 */
class App extends Object {

/**
 * List of object types and their properties
 *
 * @var array
 * @access public
 */
	var $types = array(
		'class' => array('suffix' => '.php', 'extends' => null, 'core' => true),
		'file' => array('suffix' => '.php', 'extends' => null, 'core' => true),
		'model' => array('suffix' => '.php', 'extends' => 'AppModel', 'core' => false),
		'behavior' => array('suffix' => '.php', 'extends' => 'ModelBehavior', 'core' => true),
		'controller' => array('suffix' => '_controller.php', 'extends' => 'AppController', 'core' => true),
		'component' => array('suffix' => '.php', 'extends' => null, 'core' => true),
		'lib' => array('suffix' => '.php', 'extends' => null, 'core' => true),
		'view' => array('suffix' => '.php', 'extends' => null, 'core' => true),
		'helper' => array('suffix' => '.php', 'extends' => 'AppHelper', 'core' => true),
		'vendor' => array('suffix' => '', 'extends' => null, 'core' => true),
		'shell' => array('suffix' => '.php', 'extends' => 'Shell', 'core' => true),
		'plugin' => array('suffix' => '', 'extends' => null, 'core' => true)
	);

/**
 * List of additional path(s) where model files reside.
 *
 * @var array
 * @access public
 */
	var $models = array();

/**
 * List of additional path(s) where behavior files reside.
 *
 * @var array
 * @access public
 */
	var $behaviors = array();

/**
 * List of additional path(s) where controller files reside.
 *
 * @var array
 * @access public
 */
	var $controllers = array();

/**
 * List of additional path(s) where component files reside.
 *
 * @var array
 * @access public
 */
	var $components = array();

/**
 * List of additional path(s) where datasource files reside.
 *
 * @var array
 * @access public
 */
	var $datasources = array();

/**
 * List of additional path(s) where libs files reside.
 *
 * @var array
 * @access public
 */
	var $libs = array();
/**
 * List of additional path(s) where view files reside.
 *
 * @var array
 * @access public
 */
	var $views = array();

/**
 * List of additional path(s) where helper files reside.
 *
 * @var array
 * @access public
 */
	var $helpers = array();

/**
 * List of additional path(s) where plugins reside.
 *
 * @var array
 * @access public
 */
	var $plugins = array();

/**
 * List of additional path(s) where vendor packages reside.
 *
 * @var array
 * @access public
 */
	var $vendors = array();

/**
 * List of additional path(s) where locale files reside.
 *
 * @var array
 * @access public
 */
	var $locales = array();

/**
 * List of additional path(s) where console shell files reside.
 *
 * @var array
 * @access public
 */
	var $shells = array();

/**
 * Paths to search for files.
 *
 * @var array
 * @access public
 */
	var $search = array();

/**
 * Whether or not to return the file that is loaded.
 *
 * @var boolean
 * @access public
 */
	var $return = false;

/**
 * Holds key/value pairs of $type => file path.
 *
 * @var array
 * @access private
 */
	var $__map = array();

/**
 * Holds paths for deep searching of files.
 *
 * @var array
 * @access private
 */
	var $__paths = array();

/**
 * Holds loaded files.
 *
 * @var array
 * @access private
 */
	var $__loaded = array();

/**
 * Holds and key => value array of object types.
 *
 * @var array
 * @access private
 */
	var $__objects = array();

/**
 * Used to read information stored path
 *
 * Usage:
 *
 * `App::path('models'); will return all paths for models`
 *
 * @param string $type type of path
 * @return string array
 * @access public
 */
	function path($type) {
		$_this =& App::getInstance();
		if (!isset($_this->{$type})) {
			return array();
		}
		return $_this->{$type};
	}

/**
 * Build path references. Merges the supplied $paths
 * with the base paths and the default core paths.
 *
 * @param array $paths paths defines in config/bootstrap.php
 * @param boolean $reset true will set paths, false merges paths [default] false
 * @return void
 * @access public
 */
	function build($paths = array(), $reset = false) {
		$_this =& App::getInstance();
		$defaults = array(
			'models' => array(MODELS),
			'behaviors' => array(BEHAVIORS),
			'datasources' => array(MODELS . 'datasources'),
			'controllers' => array(CONTROLLERS),
			'components' => array(COMPONENTS),
			'libs' => array(APPLIBS),
			'views' => array(VIEWS),
			'helpers' => array(HELPERS),
			'locales' => array(APP . 'locale' . DS),
			'shells' => array(APP . 'vendors' . DS . 'shells' . DS, VENDORS . 'shells' . DS),
			'vendors' => array(APP . 'vendors' . DS, VENDORS),
			'plugins' => array(APP . 'plugins' . DS)
		);

		if ($reset == true) {
			foreach ($paths as $type => $new) {
				$_this->{$type} = (array)$new;
			}
			return $paths;
		}

		$core = $_this->core();
		$app = array('models' => true, 'controllers' => true, 'helpers' => true);

		foreach ($defaults as $type => $default) {
			$merge = array();

			if (isset($app[$type])) {
				$merge = array(APP);
			}
			if (isset($core[$type])) {
				$merge = array_merge($merge, (array)$core[$type]);
			}

			if (empty($_this->{$type}) || empty($paths)) {
				$_this->{$type} = $default;
			}

			if (!empty($paths[$type])) {
				$path = array_flip(array_flip(array_merge(
					(array)$paths[$type], $_this->{$type}, $merge
				)));
				$_this->{$type} = array_values($path);
			} else {
				$path = array_flip(array_flip(array_merge($_this->{$type}, $merge)));
				$_this->{$type} = array_values($path);
			}
		}
	}

/**
 * Get the path that a plugin is on.  Searches through the defined plugin paths.
 *
 * @param string $plugin CamelCased/lower_cased plugin name to find the path of.
 * @return string full path to the plugin.
 */
	function pluginPath($plugin) {
		$_this =& App::getInstance();
		$pluginDir = Inflector::underscore($plugin);
		for ($i = 0, $length = count($_this->plugins); $i < $length; $i++) {
			if (is_dir($_this->plugins[$i] . $pluginDir)) {
				return $_this->plugins[$i] . $pluginDir . DS ;
			}
		}
		return $_this->plugins[0] . $pluginDir . DS;
	}

/**
 * Find the path that a theme is on.  Search through the defined theme paths.
 *
 * @param string $theme lower_cased theme name to find the path of.
 * @return string full path to the theme.
 */
	function themePath($theme) {
		$_this =& App::getInstance();
		$themeDir = 'themed' . DS . Inflector::underscore($theme);
		for ($i = 0, $length = count($_this->views); $i < $length; $i++) {
			if (is_dir($_this->views[$i] . $themeDir)) {
				return $_this->views[$i] . $themeDir . DS ;
			}
		}
		return $_this->views[0] . $themeDir . DS;
	}

/**
 * Returns a key/value list of all paths where core libs are found.
 * Passing $type only returns the values for a given value of $key.
 *
 * @param string $type valid values are: 'model', 'behavior', 'controller', 'component',
 *    'view', 'helper', 'datasource', 'libs', and 'cake'
 * @return array numeric keyed array of core lib paths
 * @access public
 */
	function core($type = null) {
		static $paths = false;
		if ($paths === false) {
			$paths = Cache::read('core_paths', '_cake_core_');
		}
		if (!$paths) {
			$paths = array();
			$libs = dirname(__FILE__) . DS;
			$cake = dirname($libs) . DS;
			$path = dirname($cake) . DS;

			$paths['cake'][] = $cake;
			$paths['libs'][] = $libs;
			$paths['models'][] = $libs . 'model' . DS;
			$paths['datasources'][] = $libs . 'model' . DS . 'datasources' . DS;
			$paths['behaviors'][] = $libs . 'model' . DS . 'behaviors' . DS;
			$paths['controllers'][] = $libs . 'controller' . DS;
			$paths['components'][] = $libs . 'controller' . DS . 'components' . DS;
			$paths['views'][] = $libs . 'view' . DS;
			$paths['helpers'][] = $libs . 'view' . DS . 'helpers' . DS;
			$paths['plugins'][] = $path . 'plugins' . DS;
			$paths['vendors'][] = $path . 'vendors' . DS;
			$paths['shells'][] = $cake . 'console' . DS . 'libs' . DS;

			Cache::write('core_paths', array_filter($paths), '_cake_core_');
		}
		if ($type && isset($paths[$type])) {
			return $paths[$type];
		}
		return $paths;
	}

/**
 * Returns an array of objects of the given type.
 *
 * Example usage:
 *
 * `App::objects('plugin');` returns `array('DebugKit', 'Blog', 'User');`
 *
 * @param string $type Type of object, i.e. 'model', 'controller', 'helper', or 'plugin'
 * @param mixed $path Optional Scan only the path given. If null, paths for the chosen
 *   type will be used.
 * @param boolean $cache Set to false to rescan objects of the chosen type. Defaults to true.
 * @return mixed Either false on incorrect / miss.  Or an array of found objects.
 * @access public
 */
	function objects($type, $path = null, $cache = true) {
		$objects = array();
		$extension = false;
		$name = $type;

		if ($type === 'file' && !$path) {
			return false;
		} elseif ($type === 'file') {
			$extension = true;
			$name = $type . str_replace(DS, '', $path);
		}
		$_this =& App::getInstance();

		if (empty($_this->__objects) && $cache === true) {
			$_this->__objects = Cache::read('object_map', '_cake_core_');
		}

		if (!isset($_this->__objects[$name]) || $cache !== true) {
			$types = $_this->types;

			if (!isset($types[$type])) {
				return false;
			}
			$objects = array();

			if (empty($path)) {
				$path = $_this->{"{$type}s"};
				if (isset($types[$type]['core']) && $types[$type]['core'] === false) {
					array_pop($path);
				}
			}
			$items = array();

			foreach ((array)$path as $dir) {
				if ($dir != APP) {
					$items = $_this->__list($dir, $types[$type]['suffix'], $extension);
					$objects = array_merge($items, array_diff($objects, $items));
				}
			}

			if ($type !== 'file') {
				foreach ($objects as $key => $value) {
					$objects[$key] = Inflector::camelize($value);
				}
			}

			if ($cache === true) {
				$_this->__resetCache(true);
			}
			$_this->__objects[$name] = $objects;
		}

		return $_this->__objects[$name];
	}

/**
 * Finds classes based on $name or specific file(s) to search.  Calling App::import() will
 * not construct any classes contained in the files. It will only find and require() the file.
 *
 * @link          http://book.cakephp.org/view/934/Using-App-import
 * @param mixed $type The type of Class if passed as a string, or all params can be passed as
 *                    an single array to $type,
 * @param string $name Name of the Class or a unique name for the file
 * @param mixed $parent boolean true if Class Parent should be searched, accepts key => value
 *              array('parent' => $parent ,'file' => $file, 'search' => $search, 'ext' => '$ext');
 *              $ext allows setting the extension of the file name
 *              based on Inflector::underscore($name) . ".$ext";
 * @param array $search paths to search for files, array('path 1', 'path 2', 'path 3');
 * @param string $file full name of the file to search for including extension
 * @param boolean $return, return the loaded file, the file must have a return
 *                         statement in it to work: return $variable;
 * @return boolean true if Class is already in memory or if file is found and loaded, false if not
 * @access public
 */
	function import($type = null, $name = null, $parent = true, $search = array(), $file = null, $return = false) {
		$plugin = $directory = null;

		if (is_array($type)) {
			extract($type, EXTR_OVERWRITE);
		}

		if (is_array($parent)) {
			extract($parent, EXTR_OVERWRITE);
		}

		if ($name === null && $file === null) {
			$name = $type;
			$type = 'Core';
		} elseif ($name === null) {
			$type = 'File';
		}

		if (is_array($name)) {
			foreach ($name as $class) {
				$tempType = $type;
				$plugin = null;

				if (strpos($class, '.') !== false) {
					$value = explode('.', $class);
					$count = count($value);

					if ($count > 2) {
						$tempType = $value[0];
						$plugin = $value[1] . '.';
						$class = $value[2];
					} elseif ($count === 2 && ($type === 'Core' || $type === 'File')) {
						$tempType = $value[0];
						$class = $value[1];
					} else {
						$plugin = $value[0] . '.';
						$class = $value[1];
					}
				}

				if (!App::import($tempType, $plugin . $class, $parent)) {
					return false;
				}
			}
			return true;
		}

		if ($name != null && strpos($name, '.') !== false) {
			list($plugin, $name) = explode('.', $name);
			$plugin = Inflector::camelize($plugin);
		}
		$_this =& App::getInstance();
		$_this->return = $return;

		if (isset($ext)) {
			$file = Inflector::underscore($name) . ".{$ext}";
		}
		$ext = $_this->__settings($type, $plugin, $parent);
		if ($name != null && !class_exists($name . $ext['class'])) {
			if ($load = $_this->__mapped($name . $ext['class'], $type, $plugin)) {
				if ($_this->__load($load)) {
					$_this->__overload($type, $name . $ext['class'], $parent);

					if ($_this->return) {
						return include($load);
					}
					return true;
				} else {
					$_this->__remove($name . $ext['class'], $type, $plugin);
					$_this->__resetCache(true);
				}
			}
			if (!empty($search)) {
				$_this->search = $search;
			} elseif ($plugin) {
				$_this->search = $_this->__paths('plugin');
			} else {
				$_this->search = $_this->__paths($type);
			}
			$find = $file;

			if ($find === null) {
				$find = Inflector::underscore($name . $ext['suffix']).'.php';

				if ($plugin) {
					$paths = $_this->search;
					foreach ($paths as $key => $value) {
						$_this->search[$key] = $value . $ext['path'];
					}
				}
			}

			if (strtolower($type) !== 'vendor' && empty($search) && $_this->__load($file)) {
				$directory = false;
			} else {
				$file = $find;
				$directory = $_this->__find($find, true);
			}

			if ($directory !== null) {
				$_this->__resetCache(true);
				$_this->__map($directory . $file, $name . $ext['class'], $type, $plugin);
				$_this->__overload($type, $name . $ext['class'], $parent);

				if ($_this->return) {
					return include($directory . $file);
				}
				return true;
			}
			return false;
		}
		return true;
	}

/**
 * Returns a single instance of App.
 *
 * @return object
 * @access public
 */
	function &getInstance() {
		static $instance = array();
		if (!$instance) {
			$instance[0] =& new App();
			$instance[0]->__map = (array)Cache::read('file_map', '_cake_core_');
		}
		return $instance[0];
	}

/**
 * Locates the $file in $__paths, searches recursively.
 *
 * @param string $file full file name
 * @param boolean $recursive search $__paths recursively
 * @return mixed boolean on fail, $file directory path on success
 * @access private
 */
	function __find($file, $recursive = true) {
		static $appPath = false;

		if (empty($this->search)) {
			return null;
		} elseif (is_string($this->search)) {
			$this->search = array($this->search);
		}

		if (empty($this->__paths)) {
			$this->__paths = Cache::read('dir_map', '_cake_core_');
		}

		foreach ($this->search as $path) {
			if ($appPath === false) {
				$appPath = rtrim(APP, DS);
			}
			$path = rtrim($path, DS);

			if ($path === $appPath) {
				$recursive = false;
			}
			if ($recursive === false) {
				if ($this->__load($path . DS . $file)) {
					return $path . DS;
				}
				continue;
			}

			if (!isset($this->__paths[$path])) {
				if (!class_exists('Folder')) {
					require LIBS . 'folder.php';
				}
				$Folder =& new Folder();
				$directories = $Folder->tree($path, array('.svn', '.git', 'CVS', 'tests', 'templates'), 'dir');
				sort($directories);
				$this->__paths[$path] = $directories;
			}

			foreach ($this->__paths[$path] as $directory) {
				if ($this->__load($directory . DS . $file)) {
					return $directory . DS;
				}
			}
		}
		return null;
	}

/**
 * Attempts to load $file.
 *
 * @param string $file full path to file including file name
 * @return boolean
 * @access private
 */
	function __load($file) {
		if (empty($file)) {
			return false;
		}
		if (!$this->return && isset($this->__loaded[$file])) {
			return true;
		}
		if (file_exists($file)) {
			if (!$this->return) {
				$this->__loaded[$file] = true;
				require($file);
			}
			return true;
		}
		return false;
	}

/**
 * Maps the $name to the $file.
 *
 * @param string $file full path to file
 * @param string $name unique name for this map
 * @param string $type type object being mapped
 * @param string $plugin camelized if object is from a plugin, the name of the plugin
 * @return void
 * @access private
 */
	function __map($file, $name, $type, $plugin) {
		if ($plugin) {
			$this->__map['Plugin'][$plugin][$type][$name] = $file;
		} else {
			$this->__map[$type][$name] = $file;
		}
	}

/**
 * Returns a file's complete path.
 *
 * @param string $name unique name
 * @param string $type type object
 * @param string $plugin camelized if object is from a plugin, the name of the plugin
 * @return mixed, file path if found, false otherwise
 * @access private
 */
	function __mapped($name, $type, $plugin) {
		if ($plugin) {
			if (isset($this->__map['Plugin'][$plugin][$type]) && isset($this->__map['Plugin'][$plugin][$type][$name])) {
				return $this->__map['Plugin'][$plugin][$type][$name];
			}
			return false;
		}

		if (isset($this->__map[$type]) && isset($this->__map[$type][$name])) {
			return $this->__map[$type][$name];
		}
		return false;
	}

/**
 * Used to overload objects as needed.
 *
 * @param string $type Model or Helper
 * @param string $name Class name to overload
 * @access private
 */
	function __overload($type, $name, $parent) {
		if (($type === 'Model' || $type === 'Helper') && $parent !== false) {
			Overloadable::overload($name);
		}
	}

/**
 * Loads parent classes based on $type.
 * Returns a prefix or suffix needed for loading files.
 *
 * @param string $type type of object
 * @param string $plugin camelized name of plugin
 * @param boolean $parent false will not attempt to load parent
 * @return array
 * @access private
 */
	function __settings($type, $plugin, $parent) {
		if (!$parent) {
			return array('class' => null, 'suffix' => null, 'path' => null);
		}

		if ($plugin) {
			$pluginPath = Inflector::underscore($plugin);
		}
		$path = null;
		$load = strtolower($type);

		switch ($load) {
			case 'model':
				if (!class_exists('Model')) {
					require LIBS . 'model' . DS . 'model.php';
				}
				if (!class_exists('AppModel')) {
					App::import($type, 'AppModel', false);
				}
				if ($plugin) {
					if (!class_exists($plugin . 'AppModel')) {
						App::import($type, $plugin . '.' . $plugin . 'AppModel', false, array(), $pluginPath . DS . $pluginPath . '_app_model.php');
					}
					$path = $pluginPath . DS . 'models' . DS;
				}
				return array('class' => null, 'suffix' => null, 'path' => $path);
			break;
			case 'behavior':
				if ($plugin) {
					$path = $pluginPath . DS . 'models' . DS . 'behaviors' . DS;
				}
				return array('class' => $type, 'suffix' => null, 'path' => $path);
			break;
			case 'datasource':
				if ($plugin) {
					$path = $pluginPath . DS . 'models' . DS . 'datasources' . DS;
				}
				return array('class' => $type, 'suffix' => null, 'path' => $path);
			case 'controller':
				App::import($type, 'AppController', false);
				if ($plugin) {
					App::import($type, $plugin . '.' . $plugin . 'AppController', false, array(), $pluginPath . DS . $pluginPath . '_app_controller.php');
					$path = $pluginPath . DS . 'controllers' . DS;
				}
				return array('class' => $type, 'suffix' => $type, 'path' => $path);
			break;
			case 'component':
				if ($plugin) {
					$path = $pluginPath . DS . 'controllers' . DS . 'components' . DS;
				}
				return array('class' => $type, 'suffix' => null, 'path' => $path);
			break;
			case 'lib':
				if ($plugin) {
					$path = $pluginPath . DS . 'libs' . DS;
				}
				return array('class' => null, 'suffix' => null, 'path' => $path);
			break;
			case 'view':
				if ($plugin) {
					$path = $pluginPath . DS . 'views' . DS;
				}
				return array('class' => $type, 'suffix' => null, 'path' => $path);
			break;
			case 'helper':
				if (!class_exists('AppHelper')) {
					App::import($type, 'AppHelper', false);
				}
				if ($plugin) {
					$path = $pluginPath . DS . 'views' . DS . 'helpers' . DS;
				}
				return array('class' => $type, 'suffix' => null, 'path' => $path);
			break;
			case 'vendor':
				if ($plugin) {
					$path = $pluginPath . DS . 'vendors' . DS;
				}
				return array('class' => null, 'suffix' => null, 'path' => $path);
			break;
			default:
				$type = $suffix = $path = null;
			break;
		}
		return array('class' => null, 'suffix' => null, 'path' => null);
	}

/**
 * Returns default search paths.
 *
 * @param string $type type of object to be searched
 * @return array list of paths
 * @access private
 */
	function __paths($type) {
		$type = strtolower($type);
		$paths = array();

		if ($type === 'core') {
			return App::core('libs');
		}
		if (isset($this->{$type . 's'})) {
			return $this->{$type . 's'};
		}
		return $paths;
	}

/**
 * Removes file location from map if the file has been deleted.
 *
 * @param string $name name of object
 * @param string $type type of object
 * @param string $plugin camelized name of plugin
 * @return void
 * @access private
 */
	function __remove($name, $type, $plugin) {
		if ($plugin) {
			unset($this->__map['Plugin'][$plugin][$type][$name]);
		} else {
			unset($this->__map[$type][$name]);
		}
	}

/**
 * Returns an array of filenames of PHP files in the given directory.
 *
 * @param string $path Path to scan for files
 * @param string $suffix if false, return only directories. if string, match and return files
 * @return array  List of directories or files in directory
 * @access private
 */
	function __list($path, $suffix = false, $extension = false) {
		if (!class_exists('Folder')) {
			require LIBS . 'folder.php';
		}
		$items = array();
		$Folder =& new Folder($path);
		$contents = $Folder->read(false, true);

		if (is_array($contents)) {
			if (!$suffix) {
				return $contents[0];
			} else {
				foreach ($contents[1] as $item) {
					if (substr($item, - strlen($suffix)) === $suffix) {
						if ($extension) {
							$items[] = $item;
						} else {
							$items[] = substr($item, 0, strlen($item) - strlen($suffix));
						}
					}
				}
			}
		}
		return $items;
	}

/**
 * Determines if $__maps, $__objects and $__paths cache should be reset.
 *
 * @param boolean $reset
 * @return boolean
 * @access private
 */
	function __resetCache($reset = null) {
		static $cache = array();
		if (!$cache && $reset === true) {
			$cache = true;
		}
		return $cache;
	}

/**
 * Object destructor.
 *
 * Writes cache file if changes have been made to the $__map or $__paths
 *
 * @return void
 * @access private
 */
	function __destruct() {
		if ($this->__resetCache() === true) {
			$core = App::core('cake');
			unset($this->__paths[rtrim($core[0], DS)]);
			Cache::write('dir_map', array_filter($this->__paths), '_cake_core_');
			Cache::write('file_map', array_filter($this->__map), '_cake_core_');
			Cache::write('object_map', $this->__objects, '_cake_core_');
		}
	}
}


text:
import * as React from 'react';

export interface AppProps {
    readonly baseUrl: string;
}

export const app = (ComposedComponent: any) => {

    return class InnerClass extends React.Component {

        static async getInitialProps(context: any) {
            const props = {baseUrl: context.req ? `${context.req.protocol}://${context.req.get('Host')}` : ''};
            if (typeof ComposedComponent.getInitialProps === 'function') {
                return {...props, ...(await ComposedComponent.getInitialProps(context))};
            }
            return props;
        }

        render() {
            return (<ComposedComponent {...this.props}/>);
        }
    };

};

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Encore\Admin\Form\Field;

use Encore\Admin\Form\Field;

class Password extends Field
{
}


text:
import {Injectable} from "@angular/core";
import {Http, URLSearchParams, Response} from "@angular/http";
import {Person} from "./person.model";
import {Subject, Observable} from "rxjs";
import {PeopleResult} from "./people-result.model";
import {PagerModel} from "./pager.model";

@Injectable()
export class PeopleService {
	private searchUrl = 'http://localhost:4000/search';
	private _searchTermSource = new Subject<string>();
	currentSearchTerm$ = this._searchTermSource.asObservable();

	constructor(private http: Http) {}

	searchEvent(searchTerm) {
		this._searchTermSource.next(searchTerm);
	}

	search(term: any, pager: PagerModel) {
		const params = new URLSearchParams();
		let totalCount = 0;

		params.set('name', term.name);
		params.set('phone', term.phone);
		params.set('age', term.age);
		params.set('pageIndex', pager.pageIndex.toString());
		params.set('pageSize', pager.pageSize.toString());

		return this.http
			.get(this.searchUrl, {search: params})
			.map((res) => res.json())
			.catch(this.handleError)
			.do((result: any) => {
				totalCount = result['total'];
			})
			.map((res) => res['data'].map((person)=> {
				return new Person(person)
			}))
			.map(people => new PeopleResult({
				result: people,
				totalCount: totalCount
			}));
	}

	handleError(error: Response | any){
		let errMsg: string;
		if (error instanceof Response) {
			const body = error.json() || '';
			const err = body.error || JSON.stringify(body);
			errMsg = `${error.status} - ${error.statusText || ''} ${err}`;
		} else {
			errMsg = error.message ? error.message : error.toString();
		}
		return Observable.throw(errMsg || 'server error');

	}
}


text:
$LOAD_PATH.unshift File.expand_path('../..', __FILE__)

require 'test_base'

module KillBillIntegrationTests

  class TestTenant < Base

    def setup
      setup_base

      # Create a second tenant
      @options2              = {:username => 'admin', :password => 'password'}
      tenant                 = setup_create_tenant(@user, @options2)
      @options2[:api_key]    = tenant.api_key
      @options2[:api_secret] = tenant.api_secret

      upload_catalog('Catalog-v1.xml', false, @user, @options)
      upload_catalog('Catalog-v2.xml', false, @user, @options2)

      @account  = create_account(@user, @options)
      @account2 = create_account(@user, @options2)
    end

    def teardown
      teardown_base
    end

    def test_plugin_config
      plugin_name = 'PLUGIN_XXX'
      result = upload_plugin_config(plugin_name, 'plugin.yml', @user, @options2)
      assert_equal('PLUGIN_CONFIG_PLUGIN_XXX', result.key)
      assert_equal(1, result.values.size)

      result = get_plugin_config(plugin_name, @options2)
      assert_equal('PLUGIN_CONFIG_PLUGIN_XXX', result.key)
      assert_equal(1, result.values.size)

      delete_plugin_config(plugin_name, @user, @options2)
      result = get_plugin_config(plugin_name, @options2)
      assert_equal('PLUGIN_CONFIG_PLUGIN_XXX', result.key)
      assert_equal(0, result.values.size)

    end

    def test_cross_tenants_operations
      check_clean_accounts

      handle_server_error { create_entitlement_base(@account.account_id, 'Basic', 'MONTHLY', 'DEFAULT', @user, @options2) }
      check_clean_accounts

      handle_server_error { create_entitlement_base(@account2.account_id, 'Basic', 'MONTHLY', 'DEFAULT', @user, @options) }
      check_clean_accounts

      handle_server_error { create_charge(@account.account_id, 7.0, 'USD', 'My first charge', @user, @options2) }
      check_clean_accounts

      handle_server_error { create_charge(@account2.account_id, 7.0, 'USD', 'My first charge', @user, @options) }
      check_clean_accounts

      handle_server_error { create_auth(@account.account_id, 'key', 'key', 7.0, 'USD', @user, @options2) }
      check_clean_accounts

      handle_server_error { create_auth(@account2.account_id, 'key', 'key', 7.0, 'USD', @user, @options) }
      check_clean_accounts

      kb_clock_add_days(60, nil, @options)

      check_clean_accounts
    end

    private

    def handle_server_error
      yield
      assert false
    rescue KillBillClient::API::InternalServerError
    rescue KillBillClient::API::NotFound
    end

    def check_clean_accounts
      check_clean_account(@account, @options)
      check_clean_account(@account2, @options2)
    end

    def check_clean_account(account, options)
      assert_equal(0, account.bundles(options).size)
      assert_equal(0, account.invoices(false, options).size)
      assert_equal(0, account.payments(options).size)
    end
  end

end


text:
#ifndef DD_RENDER_EDGELIST_H_INCLUDED
#define DD_RENDER_EDGELIST_H_INCLUDED

#include "../dd.h"

typedef struct _ddEdgeList ddEdgeList;
typedef struct _ddEdge ddEdge;  // defined in edgelist.c

#include "rect.h"

struct _ddEdgeList
{
	struct _ddEdgeList* next; // next path in the shape

	ddRect bounds;

	ddEdge* edges;
	int nEdges;

	ddEdge** sortedEdges;

	int index; // current render index
	ddEdge* start; // render list

	boolean swapFills;
};

#include "shape.h"
#include "shapeinstance.h"
#include "raster.h"
#include "matrix.h"
#include "cxform.h"

ddEdgeList*
dd_newEdgeList(ddShapeInstance* s, ddMatrix matrix);

void
dd_destroyEdgeList(ddEdgeList* edgelist);

void
ddEdgeList_recalcSlopes(ddEdgeList* list, ddMatrix matrix, ddRect* bounds);

void
ddEdgeList_recalcCoords(ddEdgeList* list, ddMatrix matrix, ddRect* bounds);

void
ddEdgeList_displace(ddEdgeList* list, fixed dx, fixed dy, ddRect* bounds);

void
ddEdgeList_renderScanline(ddEdgeList* list, int y, fixed maskLeft, fixed maskRight,
							ddImage* image, ddCXform cXform, UInt8* maskBuffer);

void
ddEdgeList_renderMaskedScanline(ddEdgeList* list, ddEdgeList* maskList,
								int y, int maskLeft, int maskRight, ddImage* image,
								ddCXform cXform);

void
ddEdgeList_advanceToScanline(ddEdgeList* list, int y, fixed left, fixed right);

void
ddEdgeList_reset(ddEdgeList* list);

void
ddEdge_unlinkList(ddEdge* edge);

int
ddEdgeList_hitTest(ddEdgeList* list, fixed x, fixed y);

void
ddEdgeList_strokeEdges(ddEdgeList* edgeList, ddImage* image, ddMatrix matrix, ddCXform cXform, ddRect clipRect);

#ifdef DD_DEBUG
void
dd_logEdgeList(ddEdgeList* list);
#endif

#endif /* DD_RENDER_EDGELIST_H_INCLUDED */


text:
Wikilinks are simple URIs like [[Autolinks]],
which will be converted by pegdown.

Another example with spaces: [[Special Chars]],
with square brackets: [[[Square]Brackets]].

The following links should work just normally:

* [example](http://example)
* [ex@mple](http://example)
* [example://](http://example)


text:
#pragma once

#include <react/renderer/components/view/ViewEventEmitter.h>

namespace facebook {
namespace react {

class PickerEventEmitter : public ViewEventEmitter {
 public:
  using ViewEventEmitter::ViewEventEmitter;

  struct PickerIOSChangeEvent {
    std::string newValue;
    int newIndex;
  };

  void onChange(PickerIOSChangeEvent event) const;
};

} // namespace react
} // namespace facebook


text:
package main

import (
	"database/sql"
	"encoding/csv"
	"encoding/xml"
	"github.com/gin-gonic/gin"
	"github.com/jmoiron/sqlx"
	_ "github.com/lib/pq"
	"log"
	"strconv"
	"time"
)

type FiveMinuteObservation struct {
	Year_rtm              int
	Day_rtm               int
	Hourminute_rtm        int
	Air_temp107_avg       sql.NullFloat64
	Relative_humidity_avg sql.NullFloat64
	Leaf_wetness_mv_avg   sql.NullFloat64
	Solar_radiation_avg   sql.NullFloat64
	Wind_direction_d1_wvt sql.NullFloat64
	Wind_speed_wvt        sql.NullFloat64
	Rain_mm               sql.NullFloat64
	Datetime              time.Time
}

type Rain struct {
	Rain_mm  float64   `xml:"rain-mm"`
	Datetime time.Time `xml:"datetime"`
}

func (d *FiveMinuteObservation) toMawn() []string {
	values := []string{
		"5",
		strconv.Itoa(d.Year_rtm),
		strconv.Itoa(d.Day_rtm),
		strconv.Itoa(d.Hourminute_rtm),
		floatToString(d.Rain_mm),
		floatToString(d.Leaf_wetness_mv_avg),
		"",
		floatToString(d.Wind_speed_wvt),
		floatToString(d.Air_temp107_avg),
		floatToString(d.Relative_humidity_avg),
		d.Datetime.Format(time.RFC3339),
	}
	return values
}

func (d *FiveMinuteObservation) mawnHeader() []string {
	values := []string{
		"#code",
		"year",
		"day",
		"time",
		"rain_mm",
		"leaf wetness A",
		"leaf wetnetss B",
		"wind speed",
		"air temperature",
		"relative humidity",
		"timestamp",
	}
	return values
}

func (d *FiveMinuteObservation) mawnUnit() []string {
	values := []string{
		"#",
		"",
		"",
		"",
		"mm",
		"",
		"",
		"m/s",
		"C",
		"%",
	}
	return values
}

func five_minute_observations(db *sqlx.DB, c *gin.Context) {

	rows, err := db.Queryx("select * from (select air_temp107_avg, relative_humidity_avg, leaf_wetness_mv_avg, solar_radiation_avg, wind_direction_d1_wvt, wind_speed_wvt, rain_tipping_mm as rain_mm, lter_five_minute_a.datetime from weather.lter_five_minute_a order by datetime desc limit $1 ) t1 order by datetime", limit(c, 1154))

	if err != nil {
		log.Print("error in query")
		log.Fatal(err)
	}
	defer rows.Close()

	i := 0
	writer := csv.NewWriter(c.Writer)

	obs := FiveMinuteObservation{}
	writer.Write(obs.mawnHeader())
	writer.Write(obs.mawnUnit())
	for rows.Next() {
		if err := rows.StructScan(&obs); err != nil {
			log.Fatal(err)
		}

		obs.Year_rtm, obs.Day_rtm, obs.Hourminute_rtm = CampbellTime(obs.Datetime.Local())

		obs.Relative_humidity_avg.Float64 = obs.Relative_humidity_avg.Float64 * 100

		writer.Write(obs.toMawn())

		if i%500 == 0 {
			writer.Flush()
		}
		i = i + 1

	}
	writer.Flush()
}

func five_minute_observations_js(db *sqlx.DB, c *gin.Context) {
	datetime := c.Request.URL.Query().Get("datetime")

	log.Println(datetime)
	data := []FiveMinuteObservation{}

	db.Select(&data, "select rain_mm, air_temp107_avg, datetime from weather.lter_five_minute_a where datetime > $1 order by datetime limit 1", datetime)
	c.JSON(200, data)
}

func five_minute_observations_xml(db *sqlx.DB, c *gin.Context) {
	data := []FiveMinuteObservation{}

	db.Select(&data, "select rain_mm, datetime from weather.lter_five_minute_a order by datetime desc limit $1", limit(c, 3))
	output := make([]Rain, len(data))
	for key, value := range data {
		output[key].Rain_mm = value.Rain_mm.Float64
		output[key].Datetime = value.Datetime
	}
	xmlOut, err := xml.MarshalIndent(output, " ", " ")
	if err != nil {
		log.Fatal(err)
	}
	c.Writer.Write(xmlOut)
}


text:
import logging

from src.handler.config import config

LOGGING_LEVEL_CONSOLE = logging.DEBUG
LOGGING_LEVEL_FILE = LOGGING_LEVEL_CONSOLE
LOG_FILE = config["Paths"]["log"]
LOG_FILE_MODE = 'a'
LOG_FORMAT = '[%(levelname)s] %(asctime)s - %(message)s'

logging.basicConfig(level=logging.INFO,
                    format=LOG_FORMAT)
logger = logging.getLogger('Log-Discord-Bot')
logger.setLevel(LOGGING_LEVEL_CONSOLE)

# File Handler
file_handler = logging.FileHandler(LOG_FILE, mode=LOG_FILE_MODE)
file_handler.setLevel(LOGGING_LEVEL_FILE)

# create formatter and add it to the handlers
formatter = logging.Formatter(LOG_FORMAT)
file_handler.setFormatter(formatter)

# add the handlers to the logger
logger.addHandler(file_handler)


text:
package org.drools.ide.common.client.modeldriven.dt52;

import org.drools.ide.common.client.modeldriven.dt52.DTColumnConfig52;

/**
 * This is a rule metadata - eg @foo(bar) etc.
 */
public class MetadataCol52 extends DTColumnConfig52 {

    private String metadata;

    public String getMetadata() {
        return metadata;
    }

    public void setMetadata(String metadata) {
        this.metadata = metadata;
    }

}


text:
namespace Labyrinth.Models
{
    using Labyrinth.Common;
    using Labyrinth.Console.Interfaces;

    /// <summary>
    /// Memento design pattern
    /// The 'Originator' class
    /// </summary>
    public class Grid : IGrid
    {
        /// <summary>
        /// nitializes a new instance of the Grid
        /// </summary>
        /// <param name="rows"></param>
        /// <param name="cols"></param>
        public Grid(int rows = GlobalConstants.MaximalGridRowsCount, int cols = GlobalConstants.MaximalGridColsCount)
        {
            this.TotalRows = rows;
            this.TotalCols = cols;
            this.Field = new char[this.TotalRows, this.TotalCols];
        }

        /// <summary>
        /// Get or set field
        /// </summary>
        public char[,] Field { get; set; }

        /// <summary>
        /// Get or set total rows of grid
        /// </summary>
        public int TotalRows { get; set; }

        /// <summary>
        /// Get or set total cols of grid
        /// </summary>
        public int TotalCols { get; set; }

        /// <summary>
        /// Get value from certain cell from playfield
        /// </summary>
        /// <param name="row">The value of current row</param>
        /// <param name="col">The value current col</param>
        /// <returns></returns>
        public char GetCell(int row, int col)
        {
            return this.Field[row, col];
        }

        /// <summary>
        /// Set value from certain cell from playfield
        /// </summary>
        /// <param name="row">The value of current row</param>
        /// <param name="col">The value current col</param>
        /// <param name="value">The value of the char to set</param>
        public void SetCell(int row, int col, char value)
        {
            this.Field[row, col] = value;
        }

        /// <summary>
        /// Get value from certain cell from playfield
        /// </summary>
        /// <param name="position">The position of current cell</param>
        /// <returns></returns>
        public char GetCell(Position position)
        {
            return this.Field[position.X, position.Y];
        }

        /// <summary>
        /// Set value from certain cell to playfield
        /// </summary>
        /// <param name="position">The position of current cell</param>
        /// <param name="value">The value of the char to set</param>
        public void SetCell(Position position, char value)
        {
            this.Field[position.X, position.Y] = value;
        }
    }
}


text:
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace ND.MCJ.Model
{
    /// <summary>
    /// ÕË»§±íÏêÇ飬Õ˵¥
    /// </summary>
    [Table("SystemAccountDetails")]
    public class SystemAccountDetails : BaseModel
    {
        /// <summary>
        /// ×ÔÔöÖ÷¼ü
        /// </summary>
        [DisplayName("SysAccountDetailId")]
        [Key]
        public int SysAccountDetailId { get; set; }
        /// <summary>
        ///
        /// </summary>
        [DisplayName("SysUserId")]
        public int SysUserId { get; set; }
        /// <summary>
        /// ½»Ò×½ð¶î
        /// </summary>
        [DisplayName("Amount")]
        public decimal Amount { get; set; }
        /// <summary>
        /// ϵͳÕË»§ËùÊ£Óà¶î£¬µ±Ç°½»Ò×½áÊøÖ®ºóµÄÓà¶î
        /// </summary>
        [DisplayName("Balance")]
        public decimal Balance { get; set; }
        /// <summary>
        /// ÃèÊö
        /// </summary>
        [DisplayName("Description")]
        public String Description { get; set; }
        /// <summary>
        /// IP
        /// </summary>
        [DisplayName("IP")]
        public String IP { get; set; }
        /// <summary>
        /// ´´½¨ÈÕÆÚ
        /// </summary>
        [DisplayName("CreateDate")]
        public DateTime CreateDate { get; set; }
    }
}


text:
/**
 * Used for intents (requesting and action), such as opening modals, zooming the map, etc.
 * @param {string} name of the intent (toggleModal, refreshMap, filterChanged)
 * @param {object} JSON package for intent
 * @param {object} Angular Scope object for emiting the event up the DOM.  This should correspond to an element's paranet controller.
*/
module.exports = function(name, data, scope)
{
  scope = scope || geodash.util.getScope("geodash-main");
  scope.$emit(name, data);
};


text:
package org.apache.hadoop.hbase.util;

import static org.apache.hadoop.hbase.util.Order.ASCENDING;
import static org.apache.hadoop.hbase.util.Order.DESCENDING;
import static org.junit.Assert.assertArrayEquals;

import java.util.Arrays;
import java.util.Collections;

import org.apache.hadoop.hbase.SmallTests;
import org.junit.Test;
import org.junit.experimental.categories.Category;

@Category(SmallTests.class)
public class TestOrder {

  byte[][] VALS = { Bytes.toBytes("foo"), Bytes.toBytes("bar"), Bytes.toBytes("baz") };

  @Test
  public void testApplyAscending() {
    byte[][] vals = new byte[VALS.length][];
    byte[][] ordered = new byte[VALS.length][];
    for (int i = 0; i < VALS.length; i++) {
      vals[i] = Arrays.copyOf(VALS[i], VALS[i].length);
      ordered[i] = Arrays.copyOf(VALS[i], VALS[i].length);
      ASCENDING.apply(ordered[i]);
    }

    Arrays.sort(vals, Bytes.BYTES_COMPARATOR);
    Arrays.sort(ordered, Bytes.BYTES_COMPARATOR);

    for (int i = 0; i < vals.length; i++) {
      assertArrayEquals(vals[i], ordered[i]);
    }

    byte[] rangeApply = Arrays.copyOf(VALS[0], VALS[0].length);
    ASCENDING.apply(rangeApply, 1, 1);
    assertArrayEquals(VALS[0], rangeApply);
  }

  @Test
  public void testApplyDescending() {
    byte[][] vals = new byte[VALS.length][];
    byte[][] ordered = new byte[VALS.length][];
    for (int i = 0; i < VALS.length; i++) {
      vals[i] = Arrays.copyOf(VALS[i], VALS[i].length);
      ordered[i] = Arrays.copyOf(VALS[i], VALS[i].length);
      DESCENDING.apply(ordered[i]);
    }

    Arrays.sort(vals, Collections.reverseOrder(Bytes.BYTES_COMPARATOR));
    Arrays.sort(ordered, Bytes.BYTES_COMPARATOR);

    for (int i = 0; i < vals.length; i++) {
      DESCENDING.apply(ordered[i]);
      assertArrayEquals(vals[i], ordered[i]);
    }

    byte[] expected = new byte[] { VALS[0][0], DESCENDING.apply(VALS[0][1]), VALS[0][2] };
    byte[] rangeApply = Arrays.copyOf(VALS[0], VALS[0].length);
    DESCENDING.apply(rangeApply, 1, 1);
    assertArrayEquals(expected, rangeApply);
  }
}


text:
<?php

namespace Infuse\Billing\Exception;

class BillingException extends \Exception
{
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.10"/>
<title>XLabs: Class Members - Variables</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="navtree.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

XLabs

Cross-platform reusable C# libraries

Main Page

Packages

Classes

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

Class List

Class Index

Class Hierarchy

Class Members

All

Functions

Variables

Enumerations

Properties

Events

a

b

c

d

e

f

g

h

i

k

l

m

n

o

p

r

s

t

u

v

w

x

y

- d -

DataSourceProperty
: XLabs.Forms.Charting.Controls.Chart

DateBackgroundColor
: XLabs.Forms.Controls.MonoDroid.TimesSquare.StyleDescriptor
, XLabs.Forms.Controls.StyleDescriptor

DateBackgroundColorProperty
: XLabs.Forms.Controls.CalendarView

DateForegroundColor
: XLabs.Forms.Controls.MonoDroid.TimesSquare.StyleDescriptor
, XLabs.Forms.Controls.StyleDescriptor

DateForegroundColorProperty
: XLabs.Forms.Controls.CalendarView

DateLabelFont
: XLabs.Forms.Controls.MonoDroid.TimesSquare.StyleDescriptor
, XLabs.Forms.Controls.StyleDescriptor

DateLabelFontProperty
: XLabs.Forms.Controls.CalendarView

DateSeparatorColor
: XLabs.Forms.Controls.MonoDroid.TimesSquare.StyleDescriptor
, XLabs.Forms.Controls.StyleDescriptor

DateSeparatorColorProperty
: XLabs.Forms.Controls.CalendarView

DayOfWeekLabelBackgroundColor
: XLabs.Forms.Controls.MonoDroid.TimesSquare.StyleDescriptor
, XLabs.Forms.Controls.StyleDescriptor

DayOfWeekLabelBackgroundColorProperty
: XLabs.Forms.Controls.CalendarView

DayOfWeekLabelForegroundColor
: XLabs.Forms.Controls.MonoDroid.TimesSquare.StyleDescriptor
, XLabs.Forms.Controls.StyleDescriptor

DayOfWeekLabelForegroundColorProperty
: XLabs.Forms.Controls.CalendarView

DayTiles
: XLabs.Forms.Controls.MonthGridView

DefaultImageProperty
: XLabs.Forms.Controls.WebImage

DefaultTextProperty
: XLabs.Forms.Controls.CheckBox

DetailLocationProperty
: XLabs.Forms.Controls.ExtendedTextCell

DirectionProperty
: XLabs.Forms.Behaviors.GestureInterest

DisabledImageTintColorProperty
: XLabs.Forms.Controls.ImageButton

DisabledSourceProperty
: XLabs.Forms.Controls.ImageButton

DisclousureImageProperty
: XLabs.Forms.Controls.ExtendedTextCell
, XLabs.Forms.Controls.ExtendedViewCell

DisplayedMonthProperty
: XLabs.Forms.Controls.CalendarView

DropShadowColorProperty
: XLabs.Forms.Controls.ExtendedLabel

Generated by

     1.8.10


text:
package highlighting

import (
	"bytes"
	"fmt"
	"strings"
	"testing"

	"github.com/alecthomas/chroma/v2"
	chromahtml "github.com/alecthomas/chroma/v2/formatters/html"
	"github.com/yuin/goldmark"
	"github.com/yuin/goldmark/testutil"
	"github.com/yuin/goldmark/util"
)

func TestHighlighting(t *testing.T) {
	var css bytes.Buffer
	markdown := goldmark.New(
		goldmark.WithExtensions(
			NewHighlighting(
				WithStyle("monokai"),
				WithCSSWriter(&css),
				WithFormatOptions(
					chromahtml.WithClasses(true),
					chromahtml.WithLineNumbers(false),
				),
				WithWrapperRenderer(func(w util.BufWriter, c CodeBlockContext, entering bool) {
					_, ok := c.Language()
					if entering {
						if !ok {
							w.WriteString("
")
							return
						}
						w.WriteString(`<div class="highlight">`)
					} else {
						if !ok {
							w.WriteString("
")
							return
						}
						w.WriteString(`</div>`)
					}
				}),
				WithCodeBlockOptions(func(c CodeBlockContext) []chromahtml.Option {
					if language, ok := c.Language(); ok {
						// Turn on line numbers for Go only.
						if string(language) == "go" {
							return []chromahtml.Option{
								chromahtml.WithLineNumbers(true),
							}
						}
					}
					return nil
				}),
			),
		),
	)
	var buffer bytes.Buffer
	if err := markdown.Convert([]byte(`
Title
=======
`+"``` go\n"+`func main() {
    fmt.Println("ok")
}
`+"```"+`
`), &buffer); err != nil {
		t.Fatal(err)
	}

	if strings.TrimSpace(buffer.String()) != strings.TrimSpace(`

Title

1func main() {
2    fmt.Println("ok")
3}

`) {
		t.Error("failed to render HTML\n")
	}

	expected := strings.TrimSpace(`/* Background */ .bg { color: #f8f8f2; background-color: #272822; }
/* PreWrapper */ .chroma { color: #f8f8f2; background-color: #272822; }
/* LineNumbers targeted by URL anchor */ .chroma .ln:target { color: #f8f8f2; background-color: #3c3d38 }
/* LineNumbersTable targeted by URL anchor */ .chroma .lnt:target { color: #f8f8f2; background-color: #3c3d38 }
/* Error */ .chroma .err { color: #960050; background-color: #1e0010 }
/* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; }
/* LineTable */ .chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; }
/* LineHighlight */ .chroma .hl { background-color: #3c3d38 }
/* LineNumbersTable */ .chroma .lnt { white-space: pre; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
/* LineNumbers */ .chroma .ln { white-space: pre; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
/* Line */ .chroma .line { display: flex; }
/* Keyword */ .chroma .k { color: #66d9ef }
/* KeywordConstant */ .chroma .kc { color: #66d9ef }
/* KeywordDeclaration */ .chroma .kd { color: #66d9ef }
/* KeywordNamespace */ .chroma .kn { color: #f92672 }
/* KeywordPseudo */ .chroma .kp { color: #66d9ef }
/* KeywordReserved */ .chroma .kr { color: #66d9ef }
/* KeywordType */ .chroma .kt { color: #66d9ef }
/* NameAttribute */ .chroma .na { color: #a6e22e }
/* NameClass */ .chroma .nc { color: #a6e22e }
/* NameConstant */ .chroma .no { color: #66d9ef }
/* NameDecorator */ .chroma .nd { color: #a6e22e }
/* NameException */ .chroma .ne { color: #a6e22e }
/* NameFunction */ .chroma .nf { color: #a6e22e }
/* NameOther */ .chroma .nx { color: #a6e22e }
/* NameTag */ .chroma .nt { color: #f92672 }
/* Literal */ .chroma .l { color: #ae81ff }
/* LiteralDate */ .chroma .ld { color: #e6db74 }
/* LiteralString */ .chroma .s { color: #e6db74 }
/* LiteralStringAffix */ .chroma .sa { color: #e6db74 }
/* LiteralStringBacktick */ .chroma .sb { color: #e6db74 }
/* LiteralStringChar */ .chroma .sc { color: #e6db74 }
/* LiteralStringDelimiter */ .chroma .dl { color: #e6db74 }
/* LiteralStringDoc */ .chroma .sd { color: #e6db74 }
/* LiteralStringDouble */ .chroma .s2 { color: #e6db74 }
/* LiteralStringEscape */ .chroma .se { color: #ae81ff }
/* LiteralStringHeredoc */ .chroma .sh { color: #e6db74 }
/* LiteralStringInterpol */ .chroma .si { color: #e6db74 }
/* LiteralStringOther */ .chroma .sx { color: #e6db74 }
/* LiteralStringRegex */ .chroma .sr { color: #e6db74 }
/* LiteralStringSingle */ .chroma .s1 { color: #e6db74 }
/* LiteralStringSymbol */ .chroma .ss { color: #e6db74 }
/* LiteralNumber */ .chroma .m { color: #ae81ff }
/* LiteralNumberBin */ .chroma .mb { color: #ae81ff }
/* LiteralNumberFloat */ .chroma .mf { color: #ae81ff }
/* LiteralNumberHex */ .chroma .mh { color: #ae81ff }
/* LiteralNumberInteger */ .chroma .mi { color: #ae81ff }
/* LiteralNumberIntegerLong */ .chroma .il { color: #ae81ff }
/* LiteralNumberOct */ .chroma .mo { color: #ae81ff }
/* Operator */ .chroma .o { color: #f92672 }
/* OperatorWord */ .chroma .ow { color: #f92672 }
/* Comment */ .chroma .c { color: #75715e }
/* CommentHashbang */ .chroma .ch { color: #75715e }
/* CommentMultiline */ .chroma .cm { color: #75715e }
/* CommentSingle */ .chroma .c1 { color: #75715e }
/* CommentSpecial */ .chroma .cs { color: #75715e }
/* CommentPreproc */ .chroma .cp { color: #75715e }
/* CommentPreprocFile */ .chroma .cpf { color: #75715e }
/* GenericDeleted */ .chroma .gd { color: #f92672 }
/* GenericEmph */ .chroma .ge { font-style: italic }
/* GenericInserted */ .chroma .gi { color: #a6e22e }
/* GenericStrong */ .chroma .gs { font-weight: bold }
/* GenericSubheading */ .chroma .gu { color: #75715e }`)

	gotten := strings.TrimSpace(css.String())

	if expected != gotten {
		diff := testutil.DiffPretty([]byte(expected), []byte(gotten))
		t.Errorf("incorrect CSS.\n%s", string(diff))
	}
}

func TestHighlighting2(t *testing.T) {
	markdown := goldmark.New(
		goldmark.WithExtensions(
			Highlighting,
		),
	)
	var buffer bytes.Buffer
	if err := markdown.Convert([]byte(`
Title
=======
`+"```"+`
func main() {
    fmt.Println("ok")
}
`+"```"+`
`), &buffer); err != nil {
		t.Fatal(err)
	}

	if strings.TrimSpace(buffer.String()) != strings.TrimSpace(`

Title

func main() {
    fmt.Println("ok")
}

`) {
		t.Error("failed to render HTML")
	}
}

func TestHighlighting3(t *testing.T) {
	markdown := goldmark.New(
		goldmark.WithExtensions(
			Highlighting,
		),
	)
	var buffer bytes.Buffer
	if err := markdown.Convert([]byte(`
Title
=======

`+"```"+`cpp {hl_lines=[1,2]}
#include <iostream>
int main() {
    std::cout<< "hello" << std::endl;
}
`+"```"+`
`), &buffer); err != nil {
		t.Fatal(err)
	}
	if strings.TrimSpace(buffer.String()) != strings.TrimSpace(`

Title

#include <iostream>
int main() {
    std::cout<< "hello" << std::endl;
}

`) {
		t.Error("failed to render HTML")
	}
}

func TestHighlightingCustom(t *testing.T) {
	custom := chroma.MustNewStyle("custom", chroma.StyleEntries{
		chroma.Background:           "#cccccc bg:#1d1d1d",
		chroma.Comment:              "#999999",
		chroma.CommentSpecial:       "#cd0000",
		chroma.Keyword:              "#cc99cd",
		chroma.KeywordDeclaration:   "#cc99cd",
		chroma.KeywordNamespace:     "#cc99cd",
		chroma.KeywordType:          "#cc99cd",
		chroma.Operator:             "#67cdcc",
		chroma.OperatorWord:         "#cdcd00",
		chroma.NameClass:            "#f08d49",
		chroma.NameBuiltin:          "#f08d49",
		chroma.NameFunction:         "#f08d49",
		chroma.NameException:        "bold #666699",
		chroma.NameVariable:         "#00cdcd",
		chroma.LiteralString:        "#7ec699",
		chroma.LiteralNumber:        "#f08d49",
		chroma.LiteralStringBoolean: "#f08d49",
		chroma.GenericHeading:       "bold #000080",
		chroma.GenericSubheading:    "bold #800080",
		chroma.GenericDeleted:       "#e2777a",
		chroma.GenericInserted:      "#cc99cd",
		chroma.GenericError:         "#e2777a",
		chroma.GenericEmph:          "italic",
		chroma.GenericStrong:        "bold",
		chroma.GenericPrompt:        "bold #000080",
		chroma.GenericOutput:        "#888",
		chroma.GenericTraceback:     "#04D",
		chroma.GenericUnderline:     "underline",
		chroma.Error:                "border:#e2777a",
	})

	var css bytes.Buffer
	markdown := goldmark.New(
		goldmark.WithExtensions(
			NewHighlighting(
				WithStyle("monokai"), // to make sure it is overrided even if present
				WithCustomStyle(custom),
				WithCSSWriter(&css),
				WithFormatOptions(
					chromahtml.WithClasses(true),
					chromahtml.WithLineNumbers(false),
				),
				WithWrapperRenderer(func(w util.BufWriter, c CodeBlockContext, entering bool) {
					_, ok := c.Language()
					if entering {
						if !ok {
							w.WriteString("
")
							return
						}
						w.WriteString(`<div class="highlight">`)
					} else {
						if !ok {
							w.WriteString("
")
							return
						}
						w.WriteString(`</div>`)
					}
				}),
				WithCodeBlockOptions(func(c CodeBlockContext) []chromahtml.Option {
					if language, ok := c.Language(); ok {
						// Turn on line numbers for Go only.
						if string(language) == "go" {
							return []chromahtml.Option{
								chromahtml.WithLineNumbers(true),
							}
						}
					}
					return nil
				}),
			),
		),
	)
	var buffer bytes.Buffer
	if err := markdown.Convert([]byte(`
Title
=======
`+"``` go\n"+`func main() {
    fmt.Println("ok")
}
`+"```"+`
`), &buffer); err != nil {
		t.Fatal(err)
	}

	if strings.TrimSpace(buffer.String()) != strings.TrimSpace(`

Title

1func main() {
2    fmt.Println("ok")
3}

`) {
		t.Error("failed to render HTML", buffer.String())
	}

	expected := strings.TrimSpace(`/* Background */ .bg { color: #cccccc; background-color: #1d1d1d; }
/* PreWrapper */ .chroma { color: #cccccc; background-color: #1d1d1d; }
/* LineNumbers targeted by URL anchor */ .chroma .ln:target { color: #cccccc; background-color: #333333 }
/* LineNumbersTable targeted by URL anchor */ .chroma .lnt:target { color: #cccccc; background-color: #333333 }
/* Error */ .chroma .err {  }
/* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; }
/* LineTable */ .chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; }
/* LineHighlight */ .chroma .hl { background-color: #333333 }
/* LineNumbersTable */ .chroma .lnt { white-space: pre; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #666666 }
/* LineNumbers */ .chroma .ln { white-space: pre; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #666666 }
/* Line */ .chroma .line { display: flex; }
/* Keyword */ .chroma .k { color: #cc99cd }
/* KeywordConstant */ .chroma .kc { color: #cc99cd }
/* KeywordDeclaration */ .chroma .kd { color: #cc99cd }
/* KeywordNamespace */ .chroma .kn { color: #cc99cd }
/* KeywordPseudo */ .chroma .kp { color: #cc99cd }
/* KeywordReserved */ .chroma .kr { color: #cc99cd }
/* KeywordType */ .chroma .kt { color: #cc99cd }
/* NameBuiltin */ .chroma .nb { color: #f08d49 }
/* NameClass */ .chroma .nc { color: #f08d49 }
/* NameException */ .chroma .ne { color: #666699; font-weight: bold }
/* NameFunction */ .chroma .nf { color: #f08d49 }
/* NameVariable */ .chroma .nv { color: #00cdcd }
/* LiteralString */ .chroma .s { color: #7ec699 }
/* LiteralStringAffix */ .chroma .sa { color: #7ec699 }
/* LiteralStringBacktick */ .chroma .sb { color: #7ec699 }
/* LiteralStringChar */ .chroma .sc { color: #7ec699 }
/* LiteralStringDelimiter */ .chroma .dl { color: #7ec699 }
/* LiteralStringDoc */ .chroma .sd { color: #7ec699 }
/* LiteralStringDouble */ .chroma .s2 { color: #7ec699 }
/* LiteralStringEscape */ .chroma .se { color: #7ec699 }
/* LiteralStringHeredoc */ .chroma .sh { color: #7ec699 }
/* LiteralStringInterpol */ .chroma .si { color: #7ec699 }
/* LiteralStringOther */ .chroma .sx { color: #7ec699 }
/* LiteralStringRegex */ .chroma .sr { color: #7ec699 }
/* LiteralStringSingle */ .chroma .s1 { color: #7ec699 }
/* LiteralStringSymbol */ .chroma .ss { color: #7ec699 }
/* LiteralNumber */ .chroma .m { color: #f08d49 }
/* LiteralNumberBin */ .chroma .mb { color: #f08d49 }
/* LiteralNumberFloat */ .chroma .mf { color: #f08d49 }
/* LiteralNumberHex */ .chroma .mh { color: #f08d49 }
/* LiteralNumberInteger */ .chroma .mi { color: #f08d49 }
/* LiteralNumberIntegerLong */ .chroma .il { color: #f08d49 }
/* LiteralNumberOct */ .chroma .mo { color: #f08d49 }
/* Operator */ .chroma .o { color: #67cdcc }
/* OperatorWord */ .chroma .ow { color: #cdcd00 }
/* Comment */ .chroma .c { color: #999999 }
/* CommentHashbang */ .chroma .ch { color: #999999 }
/* CommentMultiline */ .chroma .cm { color: #999999 }
/* CommentSingle */ .chroma .c1 { color: #999999 }
/* CommentSpecial */ .chroma .cs { color: #cd0000 }
/* CommentPreproc */ .chroma .cp { color: #999999 }
/* CommentPreprocFile */ .chroma .cpf { color: #999999 }
/* GenericDeleted */ .chroma .gd { color: #e2777a }
/* GenericEmph */ .chroma .ge { font-style: italic }
/* GenericError */ .chroma .gr { color: #e2777a }
/* GenericHeading */ .chroma .gh { color: #000080; font-weight: bold }
/* GenericInserted */ .chroma .gi { color: #cc99cd }
/* GenericOutput */ .chroma .go { color: #888888 }
/* GenericPrompt */ .chroma .gp { color: #000080; font-weight: bold }
/* GenericStrong */ .chroma .gs { font-weight: bold }
/* GenericSubheading */ .chroma .gu { color: #800080; font-weight: bold }
/* GenericTraceback */ .chroma .gt { color: #0044dd }
/* GenericUnderline */ .chroma .gl { text-decoration: underline }`)

	gotten := strings.TrimSpace(css.String())

	if expected != gotten {
		diff := testutil.DiffPretty([]byte(expected), []byte(gotten))
		t.Errorf("incorrect CSS.\n%s", string(diff))
	}
}

func TestHighlightingHlLines(t *testing.T) {
	markdown := goldmark.New(
		goldmark.WithExtensions(
			NewHighlighting(
				WithFormatOptions(
					chromahtml.WithClasses(true),
				),
			),
		),
	)

	for i, test := range []struct {
		attributes string
		expect     []int
	}{
		{`hl_lines=["2"]`, []int{2}},
		{`hl_lines=["2-3",5],linenostart=5`, []int{2, 3, 5}},
		{`hl_lines=["2-3"]`, []int{2, 3}},
		{`hl_lines=["2-3",5],linenostart="5"`, []int{2, 3}}, // linenostart must be a number. string values are ignored
	} {
		t.Run(fmt.Sprint(i), func(t *testing.T) {
			var buffer bytes.Buffer
			codeBlock := fmt.Sprintf(`bash {%s}
LINE1
LINE2
LINE3
LINE4
LINE5
LINE6
LINE7
LINE8
`, test.attributes)

			if err := markdown.Convert([]byte(`
`+"```"+codeBlock+"```"+`
`), &buffer); err != nil {
				t.Fatal(err)
			}

			for _, line := range test.expect {
				expectStr := fmt.Sprintf("LINE%d\n", line)
				if !strings.Contains(buffer.String(), expectStr) {
					t.Fatal("got\n", buffer.String(), "\nexpected\n", expectStr)
				}
			}
		})
	}
}

type nopPreWrapper struct{}

// Start is called to write a start
 element.
func (nopPreWrapper) Start(code bool, styleAttr string) string { return "" }

// End is called to write the end
 element.
func (nopPreWrapper) End(code bool) string { return "" }

func TestHighlightingLinenos(t *testing.T) {
	outputLineNumbersInTable := `

1

LINE1

`

	for i, test := range []struct {
		attributes         string
		lineNumbers        bool
		lineNumbersInTable bool
		expect             string
	}{
		{`linenos=true`, false, false, `1LINE1
`},
		{`linenos=false`, false, false, `LINE1
`},
		{``, true, false, `1LINE1
`},
		{``, true, true, outputLineNumbersInTable},
		{`linenos=inline`, true, true, `1LINE1
`},
		{`linenos=foo`, false, false, `1LINE1
`},
		{`linenos=table`, false, false, outputLineNumbersInTable},
	} {
		t.Run(fmt.Sprint(i), func(t *testing.T) {
			markdown := goldmark.New(
				goldmark.WithExtensions(
					NewHighlighting(
						WithFormatOptions(
							chromahtml.WithLineNumbers(test.lineNumbers),
							chromahtml.LineNumbersInTable(test.lineNumbersInTable),
							chromahtml.WithPreWrapper(nopPreWrapper{}),
							chromahtml.WithClasses(true),
						),
					),
				),
			)

			var buffer bytes.Buffer
			codeBlock := fmt.Sprintf(`bash {%s}
LINE1
`, test.attributes)

			content := "```" + codeBlock + "```"

			if err := markdown.Convert([]byte(content), &buffer); err != nil {
				t.Fatal(err)
			}

			s := strings.TrimSpace(buffer.String())

			if s != test.expect {
				t.Fatal("got\n", s, "\nexpected\n", test.expect)
			}
		})
	}
}

func TestHighlightingGuessLanguage(t *testing.T) {
	markdown := goldmark.New(
		goldmark.WithExtensions(
			NewHighlighting(
				WithGuessLanguage(true),
				WithFormatOptions(
					chromahtml.WithClasses(true),
					chromahtml.WithLineNumbers(true),
				),
			),
		),
	)
	var buffer bytes.Buffer
	if err := markdown.Convert([]byte("```"+`
LINE
`+"```"), &buffer); err != nil {
		t.Fatal(err)
	}
	if strings.TrimSpace(buffer.String()) != strings.TrimSpace(`

1LINE

`) {
		t.Errorf("render mismatch, got\n%s", buffer.String())
	}
}

func TestCoalesceNeeded(t *testing.T) {
	markdown := goldmark.New(
		goldmark.WithExtensions(
			NewHighlighting(
				// WithGuessLanguage(true),
				WithFormatOptions(
					chromahtml.WithClasses(true),
					chromahtml.WithLineNumbers(true),
				),
			),
		),
	)
	var buffer bytes.Buffer
	if err := markdown.Convert([]byte("```http"+`
GET /foo HTTP/1.1
Content-Type: application/json
User-Agent: foo

{
  "hello": "world"
}
`+"```"), &buffer); err != nil {
		t.Fatal(err)
	}
	if strings.TrimSpace(buffer.String()) != strings.TrimSpace(`

1GET /foo HTTP/1.1
2Content-Type: application/json
3User-Agent: foo
4
5{
6  "hello": "world"
7}

`) {
		t.Errorf("render mismatch, got\n%s", buffer.String())
	}
}


text:
namespace PhysBAM{

template<class T>
class LEVELSET_IMPLICIT_SURFACE:public IMPLICIT_SURFACE<T>
{
public:
    using IMPLICIT_SURFACE<T>::levelset_data;using IMPLICIT_SURFACE<T>::octree_data;using IMPLICIT_SURFACE<T>::box;using IMPLICIT_SURFACE<T>::minimum_cell_size;

    LEVELSET_3D<T> levelset;

    LEVELSET_IMPLICIT_SURFACE(GRID_3D<T>& grid_input,ARRAYS_3D<T>& phi_input)
        :levelset(grid_input,phi_input)
    {
        levelset_data=true;octree_data=false;
        Update_Box();Update_Minimum_Cell_Size();
    }

    ~LEVELSET_IMPLICIT_SURFACE()
    {}

    static LEVELSET_IMPLICIT_SURFACE* Create()
    {return new LEVELSET_IMPLICIT_SURFACE(*(new GRID_3D<T>),*(new ARRAYS_3D<T>));}

    void Destroy_Data() // this is dangerous
    {delete &levelset.grid;delete &levelset.phi;}

    void Set_Custom_Interpolation(INTERPOLATION<T,T>& interpolation_input)
    {levelset.Set_Custom_Interpolation(interpolation_input);}

    void Set_Custom_Secondary_Interpolation(INTERPOLATION<T,T>& interpolation_input)
    {levelset.Set_Custom_Secondary_Interpolation(interpolation_input);}

    void Set_Custom_Normal_Interpolation(INTERPOLATION<T,VECTOR_3D<T> >& interpolation_input)
    {levelset.Set_Custom_Normal_Interpolation(interpolation_input);}

    void Update_Box()
    {box.xmin=levelset.grid.xmin;box.xmax=levelset.grid.xmax;box.ymin=levelset.grid.ymin;box.ymax=levelset.grid.ymax;
    box.zmin=levelset.grid.zmin;box.zmax=levelset.grid.zmax;}

    void Update_Minimum_Cell_Size(const int maximum_depth=0)
    {minimum_cell_size=levelset.grid.min_dx_dy_dz;}

    T operator()(const VECTOR_3D<T>& location) const
    {return levelset.Phi(location);}

    T Extended_Phi(const VECTOR_3D<T>& location) const
    {return levelset.Extended_Phi(location);}

    T Phi_Secondary(const VECTOR_3D<T>& location) const
    {return levelset.Phi_Secondary(location);}

    VECTOR_3D<T> Normal(const VECTOR_3D<T>& location,const int aggregate=-1) const
    {assert((aggregate >= 1 && aggregate <= 6) || aggregate == -1);
    if(aggregate != -1) return box.Normal(aggregate);else return levelset.Normal(location);}

    VECTOR_3D<T> Extended_Normal(const VECTOR_3D<T>& location,const int aggregate=-1) const
    {assert((aggregate >= 1 && aggregate <= 6) || aggregate == -1);
    if(aggregate != -1) return box.Normal(aggregate);else return levelset.Extended_Normal(location);}

    MATRIX_3X3<T> Hessian(const VECTOR_3D<T>& X) const
    {return levelset.Hessian(X);}

    void Principle_Curvatures(const VECTOR_3D<T>& X,T& curvature1,T& curvature2) const
    {levelset.Principle_Curvatures(X,curvature1,curvature2);}

    void Compute_Normals()
    {levelset.Compute_Normals();}

    void Compute_Cell_Minimum_And_Maximum(const bool recompute_if_exists=true)
    {levelset.Compute_Cell_Minimum_And_Maximum(recompute_if_exists);}

    void Rescale(const T scaling_factor)
    {levelset.grid.Initialize(levelset.grid.m,levelset.grid.n,levelset.grid.mn,scaling_factor*levelset.grid.xmin,scaling_factor*levelset.grid.xmax,
                                        scaling_factor*levelset.grid.ymin,scaling_factor*levelset.grid.ymax,scaling_factor*levelset.grid.zmin,scaling_factor*levelset.grid.zmax);
    levelset.phi*=scaling_factor;Update_Box();Update_Minimum_Cell_Size();}

    void Translate(const VECTOR_3D<T>& translation)
    {levelset.grid.Initialize(levelset.grid.m,levelset.grid.n,levelset.grid.mn,levelset.grid.xmin+translation.x,levelset.grid.xmax+translation.x,levelset.grid.ymin+translation.y,
                                        levelset.grid.ymax+translation.y,levelset.grid.zmin+translation.z,levelset.grid.zmax+translation.z);
    Update_Box();Update_Minimum_Cell_Size();}

    void Inflate(const T inflation_distance)
    {levelset.phi-=inflation_distance;}

    T Integration_Step(const T phi) const
    {T distance=fabs(phi);
    if(distance > 3*minimum_cell_size) return (T).5*distance;
    else if(distance > minimum_cell_size) return (T).25*distance;
    else return (T).1*minimum_cell_size;}

    bool Lazy_Inside(const VECTOR_3D<T>& location,const T contour_value=0) const
    {return box.Lazy_Inside(location) && levelset.Lazy_Inside(location,contour_value);}

    bool Lazy_Inside_And_Value(const VECTOR_3D<T>& location,T& phi_value,const T contour_value=0) const
    {return box.Lazy_Inside(location) && levelset.Lazy_Inside_And_Value(location,phi_value,contour_value);}

    bool Lazy_Inside_Extended_Levelset(const VECTOR_3D<T>& unclamped_X,const T contour_value=0) const
    {return levelset.Lazy_Inside_Extended_Levelset(unclamped_X,contour_value);}

    bool Lazy_Inside_Extended_Levelset_And_Value(const VECTOR_3D<T>& unclamped_X,T& phi_value,const T contour_value=0) const
    {return levelset.Lazy_Inside_Extended_Levelset_And_Value(unclamped_X,phi_value,contour_value);}

    bool Lazy_Outside(const VECTOR_3D<T>& location,const T contour_value=0) const
    {return box.Lazy_Outside(location) || levelset.Lazy_Outside(location,contour_value);}

    bool Lazy_Outside_Extended_Levelset(const VECTOR_3D<T>& unclamped_X,const T contour_value=0) const
    {return levelset.Lazy_Outside_Extended_Levelset(unclamped_X,contour_value);}

    bool Lazy_Outside_Extended_Levelset_And_Value(const VECTOR_3D<T>& unclamped_X,T& phi_value,const T contour_value=0) const
    {return levelset.Lazy_Outside_Extended_Levelset_And_Value(unclamped_X,phi_value,contour_value);}

    virtual T Min_Phi() const
    {return ARRAYS_3D<T>::min(levelset.phi);}

    TRIANGULATED_SURFACE<T>* Generate_Triangles() const
    {TRIANGULATED_SURFACE<T>* triangulated_surface=TRIANGULATED_SURFACE<T>::Create();
    levelset.Calculate_Triangulated_Surface_From_Marching_Tetrahedra(*triangulated_surface);
    return triangulated_surface;}

    template<class RW>
    void Read(std::istream& input_stream)
    {levelset.template Read<RW>(input_stream);levelset_data=true;octree_data=false;Update_Box();Update_Minimum_Cell_Size();}

    template<class RW>
    void Write(std::ostream& output_stream) const
    {levelset.template Write<RW>(output_stream);}

//###########################################################################
};

}
#endif


text:
#ifndef WebRenderTheme_h
#define WebRenderTheme_h

#include "../WebCommon.h"

namespace WebKit {

// Set caret blink interval for text input areas.
WEBKIT_API void setCaretBlinkInterval(double);

} // namespace WebKit

#endif


text:
class PerfTestSuite : public TestSuite {
 public:
  PerfTestSuite(int argc, char** argv) : TestSuite(argc, argv) {
  }

  virtual void Initialize() {
    TestSuite::Initialize();

    // Initialize the perf timer log
    FilePath log_path;
    std::wstring log_file =
        CommandLine::ForCurrentProcess()->GetSwitchValue(L"log-file");
    if (log_file.empty()) {
      FilePath exe;
      PathService::Get(base::FILE_EXE, &exe);
      log_path = exe.ReplaceExtension(FILE_PATH_LITERAL("log"));
      log_path = log_path.InsertBeforeExtension(FILE_PATH_LITERAL("_perf"));
    } else {
      log_path = FilePath::FromWStringHack(log_file);
    }
    ASSERT_TRUE(InitPerfLog(log_path));

    // Raise to high priority to have more precise measurements. Since we don't
    // aim at 1% precision, it is not necessary to run at realtime level.
    if (!DebugUtil::BeingDebugged())
      base::RaiseProcessToHighPriority();
  }

  virtual void Shutdown() {
    TestSuite::Shutdown();

    FinalizePerfLog();
  }
};

#endif  // BASE_PERF_TEST_SUITE_H_


text:
package io.netty.example.http2.client;

import static java.util.concurrent.TimeUnit.SECONDS;
import io.netty.bootstrap.Bootstrap;
import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.example.http2.server.Http2Server;
import io.netty.handler.codec.http.HttpMethod;
import io.netty.handler.codec.http2.DefaultHttp2Headers;
import io.netty.handler.codec.http2.Http2Exception;
import io.netty.handler.codec.http2.Http2Headers;

import java.net.InetSocketAddress;
import java.util.concurrent.BlockingQueue;

/**
 * An HTTP2 client that allows you to send HTTP2 frames to a server. Inbound and outbound frames are
 * logged.
 */
public class Http2Client {

    private final String host;
    private final int port;
    private final Http2ClientConnectionHandler http2ConnectionHandler;
    private Channel channel;
    private EventLoopGroup workerGroup;

    public Http2Client(String host, int port) {
        this.host = host;
        this.port = port;
        http2ConnectionHandler = new Http2ClientConnectionHandler();
    }

    public void start() throws Exception {
        if (channel != null) {
            System.out.println("Already running!");
            return;
        }

        workerGroup = new NioEventLoopGroup();

        Bootstrap b = new Bootstrap();
        b.group(workerGroup);
        b.channel(NioSocketChannel.class);
        b.option(ChannelOption.SO_KEEPALIVE, true);
        b.remoteAddress(new InetSocketAddress(host, port));
        b.handler(new Http2ClientInitializer(http2ConnectionHandler));

        // Start the client.
        channel = b.connect().syncUninterruptibly().channel();
        http2ConnectionHandler.awaitInitialization();
        System.out.println("Connected to [" + host + ':' + port + ']');
    }

    public void stop() {
        try {
            // Wait until the connection is closed.
            channel.close().syncUninterruptibly();
        } finally {
            if (workerGroup != null) {
                workerGroup.shutdownGracefully();
            }
        }
    }

    public ChannelFuture sendHeaders(int streamId, Http2Headers headers) throws Http2Exception {
        return http2ConnectionHandler.writeHeaders(streamId, headers, 0, true, true);
    }

    public ChannelFuture send(int streamId, ByteBuf data, int padding, boolean endStream,
            boolean endSegment, boolean compressed) throws Http2Exception {
        return http2ConnectionHandler.writeData(streamId, data, padding, endStream, endSegment,
                compressed);
    }

    public Http2Headers headers() {
        return DefaultHttp2Headers.newBuilder().authority(host).method(HttpMethod.GET.name())
                .build();
    }

    public BlockingQueue<ChannelFuture> queue() {
        return http2ConnectionHandler.queue();
    }

    public static void main(String[] args) throws Exception {
        Http2Server.checkForNpnSupport();
        int port;
        if (args.length > 0) {
            port = Integer.parseInt(args[0]);
        } else {
            port = 8443;
        }

        final Http2Client client = new Http2Client("localhost", port);

        try {
            client.start();
            System.out.println("Sending headers...");
            ChannelFuture requestFuture = client.sendHeaders(3, client.headers()).sync();
            System.out.println("Back from sending headers...");
            if (!requestFuture.isSuccess()) {
                requestFuture.cause().printStackTrace();
            }

            // Waits for the complete response
            ChannelFuture responseFuture = client.queue().poll(5, SECONDS);

            if (!responseFuture.isSuccess()) {
                responseFuture.cause().printStackTrace();
            }

            System.out.println("Finished HTTP/2 request");
        } catch (Throwable t) {
            t.printStackTrace();
        } finally {
            client.stop();
        }
    }
}


text:
from app import app, login_manager
from flask import Flask, abort, render_template, session, redirect, url_for, escape, request, flash, g, Response
from .models import db, Dokumen, User_app
from .forms import LoginAdminForm
from cassandra.cluster import Cluster
from datetime import datetime

cluster = Cluster(['172.17.0.2','172.17.0.3','172.17.0.4'])
sesi = cluster.connect()
sesi.execute("USE project")

@app.route('/detil/<judul>-<nim>')
def detil_doc(nim, judul):
	detil = Dokumen.objects(nim = nim).allow_filtering()
	return render_template("document.html", detil=detil)

@app.route('/')
@app.route('/index')
def index():
	return render_template("index.html")

@app.route('/form_search')
def form_search():
	data = Dokumen.objects().all()
	return render_template("form_search.html", data=data)

@app.route('/search', methods=['GET','POST'])
def search():
	""" cari, query cari """
	cari_judul = sesi.execute(" SELECT * FROM dokumen WHERE judul LIKE  '%{}%'".format(request.form['cari']))
	info = request.form['cari']
	return render_template("hasil_search.html", cari_judul=cari_judul, info=info)

@app.route('/admin')
def admin():
	if not session.get('logged_in') or session.get('logged_mhs') or session.get('logged_biasa'):
		"""  jalankan """
		return render_template("login.html")
	else:
		""" jalankan """
    	return render_template("index.html")

@app.route('/login')
def login():
	return render_template("login.html")

@app.route('/login_admin', methods=['POST'])
def login_admin():
    if request.form['password'] == 'password' and request.form['username'] == 'admin':
        session['logged_in'] = True
    else:
        flash('wrong password!')
    return admin()

@app.route("/logout")
def logout():
    session['logged_in'] = False
    session['logged_biasa'] = False
    session['logged_mhs'] = False
    return admin()

@app.route('/add', methods = ['GET', 'POST'])
def add():
	error = None
	if request.method == 'POST':
		if not request.form['nim'] or not request.form['judul']:
			error = "Masukkan Data dengan komplit dan sesuai!"
		else:
			doc = Dokumen( nim=request.form['nim'],
							nama_mhs=request.form['nama'],
							angkatan=request.form['angkatan'],
							tahun=request.form['Tlulus'],
							prodi=request.form['jurusan'],
							judul=request.form['judul'],
							kata_kunci=request.form['kunci'],
							intisari=request.form['Isari'],
							pembimbing=request.form['PBimbing'],
							password=request.form['pas'],
							file1=request.form['file_doc1'],
							file2=request.form['file_doc2'],
							file3=request.form['file_doc3'],
							file4=request.form['file_doc4'],
							file5=request.form['file_doc5']
							)
			doc.save()

			error="Sukses menambah data"
			return redirect(url_for('index'))

	return redirect(url_for('data_doc'))

@app.route('/userAdd', methods = ['GET', 'POST'])
def addUser():
	user_petugas = User_app.objects.filter(jabatan = 'Petugas').allow_filtering()
	user_dosen = User_app.objects.filter(jabatan = 'Dosen').allow_filtering()
	user_mhs = Dokumen.objects().all()

	return render_template('data_user.html', user_petugas = user_petugas, user_dosen = user_dosen, user_mhs = user_mhs)

@app.route('/add_user_mhs', methods = ['GET', 'POST'])
def add_user_mhs():
	error = None
	if request.method == 'POST':
		if not request.form['nim'] or not request.form['jurusan']:
			error = "Masukkan Data dengan komplit dan sesuai!"
		else:
			doc = Dokumen( nim=request.form['nim'],
							nama_mhs=request.form['nama_mhs'],
							prodi=request.form['jurusan'],
							judul=request.form['judul'],
							password=request.form['password']
							)
			doc.save()

			error="Sukses menambah data"
			return redirect(url_for('addUser'))

	return redirect(url_for('addUser'))

@app.route('/add_data_user', methods = ['GET', 'POST'])
def add_data_user():
	error = None
	if request.method == 'POST':
		if not request.form['nip'] or not request.form['jabatan']:
			error = "Masukkan Data dengan komplit dan sesuai!"
		else:
			doc = User_app( nip=request.form['nip'],
							username=request.form['username'],
							jabatan=request.form['jabatan'],
							password=request.form['password']
							)
			doc.save()

			error="Sukses menambah data"
			return redirect(url_for('addUser'))

	return redirect(url_for('addUser'))

@app.route('/data_doc', methods = ['GET','POST'])
def data_doc():
	now = datetime.now()
	now = now.strftime("%Y")
	angkatan_date = reversed(range(int(now)-10, int(now)+1))
	tahun_date = reversed(range(int(now)-10, int(now)+1))
	data_ti = Dokumen.objects.filter(prodi='Teknik Informatika').allow_filtering()
	data_si = Dokumen.objects.filter(prodi='Sistem Informasi').allow_filtering()
	data_tk = Dokumen.objects.filter(prodi='Teknik Komputer').allow_filtering()
	data_mi = Dokumen.objects.filter(prodi='Management Informatika').allow_filtering()
	data_ka = Dokumen.objects.filter(prodi='Komputer Akutansi').allow_filtering()

	return render_template("data_doc.html", data_ti=data_ti, data_si=data_si, data_tk=data_tk, data_mi=data_mi, data_ka=data_ka, date1=angkatan_date, date2=tahun_date)

@app.route('/edit_doc/<nim>', methods = ['GET','POST'])
def edit_doc(nim):
	now = datetime.now()
	now = now.strftime("%Y")
	angkatan_date = reversed(range(int(now)-10, int(now)+1))
	tahun_date = reversed(range(int(now)-10, int(now)+1))
	view_doc = Dokumen.objects(nim = nim).allow_filtering()
	return render_template("edit_doc.html", view_doc=view_doc, date1=angkatan_date, date2=tahun_date)

@app.route('/respon_edit', methods=['GET','POST'])
def respon_edit():
	error = None
	if request.method == 'POST':
		if not request.form['nama_m']:
			error = "Masukkan Data dengan komplit dan sesuai!"
		else:
			data = Dokumen.objects(prodi=request.form['jurusan'], nim=request.form['nim_mhs']).update(
									nama_mhs=request.form['nama_m'],
									angkatan=request.form['angkatan_mhs'],
									tahun=request.form['tlulus_mhs'],
									judul=request.form['judul_doc'],
									kata_kunci=request.form['kunci_kata'],
									intisari=request.form['intisari_doc'],
									pembimbing=request.form['pembimbing_mhs']
									)
			error = "Maaf Isi Data Secara Lengkap"
			return redirect(url_for('data_doc'))

	return redirect(url_for('data_doc'))

@app.route('/respon_unggah', methods=['GET','POST'])
def respon_unggah():
	error = None
	if request.method == 'POST':
		if not request.form['nim_mhs']:
			error = "Masukkan Data dengan komplit dan sesuai!"
		else:
			data = Dokumen.objects(prodi=request.form['jurusan'], nim=request.form['nim_mhs']).update(
									angkatan=request.form['angkatan_mhs'],
									tahun=request.form['tlulus_mhs'],
									kata_kunci=request.form['kunci_kata'],
									intisari=request.form['intisari_doc'],
									pembimbing=request.form['pembimbing_mhs'],
									file1=request.form['file_doc1'],
									file2=request.form['file_doc2'],
									file3=request.form['file_doc3'],
									file4=request.form['file_doc4'],
									file5=request.form['file_doc5']
									)
			error = "Maaf Isi Data Secara Lengkap"
			return redirect(url_for('unggah_doc'))

	return redirect(url_for('unggah_doc'))

@app.route('/edit_user_pet/<nip>')
def edit_user_pet(nip):
	view_user = User_app.objects(nip = nip).allow_filtering()
	return render_template("edit_user_pet.html", view_user=view_user)

@app.route('/respon_edit_pet', methods=['GET','POST'])
def respon_edit_pet():
	error = None
	if request.method == 'POST':
		if not request.form['jabatan'] or not request.form['nip']:
			error = "Masukkan Data dengan komplit dan sesuai!"
		else:
			data = User_app.objects(jabatan=request.form['jabatan'], nip=request.form['nip']).update(
									username=request.form['username'],
									password=request.form['password']
									)
			error = "Data Berhasil diubah"
			return redirect(url_for('addUser'))

	return redirect(url_for('addUser'))

@app.route('/delete_doc/<prodi>-<nim>', methods=['GET','POST'])
def delete_doc(prodi,nim):
	return render_template("delete_doc.html", nim=nim, prodi=prodi)

@app.route('/delete_user_pet/<jabatan>-<nip>')
def delete_user_pet(jabatan, nip):
	return render_template("delete_petugas.html", jabatan=jabatan, nip=nip)

@app.route('/respon_delete_user_pet', methods=['GET','POST'])
def respon_delete_user_pet():
	error = None
	if request.method == 'POST':
		if not request.form['jabatan_in'] or not request.form['nip_in']:
			error = "Masukkan Data dengan komplit dan sesuai!"
		else:
			sesi.execute(" DELETE FROM user_app WHERE jabatan = %s AND nip = %s ", (request.form['jabatan_in'], (int(request.form['nip_in'])) ) )
			error = "Maaf Isi Data Secara Lengkap"
			return redirect(url_for('addUser'))
	return redirect(url_for('addUser'))

@app.route('/respon_delete', methods=['GET','POST'])
def respon_delete():
	error = None
	if request.method == 'POST':
		if not request.form['prodi_in'] or not request.form['nim_in']:
			error = "Masukkan Data dengan komplit dan sesuai!"
		else:
			sesi.execute(" DELETE FROM dokumen WHERE prodi = %s AND nim = %s ", (request.form['prodi_in'], (request.form['nim_in']) ) )
			error = "Maaf Isi Data Secara Lengkap"
			return redirect(url_for('data_doc'))
	return redirect(url_for('data_doc'))

@app.route('/login_app', methods=['POST'])
def login_app():
	error = None
	q1 = User_app.objects.filter(nip =request.form['nip']).allow_filtering()
	for a in q1:
		if a.jabatan == 'Petugas':
			if a.jabatan == request.form['jabatan'] and a.password == request.form['password']:
				session['logged_in'] = True
				return redirect(url_for('admin'))
			else:
				error = "User atau Password Anda Salah, Ulangi Kembali !"
		else:
			if a.jabatan == request.form['jabatan'] and a.password == request.form['password']:
				session['logged_biasa'] = True
				return redirect(url_for('form_search'))
			else:
				error = "User atau Password Anda Salah, Ulangi Kembali !"
	return render_template('login.html', error=error)

@app.route('/login_mhs', methods=['POST'])
def login_mhs():
	error = None
	q1 = Dokumen.objects.filter(nim =request.form['nim']).allow_filtering()
	for a in q1:
		if a.prodi == request.form['jurusan'] and a.password == request.form['password']:
			session['logged_mhs'] = True
			return redirect(url_for('unggah_doc'))
		else:
			error = "User atau Password Anda Salah, Ulangi Kembali !"
	return render_template('login.html', error=error)

@app.route('/unggah_doc/')
def unggah_doc():
	now = datetime.now()
	now = now.strftime("%Y")
	angkatan_date = reversed(range(int(now)-10, int(now)+1))
	tahun_date = reversed(range(int(now)-10, int(now)+1))
	return render_template('data_doc_mhs.html', date1=angkatan_date, date2=tahun_date)

@app.route('/lihat', methods=['GET', 'POST'])
def lihat():
	if request.method == 'POST':
		if request.form['nim'] == "":
			error = "Masukkan Data dengan komplit dan sesuai!"
			return redirect(url_for('unggah_doc'))
		else:
			detil = sesi.execute(" SELECT * FROM dokumen WHERE prodi = %s AND nim = %s ", (request.form['jurusan'], request.form['nim'] ) )
			error = "Maaf Isi Data Secara Lengkap"
			return render_template("document.html", detil=detil)
	return redirect(url_for('unggah_doc'))


text:
OWL ontologies created within [SemIoT](http://semiot.ru) project which mainly cover the domain of smart meters and its observations.

## Related works
* https://github.com/ox-it/metering-ontology
* [SEAS ontology](http://purl.org/NET/seas)


text:
var pipsCount = document.getElementById('pips-count');

noUiSlider.create(pipsCount, {
	range: range_all_sliders,
	start: 0,
	pips: {
		mode: 'count',
		values: 6,
		density: 4
	}
});


text:
<!DOCTYPE html>
<html>
<head>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script>
testRunner.setAllowUniversalAccessFromFileURLs(false);
testRunner.setAllowFileAccessFromFileURLs(false);

var t = async_test('file: should be a unique-origin protocol for XHR purposes');
window.addEventListener('message', t.step_func(function(evt) {
  assert_equals(evt.data, 'NetworkError');
  t.done();
}));
</script>
</head>
<body>
<iframe src="resources/cannot-read-self-from-file.html"></iframe>
</body>
</html>


text:
/**
 * @file
 * Base Memory Object declaration.
 */

#ifndef __MEM_MEM_OBJECT_HH__
#define __MEM_MEM_OBJECT_HH__

#include "mem/port.hh"
#include "params/MemObject.hh"
#include "sim/sim_object.hh"

/**
 * The base MemoryObject class, allows for an accesor function to a
 * simobj that returns the Port.
 */
class MemObject : public SimObject
{
  public:
    typedef MemObjectParams Params;
    const Params *params() const
    { return dynamic_cast<const Params *>(_params); }

    MemObject(const Params *params);

  public:
    /** Additional function to return the Port of a memory object. */
    virtual Port *getPort(const std::string &if_name, int idx = -1) = 0;

    /** Tell object that this port is about to disappear, so it should remove it
     * from any structures that it's keeping it in. */
    virtual void deletePortRefs(Port *p) ;
};

#endif //__MEM_MEM_OBJECT_HH__