text:
const fs         = require('fs');
const request    = require('request');
const gm         = require('gm');
const dateHelper = require('../helper.js');
const logger     = require('bole')('maps');
const config     = require('../config');

const TEMP_DIR     = require('os').tmpdir();
const MAPBOX_TOKEN = config('mapbox').token;

class Card {
	constructor(event) {
		this.event = event;
	}

	generate(callback) {
		let lat = this.event['origin']['lat'];
		let lon = this.event['origin']['lon'];
		let id = this.event['id'];

		logger.info(`Downloading map for event <${id}>`);

		// Download the static map file
		this._downloadMap(id, lat, lon, (err, mapPath) => {
			if (err) {
				callback && callback(true);
				return;
			}

			logger.info(`Composing card for event <${id}>`);

			// Compose the card with the map and the earthquake details
			this._composeCard(this.event, mapPath, (err, cardPath) => {
				if (err) { // already logged
					callback && callback(true);
				}
				else {
					callback && callback(null, cardPath);
				}
			});
		});
	}

	_downloadMap(eventId, lat, lon, callback) {
		let center = lon + ',' + lat;

		let url = `https://api.mapbox.com/styles/v1/matteocontrini/ciwj780r900232qmqozqa3o0r/static/${center},8/600x484`;
		url = encodeURI(url);

		let fileName = TEMP_DIR + '/terre-map-' + eventId + '.png';
		let stream = fs.createWriteStream(fileName);

		let options = {
			method: 'GET',
			url: url,
			qs: {
				access_token: MAPBOX_TOKEN,
				logo: false
			}
		};

		request(options)
			.on('error', (err) => {
				logger.error({ url: url, err: err }, 'Static map download error');
				callback(true);
			})
			.on('response', (r) => {
				if (r.statusCode != 200) {
					logger.error({ url: url }, 'Static map download returned status code ' + r.statusCode);
				}
				else {
					r.pipe(stream).on('finish', () => {
						callback(null, fileName);
					});
				}
			});
	}

	_composeCard(event, mapPath, callback) {
		if (!event['id']) {
			logger.error(event, 'Missing event ID');
			callback(true);
			return;
		}

		// Load the template image
		let img = gm(__dirname + '/template.png');

		// If the map is available, overlay the image
		if (mapPath && typeof mapPath == 'string') {
			img.draw(`image over 0,116 0,0 '${mapPath}'`);
			img.draw(`image over 0,116 0,0 '${__dirname}/shadow.png`);
			img.draw(`image over 272.5,330.5 0,0 '${__dirname}/pin.png`);
		}

		// Set the font
		img.font(__dirname + '/font.otf');

		// Big text
		img.fontSize(72);
		// Green text
		img.fill('#73C94B');

		// Write the magnitude value
		let mag = event['magnitude']['value'].toFixed(1);
		img.draw(`text 470.25,72 '${mag}'`);

		// Write the city name in green, medium size
		img.fontSize(21);

		// If the city name is too long
		let city = event['city'];
		if (city.length > 30) {
			// If only the province initials would be left off, leave them out
			if (city[30] == '(' || city[31] == '(') {
				city = city.slice(0, 30).trim();
			}
			else {
				city = city.substring(0, 30).trim() + '…';
			}
		}

		city = city.replace(/'/g, '\\\'');

		img.draw(`text 26,31 '${city.toUpperCase()}'`);

		// Small gray text
		img.fontSize(17);
		img.fill('#9B9B9B');

		// ML or Mw
		img.draw(`text 562,97 '${event.magnitude.type}'`);
		// Hypocenter depth
		img.draw(`text 147,55 '${event.origin.depth.toFixed(1)} km'`);
		// Date
		let date = dateHelper.dateToPrettyDate(event.date);
		img.draw(`text 81,94 '${date}'`);
		// Time
		let time = dateHelper.dateToPrettyTime(event.date);
		img.draw(`text 247,94 '${time}'`);

		let output = TEMP_DIR + '/terre-card-' + event['id'] + '.jpg';
		let args = img.args();

		img.write(output, (err) => {
			if (err) {
				logger.error(err, 'gm error', event, args);
				callback(true);
			}
			else {
				callback(null, output);
			}
		});
	}
}

module.exports.Card = Card;


text:
<?php
/**
 * Local repository that stores files in the local filesystem and registers them
 * in the wiki's own database.
 *
 * @file
 * @ingroup FileRepo
 */

/**
 * A repository that stores files in the local filesystem and registers them
 * in the wiki's own database. This is the most commonly used repository class.
 *
 * @ingroup FileRepo
 */
class LocalRepo extends FileRepo {
	var $fileFactory           = array( 'LocalFile'   , 'newFromTitle' );
	var $fileFactoryKey        = array( 'LocalFile'   , 'newFromKey'   );
	var $fileFromRowFactory    = array( 'LocalFile'   , 'newFromRow'   );
	var $oldFileFactory        = array( 'OldLocalFile', 'newFromTitle' );
	var $oldFileFactoryKey     = array( 'OldLocalFile', 'newFromKey'   );
	var $oldFileFromRowFactory = array( 'OldLocalFile', 'newFromRow'   );

	/**
	 * @throws MWException
	 * @param $row
	 * @return File
	 */
	function newFileFromRow( $row ) {
		if ( isset( $row->img_name ) ) {
			return call_user_func( $this->fileFromRowFactory, $row, $this );
		} elseif ( isset( $row->oi_name ) ) {
			return call_user_func( $this->oldFileFromRowFactory, $row, $this );
		} else {
			throw new MWException( __METHOD__.': invalid row' );
		}
	}

	/**
	 * @param $title
	 * @param $archiveName
	 * @return OldLocalFile
	 */
	function newFromArchiveName( $title, $archiveName ) {
		return OldLocalFile::newFromArchiveName( $title, $this, $archiveName );
	}

	/**
	 * Delete files in the deleted directory if they are not referenced in the
	 * filearchive table. This needs to be done in the repo because it needs to
	 * interleave database locks with file operations, which is potentially a
	 * remote operation.
	 *
	 * @param $storageKeys array
	 *
	 * @return FileRepoStatus
	 */
	function cleanupDeletedBatch( $storageKeys ) {
		$backend = $this->backend; // convenience
		$root = $this->getZonePath( 'deleted' );
		$dbw = $this->getMasterDB();
		$status = $this->newGood();
		$storageKeys = array_unique( $storageKeys );
		foreach ( $storageKeys as $key ) {
			$hashPath = $this->getDeletedHashPath( $key );
			$path = "$root/$hashPath$key";
			$dbw->begin();
			// Check for usage in deleted/hidden files and pre-emptively
			// lock the key to avoid any future use until we are finished.
			$deleted = $this->deletedFileHasKey( $key, 'lock' );
			$hidden = $this->hiddenFileHasKey( $key, 'lock' );
			if ( !$deleted && !$hidden ) { // not in use now
				wfDebug( __METHOD__ . ": deleting $key\n" );
				$op = array( 'op' => 'delete', 'src' => $path );
				if ( !$backend->doOperation( $op )->isOK() ) {
					$status->error( 'undelete-cleanup-error', $path );
					$status->failCount++;
				}
			} else {
				wfDebug( __METHOD__ . ": $key still in use\n" );
				$status->successCount++;
			}
			$dbw->commit();
		}
		return $status;
	}

	/**
	 * Check if a deleted (filearchive) file has this sha1 key
	 *
	 * @param $key String File storage key (base-36 sha1 key with file extension)
	 * @param $lock String|null Use "lock" to lock the row via FOR UPDATE
	 * @return bool File with this key is in use
	 */
	protected function deletedFileHasKey( $key, $lock = null ) {
		$options = ( $lock === 'lock' ) ? array( 'FOR UPDATE' ) : array();

		$dbw = $this->getMasterDB();
		return (bool)$dbw->selectField( 'filearchive', '1',
			array( 'fa_storage_group' => 'deleted', 'fa_storage_key' => $key ),
			__METHOD__, $options
		);
	}

	/**
	 * Check if a hidden (revision delete) file has this sha1 key
	 *
	 * @param $key String File storage key (base-36 sha1 key with file extension)
	 * @param $lock String|null Use "lock" to lock the row via FOR UPDATE
	 * @return bool File with this key is in use
	 */
	protected function hiddenFileHasKey( $key, $lock = null ) {
		$options = ( $lock === 'lock' ) ? array( 'FOR UPDATE' ) : array();

		$sha1 = self::getHashFromKey( $key );
		$ext = File::normalizeExtension( substr( $key, strcspn( $key, '.' ) + 1 ) );

		$dbw = $this->getMasterDB();
		return (bool)$dbw->selectField( 'oldimage', '1',
			array( 'oi_sha1' => $sha1,
				'oi_archive_name ' . $dbw->buildLike( $dbw->anyString(), ".$ext" ),
				$dbw->bitAnd( 'oi_deleted', File::DELETED_FILE ) => File::DELETED_FILE ),
			__METHOD__, $options
		);
	}

	/**
	 * Gets the SHA1 hash from a storage key
	 *
	 * @param string $key
	 * @return string
	 */
	public static function getHashFromKey( $key ) {
		return strtok( $key, '.' );
	}

	/**
	 * Checks if there is a redirect named as $title
	 *
	 * @param $title Title of file
	 * @return bool
	 */
	function checkRedirect( Title $title ) {
		global $wgMemc;

		$title = File::normalizeTitle( $title, 'exception' );

		$memcKey = $this->getSharedCacheKey( 'image_redirect', md5( $title->getDBkey() ) );
		if ( $memcKey === false ) {
			$memcKey = $this->getLocalCacheKey( 'image_redirect', md5( $title->getDBkey() ) );
			$expiry = 300; // no invalidation, 5 minutes
		} else {
			$expiry = 86400; // has invalidation, 1 day
		}
		$cachedValue = $wgMemc->get( $memcKey );
		if ( $cachedValue === ' '  || $cachedValue === '' ) {
			// Does not exist
			return false;
		} elseif ( strval( $cachedValue ) !== '' ) {
			return Title::newFromText( $cachedValue, NS_FILE );
		} // else $cachedValue is false or null: cache miss

		$id = $this->getArticleID( $title );
		if( !$id ) {
			$wgMemc->set( $memcKey, " ", $expiry );
			return false;
		}
		$dbr = $this->getSlaveDB();
		$row = $dbr->selectRow(
			'redirect',
			array( 'rd_title', 'rd_namespace' ),
			array( 'rd_from' => $id ),
			__METHOD__
		);

		if( $row && $row->rd_namespace == NS_FILE ) {
			$targetTitle = Title::makeTitle( $row->rd_namespace, $row->rd_title );
			$wgMemc->set( $memcKey, $targetTitle->getDBkey(), $expiry );
			return $targetTitle;
		} else {
			$wgMemc->set( $memcKey, '', $expiry );
			return false;
		}
	}

	/**
	 * Function link Title::getArticleID().
	 * We can't say Title object, what database it should use, so we duplicate that function here.
	 *
	 * @param $title Title
	 */
	protected function getArticleID( $title ) {
		if( !$title instanceof Title ) {
			return 0;
		}
		$dbr = $this->getSlaveDB();
		$id = $dbr->selectField(
			'page', // Table
			'page_id',  //Field
			array(  //Conditions
				'page_namespace' => $title->getNamespace(),
				'page_title' => $title->getDBkey(),
			),
			__METHOD__  //Function name
		);
		return $id;
	}

	/**
	 * Get an array or iterator of file objects for files that have a given
	 * SHA-1 content hash.
	 *
	 * @param $hash String a sha1 hash to look for
	 * @return Array
	 */
	function findBySha1( $hash ) {
		$dbr = $this->getSlaveDB();
		$res = $dbr->select(
			'image',
			LocalFile::selectFields(),
			array( 'img_sha1' => $hash )
		);

		$result = array();
		foreach ( $res as $row ) {
			$result[] = $this->newFileFromRow( $row );
		}
		$res->free();

		return $result;
	}

	/**
	 * Get a connection to the slave DB
	 */
	function getSlaveDB() {
		return wfGetDB( DB_SLAVE );
	}

	/**
	 * Get a connection to the master DB
	 */
	function getMasterDB() {
		return wfGetDB( DB_MASTER );
	}

	/**
	 * Get a key on the primary cache for this repository.
	 * Returns false if the repository's cache is not accessible at this site.
	 * The parameters are the parts of the key, as for wfMemcKey().
	 *
	 * @return string
	 */
	function getSharedCacheKey( /*...*/ ) {
		$args = func_get_args();
		return call_user_func_array( 'wfMemcKey', $args );
	}

	/**
	 * Invalidates image redirect cache related to that image
	 *
	 * @param $title Title of page
	 * @return void
	 */
	function invalidateImageRedirect( Title $title ) {
		global $wgMemc;
		$memcKey = $this->getSharedCacheKey( 'image_redirect', md5( $title->getDBkey() ) );
		if ( $memcKey ) {
			$wgMemc->delete( $memcKey );
		}
	}
}

redpajama_set_name: RedPajamaGithub


text:
double my_scalbn(double x, int n);

double my_ldexp(double x, int n)
{
	return my_scalbn(x, n);
}


text:
#ifndef LNX_ADAPTER_H_
#define	LNX_ADAPTER_H_
#ifdef __cplusplus
extern "C"
{
#endif

#ifdef __MSVC__
#define PACK_STRUCT(_structure_) __pragma(pack(push,1)) _structure_; __pragma(pack(pop))

#else
#define PACK_STRUCT(_structure_) _structure_ __attribute__((packed));
#endif
int wait_for_sec(unsigned int seconds);

#ifdef __cplusplus
}
#endif

#endif


text:
[Nodejs](https://github.com/joyent/node/wiki/Installation)
[Docker and Compose](https://docs.docker.com/compose/install/)

## Running the examples

### Start Mongodb

Issue the following commmand in the examples dir

    docker-compose up -d

This should bring up Mongodb

### Enable the Oplog

In order for the [streaming change events](https://github.com/agco/agco-json-api-profiles/blob/master/public/change-events-profile.md#stream-changes)
feature to work you will need to enable the oplog

As a one-off execute the replSet.sh file, this will initiate a replication set and hence wake up the oplog feature.

    ./replSet.sh

### Run an example

#### Artists insert and stream

    node artists_insertAndStream.js

This will start up an change events consumer and insert a new entry after a couple of seconds, you should see the output of both actions in the console

The resource can be accessed at the following url

    http://localhost:1337/artists


text:
<?php
/**
 * ALIPAY API: alipay.open.auth.token.app request
 *
 * @author auto create
 * @since 1.0, 2019-05-24 18:41:10
 */
class AlipayOpenAuthTokenAppRequest
{
	/**
	 * 用应用授权码(app_auth_code)换取或者刷新应用授权令牌(app_auth_token)
	 **/
	private $bizContent;

	private $apiParas = array();
	private $terminalType;
	private $terminalInfo;
	private $prodCode;
	private $apiVersion="1.0";
	private $notifyUrl;
	private $returnUrl;
    private $needEncrypt=false;

	public function setBizContent($bizContent)
	{
		$this->bizContent = $bizContent;
		$this->apiParas["biz_content"] = $bizContent;
	}

	public function getBizContent()
	{
		return $this->bizContent;
	}

	public function getApiMethodName()
	{
		return "alipay.open.auth.token.app";
	}

	public function setNotifyUrl($notifyUrl)
	{
		$this->notifyUrl=$notifyUrl;
	}

	public function getNotifyUrl()
	{
		return $this->notifyUrl;
	}

	public function setReturnUrl($returnUrl)
	{
		$this->returnUrl=$returnUrl;
	}

	public function getReturnUrl()
	{
		return $this->returnUrl;
	}

	public function getApiParas()
	{
		return $this->apiParas;
	}

	public function getTerminalType()
	{
		return $this->terminalType;
	}

	public function setTerminalType($terminalType)
	{
		$this->terminalType = $terminalType;
	}

	public function getTerminalInfo()
	{
		return $this->terminalInfo;
	}

	public function setTerminalInfo($terminalInfo)
	{
		$this->terminalInfo = $terminalInfo;
	}

	public function getProdCode()
	{
		return $this->prodCode;
	}

	public function setProdCode($prodCode)
	{
		$this->prodCode = $prodCode;
	}

	public function setApiVersion($apiVersion)
	{
		$this->apiVersion=$apiVersion;
	}

	public function getApiVersion()
	{
		return $this->apiVersion;
	}

  public function setNeedEncrypt($needEncrypt)
  {

     $this->needEncrypt=$needEncrypt;

  }

  public function getNeedEncrypt()
  {
    return $this->needEncrypt;
  }

}


text:
class RootController < ApplicationController
  def index
    redirect_to "http://docs.apibucket.apiary.io/"
  end
end


text:
import subprocess
from tempfile import mkdtemp

import click
import pymongo
import mongoengine
from click import echo

from .utils import temp_directory
from .models import Migration, MigrationHistoryStorage
from .query_sets import querysets

def establish_datastore_connection(environment):
    mongo_db_name = environment['db_name']

    username_password_couple = ""
    if 'username' in environment:
        if 'password' in environment:
            username_password_couple = "{}:{}@".format(environment['username'], environment['password'])
        else:
            username_password_couple = "{}@".format(environment['username'])

    if 'port' in environment:
        raise Exception("port no longer supported, use the host:port syntax in the host parameter")

    host_and_port = environment['host']

    db_name = "/{}".format(environment['db_name'])

    uri = "mongodb://{username_password_couple}{host_and_port}{db_name}".format(username_password_couple=username_password_couple,
                                                                                host_and_port=host_and_port,
                                                                                db_name=db_name)

    if 'sslCAFile' in environment:
        echo('appending ssl')
        uri = "{}?ssl=true&ssl_ca_certs={}".format(uri, environment['sslCAFile'])

    echo('executing: {}'.format(uri))
    return mongoengine.connect(mongo_db_name, host=uri)

class MongoMigrationHistory(MigrationHistoryStorage, mongoengine.Document):
    """
    Mongo Table to keep track of the status of migrations
    """
    key = mongoengine.StringField()
    state = mongoengine.StringField(default=Migration.STATE_NEW)
    processed_at = mongoengine.DateTimeField()

    @classmethod
    def find_or_create_by_key(cls, migration_key):
        result = cls.objects(key=migration_key)
        if len(result) == 1:
            return result[0]
        else:
            return cls(key=migration_key).save()

    @classmethod
    def find_by_key(cls, migration_key):
        results = cls.objects(key=migration_key)
        if len(results) == 1:
            return results[0]
        else:
            return None

    @classmethod
    def all(cls):
        return cls.objects()

class MongoBackedMigration(Migration):

    def update_status(self, state):
        migration_meta = MongoMigrationHistory.find_or_create_by_key(self.migration_key)
        migration_meta.update(set__state=state)

    @property
    def status(self):
        migration_meta = MongoMigrationHistory.find_or_create_by_key(self.migration_key)
        return migration_meta.state

def dump_db(from_env, **kwargs):
    """accepts temp_dir and QuerySet as keyword options"""

    if 'temp_dir' in kwargs:
        temp_dir = kwargs['temp_dir']
    else:
        temp_dir = mkdtemp()

    if 'QuerySet' in kwargs:
        QuerySet = kwargs['QuerySet']

    echo("env: {}".format(from_env))

    options = {
        '-h': from_env['host'],
        '-d': from_env['db_name'],
        '-o': temp_dir
    }
    if 'username' in from_env:
        options['-u'] = from_env['username']
    if 'password' in from_env:
        options['-p'] = from_env['password']

    if QuerySet:
        echo("In Query Set: Env: {}".format(from_env))
        connection = establish_datastore_connection(from_env)
        database = connection[from_env['db_name']]

        query_set = QuerySet(database, options)

        query_set.execute()

    else:

        execution_array = ['mongodump']
        if 'sslCAFile' in from_env:
            execution_array.append('--ssl')
            execution_array.extend(['--sslCAFile', from_env['sslCAFile']])

        for option in options:
            execution_array.extend([option, options[option]])
        echo("Executing: {}".format(execution_array))
        subprocess.call(execution_array)

    # mongorestore -h localhost --drop -d spotlight db/backups/spotlight-staging-1/
    dump_path = "{}/{}".format(temp_dir, from_env['db_name'])
    return dump_path

def copy_db(from_env, to_env, query_set=None):
    with temp_directory() as temp_dir:
        dump_path = dump_db(from_env, temp_dir=temp_dir, QuerySet=query_set)
        restore(dump_path, to_env)

def restore(dump_path, to_env):
    drop(to_env)

    options = {
        '-h': to_env['host'],
        '-d': to_env['db_name'],
    }

    if 'username' in to_env:
        options['-u'] = to_env['username']

    if 'password' in to_env:
        options['-p'] = to_env['password']

    execution_array = ['mongorestore', '--drop']

    if 'sslCAFile' in to_env:
        execution_array.append('--ssl')
        execution_array.extend(['--sslCAFile', to_env['sslCAFile']])

    for option in options:
        execution_array.extend([option, options[option]])

    execution_array.append(dump_path)

    echo("Executing: {}".format(execution_array))
    subprocess.call(execution_array)

def drop(environ):

    options = {
        '--eval': '"db.dropDatabase()"'
    }

    database_string = "{}/{}".format(environ['host'], environ['db_name'])

    execution_array = ['mongo', database_string]

    if 'sslCAFile' in environ:
        execution_array.append('--ssl')
        execution_array.extend(['--sslCAFile', environ['sslCAFile']])

    for option in options:
        execution_array.extend([option, options[option]])

    echo()
    echo("You are about to execute the following database drop")
    echo("    {}".format(' '.join(execution_array)))
    echo()
    click.confirm('ARE YOU SURE??', abort=True)

    subprocess.call(' '.join(execution_array), shell=True)


text:
cask 'unity-windows-support-for-editor' do
  version '2018.2.12f1,0a46ddfcfad4'
  sha256 '055c38a26fcaa69938d754b13fce0a1e2ebc00c2305d26b7c3a04f111ea8bc04'

  url "https://netstorage.unity3d.com/unity/#{version.after_comma}/MacEditorTargetInstaller/UnitySetup-Windows-Mono-Support-for-Editor-#{version.before_comma}.pkg"
  appcast 'https://unity3d.com/get-unity/download/archive'
  name 'Unity Windows (Mono) Build Support'
  homepage 'https://unity3d.com/unity/'

  depends_on cask: 'unity'

  pkg "UnitySetup-Windows-Mono-Support-for-Editor-#{version.before_comma}.pkg"

  uninstall pkgutil: 'com.unity3d.WindowsStandaloneSupport'
end


text:
package com.github.dactiv.showcase.test;

import org.eclipse.jetty.server.Server;
import com.github.dactiv.common.unit.JettyFactory;

/**
 * 启动jetty服务,运行后通过http://localhost:8080/dactiv-base-curd/来访问项目路径
 *
 * @author maurice
 *
 */
public class LaunchJetty {

	/**
	 * 端口
	 */
	public static final int PORT = 8080;
	/**
	 * 项目名称
	 */
	public static final String CONTEXT = "/dactiv";
	public static final String ACTIVE_PROFILE = "spring.profiles.active";

	public static void main(String[] args) throws Exception {
		System.setProperty(ACTIVE_PROFILE, "dev");
		Server server = JettyFactory.createServerInSource(PORT, CONTEXT);

		try {
			System.out.println("[HINT] Don't forget to set -XX:MaxPermSize=128m");
			server.start();
			System.out.println("Server running at http://localhost:" + PORT + CONTEXT);
			System.out.println("[HINT] Hit Enter to reload the application quickly");

			// 等待用户输入回车重载应用.
			while (true) {
				char c = (char) System.in.read();
				if (c == '\n') {
					JettyFactory.reloadContext(server);
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(-1);
		}
	}
}


text:
package iurii.job.interview.generic.effective_java;

import org.junit.Test;

import java.util.EnumMap;
import java.util.EnumSet;

import static org.assertj.core.api.Assertions.assertThat;

/**
 *  enums prove to be great abstraction for Singleton pattern {@link SingletonAndSerializationExampleTest}
 */
public class EnumsAndAnnotationsTest {

    // enum type is great to replace constants. having a scope and type provides type safety and compiler support
    // provides better support if constant value is changed. clients of api do not need to be recompiled (only if name changes)
    // [if ONE TWO names changed clients need to be recompiled. If 1 or 2 values are changed nothing is needed]
    // easy to extend and add additional enum values. easy to delete value
    // (only the clients that used deleted value should be recompiled and fixed)
    // limitation is that enum extends abstract class Enum and implements Comparable and Serializable under the hood,
    // in case it is needed to extend other class (and not an interface) - it is not possible to use enum
    // different behaviour can be associated as well (abstract method)
    // [needs to be implemented in each instance] - constant-specific class body
    // such methods are known as constant-specific method implementations.
    // static is obsolete in the inner enum declaration - they are static.
    // enums should be immutable it is their nature! instance fields should not be changed
    public enum EnumSingleton {
        ONE(1) {
            // enums are good to encapsulate strategy (strategy enum). More flexible instead of switch statements
            @Override
            public int getStrategyValue() {
                return getValue();
            }
        },

        TWO(2) {
            @Override
            public int getStrategyValue() {
                return getValue();
            }
        };
        // how many instances of the class you need

        // encapsulation, so that fields can not be accessed;
        // has non null invariant (property, truth that is maintained )
        private final int value;

        // public and protected modifiers are not allowed for the enum
        EnumSingleton(int value) {
            this.value = value;
        }

        public int getValue() {
            return value;
        }

        public abstract int getStrategyValue();
    }

    @Test(expected = IllegalArgumentException.class)
    public void test() {
        // no issues to get enum constant by name
        EnumSingleton one = EnumSingleton.valueOf("ONE");
        assertThat(one.getValue()).isEqualTo(1);

        // ordinal starts from zero like array indexes, but it is better not to rely on order (it might change)
        assertThat(EnumSingleton.ONE.ordinal()).isEqualTo(0);

        // IllegalArgumentException is thrown
        EnumSingleton.valueOf("NOT EXISTING");
    }

    // enumSet and EnumMap store keys in the array optimised based on enum instead of hashcode
    // annotation @Test prefer instead of naming patterns for the methods. it is more safe
    // also called marker annotation (no parameters, simply marks)
    // also called meta annotations and can retains at runtime if retention policy is runtime
    // can be processed by annotation processors
    // use marker interfaces to define a type. Arguably Serializable is a type marker interface
    // that indicates that instance is eligible to be processed by ObjectOutputStream
    // Set is restricted marker interface case adds nothing just what collection has
    @Test
    public void testEnumSetMap() {
        EnumSet<EnumSingleton> enumSet = EnumSet.allOf(EnumSingleton.class);
        EnumMap<EnumSingleton, String> enumMap = new EnumMap<>(EnumSingleton.class);
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<layout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools">
    <data>
        <variable
            name="viewModel"
            type="apidez.com.databinding.viewmodel.IPlacesViewModel"/>
    </data>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".view.fragment.PlacesFragment">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            style="@style/MyActionBar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:layout_collapseMode="pin"
            app:popupTheme="@style/AppTheme.PopupOverlay"
            app:theme="@style/AppTheme.ActionBarTheme"
            app:title="@string/title_places"
            app:titleTextColor="@color/action_bar_title"/>

        <android.support.v4.widget.SwipeRefreshLayout
            android:layout_below="@+id/toolbar"
            android:id="@+id/swipe_refresh"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <android.support.v7.widget.RecyclerView
                android:id="@+id/recycler_view"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_margin="8dp"
                app:items="@{viewModel.currentPlaces}"/>
        </android.support.v4.widget.SwipeRefreshLayout>
    </RelativeLayout>
</layout>


text:
package iso20022

// Specifies the type of document referred by the creditor.
type CreditorReferenceType1Choice struct {

	// Type of creditor reference, in a coded form.
	Code *DocumentType3Code `xml:"Cd"`

	// Creditor reference type, in a proprietary form.
	Proprietary *Max35Text `xml:"Prtry"`
}

func (c *CreditorReferenceType1Choice) SetCode(value string) {
	c.Code = (*DocumentType3Code)(&value)
}

func (c *CreditorReferenceType1Choice) SetProprietary(value string) {
	c.Proprietary = (*Max35Text)(&value)
}


text:
@interface WITMicButton : UIButton
@property (strong, atomic) CALayer* volumeLayer;
@property (strong, atomic) CALayer* microphoneLayer;
@property (strong, atomic) WITCircleView* outerCircleView;
@property (strong, atomic) WITCircleView* innerCircleView;
@end


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Uses of Package org.apache.poi.ss.formula (POI API Documentation)</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Package
org.apache.poi.ss.formula

Packages that use org.apache.poi.ss.formula

Package
Description

org.apache.poi.hssf.model

Provides low level API structures for reading, writing, modifying XLS files.

org.apache.poi.hssf.record

Record package contains class representations for XLS binary strutures.

org.apache.poi.hssf.record.aggregates

record aggregates are not real "records" but collections of records that act as a single record.

org.apache.poi.hssf.usermodel

usermodel package maps HSSF low level strutures to familiar workbook/sheet model

org.apache.poi.ss.formula

This package contains common internal POI code for manipulating formulas.

org.apache.poi.ss.formula.eval

org.apache.poi.ss.formula.eval.forked

org.apache.poi.ss.formula.functions

org.apache.poi.ss.formula.ptg

formula package contains binary PTG structures used in Formulas

org.apache.poi.ss.usermodel

org.apache.poi.xssf.streaming

org.apache.poi.xssf.usermodel

org.apache.poi.xssf.usermodel.helpers

Classes in org.apache.poi.ss.formula used by org.apache.poi.hssf.model

Class and Description

EvaluationWorkbook.ExternalName

EvaluationWorkbook.ExternalSheet

FormulaParseException

This exception thrown when a supplied formula has incorrect syntax (or syntax currently not
 supported by POI).

FormulaShifter

Updates Formulas as rows or sheets are shifted

Classes in org.apache.poi.ss.formula used by org.apache.poi.hssf.record

Class and Description

Formula

Encapsulates an encoded formula token array.

Classes in org.apache.poi.ss.formula used by org.apache.poi.hssf.record.aggregates

Class and Description

FormulaShifter

Updates Formulas as rows or sheets are shifted

Classes in org.apache.poi.ss.formula used by org.apache.poi.hssf.usermodel

Class and Description

EvaluationCell

Abstracts a cell for the purpose of formula evaluation.

EvaluationName

Abstracts a name record for formula evaluation.

 For POI internal use only

EvaluationSheet

Abstracts a sheet for the purpose of formula evaluation.

 For POI internal use only

EvaluationWorkbook

Abstracts a workbook for the purpose of formula evaluation.

 For POI internal use only

EvaluationWorkbook.ExternalName

EvaluationWorkbook.ExternalSheet

FormulaParsingWorkbook

Abstracts a workbook for the purpose of formula parsing.

 For POI internal use only

FormulaRenderingWorkbook

Abstracts a workbook for the purpose of converting formula to text.

 For POI internal use only

IStabilityClassifier

Used to help optimise cell evaluation result caching by allowing applications to specify which
 parts of a workbook are final.

 The term final is introduced here to denote immutability or 'having constant definition'.

SheetIdentifier

WorkbookEvaluator

Evaluates formula cells.

 For performance reasons, this class keeps a cache of all previously calculated intermediate
 cell values.

WorkbookEvaluatorProvider

Provides access to a WorkbookEvaluator, eg for use with
  CollaboratingWorkbooksEnvironment

Classes in org.apache.poi.ss.formula used by org.apache.poi.ss.formula

Class and Description

CollaboratingWorkbooksEnvironment

Manages a collection of WorkbookEvaluators, in order to support
 evaluation of formulas across spreadsheets.

CollaboratingWorkbooksEnvironment.WorkbookNotFoundException

EvaluationCell

Abstracts a cell for the purpose of formula evaluation.

EvaluationName

Abstracts a name record for formula evaluation.

 For POI internal use only

EvaluationSheet

Abstracts a sheet for the purpose of formula evaluation.

 For POI internal use only

EvaluationWorkbook

Abstracts a workbook for the purpose of formula evaluation.

 For POI internal use only

EvaluationWorkbook.ExternalName

EvaluationWorkbook.ExternalSheet

Formula

Encapsulates an encoded formula token array.

FormulaParsingWorkbook

Abstracts a workbook for the purpose of formula parsing.

 For POI internal use only

FormulaRenderingWorkbook

Abstracts a workbook for the purpose of converting formula to text.

 For POI internal use only

FormulaShifter

Updates Formulas as rows or sheets are shifted

IStabilityClassifier

Used to help optimise cell evaluation result caching by allowing applications to specify which
 parts of a workbook are final.

 The term final is introduced here to denote immutability or 'having constant definition'.

NameIdentifier

SheetIdentifier

SheetRange

TwoDEval

Common interface of AreaEval and AreaEvalBase,
 for 2D (row+column) evaluations

WorkbookEvaluator

Evaluates formula cells.

 For performance reasons, this class keeps a cache of all previously calculated intermediate
 cell values.

Classes in org.apache.poi.ss.formula used by org.apache.poi.ss.formula.eval

Class and Description

EvaluationName

Abstracts a name record for formula evaluation.

 For POI internal use only

SheetRange

ThreeDEval

Optional Extension to the likes of AreaEval and
  AreaEvalBase,
  which allows for looking up 3D (sheet+row+column) evaluations

TwoDEval

Common interface of AreaEval and AreaEvalBase,
 for 2D (row+column) evaluations

Classes in org.apache.poi.ss.formula used by org.apache.poi.ss.formula.eval.forked

Class and Description

IStabilityClassifier

Used to help optimise cell evaluation result caching by allowing applications to specify which
 parts of a workbook are final.

 The term final is introduced here to denote immutability or 'having constant definition'.

Classes in org.apache.poi.ss.formula used by org.apache.poi.ss.formula.functions

Class and Description

OperationEvaluationContext

Contains all the contextual information required to evaluate an operation
 within a formula

 For POI internal use only

Classes in org.apache.poi.ss.formula used by org.apache.poi.ss.formula.ptg

Class and Description

ExternSheetReferenceToken

Should be implemented by any Ptg subclass that needs has an extern sheet index

 For POI internal use only

FormulaRenderingWorkbook

Abstracts a workbook for the purpose of converting formula to text.

 For POI internal use only

SheetIdentifier

WorkbookDependentFormula

Should be implemented by any Ptg subclass that needs a workbook to render its formula.

Classes in org.apache.poi.ss.formula used by org.apache.poi.ss.usermodel

Class and Description

FormulaParseException

This exception thrown when a supplied formula has incorrect syntax (or syntax currently not
 supported by POI).

Classes in org.apache.poi.ss.formula used by org.apache.poi.xssf.streaming

Class and Description

FormulaParseException

This exception thrown when a supplied formula has incorrect syntax (or syntax currently not
 supported by POI).

Classes in org.apache.poi.ss.formula used by org.apache.poi.xssf.usermodel

Class and Description

EvaluationCell

Abstracts a cell for the purpose of formula evaluation.

EvaluationName

Abstracts a name record for formula evaluation.

 For POI internal use only

EvaluationSheet

Abstracts a sheet for the purpose of formula evaluation.

 For POI internal use only

EvaluationWorkbook

Abstracts a workbook for the purpose of formula evaluation.

 For POI internal use only

EvaluationWorkbook.ExternalName

EvaluationWorkbook.ExternalSheet

FormulaParsingWorkbook

Abstracts a workbook for the purpose of formula parsing.

 For POI internal use only

FormulaRenderingWorkbook

Abstracts a workbook for the purpose of converting formula to text.

 For POI internal use only

IStabilityClassifier

Used to help optimise cell evaluation result caching by allowing applications to specify which
 parts of a workbook are final.

 The term final is introduced here to denote immutability or 'having constant definition'.

SheetIdentifier

WorkbookEvaluator

Evaluates formula cells.

 For performance reasons, this class keeps a cache of all previously calculated intermediate
 cell values.

WorkbookEvaluatorProvider

Provides access to a WorkbookEvaluator, eg for use with
  CollaboratingWorkbooksEnvironment

Classes in org.apache.poi.ss.formula used by org.apache.poi.xssf.usermodel.helpers

Class and Description

FormulaShifter

Updates Formulas as rows or sheets are shifted

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

                Copyright 2015 The Apache Software Foundation or
        its licensors, as applicable.


text:
// coding: utf-8
// ----------------------------------------------------------------------------

// ----------------------------------------------------------------------------
/*
 * WARNING: This file is generated automatically, do not edit!
 * Please modify the corresponding *.in file instead and rebuild this file.
 */
// ----------------------------------------------------------------------------

#include "../gpio.hpp"
#include "../device.h"

#include "uart_4.hpp"

#include <xpcc/architecture/driver/atomic.hpp>
#include <xpcc_config.hpp>

// RTS and CTS pin and port must be declated in project.cfg
#if (UART4_RTS_PIN  != -1) && \
	(UART4_CTS_PIN  != -1)

/*	(UART4_RTS_PORT != -1) && \
    (UART4_CTS_PORT != -1) */

#if defined(STM32F10X_HD) || defined(STM32F10X_XL) || defined(STM32F10X_CL) || \
	defined(STM32F2XX) || defined(STM32F3XX) || defined(STM32F4XX)

namespace
{
	static xpcc::atomic::Queue<char, UART4_RX_BUFFER_SIZE> rxBuffer;
	static xpcc::atomic::Queue<char, UART4_TX_BUFFER_SIZE> txBuffer;

	static bool isBlocking = true;
}

namespace
{
	#if defined(STM32F2XX) || defined(STM32F4XX)
	GPIO__OUTPUT(TxdA0, A, 0);
	GPIO__INPUT(RxdA1, A, 1);
#endif

	GPIO__OUTPUT(TxdC10, C, 10);
	GPIO__INPUT(RxdC11, C, 11);
}
namespace
{
	static const uint32_t apbClk = STM32_APB1_FREQUENCY;	// APB1
}

namespace
{
	GPIO__OUTPUT(RTS, UART4_RTS_PORT, UART4_RTS_PIN);
	GPIO__INPUT (CTS, UART4_CTS_PORT, UART4_CTS_PIN);
}

// ----------------------------------------------------------------------------
void
xpcc::stm32::BufferedFlowUart4::configurePins(Mapping mapping)
{
	// Enable clock
	RCC->APB1ENR |= RCC_APB1ENR_UART4EN;

	// Initialize IO pins
#if defined(STM32F2XX) || defined(STM32F3XX) || defined(STM32F4XX)
	#if defined(STM32F3XX)
	(void) mapping;		// avoid compiler warning

	TxdC10::setAlternateFunction(AF_UART4, xpcc::stm32::PUSH_PULL);
	RxdC11::setAlternateFunction(AF_UART4);
#else
	if (mapping == REMAP_PA0_PA1) {
		TxdA0::setAlternateFunction(AF_UART4, xpcc::stm32::PUSH_PULL);
		RxdA1::setAlternateFunction(AF_UART4);
	}
	else {
		TxdC10::setAlternateFunction(AF_UART4, xpcc::stm32::PUSH_PULL);
		RxdC11::setAlternateFunction(AF_UART4);
	}
#endif
#else
	(void) mapping;		// avoid compiler warning

	TxdC10::setAlternateFunction(xpcc::stm32::PUSH_PULL);
	RxdC11::setInput();
#endif
}

// ----------------------------------------------------------------------------
#if defined(STM32F3XX)
	#define USART_SR_RXNE USART_ISR_RXNE
	#define USART_SR_TXE  USART_ISR_TXE

	// new register names for STM32F3 series
	#define UART4_SR \
		UART4->ISR
	#define UART4_RDR \
		UART4->RDR
	#define UART4_TDR \
		UART4->TDR

#else
	#define UART4_SR \
		UART4->SR
	#define UART4_RDR \
		UART4->DR
	#define UART4_TDR \
		UART4->DR
#endif

extern "C" void
UART4_IRQHandler()
{
	uint32_t state = UART4_SR;

	// Read Data Register not empty
	if (state & USART_SR_RXNE)
	{
		// First save the errors TODO
		// error |= USART4_STATUS & (USART_FERR_bm | USART_BUFOVF_bm | USART_PERR_bm);

		// Then read the buffer (read from DR clears the RXNE flag)
		uint8_t data = UART4_RDR;

		if (!rxBuffer.push(data))
		{
			// TODO Error handling if internal RX buffer is full.
		}

		// If the internal buffer is now nearly full set RTS to high to inhibit
		// remote from sending new data. As the remote may not stop instantenously
		// it is important to stop before the buffer is completely full.
		if (rxBuffer.isNearlyFull()) {
			RTS::set();
		}
	} // USART_SR_RXNE

	// Transmit Data Register empty
	if (state & USART_SR_TXE)
	{
		if (txBuffer.isEmpty())
		{
			// transmission finished, disable DRE interrupt
			UART4->CR1 &= ~USART_CR1_TXEIE;
		}
		else {
			// check if CTS is low which indicates that the remote device is ready
			// to accept data
			if (CTS::read())
			{
				// RTS output of remote device high: do not send new data.
				// Disable DRE interrupt
				UART4->CR1 &= ~USART_CR1_TXEIE;

				// TODO: Setup interrupt for rising edge of CTS to resume sending
				// when remote device is ready again.
			}
			else
			{
				// RTS of remote device low: ready to receive new data.
				// get one byte from buffer and write it to the UART buffer
				// which starts the transmission
				UART4_TDR = txBuffer.get();
				txBuffer.pop();
			} // CTS
		} // txBuffer
	} // USART_SR_TXE
} // IRQHandler

// ----------------------------------------------------------------------------
void
xpcc::stm32::BufferedFlowUart4::setBaudrate(uint32_t baudrate,
		uint32_t interruptPriority, bool blocking)
{
	// Enable clock
	RCC->APB1ENR |= RCC_APB1ENR_UART4EN;

	isBlocking = blocking;

	UART4->CR1 = 0;

	// Set vector priority
	NVIC_SetPriority(UART4_IRQn, interruptPriority);

	// Enable USART in the interrupt controller and enable receive ready interrupt
	NVIC->ISER[UART4_IRQn / 32] = 1 << (UART4_IRQn & 0x1F);

	UART4->CR1 |= USART_CR1_RXNEIE;

	// Set baudrate
	UART4->BRR = calculateBaudrateSettings(apbClk, baudrate);

	// Transmitter & Receiver-Enable, 8 Data Bits, 1 Stop Bit
	UART4->CR1 |= USART_CR1_TE | USART_CR1_RE;
	UART4->CR2 = 0;
	UART4->CR3 = 0;

	UART4->CR1 |= USART_CR1_UE;		// Uart Enable
}

// ----------------------------------------------------------------------------
void
xpcc::stm32::BufferedFlowUart4::write(const uint8_t *s, uint8_t n)
{
	while (n-- != 0) {
		write(*s++);
	}
}

// ----------------------------------------------------------------------------
void
xpcc::stm32::BufferedFlowUart4::write(uint8_t c)
{
	while ( !txBuffer.push(c) ) {
		if (!isBlocking) {
			return;
		}
	}

	// Disable interrupts while enabling the transmit interrupt
	atomic::Lock lock;

	// Transmit Data Register Empty Interrupt Enable
	UART4->CR1 |= USART_CR1_TXEIE;
}

// ----------------------------------------------------------------------------
bool
xpcc::stm32::BufferedFlowUart4::read(uint8_t& c)
{
	if (rxBuffer.isNearlyEmpty()) {
		// When the buffer is nearly empty allow remote device to send again.
		// This will create a continous flow of data.
		RTS::reset();
	}

	// Small hack: When the STM stopped transmission due to a high CTS signal try to resume
	// transmission now when CTS is low again and there is something to send.
	// TODO: can be removed if CTS interrupt is included.

	if (!CTS::read() && !txBuffer.isEmpty()) {
		// enable DRE interrupt to resume transmission
		USART2->CR1 |= USART_CR1_RXNEIE;
	}

	if (rxBuffer.isEmpty()) {
		// no data in buffer anymore
		RTS::reset();
		return false;
	}
	else {
		// at least one byte in buffer
		c = rxBuffer.get();
		rxBuffer.pop();

		return true;
	}
}

// ----------------------------------------------------------------------------
uint8_t
xpcc::stm32::BufferedFlowUart4::read(uint8_t *buffer, uint8_t n)
{
	uint_fast8_t i = 0;
	for (; i < n; ++i)
	{
		if (rxBuffer.isEmpty()) {
			RTS::reset();
			return i;
		}
		else {
			*buffer++ = rxBuffer.get();
			rxBuffer.pop();

			if (rxBuffer.isNearlyEmpty()) {
				// When the buffer is nearly empty allow remote device to send again.
				// This will create a continous flow of data.
				RTS::reset();
			}
		}
	}

	return i;
}

uint8_t
xpcc::stm32::BufferedFlowUart4::flushReceiveBuffer()
{
	uint_fast8_t i = 0;
	while (!rxBuffer.isEmpty()) {
		rxBuffer.pop();
		++i;
	}
//	unsigned char c;
//	while (USART4_STATUS & USART_RXCIF_bm)
//		c = USART4_DATA;

	return i;
}

//uint8_t
//xpcc::stm32::BufferedFlowUart4::flushTransmitBuffer()
//{
//	uint8_t i(0);
//	while(!txBuffer.isEmpty()) {
//		txBuffer.pop();
//		++i;
//	}
//
//	return i;
//}

#endif

#endif


text:
package net.anotheria.moskito.webui.producers.api;

import net.anotheria.anoplass.api.APIFactory;

/**
 * TODO comment this class
 *
 * @author lrosenberg
 * @since 14.02.13 11:48
 */
public class ProducerAPIFactory implements APIFactory<ProducerAPI> {
	@Override
	public ProducerAPI createAPI() {
		return new ProducerAPIImpl();
	}
}


text:
package monitor.config;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

public class EmailConfig extends Properties {
    public static final String SMTP_HOST = "mail.smtp.host";
    public static final String SMTP_PORT = "mail.smtp.port";
    public static final String SMTP_AUTHENTICATED = "mail.smtp.auth";
    public static final String SMTP_USER = "mail.user";
    public static final String SMTP_PASS = "mail.password";
    public static final String MAIL_TOPIC = "mail.topic";
    public static final String MAIL_SENDER = "mail.sender";
    public static final String MAIL_RECIPIENTS = "mail.recipients";

    public EmailConfig(String configFileName) {
        super();
        try {
            this.load(Thread.currentThread().getContextClassLoader().getResourceAsStream(configFileName));
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

    public EmailConfig(Properties config) {
        super(config);
    }

    public String getSmtpHost() {
        return getProperty(SMTP_HOST);
    }

    public int getSmtpPort() {
        return Integer.parseInt(getProperty(SMTP_PORT));
    }

    public String getSmtpUser() {
        return getProperty(SMTP_USER);
    }

    public String getSmtpPassword() {
        return getProperty(SMTP_PASS);
    }

    public String getTopic() {
        return getProperty(MAIL_TOPIC);
    }

    public String getSender() {
        return getProperty(MAIL_SENDER);
    }

    public String getRecipients() {
        return getProperty(MAIL_RECIPIENTS);
    }

    public Boolean isAuthenticated() {
        return Boolean.valueOf(getProperty("mail.smtp.auth"));
    }
}


text:
layout: relation
title: 'nmod:appos'
shortdef: 'nominal modifier apposition'
udver: '2'
---

TODO: check this page !!!

The `nmod:appos` relation is used for apposition-like support nouns which modify nominal elements.
The nominal modifier is not introduced by an adposition (otherwise we use the [nmod]() relation).
Contrary to the [appos]() relation, the `nmod:appos` relation can also go right to left.
This not the `compound:nn` found in the Finnish treebanks.

Here is the first example:

~~~ sdparse
Шонді пуксигӧн Ручпиян сиктсянь шептасьысь нянь йӧръяс костті... ю дорӧ лэччисны ныв-зон чукӧр. \n As the sun set, a group of girls and boys went down to the river between the patches of heading grain from Ruchpiyan village.
nmod:subj(пуксигӧн-2, Шонді-1)
advcl:tcl(лэччисны-12, пуксигӧн-2)
nmod:appos(сиктсянь-4, Ручпиян-3)
obl:lfrom(лэччисны-12, сиктсянь-4)
~~~

~~~ sdparse
Эжва ю \n The Ezhva River
nmod:appos(ю, Эжва)
~~~

~~~ sdparse
Йӧзӧдӧма « Войвыв кодзув » журналын . \n Published in «Vojvyv kodzuv» magazine.
nmod(кодзув, Войвыв)
nmod:appos(журналын, кодзув)
obl:lmod(Йӧзӧдӧма, журналын)
~~~
<!-- Interlanguage links updated Po lis 14 15:35:31 CET 2022 -->


text:
package rpc;

import java.io.IOException;

/**
 * Created by Administrator on 2017/10/7.
 */

/**
 * 服务中心
 */
public interface ServiceCenter {
    void start() throws IOException;

    void stop();

    void register(Class service, Class serviceImpl);

    boolean isRunning();

    int getPort();
}


text:
function [noiseTS,outdir,noiseTSz] = prepro_noise(cfg)
    % 1 - Correct noise in EPI output from step 11 of prepro_base script (or output from step 12 in case of ICA-AROMA)
    %       See below for details
    % 2 - Bandpass filter (includes demeaning)
    % 3 - Spatial smoothing (not in case of ICA-AROMA)
    %
    % Copyright (C) 2017, Linden Parkes <lindenparkes@gmail.com>,
    % ------------------------------------------------------------------------------
    % Choose noise removal
    % ------------------------------------------------------------------------------
        % Options:

        % ------------------------------------------------------------------------------
        % The standard methods
        % ------------------------------------------------------------------------------
        % cfg.removeNoise = '6P'
            % Six motion parameters from realignment
            % totaling 6 noise regressors
        % cfg.removeNoise = '6P+2P'
            % Six motion parameters from realignment
            % as well as mean WM/CSF
            % totaling 8 noise regressors
        % cfg.removeNoise = '6P+2P+GSR'
            % Six motion parameters from realignment
            % as well as GSR
            % totaling 9 noise regressors

        % ------------------------------------------------------------------------------
        % The expanded methods
        % ------------------------------------------------------------------------------
        % cfg.removeNoise = '24P'
            % Involves regressing out the following:
            % 1) 6 motion parameters from realignment
            % 3) the temporal derivatives of the above (calculated as the backwards difference)
            % 4) the squares of the above
            % totaling 24 noise regressors. (6*2*2)
        % cfg.removeNoise = '24P+8P'
            % Involves regressing out the following:
            % 1) 6 motion parameters from realignment
            % 2) mean WM and CSF signals
            % 3) the temporal derivatives of the above (calculated as the backwards difference)
            % 4) the squares of the above
            % totaling 32 noise regressors. (6*2*2) + (2*2*2)
        % cfg.removeNoise = '24P+8P+4GSR'
            % 24P+8P as well as 4GSR (expanded)
            % totaling 36 noise regressors. (6*2*2) + (2*2*2) + (1*2*2)
        % cfg.removeNoise = '24P+8P+SpikeReg'
            % 24P+8P as well as spike regression calculated by thresholding the output from GetFDJenk.m (as per Ciric/Satterthwaite)
            % totaling 24P+8P + N noise regressors (where N varies per subject depending on the number of suprathreshold fd spikes)
        % cfg.removeNoise = '24P+8P+4GSR+SpikeReg'
            % The 24P+8P+4GSR model with spike regression
            % AKA, the 24P+8P+SpikeReg model with 4GSR
            % So, 36 params + N spike regressors
            % Same as in Satterthwaite

        % Extra, not in paper
        % cfg.removeNoise = '24P+4GSR'
            % 24P as well as 4GSR (expanded)
            % totaling 28 noise regressors. (6*2*2) + (1*2*2)
        % ------------------------------------------------------------------------------

        % ------------------------------------------------------------------------------
        % The aCompCor methods.
        % ------------------------------------------------------------------------------
        % cfg.removeNoise = '12P+aCC'
            % As per Muschelli et al 2014
            % 1) 6 motion parameters from realignment
            % 2) the temporal derivatives of the above (calculated as the backwards difference)
            % 3) 10 regressors from aCompCor
                % 5 from WM and 5 from CSF
            % totaling 22 regressors. (6*2) + 5 + 5
        % cfg.removeNoise = '12P+aCC'
            % As per Muschelli et al 2014 but using enough PCs to account for 50% of the variance
        % cfg.removeNoise = '24P+aCC'
            % 1) 6 motion parameters from realignment
            % 2) the temporal derivatives of the above (calculated as the backwards difference)
            % 3) the squares of the above
            % 4) 10 regressors from aCompCor
                % 5 from WM and 5 from CSF
            % totaling 34 regressors. (6*2*2) + 5 + 5
        % cfg.removeNoise = '24P+aCC+4GSR'
            % 24P+aCC as well as 4GSR (including temporal derivatives and squares)
            % totaling 38 noise regressors. (6*2*2) + 5 + 5 + 4
        % cfg.removeNoise = '24P+aCC+SpikeReg'
            % 24P+aCC as well as spike regression calculated by thresholding the output from GetFDJenk.m (as per Ciric/Satterthwaite)
            % totaling 24P+aCC + N noise regressors (where N varies per subject depending on the number of suprathreshold fd spikes)
        % cfg.removeNoise = '24P+aCC+4GSR+SpikeReg'
            % 24P+aCC+4GSR and spike regression
            % totaling 38 + N noise regressors. (6*2*2) + 5 + 5 + 4 + N spikes
        % ------------------------------------------------------------------------------

        % ------------------------------------------------------------------------------
        % The ICA methods
        % ------------------------------------------------------------------------------
        % cfg.removeNoise = 'ICA-AROMA+2P'
            % ICA-AROMA as well as mean WM/CSF
        % cfg.removeNoise = 'ICA-AROMA+GSR'
            % ICA-AROMA as well as GSR
        % cfg.removeNoise = 'ICA-AROMA+2P+GSR'
            % ICA-AROMA as well as mean WM/CSF and GSR

        % cfg.removeNoise = 'ICA-AROMA+8P'
            % ICA-AROMA as well as mean expanded WM/CSF
        % cfg.removeNoise = 'ICA-AROMA+4GSR'
            % ICA-AROMA as well as 4GSR
        % cfg.removeNoise = 'ICA-AROMA+8P+4GSR'
            % ICA-AROMA as well as expanded WM/CSF and 4GSR

    fprintf('\n\t\t ----- Noise correction ----- \n\n');

    fprintf(1, '\t\t Subject: %s \n', cfg.subject)
    fprintf(1, '\t\t Noise correction: %s \n', cfg.removeNoise);
    fprintf(1, '\t\t Input file: %s \n', cfg.CleanIn);

    fprintf('\n\t\t ---------------------------- \n\n');

    % ------------------------------------------------------------------------------
    % Setup output directory
    % ------------------------------------------------------------------------------
        outdir = [cfg.preprodir,cfg.removeNoise,'/'];

        if exist(outdir) == 0
            fprintf(1,'\n\t\t Initialising outdir\n')
            mkdir(outdir)
        elseif exist(outdir) == 7
            fprintf(1,'\n\t\t Cleaning and re-initialising outdir\n')
            rmdir(outdir,'s')
            mkdir(outdir)
        end

        cd(outdir)

    % ------------------------------------------------------------------------------
    % Decompress input files if necessary
    % Note, due to storage constraints on MASSIVE, all output files are compressed
    % after completing on run_prepro.m.
    % This code was added in cases where I wanted to run additional pipelines after
    % the initial run_prepro job.
    % Since this prepro_noise.m expects .nii extension files (as per outputs of prepro_base.m),
    % I added this code to check whether the input files are compressed (.gz) or not.
    % If they are, decompress.
    % They will all be recompressed once again after run_prepro.m completes
    % ------------------------------------------------------------------------------
        filesToCheck = {{cfg.CleanIn,cfg.NuisanceIn_wm,cfg.NuisanceIn_csf,cfg.BrainMask}, ...
                        [cfg.wm,cfg.csf,cfg.gmmask]};

        dirsOfFiles = {cfg.preprodir, ...
                        cfg.t1dir};

        for i = 1:length(filesToCheck)
            for j = 1:length(filesToCheck{i})
                if exist([dirsOfFiles{i},filesToCheck{i}{j},'.gz']) == 2
                    fprintf(1, '\t\t Decompressing %s\n',filesToCheck{i}{j});
                    gunzip([dirsOfFiles{i},filesToCheck{i}{j},'.gz'],dirsOfFiles{i})
                    delete([dirsOfFiles{i},filesToCheck{i}{j},'.gz'])
                elseif exist([dirsOfFiles{i},filesToCheck{i}{j},'.gz']) == 0
                    fprintf(1, '\t\t No need to decompress %s\n',filesToCheck{i}{j});
                end
            end
        end

    % ------------------------------------------------------------------------------
    % Setup switches
    % ------------------------------------------------------------------------------
        cfg.removeNoiseSplit = strsplit(cfg.removeNoise,'+');

        % ICA-AROMA
        if any(strmatch('ICA-AROMA',cfg.removeNoiseSplit,'exact')) == 1
            runICA = 1;
        else
            runICA = 0;
        end

        % motion params
        if any(strmatch('6P',cfg.removeNoiseSplit,'exact')) == 1 || ...
            any(strmatch('12P',cfg.removeNoiseSplit,'exact')) == 1 || ...
            any(strmatch('24P',cfg.removeNoiseSplit,'exact')) == 1
            runMot = 1;
        else
            runMot = 0;
        end

        % Physiological noise
        if any(strmatch('2P',cfg.removeNoiseSplit,'exact')) == 1 || ...
            any(strmatch('4P',cfg.removeNoiseSplit,'exact')) == 1 || ...
            any(strmatch('8P',cfg.removeNoiseSplit,'exact')) == 1
            runPhys = 1;
        else
            runPhys = 0;
        end

        % GSR
        if any(strmatch('GSR',cfg.removeNoiseSplit,'exact')) == 1 || ...
            any(strmatch('2GSR',cfg.removeNoiseSplit,'exact')) == 1 || ...
            any(strmatch('4GSR',cfg.removeNoiseSplit,'exact')) == 1
            runGSR = 1;
        else
            runGSR = 0;
        end

        % aCompCor
        if any(strmatch('aCC',cfg.removeNoiseSplit,'exact')) == 1
            runaCC = 1;
            aCCversion = 5;
        elseif any(strmatch('aCC50',cfg.removeNoiseSplit,'exact')) == 1
            runaCC = 1;
            aCCversion = 50;
        else
            runaCC = 0;
        end

        % Power 2014 scrubbing
        if any(strmatch('JP14Scrub',cfg.removeNoiseSplit,'exact')) == 1
            runJP14Scrub = 1;
        else
            runJP14Scrub = 0;
        end

        % Spike regression
        if any(strmatch('SpikeReg',cfg.removeNoiseSplit,'exact')) == 1
            runSpikeReg = 1;
        else
            runSpikeReg = 0;
        end

    % ------------------------------------------------------------------------------
    % 0) ICA AROMA
    % ------------------------------------------------------------------------------
        if runICA == 1

            % if runJP14Scrub == 1
            %     ICA_outdir = [cfg.preprodir,'JP14_ICA-AROMA_output/'];
            % elseif runJP14Scrub == 0
            %     ICA_outdir = [cfg.preprodir,'ICA-AROMA_output/'];
            % end
            ICA_outdir = [cfg.preprodir,'ICA-AROMA_output/'];

            % First check if ICA-AROMA has been run already
            if exist(ICA_outdir) == 0
                fprintf(1, '\n\t\t !!!! Overriding inputs for ICA-AROMA !!!! \n\n');
                % If it doesn't, run ICA-AROMA

                % set FSL output to nifti_gz because ICA-AROMA requires it!!!!
                setenv('FSLOUTPUTTYPE','NIFTI_GZ');

                fprintf(1,'\n\t\t Initialising ICA_outdir\n')
                mkdir(ICA_outdir)
                cd(ICA_outdir)

                str = ['python2.7 ',cfg.scriptdir_ICA,'ICA_AROMA.py -in ',cfg.preprodir,cfg.CleanIn,' -out ',ICA_outdir,' -mc ',cfg.preprodir,'raw_mov/rp*.txt -m ',cfg.preprodir,cfg.BrainMask,' -tr ',num2str(cfg.TR),' -den no'];
                system(str);

                % Get list of noise ICs
                noiseICs = dlmread('classified_motion_ICs.txt');
                noiseTS_ICA = [];
                for i = 1:length(noiseICs)
                    noiseTS_ICA(:,i) = dlmread([ICA_outdir,'melodic.ica/report/t',num2str(noiseICs(i)),'.txt']);
                end
                % write out
                dlmwrite('noiseTS_ICA.txt',noiseTS_ICA,'delimiter','\t','precision','%.6f');

                % load data
                [hdr,data] = read([cfg.preprodir,cfg.CleanIn]);

                % reshape to 2d
                dim = size(data);
                data = reshape(data,[],dim(4));

                % Nuisance regression
                [data_out,~,~] = JP14_regress_nuisance(data,noiseTS_ICA,cfg.demean);

                % redefine clean in
                CleanInNew = ['ica_',cfg.CleanIn];
                % write out
                data_out = reshape(data_out,dim);
                write(hdr,data_out,CleanInNew)

                cfg.CleanIn = CleanInNew;
                % redefine wm/csf files
                cfg.NuisanceIn_wm = CleanInNew;
                cfg.NuisanceIn_csf = CleanInNew;

                % move ICA cleaned file
                movefile(cfg.CleanIn,cfg.preprodir)

                % Set FSL output back to nifti
                setenv('FSLOUTPUTTYPE','NIFTI');
            elseif exist(ICA_outdir) == 7
                fprintf(1,'\n\t\t ICA-AROMA has already been done: skipping \n')
                fprintf(1, '\n\t\t !!!! Overriding inputs for ICA-AROMA !!!! \n\n');
                cd(ICA_outdir)

                % redefine clean in
                CleanInNew = ['ica_',cfg.CleanIn];
                cfg.CleanIn = CleanInNew;
                % redefine wm/csf files
                cfg.NuisanceIn_wm = CleanInNew;
                cfg.NuisanceIn_csf = CleanInNew;

                % move ICA cleaned file
                movefile(cfg.CleanIn,cfg.preprodir)
            end

            % Change back to primary outdir
            cd(outdir)
        end

    % ------------------------------------------------------------------------------
    % 1) Motion parameters
    % ------------------------------------------------------------------------------
        % read in motion
        mfile = dir([cfg.preprodir,'raw_mov/rp*.txt']);
        mov = dlmread([cfg.preprodir,'raw_mov/',mfile(1).name]);
        % mfile = dir([cfg.preprodir,'rp*.txt']);
        % mov = dlmread([cfg.preprodir,mfile(1).name]);

    % ------------------------------------------------------------------------------
    % 2) Physiological time series
    % ------------------------------------------------------------------------------
        if runPhys == 1
            % Extract time series

            % White Matter
            str = [cfg.fsldir,'fslmeants -i ',cfg.preprodir,cfg.NuisanceIn_wm,' -o wmTS.txt -m ',cfg.t1dir,cfg.wmmask];
            system(str);
            wmTS = dlmread('wmTS.txt');

            % also get the other less eroded wm masks.
            % Note, this code is a bit lazy and will end up with a duplicate .txt file.
            % e.g., wmTS.txt is probablity be identical to wm_e5_TS.txt
            for i = 1:length(cfg.wm)
                [hdr,data] = read([cfg.t1dir,cfg.wm{i}]);
                if any(data(:)) == 1;
                    str = [cfg.fsldir,'fslmeants -i ',cfg.preprodir,cfg.NuisanceIn_wm,' -o wm_e',num2str(i),'_TS.txt -m ',cfg.t1dir,cfg.wm{i}];
                    system(str);
                end
            end

            % CSF
            str = [cfg.fsldir,'fslmeants -i ',cfg.preprodir,cfg.NuisanceIn_csf,' -o csfTS.txt -m ',cfg.t1dir,cfg.csfmask];
            system(str);
            csfTS = dlmread('csfTS.txt');

            for i = 1:length(cfg.csf)
                [hdr,data] = read([cfg.t1dir,cfg.csf{i}]);
                if any(data(:)) == 1;
                    str = [cfg.fsldir,'fslmeants -i ',cfg.preprodir,cfg.NuisanceIn_csf,' -o csf_e',num2str(i),'_TS.txt -m ',cfg.t1dir,cfg.csf{i}];
                    system(str);
                end
            end

            % Gray Matter
            % Note, not used for denoising.
            % We only retain a pre-cleaned GM signal so we can examinine wm-gm correlations as a function of wm erosion (Power et al., 2017)
            % Note correlation to WM will likely be 0.1-0.2 higher than in Power et al., because Power uses the ribbon only to get GM (ribbon is better)
            str = [cfg.fsldir,'fslmeants -i ',cfg.preprodir,cfg.CleanIn,' -o gmTS.txt -m ',cfg.t1dir,cfg.gmmask];
            system(str);

            clear hdr data
        end

    % ------------------------------------------------------------------------------
    % 2.1) Global Signal Regression
    % ------------------------------------------------------------------------------
        if runGSR == 1
            % Global
            str = [cfg.fsldir,'fslmeants -i ',cfg.preprodir,cfg.CleanIn,' -o gsTS.txt -m ',cfg.preprodir,cfg.BrainMask];
            system(str);
            gsTS = dlmread('gsTS.txt');
        end

    % ------------------------------------------------------------------------------
    % 3) CompCor
    % ------------------------------------------------------------------------------
        if runaCC == 1
            fprintf(1,'\n\t\t ----- Anatomical CompCor ----- \n\n')

            % 1) White Matter
            if aCCversion == 5
                fprintf(1, '\t\t Running aCompCor: white matter. 5 PCs. \n');
            elseif aCCversion == 50
                fprintf(1, '\t\t Running aCompCor: white matter. 50%% PCs. \n');
            end

            % Check if tissue map is empty
            [~,temp] = read([cfg.t1dir,cfg.wmmask]);
            if numel(unique(temp)) == 1
                fprintf(1, 'WARNING! Your tissue mask is empty. Please check.\n');
                return
            else
                % Extract nuisance time course
                str = [cfg.fsldir,'fslmeants -i ',cfg.preprodir,cfg.NuisanceIn_wm,' -o wmTS_aCC.txt -m ',cfg.t1dir,cfg.wmmask,' --showall'];
                system(str);

                % Read in cfg.wm time courses
                wmTS = dlmread('wmTS_aCC.txt');
                wmTS(1:3,:) = []; % delete first 3 rows, which list voxel coords

                % run cfg.wm aCompCor
                if aCCversion == 5
                    wm_aCompCor = CompCor(wmTS,'retain',[],5);
                elseif aCCversion == 50
                    wm_aCompCor = CompCor(wmTS,'50pc');
                end

                % Save out number of components
                aCC_num_wm = size(wm_aCompCor,2);
                dlmwrite('aCC_num_wm.txt',aCC_num_wm)

                clear wmTS % clear to save memory
            end
            clear temp

            % 2) CSF
            if aCCversion == 5
                fprintf(1, '\t\t Running aCompCor: csf. 5 PCs. \n');
            elseif aCCversion == 50
                fprintf(1, '\t\t Running aCompCor: csf. 50%% PCs. \n');
            end

            % Check if tissue map is empty
            [~,temp] = read([cfg.t1dir,cfg.csfmask]);
            if numel(unique(temp)) == 1
                fprintf(1, 'WARNING! Your tissue mask is empty. Please check.\n');
                return
            else
                % Extract nuisance time course
                str = [cfg.fsldir,'fslmeants -i ',cfg.preprodir,cfg.NuisanceIn_csf,' -o csfTS_aCC.txt -m ',cfg.t1dir,cfg.csfmask,' --showall'];
                system(str);

                % Read in cfg.csf time courses
                csfTS = dlmread('csfTS_aCC.txt');
                csfTS(1:3,:) = []; % delete first 3 rows, which list voxel coords

                % run cfg.csf aCompCor
                if aCCversion == 5
                    csf_aCompCor = CompCor(csfTS,'retain',[],5);
                elseif aCCversion == 50
                    csf_aCompCor = CompCor(csfTS,'50pc');
                end

                % Save out number of components
                aCC_num_csf = size(csf_aCompCor,2);
                dlmwrite('aCC_num_csf.txt',aCC_num_csf)

                clear csfTS % clear to save memory
            end
            clear temp
        end

    % ------------------------------------------------------------------------------
    % 4) Spike regression
    % ------------------------------------------------------------------------------
        if runSpikeReg == 1
            fprintf(1,'\n\t\t ----- Generating spike regressors ----- \n\n');

            % calculate Jenkinson FD
            fd = GetFDJenk(mov);

            % generate spike regressors
            spikereg = GetSpikeRegressors(fd,0.25);

            clear fd
        end

    % ------------------------------------------------------------------------------
    % Generate noiseTS
    % ------------------------------------------------------------------------------
        fprintf(1,'\n\t\t ----- Generating noiseTS ----- \n\n');

        if runMot == 1
            fprintf(1,'\t\t Adding motion params \n');

            % Get expansions for motion
            if any(strmatch('24P',cfg.removeNoiseSplit,'exact')) == 1
                fprintf(1,'\t\t Getting derivatives and squares \n');
                noiseTS = GetDerivatives(mov,cfg.detr);
            elseif any(strmatch('12P',cfg.removeNoiseSplit,'exact')) == 1
                fprintf(1,'\t\t Getting derivatives only \n');
                noiseTS = GetDerivatives(mov,cfg.detr,0);
            else
                % Otherwise, just detrend (note, detrending done as part of GetDerivatives.m)
                if cfg.detr == 1
                    fprintf(1,'\t\t Detrending only \n');
                    noiseTS = detrend(mov);
                elseif cfg.detr == 0
                    noiseTS = mov;
                end
            end
        elseif runMot == 0
            fprintf(1,'\t\t Skipping motion params \n');
            noiseTS = [];
        end

        % If it was run, then we dont regress out mov params
        if runICA == 1
            fprintf(1,'\t\t ICA-AROMA: no motion params \n');
            noiseTS = [];
        end

        % concatenate phys time series
        if runPhys == 1
            fprintf(1,'\t\t Adding phys signals \n');
            physTS = [wmTS csfTS];

            if any(strmatch('8P',cfg.removeNoiseSplit,'exact')) == 1
                fprintf(1,'\t\t Getting derivatives and squares \n');
                physTS = GetDerivatives(physTS,cfg.detr);
            elseif any(strmatch('4P',cfg.removeNoiseSplit,'exact')) == 1
                fprintf(1,'\t\t Getting derivatives only \n');
                physTS = GetDerivatives(physTS,cfg.detr,0);
            else
                % Otherwise, just detrend (note, detrending done as part of GetDerivatives.m)
                if cfg.detr == 1
                    fprintf(1,'\t\t Detrending only \n');
                    physTS = detrend(physTS);
                end
            end

            noiseTS = [noiseTS physTS];
        end

        % concatenate global time series
        if runGSR == 1
            fprintf(1,'\t\t Adding global signal \n');

            if any(strmatch('4GSR',cfg.removeNoiseSplit,'exact')) == 1
                fprintf(1,'\t\t Getting derivatives and squares \n');
                gsTS = GetDerivatives(gsTS,cfg.detr);
            elseif any(strmatch('2GSR',cfg.removeNoiseSplit,'exact')) == 1
                fprintf(1,'\t\t Getting derivatives only \n');
                gsTS = GetDerivatives(gsTS,cfg.detr,0);
            else
                % Otherwise, just detrend (note, detrending done as part of GetDerivatives.m)
                if cfg.detr == 1
                    fprintf(1,'\t\t Detrending only \n');
                    gsTS = detrend(gsTS);
                end
            end

            noiseTS = [noiseTS gsTS];
        end

        % We dont get expansion terms on spike regressors or aCompCor

        % concatenate aCompCor
        if runaCC == 1
            fprintf(1,'\t\t Adding aCompCor signals \n');
            noiseTS = [noiseTS wm_aCompCor csf_aCompCor];
        end

        % concatenate spike regressors
        if runSpikeReg == 1
            fprintf(1,'\t\t Adding spike regressors \n');
            noiseTS = [noiseTS spikereg];
        end

    % ------------------------------------------------------------------------------
    % Nuisance regression
    % ------------------------------------------------------------------------------
        if any(strmatch('none',cfg.removeNoiseSplit,'exact')) ~= 1
            [hdr,data] = read([cfg.preprodir,cfg.CleanIn]);

            % reshape to 2d
            dim = size(data);
            data = reshape(data,[],dim(4));

            if runJP14Scrub == 1
                fprintf(1,'\n\t\t ----- Running nuisance regression with scrubbing ----- \n\n');
                % Read in scrubbing mask
                scrubmask = logical(dlmread([cfg.preprodir,'JP14_ScrubMask.txt']));
                [data_out zb noiseTSz] = JP14_regress_nuisance(data,noiseTS,cfg.demean,~scrubmask(:,2));
            elseif runJP14Scrub == 0
                fprintf(1,'\n\t\t ----- Running nuisance regression without scrubbing ----- \n\n');
                [data_out zb noiseTSz] = JP14_regress_nuisance(data,noiseTS,cfg.demean);
            end

            CleanOut = 'epi_clean.nii';
            data_out = reshape(data_out,dim);
            write(hdr,data_out,CleanOut)

            % write out noiseTS incase people want to model nuisance at SPM
            dlmwrite('noiseTS.txt',noiseTS,'delimiter','\t','precision','%.6f');
            dlmwrite('noiseTSz.txt',noiseTSz,'delimiter','\t','precision','%.6f');

            clear hdr data data_out
        elseif any(strmatch('none',cfg.removeNoiseSplit,'exact')) == 1
            fprintf(1,'\n\t\t ----- Skipping nuisance regression ----- \n\n');
            copyfile([cfg.preprodir,cfg.CleanIn],outdir)
            CleanOut = cfg.CleanIn;
            noiseTSz = [];
        end

    % ------------------------------------------------------------------------------
    % Bandpass filter with REST
    % ------------------------------------------------------------------------------
        if cfg.runBandpass == 1
            FiltIn = CleanOut;

            % load nifti
            [hdr,data] = read(FiltIn);

            % reshape to 2d
            dim = size(data);
            data = reshape(data,[],dim(4));
            % Put time on first dimension
            data = data';
            numVoxels = size(data,2);

            % load in brain mask
            [hdr_mask,data_mask] = read([cfg.preprodir,cfg.BrainMask]);
            data_mask = reshape(data_mask,[],1);
            data_mask = logical(data_mask);

            % mask out non-brain voxels
            % Note, we only do this to speed up the interpolation step that is run only for JP14Scrub method
            data = data(:,data_mask);

            if runJP14Scrub == 1
                fprintf(1,'\n\t\t ----- Running bandpass filtering with interpolation ----- \n\n');
                % Read in scrubbing mask
                scrubmask = logical(dlmread([cfg.preprodir,'JP14_ScrubMask.txt']));
                TRtimes = ([1:cfg.tN]')*cfg.TR;

                voxbinsize = 100;
                voxbin = 1:voxbinsize:size(data,2);
                voxbin = [voxbin size(data,2)];

                data_surrogate = zeros(size(data,1),size(data,2));

                for v = 1:numel(voxbin)-1 % this takes huge RAM if all voxels
                    fprintf(1, 'Processing voxel bin %u/%u\n', v,numel(voxbin)-1);
                    data_surrogate(:,voxbin(v):voxbin(v+1)) = JP14_getTransform(data(:,voxbin(v):voxbin(v+1)),TRtimes,scrubmask(:,2));
                end

                % insert surrogate data into real data at censored time points
                data(scrubmask(:,2),:) = data_surrogate(scrubmask(:,2),:);
            elseif runJP14Scrub == 0
                fprintf(1,'\n\t\t ----- Running bandpass filtering without interpolation ----- \n\n');
            end

            % bandpass filter the masked data
            data = rest_IdealFilter(data, cfg.TR, [cfg.HighPass, cfg.LowPass]);

            % put filtered data back with non-brain voxels
            data_out = zeros(cfg.tN,numVoxels);
            data_out(:,data_mask) = data;
            clear data

            % reshape back to 4d
            data_out = data_out';
            data_out = reshape(data_out,dim);

            % write nifti
            FiltOut = 'epi_filtered.nii';
            write(hdr,data_out,FiltOut)
            clear hdr data data_out
        elseif cfg.runBandpass == 0
            fprintf(1,'\n\t\t ----- Skipping bandpass filtering ----- \n\n');
        end

    % ------------------------------------------------------------------------------
    % Spatially smooth the data
    % ------------------------------------------------------------------------------
        if cfg.runBandpass == 1
            SmoothIn = FiltOut;
        elseif cfg.runBandpass == 0
            SmoothIn = CleanOut;
        end

        switch cfg.smoothing
            case 'after'
                fprintf('\n\t\t ----- Spatial smoothing ----- \n\n');
                SmoothEPI(SmoothIn,cfg.kernel,cfg.tN)
                movefile(['s',SmoothIn],'epi_prepro.nii')
            case 'none'
                fprintf('\n\t\t !!!! Skipping spatial smoothing !!!! \n\n');
                % Simply rename the filtered epi to epi_prepro.nii so that the final output file is always the same file name
                movefile(SmoothIn,'epi_prepro.nii')
            case 'before'
                movefile(SmoothIn,'epi_prepro.nii')
        end

    % ------------------------------------------------------------------------------
    % Put ICA-AROMA output back in ICA dir
    % ------------------------------------------------------------------------------
        if runICA == 1
            % Move back
            movefile([cfg.preprodir,cfg.CleanIn],ICA_outdir)
        end

    % ------------------------------------------------------------------------------
    % Delete intermediate files
    % ------------------------------------------------------------------------------
        filesToCheck = {'epi_clean.nii', ...
                        'epi_filtered.nii'};

        for i = 1:length(filesToCheck)
            if exist(filesToCheck{i}) == 2
                fprintf(1, '\t\t Deleting %s\n',filesToCheck{i});
                delete(filesToCheck{i})
            elseif exist(filesToCheck{i}) == 0
                fprintf(1, '\t\t No need to delete %s\n',filesToCheck{i});
            end
        end

    fprintf('\n\t\t ----- Noise correction complete ----- \n\n');
end


text:
/*
* Template Name: Unify - Responsive Bootstrap Template
* Description: Business, Corporate, Portfolio, Blog and One Page Theme.
* Version: 1.8
* Author: @htmlstream
* Website: http://htmlstream.com
*/

/*Import Global Compulsory CSS Files*/
@import url(app.css);
@import url(blocks.css);
@import url(plugins.css);
@import url(http://fonts.googleapis.com/earlyaccess/nanumgothic.css);

body {
  width: 100%;
  height: 100%;
  color: #fff;
  font-size: 13px;
  line-height: 1.6;
  font-family: 'nanumgothic', cursive;
}

html {
  width: 100%;
  height: 100%;
}

h1, h2, h3, h4, h5, h6 {
  color: #555;
}

p,
li,
li a {
  color: #555;
}

a {
  color: #111e90;
  text-decoration: none;
}

a,
a:focus,
a:hover,
a:active {
  outline: 0 !important;
}
a:focus {
  text-decoration: none;
}
a:hover {
  color: #111e90;
  text-decoration: underline;
}

::selection {
  color: #fff;
  background: #111e90;
}

.navbar-fixed-bottom .navbar-collapse,
.navbar-fixed-top .navbar-collapse {
  max-height: 100%;
}

/*Header
------------------------------------*/
/*Containers*/

@media (min-width: 368px) and (max-width: 768px) {
  .one-page-header .menu-container {
    width: 300px;
  }
}

@media (min-width: 768px) and (max-width: 991px) {
  .one-page-header .menu-container {
    width: 720px;
  }
}

@media (max-width: 991px) {
  .one-page-header .menu-container:before,
  .one-page-header .menu-container:after {
    content: " ";
    display: table;
  }

  .one-page-header .menu-container:after {
    clear: both;
  }

  .one-page-header > .navbar-default > .container {
    width: inherit;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
  }

  .one-page-header > .navbar-default > .container > .navbar-header,
  .one-page-header > .navbar-default > .container > .navbar-collapse {
    margin-left: 0;
    margin-right: 0;
  }
}

/*Navbar Logo*/
.one-page-header .navbar-brand {
  font-size: 31px;
  font-weight: 200;
  line-height: 15px;
  padding: 17px 0px 13px 0px;
  color: #fff !important;
}

@media (max-width: 368px) {
  .one-page-header .navbar-brand {
    padding-left: 0;
    width:250px;
  } }
    .one-page-header .navbar-brand > img { width:160px; }

/*Navbar Toggle*/
.one-page-header .navbar-toggle {
  border: none;
  margin-right: 3px;
  padding-right: 0;
}

.one-page-header .navbar-toggle:hover,
.one-page-header .navbar-toggle:focus {
  background: none;
}

.one-page-header .navbar-toggle .icon-bar {
  background: #fff;
}

.one-page-header .navbar-toggle .icon-bar {
  height: 1px;
  width: 25px;
  font-size: 22px;
  background: #fff;
  margin-bottom: 7px;
}

.one-page-header .navbar-toggle .icon-bar:last-child {
  margin-bottom: 0;
}

/*Navbar*/
.one-page-header {
  border-bottom: none;
  background: #fff;
}
.one-page-header .container {
  position: relative;
}

.one-page-header .navbar-nav > li{

}

.one-page-header .navbar-nav > li > a {
  color: #2a7de2;
  font-size: 12.5px;
  text-transform: uppercase;
  padding: 17px 15px 13px;
}

.one-page-header .navbar-nav > li > a:before {
  left: -3px;
  top: 15px;
  z-index: 2;
  margin-right: 6px;
  position: absolute;
   font-family: 'nanumgothic', cursive;
}

.one-page-header .navbar-nav > li.home > a:before {
  content: "";
}

.one-page-header .navbar-nav > li > a:hover {
  z-index: 1;
  color: #111e90;
}

.one-page-header .navbar-nav > li > a:focus {
  color: #111e90;
}

.one-page-header .navbar-nav > .active > a,
.one-page-header .navbar-nav > .active > a:hover,
.one-page-header .navbar-nav > .active > a:focus,
.one-page-header .dropdown-menu > .active > a,
.one-page-header .dropdown-menu > .active > a:hover,
.one-page-header .dropdown-menu > .active > a:focus,
.one-page-header.top-nav-collapse .dropdown-menu > .active > a,
.one-page-header.top-nav-collapse .dropdown-menu > .active > a:hover,
.one-page-header.top-nav-collapse .dropdown-menu > .active > a:focus {
  z-index: 1;
  background: none;
  color: #111e90 !important;
}

@media (max-width: 768px) {
  .one-page-header .navbar-brand {
    padding-left: 0;
  } }
    .one-page-header .navbar-brand > img { width:160px; }

/*Navbar Toggle*/
.one-page-header .navbar-toggle {
  border: none;
  margin-right: 3px;
  padding-right: 0;
}

.one-page-header .navbar-toggle:hover,
.one-page-header .navbar-toggle:focus {
  background: none;
}

.one-page-header .navbar-toggle .icon-bar {
  background: #fff;
}

.one-page-header .navbar-toggle .icon-bar {
  height: 1px;
  width: 25px;
  font-size: 22px;
  background: #fff;
  margin-bottom: 7px;
}

.one-page-header .navbar-toggle .icon-bar:last-child {
  margin-bottom: 0;
}

/*Navbar*/
.one-page-header {
  border-bottom: none;
  background: #fff;
}
.one-page-header .container {
  position: relative;
}

.one-page-header .navbar-nav > li{

}

.one-page-header .navbar-nav > li > a {
  color: #2a7de2;
  font-size: 12.5px;
  text-transform: uppercase;
  padding: 17px 15px 13px;
}

.one-page-header .navbar-nav > li > a:before {
  left: -3px;
  top: 15px;
  z-index: 2;
  margin-right: 6px;
  position: absolute;
   font-family: 'nanumgothic', cursive;
}

.one-page-header .navbar-nav > li.home > a:before {
  content: "";
}

.one-page-header .navbar-nav > li > a:hover {
  z-index: 1;
  color: #111e90;
}

.one-page-header .navbar-nav > li > a:focus {
  color: #111e90;
}

.one-page-header .navbar-nav > .active > a,
.one-page-header .navbar-nav > .active > a:hover,
.one-page-header .navbar-nav > .active > a:focus,
.one-page-header .dropdown-menu > .active > a,
.one-page-header .dropdown-menu > .active > a:hover,
.one-page-header .dropdown-menu > .active > a:focus,
.one-page-header.top-nav-collapse .dropdown-menu > .active > a,
.one-page-header.top-nav-collapse .dropdown-menu > .active > a:hover,
.one-page-header.top-nav-collapse .dropdown-menu > .active > a:focus {
  z-index: 1;
  background: none;
  color: #111e90 !important;
}

/*Responsive Navbar*/
@media (max-width: 991px) {
  /*Responsive code for max-width: 991px*/
  .one-page-header .navbar-header {
    float: none;
  }

  .one-page-header .navbar-toggle {
    display: block;
  }

  .one-page-header .navbar-collapse.collapse {
    display: none !important;
  }

  .one-page-header .navbar-collapse.collapse.in {
    display: block !important;
  }

  .one-page-header .navbar-nav {
    margin: 0 0 5px;
    float: none !important;
  }

  .one-page-header .navbar-nav > li {
    float: none;
  }

  .navbar-default .navbar-nav > li > a {
    padding: 10px 0;
  }

  .navbar-default .navbar-nav > li > a::before {
    content: '';
  }
}

@media(min-width: 992px) {
  .one-page-header.navbar {
    padding: 12px 0;
    -webkit-transition: background .3s ease-in-out,padding .3s ease-in-out;
    -moz-transition: background .3s ease-in-out,padding .3s ease-in-out;
    transition: background .3s ease-in-out,padding .3s ease-in-out;
  }

  .one-page-header.top-nav-collapse {
    /* Customize the look and feel of the collapsed top nav here */
    padding: 7px 0;
  }
}

@media (max-width: 768px) {
  .one-page-header .navbar-nav > li > a:before {
    content: " ";
  }
}

/*Navbar*/
@media (min-width: 992px) {
  .one-page-header.navbar .navbar-nav {
    float: right;
  }
  .one-page-header-style-2.navbar .navbar-nav {
    float: left;
    margin-left: 25px;
  }
}

/* Top Log-Reg */
.log-reg-block {
  float: right;
  list-style: none;
  margin: 0;
  padding: 0;
}
.log-reg-block > li {
  float: left;
  position: relative;
}
.log-reg-block a {
  color: #eee;
  font-size: 12.5px;
  text-transform: uppercase;
  padding: 17px 15px 13px 15px;
  display: block;
  line-height: 20px;
}
.log-reg-block a:hover {
  color: #111e90;
  z-index: 1;
}
.log-reg-block a:before {
  color: #eee;
  content: "\f10c";
   font-family: 'nanumgothic', cursive;
  font-size: 4px;
  left: -3px;
  margin-right: 6px;
  position: absolute;
  z-index: 2;
}
.log-reg-block a.cd-signin:before {
  content: "";
}
.top-nav-collapse .log-reg-block a,
.top-nav-collapse .log-reg-block a:before {
  color: #777;
}

@media (max-width: 992px) {
  .one-page-header .navbar-nav > li.cd-log_reg {
    opacity: 0.5;
  }
}

/* Dropdown Menu */
.one-page-header .dropdown-menu,
.one-page-header.top-nav-collapse .dropdown-menu {
  border: none;
  background: none;
  box-shadow: none;
  float: none;
}
.one-page-header .navbar-nav a.dropdown-toggle {
  color: #fff !important;
}
.one-page-header.top-nav-collapse .navbar-nav a.dropdown-toggle {
  color: #777 !important;
}
.one-page-header .dropdown-menu .active > a,
.one-page-header .dropdown-menu li > a:hover {
  background: none;
  filter: none !important;
  -webkit-transition: all 0.1s ease-in-out;
  -moz-transition: all 0.1s ease-in-out;
  -o-transition: all 0.1s ease-in-out;
  transition: all 0.1s ease-in-out;
}
.one-page-header .dropdown-menu li > a:focus {
  background: none;
  filter: none !important;
}
@media (min-width: 992px) {
  .one-page-header .dropdown-menu,
  .one-page-header.top-nav-collapse .dropdown-menu {
    padding-top: 12px;
    min-width: 200px;
    border-radius: 0;
    z-index: 9999 !important;
    top: 100%;
  }
  .one-page-header.top-nav-collapse .dropdown-menu {
    padding-top: 7px;
  }
  .one-page-header .navbar-nav > li.dropdown:hover > .dropdown-menu {
    display: block;
  }
  .one-page-header .open > .dropdown-menu {
    display: none;
  }
  .one-page-header .dropdown-menu > li {
    background: rgba(0, 0, 0, 0.4);
  }
  .one-page-header.top-nav-collapse .dropdown-menu > li {
    background: #fff;
  }
  .one-page-header .dropdown-menu > li:first-child {
    padding-top: 15px;
  }
  .one-page-header .dropdown-menu > li:last-child {
    padding-bottom: 15px;
  }
  .one-page-header .dropdown-menu > li > a {
    color: #fff;
    font-size: 13px;
    font-weight: 400;
    padding: 6px 25px;
  }
  .one-page-header.top-nav-collapse .dropdown-menu > li > a {
    color: #777;
  }
  .one-page-header.top-nav-collapse .dropdown-menu > li > a:hover {
    color: #111e90;
  }
}
@media (max-width: 991px) {
  .one-page-header .dropdown-menu {
    position: relative;
  }
  .one-page-header .dropdown-menu a {
    color: #fff !important;
    padding: 10px 20px;
    background: none !important;
  }
  .one-page-header.top-nav-collapse .dropdown-menu > li > a {
    color: #777 !important;
  }
  .one-page-header .dropdown-menu a:hover,
  .one-page-header.top-nav-collapse .dropdown-menu > li > a:hover {
    color: #111e90 !important;
  }
}

/* Top Contacts Block */
.top-contact-block {
  float: right;
  padding: 9px 0 0 20px;
  font-weight: 300;
  font-size: 16px;
  line-height: 20px;
}
.top-contact-block i {
  display: inline-block;
  width: 30px;
  height: 30px;
  color: #fff;
  border: solid 1px #fff;
  border-radius: 50% !important;
  text-align: center;
  padding-top: 7px;
  margin-right: 5px;
}
.top-nav-collapse .top-contact-block i {
  color: #777;
  border-color: #777;
}
.top-contact-block a {
  color: #fff;
  position: relative;
  top: 1px;
}
.top-contact-block a:hover {
  text-decoration: none;
}
.top-nav-collapse .top-contact-block a {
  color: #777;
}
@media (max-width: 991px) {
  .top-contact-block {
    position: absolute;
    top: 10px;
    left: 130px;
    float: none;
    padding: 0;
  }
}
@media (max-width: 480px) {
  .top-contact-block {
/*    position: static;
    padding: 8px 0 14px;
    text-align: right;*/
    display: none;
  }
}

/* Login Block Simple */
.log-reg-block-simple {
  float: right;
  padding: 10px 0 4px 20px;
  line-height: 20px;
  text-transform: uppercase;
}
.log-reg-block-simple .btn-u {
  font-size: 12.5px;
  color: #fff;
  border: solid 1px #fff;
  background: none;
  padding: 5px 13px;
}
.top-nav-collapse .log-reg-block-simple .btn-u {
  color: #777;
  border-color: #777;
}
.log-reg-block-simple .btn-u:hover,
.top-nav-collapse .log-reg-block-simple .btn-u:hover {
  color: #fff;
  background: #111e90;
  border-color: #111e90;
}

@media (max-width: 991px) {
  .log-reg-block-simple {
    position: absolute;
    top: 10px;
    right: 60px;
    float: none;
    padding: 0;
  }
}

/* Lang Block */
.lang-block {
  float: right;
  background: rgba(0,0,0,0.6);
  padding: 6px 13px 4px 13px;
  margin: 10px 0 0 20px;
  font-size: 12.5px;
  text-transform: uppercase;
  line-height: 20px;
  position: relative;
}
.mega-hover__current {
  display: inline-block;
  position: relative;
  padding-right: 15px;
}
.mega-hover__current:before {
  color: #fff;
  content: "\f107";
   font-family: 'nanumgothic', cursive;
  position: absolute;
  right: 0;
  top: 0;
}
.lang-block ul {
  list-style: none;
  padding: 0 13px 5px;
  margin: 0;
  background: rgba(0,0,0,0.6);
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
}
.mega-hover-list {
  display: none;
}
/*.lang-block:hover {
  cursor: pointer;
}*/
.lang-block:hover .mega-hover-list {
  display: block;
}
.lang-block a {
  color: #fff;
}
@media (max-width: 991px) {
  .lang-block {
    float: none;
    background: rgba(0,0,0,0.6);
    display: inline-block;
    position: absolute;
    top: 0;
    right: 60px;
  }
}

/*Fixed Header*/
.one-page-header.top-nav-collapse {
  background: #fff;
  box-shadow: 0 0 3px #b5b5b5;
}

@media (max-width: 768px) {
  .one-page-header.top-nav-collapse {
    padding: 0;
  }
}

.one-page-header.top-nav-collapse .navbar-brand,
.one-page-header.top-nav-collapse .navbar-nav > li > a,
.one-page-header.top-nav-collapse .navbar-nav > li > a:before {
  color: #777;
}

/*Navbar Toggle*/
.one-page-header.top-nav-collapse .navbar-toggle .icon-bar {
  background: #555;
}

.one-page-header.top-nav-collapse .navbar-toggle:hover .icon-bar {
  background: #111e90;
}

/*Intro Section
------------------------------------*/
/*Intro Section*/
.intro-section {
  background: #222;
}

.intro-section:after {
  width: 100%;
  height: 100%;
  position: absolute;
}

/*About Section
------------------------------------*/
/*About Section*/
.about-section {
  padding-bottom: 0px;
}

.block-v1 {
  padding: 50px 0;
}

.about-section .about-image {
  padding-top: 100px;
  padding-bottom: 50px;
}

/*Icon Lists*/
.content-boxes-v3 i.icon-custom {
  margin-right: 8px;
}

.content-boxes-v3 h2 {
  font-size: 15px;
  margin-bottom: 5px;
  font-weight: bold;
  text-transform: uppercase;
}

/*Style for Cube Portfolio wrapper*/
.cube-portfolio #filters-container {
  text-align: center;
}

.cube-portfolio #filters-container .cbp-filter-item-active {
  background: #111e90;
  border-color: #111e90;
}

.cube-portfolio .cbp-l-filters-button .cbp-filter-counter {
  color: #fff;
  background: #111e90;
}

.cube-portfolio .cbp-l-filters-button .cbp-filter-counter:before {
  border-top-color: #111e90;
}

.promo-section {
  position: relative;
}
.backstretch:after {
  background: rgba(0,0,0,0.3);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  content: "";
}
.promo-section h2 {
  color: #fff;
  font-size: 35px;
  line-height: 1.1;
  font-weight: 200;
  padding: 10px 75px;
  position: relative;
  border-top: solid 1px #fff;
  border-bottom: solid 1px #fff;
  text-align: center;
  margin-bottom: 30px;
}
.promo-section h2:after,
.promo-section h2:before {
  font-size: 16px;
  content: "\f005";
  position: absolute;
   font-family: 'nanumgothic', cursive;

  position: absolute;
  top: 50%;
  margin-top: -8px;
}
.promo-section h2:after {
  right: 4%;
}
.promo-section h2:before {
  left: 4%;
}
.promo-text {
  color: #fff;
  position: relative;
  font-size: 26px;
  font-weight: 200;
  line-height: 40px;
  padding: 10px 50px;
  text-align: center;
  margin-bottom: 60px;
}
.promo-text:after {
  left: 50%;
  content: "";
  height: 1px;
  width: 100px;
  bottom: -10px;
  background: #fff;
  margin-left: -50px;
  position: absolute;
}

.promo-next {
  text-align: center;
}
.promo-next a {
  margin: 0 5px;
  padding: 7px 20px;
  text-transform: uppercase;
}

.promo-section h2,
.promo-text,
.promo-next {
  opacity: .9;
}

@media (max-width: 600px) {
  .promo-section h2 {
    font-size: 25px;
    margin-bottom: 10px;
  }
  .promo-text {
    font-size: 18px;
    line-height: 1.4;
    margin-bottom: 20px;
  }
  .promo-text:after {
    display: none;
  }
}

.contacts-section2 {
  padding-top: 50px;
  padding-bottom: 10px;
  font-size: 15px;
}
.contacts-section2 h2 {
  color: #444;
  font: 28px "Open Sans",sans-serif;
  margin-bottom: 15px;
  padding-bottom: 15px;
  position: relative;
  text-transform: uppercase;
}
.contacts-section2 .lead {
  font-size: 18px;
}
.contacts-section2 i {
  float: left;
  margin-right: 15px;
}
.contacts-section2 h6 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 5px;
}

.footer-simple {
  padding: 20px 0;
  border-top: 1px solid #eee;
}
.footer-simple p {
  margin-top: 15px;
  margin-bottom: 0;
}
.footer-simple .social-icons {
  margin-top: 10px;
}
.footer-simple .social-icons li {
  margin-bottom: 0;
}

.what-people-say .testimonials-v6 .testimonials-info {
  background: #f7f7f7;
}
.what-people-say .testimonials-v6.testimonials-wrap {
  padding-left: 0;
  padding-right: 0;
}


text:
package com.github.messenger4j.send.message.richmedia;

import lombok.EqualsAndHashCode;
import lombok.NonNull;
import lombok.ToString;

/**
 * @author Max Grabenhorst
 * @since 1.0.0
 */
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public final class ReusableRichMediaAsset extends RichMediaAsset {

  private final String attachmentId;

  private ReusableRichMediaAsset(Type type, String attachmentId) {
    super(type);
    this.attachmentId = attachmentId;
  }

  public static ReusableRichMediaAsset create(@NonNull Type type, @NonNull String attachmentId) {
    return new ReusableRichMediaAsset(type, attachmentId);
  }

  public String attachmentId() {
    return attachmentId;
  }
}


text:
- The cache configuration file is located at **./config/cache.php**.
- Laravel supports popular caching backends like **Memcached** and **Redis** out of the box.
- By default, Laravel is configured to use the **file** cache driver, which stores the **serialized**, cached objects in the filesystem.
- For larger applications, it is recommended that you use an **in-memory cache** such as Memcached or APC.

#### Cache Prerequisites(先決條件)

##### Database

- When using the **database** cache driver, you'll need to setup a table to contain the cache items.

```php
Schema::create('cache', function($table){
	$table->string('key')->unique();
	$table->text('value');
	$talbe->integer('expiration');
});
```

##### Memcached

- Using the Memcached cache requires the [**Memcached PECL package**](http://pecl.php.net/package/memcached) to be installed.
- The default configuration uses TCP/IP based on Memcached::addServer.

```php
'memcached' => [
    [
        'host' => '127.0.0.1',
        'port' => 11211,
        'weight' => 100
    ],
],
```

- You may also set the host option to a UNIX socket path. If you do this, the port option should be set to **0**.

```php
`memcached` => [
	[
		'host' => '/var/run/memcached/memcached.sock',
		'port' => 0,
		'weight' => 100
	],
],
```

##### Redis

- Before using a Redis cache with Laravel, you will need to install the **predis/predis** package (~1.0) via Composer.


text:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <corners
        android:radius="2dp"/>
    <solid android:color="#e3dfdf"></solid>
    <stroke
        android:width="0.5dp"
        android:color="@color/colorAccent"></stroke>
</shape>