text:
"""
Support for DS18B20 One Wire Sensors.

For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.onewire/
"""
import logging
import os
import time
from glob import glob

from blumate.const import STATE_UNKNOWN, TEMP_CELSIUS
from blumate.helpers.entity import Entity

BASE_DIR = '/sys/bus/w1/devices/'
DEVICE_FOLDERS = glob(os.path.join(BASE_DIR, '28*'))
SENSOR_IDS = []
DEVICE_FILES = []
for device_folder in DEVICE_FOLDERS:
    SENSOR_IDS.append(os.path.split(device_folder)[1])
    DEVICE_FILES.append(os.path.join(device_folder, 'w1_slave'))

_LOGGER = logging.getLogger(__name__)

# pylint: disable=unused-argument
def setup_platform(hass, config, add_devices, discovery_info=None):
    """Setup the one wire Sensors."""
    if DEVICE_FILES == []:
        _LOGGER.error('No onewire sensor found.')
        _LOGGER.error('Check if dtoverlay=w1-gpio,gpiopin=4.')
        _LOGGER.error('is in your /boot/config.txt and')
        _LOGGER.error('the correct gpiopin number is set.')
        return

    devs = []
    names = SENSOR_IDS

    for key in config.keys():
        if key == "names":
            # only one name given
            if isinstance(config['names'], str):
                names = [config['names']]
            # map names and sensors in given order
            elif isinstance(config['names'], list):
                names = config['names']
            # map names to ids.
            elif isinstance(config['names'], dict):
                names = []
                for sensor_id in SENSOR_IDS:
                    names.append(config['names'].get(sensor_id, sensor_id))
    for device_file, name in zip(DEVICE_FILES, names):
        devs.append(OneWire(name, device_file))
    add_devices(devs)

class OneWire(Entity):
    """Implementation of an One wire Sensor."""

    def __init__(self, name, device_file):
        """Initialize the sensor."""
        self._name = name
        self._device_file = device_file
        self._state = STATE_UNKNOWN
        self.update()

    def _read_temp_raw(self):
        """Read the temperature as it is returned by the sensor."""
        ds_device_file = open(self._device_file, 'r')
        lines = ds_device_file.readlines()
        ds_device_file.close()
        return lines

    @property
    def name(self):
        """Return the name of the sensor."""
        return self._name

    @property
    def state(self):
        """Return the state of the sensor."""
        return self._state

    @property
    def unit_of_measurement(self):
        """Return the unit the value is expressed in."""
        return TEMP_CELSIUS

    def update(self):
        """Get the latest data from the device."""
        lines = self._read_temp_raw()
        while lines[0].strip()[-3:] != 'YES':
            time.sleep(0.2)
            lines = self._read_temp_raw()
        equals_pos = lines[1].find('t=')
        if equals_pos != -1:
            temp_string = lines[1][equals_pos+2:]
            temp = round(float(temp_string) / 1000.0, 1)
            if temp < -55 or temp > 125:
                return
            self._state = temp


text:
<TITLE>Partitioning</TITLE>
<LINK REL="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

<< Back
INDEX
Next >>

Page 23

Partitioning

    Divide hard disk

    fdisk vs disklabel

    Partitions vs DOS attacks

    Sharing with other OSes

redpajama_set_name: RedPajamaGithub


text:
#ifndef _RTE_POWER_ACPI_CPUFREQ_H
#define _RTE_POWER_ACPI_CPUFREQ_H

/**
 * @file
 * RTE Power Management via userspace ACPI cpufreq
 */

#include <rte_common.h>
#include <rte_byteorder.h>
#include <rte_log.h>
#include <rte_string_fns.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 * Initialize power management for a specific lcore. It will check and set the
 * governor to userspace for the lcore, get the available frequencies, and
 * prepare to set new lcore frequency.
 *
 * @param lcore_id
 *  lcore id.
 *
 * @return
 *  - 0 on success.
 *  - Negative on error.
 */
int rte_power_acpi_cpufreq_init(unsigned lcore_id);

/**
 * Exit power management on a specific lcore. It will set the governor to which
 * is before initialized.
 *
 * @param lcore_id
 *  lcore id.
 *
 * @return
 *  - 0 on success.
 *  - Negative on error.
 */
int rte_power_acpi_cpufreq_exit(unsigned lcore_id);

/**
 * Get the available frequencies of a specific lcore. The return value will be
 * the minimal one of the total number of available frequencies and the number
 * of buffer. The index of available frequencies used in other interfaces
 * should be in the range of 0 to this return value.
 * It should be protected outside of this function for threadsafe.
 *
 * @param lcore_id
 *  lcore id.
 * @param freqs
 *  The buffer array to save the frequencies.
 * @param num
 *  The number of frequencies to get.
 *
 * @return
 *  The number of available frequencies.
 */
uint32_t rte_power_acpi_cpufreq_freqs(unsigned lcore_id, uint32_t *freqs,
		uint32_t num);

/**
 * Return the current index of available frequencies of a specific lcore. It
 * will return 'RTE_POWER_INVALID_FREQ_INDEX = (~0)' if error.
 * It should be protected outside of this function for threadsafe.
 *
 * @param lcore_id
 *  lcore id.
 *
 * @return
 *  The current index of available frequencies.
 */
uint32_t rte_power_acpi_cpufreq_get_freq(unsigned lcore_id);

/**
 * Set the new frequency for a specific lcore by indicating the index of
 * available frequencies.
 * It should be protected outside of this function for threadsafe.
 *
 * @param lcore_id
 *  lcore id.
 * @param index
 *  The index of available frequencies.
 *
 * @return
 *  - 1 on success with frequency changed.
 *  - 0 on success without frequency changed.
 *  - Negative on error.
 */
int rte_power_acpi_cpufreq_set_freq(unsigned lcore_id, uint32_t index);

/**
 * Scale up the frequency of a specific lcore according to the available
 * frequencies.
 * It should be protected outside of this function for threadsafe.
 *
 * @param lcore_id
 *  lcore id.
 *
 * @return
 *  - 1 on success with frequency changed.
 *  - 0 on success without frequency changed.
 *  - Negative on error.
 */
int rte_power_acpi_cpufreq_freq_up(unsigned lcore_id);

/**
 * Scale down the frequency of a specific lcore according to the available
 * frequencies.
 * It should be protected outside of this function for threadsafe.
 *
 * @param lcore_id
 *  lcore id.
 *
 * @return
 *  - 1 on success with frequency changed.
 *  - 0 on success without frequency changed.
 *  - Negative on error.
 */
int rte_power_acpi_cpufreq_freq_down(unsigned lcore_id);

/**
 * Scale up the frequency of a specific lcore to the highest according to the
 * available frequencies.
 * It should be protected outside of this function for threadsafe.
 *
 * @param lcore_id
 *  lcore id.
 *
 * @return
 *  - 1 on success with frequency changed.
 *  - 0 on success without frequency changed.
 *  - Negative on error.
 */
int rte_power_acpi_cpufreq_freq_max(unsigned lcore_id);

/**
 * Scale down the frequency of a specific lcore to the lowest according to the
 * available frequencies.
 * It should be protected outside of this function for threadsafe.
 *
 * @param lcore_id
 *  lcore id.
 *
 * @return
 *  - 1 on success with frequency changed.
 *  - 0 on success without frequency chnaged.
 *  - Negative on error.
 */
int rte_power_acpi_cpufreq_freq_min(unsigned lcore_id);

#ifdef __cplusplus
}
#endif

#endif


text:
var jet = require('../lib/jet')

var daemon = new jet.Daemon()

var provider = new jet.Peer()

var n = 10000
var changes = 1000
var states = {}

for (var i = 0; i < n; ++i) {
  var state = new jet.State('#' + i, Math.random())
  states['#' + i] = state
  provider.add(state)
}

provider.connect().then(function () {
  console.log('provider ready')
})

var consumer = new jet.Peer()

var fetcher = new jet.Fetcher()
  .sortByValue('number')
  .range(20, 100)

var changeCount = 0
fetcher.on('data', function (data) {
  changeCount++
  var first = states[data[0].path]
  var last = states[data[data.length - 1].path]
  first.value(last.value() + Math.random())
  if (changeCount === changes) {
    console.log('done', changeCount)
    process.exit(0)
  }
})

consumer.fetch(fetcher)

consumer.connect().then(function () {
  console.log('consumer ready')
})

daemon.listen()


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IonFar.SharePoint.Migration;

namespace IonFar.SharePoint.Synchronization.Preprocessors
{
    internal class StreamPreprocessor : IDisposable
    {
        private bool _disposedValue = false; // To detect redundant calls

        readonly System.IO.Stream _inputStream;
        IEnumerable<ITextFilePreprocessor> _preprocessors;
        readonly System.IO.Stream _outputStream;

        public StreamPreprocessor(IContextManager contextManager, IUpgradeLog logger, System.IO.Stream inputStream, IEnumerable<ITextFilePreprocessor> preprocessors)
        {
            _inputStream = inputStream;
            _preprocessors = preprocessors;

            if (_preprocessors.Any())
            {
                using (var reader = new System.IO.StreamReader(_inputStream, Encoding.UTF8))
                {
                    var content = reader.ReadToEnd();
                    foreach (var preprocessor in preprocessors)
                    {
                        content = preprocessor.Process(contextManager, logger, content);
                    }
                    _outputStream = new System.IO.MemoryStream(Encoding.UTF8.GetBytes(content));
                }
            }
        }

        public System.IO.Stream Stream
        {
            get
            {
                return _outputStream ?? _inputStream;
            }
        }

        public void Dispose()
        {
            Dispose(true);
            // GC.SuppressFinalize(this);
        }

        protected virtual void Dispose(bool disposing)
        {
            if (!_disposedValue)
            {
                if (disposing)
                {
                    if (_outputStream != null)
                    {
                        _outputStream.Dispose();
                    }
                }
                _disposedValue = true;
            }
        }
    }
}


text:
if (SERVER_SIDE){
	var key          = '_request_local_storage_'
	,   cls          = require('continuation-local-storage').createNamespace(key)
	,   bind         = cls.bind.bind(cls)
	,   patch        = func => func(cls)
	,   getContainer = () => cls.get(key)
	,   startRequest = (start) => { cls.run(() => {cls.set(key, []); start()}) }
} else {
	var container    = []
	,   bind         = f  => f
	,   patch        = () => {}
	,   getContainer = () => container
	,   startRequest = () => container = []
}

var namespaces         = 0
,   getCountNamespaces = () => namespaces
,   getNamespace       = () => {

	// This will be our return value.
	var getter = (i => () => {
		var container = getContainer();
		if (!container){
			throw new Error("RLS() access outside of request!");
		}
		return container[i] || (container[i] = {});
	})(namespaces++);

	getter.isActive = () => !!getContainer();

	// This is guarded against old versions of node that don't provide the
	// necessary API (bamboo).
	if (SERVER_SIDE && Proxy) {
		getter = new Proxy(getter, {set: function(target, prop) {
			// It's easy to make the mistake of using `RLS.foo`
			// instead of `RLS().foo`, but this is actually a very
			// bad error server-side.  It's a leak across requests.
			throw new Error(`Use of "RLS.${prop}" should be "RLS().${prop}"!`);
		}});
	}

	return getter;
}

global.requestLocalStorage = global.requestLocalStorage || {};

module.exports = global.requestLocalStorage[REQUEST_LOCAL_STORAGE_VERSION] || { getNamespace, getCountNamespaces, startRequest, bind, patch };

if (!global.requestLocalStorage[REQUEST_LOCAL_STORAGE_VERSION]) global.requestLocalStorage[REQUEST_LOCAL_STORAGE_VERSION] = module.exports;


text:
require File.join(File.dirname(__FILE__), %w(.. dagnabit))

module Dagnabit::Vertex
  autoload :Activation,   'dagnabit/vertex/activation'
  autoload :Associations, 'dagnabit/vertex/associations'
  autoload :Bonding,      'dagnabit/vertex/bonding'
  autoload :Connectivity, 'dagnabit/vertex/connectivity'
  autoload :Neighbors,    'dagnabit/vertex/neighbors'
  autoload :Settings,     'dagnabit/vertex/settings'
end


text:
xiShader *	xiShader::singleton = nullptr;
int32_t				xiShader::references = 0;

int xiShader::Shaders_Compare( const void * const left, const void * const right ) {
	const shader_t * const leftShader = ( shader_t * )left;
	const shader_t * const rightShader = ( shader_t * )right;

	const size_t leftLen = strlen( leftShader->name );
	const size_t rightLen = strlen( rightShader->name );
	const size_t minLen = MIN( leftLen, rightLen );

	for ( size_t ii = 0; ii < minLen; ii++ ) {
		if ( leftShader->name[ii] < rightShader->name[ii] ) {
			return -1;
		} else if ( leftShader->name[ii] > rightShader->name[ii] ) {
			return 1;
		}
	}

	if ( leftLen < rightLen ) {
		return -1;
	} else if ( leftLen > rightLen ) {
		return 1;
	}

	return 0;
}

xiShader * xiShader::Get() {
	if ( !singleton ) {
		singleton = new xiShader();
	}

	singleton->Retain();

	return singleton;
}

void xiShader::Retain() {
	references++;
}

void xiShader::Release() {
	references--;

	if ( !references ) {
		delete( this );
		singleton = nullptr;
	}
}

xiShader::xiShader() {
	shaders.ptr = 0;
	shaders.len = 0;
}

xiShader::~xiShader() {
	if ( shaders.ptr ) {
		int32_t index = shaders.len - 1;
		do {
			glDeleteShader( shaders.ptr[index].glHandle );
		} while ( index-- );

		free( shaders.ptr );
	}
}

int xiShader::Compile( const char * const fileName, const shaderType_e type ) {
	shader_t * const shader = Shaders_Find( fileName );

	if ( shader ) {
		if ( shader->type != type ) {
			// Identical names
			return -1;
		}

		return shader->glHandle;
	}

	GLuint shaderType = 0;
	switch ( type ) {
	case SHADER_COMPUTE:
		shaderType = GL_COMPUTE_SHADER;
		break;
	case SHADER_VERTEX:
		shaderType = GL_VERTEX_SHADER;
		break;
	case SHADER_TESS_CONTROL:
		shaderType = GL_TESS_CONTROL_SHADER;
		break;
	case SHADER_TESS_EVALUATION:
		shaderType = GL_TESS_EVALUATION_SHADER;
		break;
	case SHADER_GEOMETRY:
		shaderType = GL_GEOMETRY_SHADER;
		break;
	case SHADER_FRAGMENT:
		shaderType = GL_FRAGMENT_SHADER;
		break;
	}

	if ( !shaderType ) {
		return -1;
	}

	// Load new shader
	xiReadFile * const readFile = xiReadFile::CreateReadFile( fileName );
	if ( readFile ) {
		const size_t sourceLen = readFile->GetSize();
		const GLint glSourceLen = ( GLint )sourceLen;

		char * const sourceBuffer = new char[sourceLen + 1];
		readFile->Read( sourceBuffer, sourceLen );
		sourceBuffer[sourceLen] = 0;

		readFile->Release();

		GLuint shaderHandle = glCreateShader( shaderType );
		glShaderSource( shaderHandle, 1, ( const char ** )&sourceBuffer, &glSourceLen );
		glCompileShader( shaderHandle );
		delete[]( sourceBuffer );

		GLint isCompiled = 0;
		glGetShaderiv( shaderHandle, GL_COMPILE_STATUS, &isCompiled );
		if ( isCompiled == GL_FALSE ) {
			GLint maxLength = 0;
			glGetShaderiv( shaderHandle, GL_INFO_LOG_LENGTH, &maxLength );

			char * const infoLog = new char[maxLength];
			glGetShaderInfoLog( shaderHandle, maxLength, &maxLength, &infoLog[0] );

			const size_t nameLen = strlen( fileName ) + 4;
			char * const logName = new char[nameLen + 1];
			strcpy( logName, fileName );
			logName[nameLen - 4] = '.';
			logName[nameLen - 3] = 'l';
			logName[nameLen - 2] = 'o';
			logName[nameLen - 1] = 'g';
			logName[nameLen] = 0;

			xiWriteFile * const writeFile = xiWriteFile::CreateWriteFile( logName );
			if ( writeFile ) {
				writeFile->Write( infoLog, maxLength );

				writeFile->Release();
			}
			delete[]( logName );
			delete[]( infoLog );

			glDeleteShader( shaderHandle );

			return -1;
		}

		shader_t newShader;
		newShader.glHandle = shaderHandle;
		newShader.type = type;
		strcpy( &newShader.name[0], fileName );

		Shaders_PushBack( &newShader );
		Shaders_Sort();

		return newShader.glHandle;
	}

	return -1;
}

void xiShader::Shaders_Sort() {
	qsort( shaders.ptr, shaders.len, sizeof( *shaders.ptr ), &Shaders_Compare );
}

xiShader::shader_t * xiShader::Shaders_Find( const char * const name ) {
	if ( !shaders.ptr ) {
		return nullptr;
	}

	shader_t search;
	strcpy( &search.name[0], name );

	int32_t boundLeft = 0;
	int32_t boundRight = shaders.len;

	while ( boundRight >= boundLeft ) {
		const int32_t cursor = ( boundLeft + boundRight ) >> 1;

		const int dir = Shaders_Compare( &shaders.ptr[cursor], &search );
		if ( dir == 0 ) {
			return &shaders.ptr[cursor];
		}

		if ( dir < 0 ) {
			boundLeft = cursor + 1;
		} else if ( dir > 0 ) {
			boundRight = cursor - 1;
		}
	}

	return nullptr;
}

void xiShader::Shaders_PushBack( shader_t * const newShader ) {
	const int32_t biggerLen = shaders.len + 1;
	shader_t * const biggerPtr = ( shader_t * )realloc( shaders.ptr, sizeof( *biggerPtr ) * biggerLen );

	if ( biggerPtr ) {
		memcpy( &biggerPtr[shaders.len], newShader, sizeof( *newShader ) );

		shaders.ptr = biggerPtr;
		shaders.len = biggerLen;
	}
}


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
N. Z. Jl Bot. 7(3): 241 (1969)

#### Original name
Platygloea australis McNabb, 1969

### Remarks
null


text:
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">
	<info organisation="org.scalatest"
		module="scalatest_2.11"
		revision="2.1.5"
		status="release"
		publication="20140428190638"
	>
		<license name="the Apache License, ASL Version 2.0" url="http://www.apache.org/licenses/LICENSE-2.0" />
		<description homepage="http://www.scalatest.org">
		ScalaTest is a free, open-source testing toolkit for Scala and Java
    programmers.
		</description>
		<m:properties__project.build.sourceEncoding>UTF-8</m:properties__project.build.sourceEncoding>
		<m:properties__project.reporting.outputEncoding>UTF-8</m:properties__project.reporting.outputEncoding>
		<m:properties__sonatypeOssDistMgmtSnapshotsUrl>https://oss.sonatype.org/content/repositories/snapshots/</m:properties__sonatypeOssDistMgmtSnapshotsUrl>
		<m:properties__pax.url.version>1.6.0</m:properties__pax.url.version>
		<m:properties__scala.version>2.11.0</m:properties__scala.version>
		<m:properties__pax.exam.version>3.4.0</m:properties__pax.exam.version>
		<m:maven.plugins>org.apache.maven.plugins__maven-enforcer-plugin__1.0|org.apache.maven.plugins__maven-enforcer-plugin__1.0</m:maven.plugins>
	</info>
	<configurations>
		<conf name="default" visibility="public" description="runtime dependencies and master artifact can be used with this conf" extends="runtime,master"/>
		<conf name="master" visibility="public" description="contains only the artifact published by this module itself, with no transitive dependencies"/>
		<conf name="compile" visibility="public" description="this is the default scope, used if none is specified. Compile dependencies are available in all classpaths."/>
		<conf name="provided" visibility="public" description="this is much like compile, but indicates you expect the JDK or a container to provide it. It is only available on the compilation classpath, and is not transitive."/>
		<conf name="runtime" visibility="public" description="this scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath." extends="compile"/>
		<conf name="test" visibility="private" description="this scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases." extends="runtime"/>
		<conf name="system" visibility="public" description="this scope is similar to provided except that you have to provide the JAR which contains it explicitly. The artifact is always available and is not looked up in a repository."/>
		<conf name="sources" visibility="public" description="this configuration contains the source artifact of this module, if any."/>
		<conf name="javadoc" visibility="public" description="this configuration contains the javadoc artifact of this module, if any."/>
		<conf name="optional" visibility="public" description="contains all optional dependencies"/>
	</configurations>
	<publications>
		<artifact name="scalatest_2.11" type="jar" ext="jar" conf="master"/>
	</publications>
	<dependencies>
		<dependency org="org.scala-lang" name="scala-library" rev="2.11.0" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
		<dependency org="org.scala-lang" name="scala-compiler" rev="2.11.0" force="true" conf="optional->compile(*),master(*)"/>
		<dependency org="org.scala-lang" name="scala-reflect" rev="2.11.0" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
		<dependency org="org.scala-lang.modules" name="scala-parser-combinators_2.11" rev="1.0.1" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
		<dependency org="org.scala-lang.modules" name="scala-xml_2.11" rev="1.0.1" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
		<dependency org="org.scala-sbt" name="test-interface" rev="1.0" force="true" conf="optional->compile(*),master(*)"/>
		<dependency org="org.antlr" name="stringtemplate" rev="3.2" force="true" conf="optional->compile(*),master(*)"/>
		<dependency org="org.scalacheck" name="scalacheck_2.11" rev="1.11.3" force="true" conf="optional->compile(*),master(*)"/>
		<dependency org="org.easymock" name="easymockclassextension" rev="3.1" force="true" conf="optional->compile(*),master(*)"/>
		<dependency org="org.jmock" name="jmock-legacy" rev="2.5.1" force="true" conf="optional->compile(*),master(*)"/>
		<dependency org="org.mockito" name="mockito-all" rev="1.9.0" force="true" conf="optional->compile(*),master(*)"/>
		<dependency org="org.testng" name="testng" rev="6.8.7" force="true" conf="optional->compile(*),master(*)"/>
		<dependency org="com.google.inject" name="guice" rev="2.0" force="true" conf="optional->compile(*),master(*)"/>
		<dependency org="junit" name="junit" rev="4.10" force="true" conf="optional->compile(*),master(*)"/>
		<dependency org="org.seleniumhq.selenium" name="selenium-java" rev="2.35.0" force="true" conf="optional->compile(*),master(*)"/>
		<dependency org="org.apache.ant" name="ant" rev="1.7.1" force="true" conf="optional->compile(*),master(*)"/>
		<dependency org="commons-io" name="commons-io" rev="1.3.2" force="true" conf="test->runtime(*),master(*)"/>
		<dependency org="org.eclipse.jetty" name="jetty-server" rev="8.1.8.v20121106" force="true" conf="test->runtime(*),master(*)"/>
		<dependency org="org.eclipse.jetty" name="jetty-webapp" rev="8.1.8.v20121106" force="true" conf="test->runtime(*),master(*)"/>
		<dependency org="org.ow2.asm" name="asm-all" rev="4.1" force="true" conf="optional->compile(*),master(*)"/>
		<dependency org="org.pegdown" name="pegdown" rev="1.4.2" force="true" conf="optional->compile(*),master(*)"/>
		<dependency org="org.ops4j.pax.exam" name="pax-exam-container-native" rev="3.4.0" force="true" conf="test->runtime(*),master(*)"/>
		<dependency org="org.ops4j.pax.exam" name="pax-exam-junit4" rev="3.4.0" force="true" conf="test->runtime(*),master(*)"/>
		<dependency org="org.ops4j.pax.exam" name="pax-exam-link-mvn" rev="3.4.0" force="true" conf="test->runtime(*),master(*)"/>
		<dependency org="org.ops4j.pax.url" name="pax-url-aether" rev="1.6.0" force="true" conf="test->runtime(*),master(*)"/>
		<dependency org="org.apache.felix" name="org.apache.felix.framework" rev="4.4.0" force="true" conf="test->runtime(*),master(*)"/>
		<dependency org="org.osgi" name="org.osgi.core" rev="5.0.0" force="true" conf="test->runtime(*),master(*)"/>
		<dependency org="org.slf4j" name="slf4j-api" rev="1.7.7" force="true" conf="test->runtime(*),master(*)"/>
		<dependency org="ch.qos.logback" name="logback-core" rev="1.1.2" force="true" conf="test->runtime(*),master(*)"/>
		<dependency org="ch.qos.logback" name="logback-classic" rev="1.1.2" force="true" conf="test->runtime(*),master(*)"/>
	</dependencies>
</ivy-module>


text:
package org.apereo.cas.adaptors.jdbc;

import org.apereo.cas.authentication.CoreAuthenticationTestUtils;
import org.apereo.cas.authentication.CoreAuthenticationUtils;
import org.apereo.cas.authentication.principal.PrincipalFactoryUtils;
import org.apereo.cas.util.CollectionUtils;
import org.apereo.cas.util.junit.EnabledIfPortOpen;
import org.apereo.cas.util.serialization.SerializationUtils;

import lombok.SneakyThrows;
import lombok.val;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.TestPropertySource;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.sql.DataSource;

import java.util.List;

import static org.junit.jupiter.api.Assertions.*;

/**
 * This is postgres tests for {@link QueryDatabaseAuthenticationHandler}.
 *
 * @author Misagh Moayyed
 * @since 6.0.0
 */
@TestPropertySource(properties = {
    "database.user=postgres",
    "database.password=password",
    "database.driver-class=org.postgresql.Driver",
    "database.name=postgres",
    "database.url=jdbc:postgresql://localhost:5432/",
    "database.dialect=org.hibernate.dialect.PostgreSQL95Dialect"
})
@EnabledIfPortOpen(port = 5432)
@Tag("Postgres")
public class QueryDatabaseAuthenticationHandlerPostgresTests extends BaseDatabaseAuthenticationHandlerTests {
    private static final String SQL = "SELECT * FROM caspgusers where username=?";

    private static final String PASSWORD_FIELD = "password";

    @Autowired
    @Qualifier("dataSource")
    private DataSource dataSource;

    @BeforeEach
    @SneakyThrows
    public void initialize() {
        try (val c = this.dataSource.getConnection()) {
            c.setAutoCommit(true);
            try (val pstmt = c.prepareStatement("insert into caspgusers (username, password, locations) values(?,?,?);")) {
                val array = c.createArrayOf("text", new String[]{"usa", "uk"});
                pstmt.setString(1, "casuser");
                pstmt.setString(2, "Mellon");
                pstmt.setArray(3, array);
                pstmt.executeUpdate();
            }
        }
    }

    @AfterEach
    @SneakyThrows
    public void afterEachTest() {
        try (val c = this.dataSource.getConnection()) {
            try (val s = c.createStatement()) {
                c.setAutoCommit(true);
                s.execute("delete from caspgusers;");
            }
        }
    }

    @Test
    @SneakyThrows
    public void verifySuccess() {
        val map = CoreAuthenticationUtils.transformPrincipalAttributesListIntoMultiMap(List.of("locations"));
        val q = new QueryDatabaseAuthenticationHandler("DbHandler", null,
            PrincipalFactoryUtils.newPrincipalFactory(), 0,
            this.dataSource, SQL, PASSWORD_FIELD,
            null, null, CollectionUtils.wrap(map));
        val c = CoreAuthenticationTestUtils.getCredentialsWithDifferentUsernameAndPassword("casuser", "Mellon");
        val result = q.authenticate(c);
        assertNotNull(result);
        assertNotNull(result.getPrincipal());
        assertTrue(result.getPrincipal().getAttributes().containsKey("locations"));
        assertNotNull(SerializationUtils.serialize(result));
    }

    @SuppressWarnings("unused")
    @Entity(name = "caspgusers")
    public static class UsersTable {
        @Id
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        private Long id;

        @Column
        private String username;

        @Column
        private String password;

        @Column(
            name = "locations",
            columnDefinition = "text[]"
        )
        private String[] locations;
    }
}


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<project name="testInvalidDuplicateHookDefinition">

	<taskdef resource="net/meisen/ant/tasks/antlib.xml" />
	<defineHook name="InvalidDuplicateHookDefinition" />
	<defineHook name="InvalidDuplicateHookDefinition" />
</project>


text:
#include <photon/element/dial.hpp>
#include <photon/support/theme.hpp>
#include <photon/view.hpp>
#include <cmath>

#include <iostream>

namespace cycfi { namespace photon
{
   dial_base::dial_base(double init_value)
    : _value(init_value)
   {
      clamp(_value, 0.0, 1.0);
   }

   void dial_base::prepare_subject(context& ctx)
   {
      proxy_base::prepare_subject(ctx);
      subject().value(_value);
   }

   void dial_base::value(double val)
   {
      clamp(val, 0.0, 1.0);
      _value = val;
      subject().value(_value);
      if (on_change)
         on_change(_value);
   }

   double dial_base::value_from_point(context const& ctx, point p)
   {
      using namespace radial_consts;

      point center = center_point(ctx.bounds);
      double angle = -std::atan2(p.x-center.x, p.y-center.y);
      if (angle < 0.0)
         angle += _2pi;

      float val = (angle-start_angle) / range;
      if (std::abs(val - value()) < 0.6)
      {
         clamp(val, 0.0, 1.0);
         return val;
      }

      return value();
   }

   void dial_base::begin_tracking(context const& ctx, info& track_info)
   {
   }

   void dial_base::keep_tracking(context const& ctx, info& track_info)
   {
      if (track_info.current != track_info.previous)
      {
         double new_value = value_from_point(ctx, track_info.current);
         if (_value != new_value)
         {
            value(new_value);
            ctx.view.refresh(ctx);
         }
      }
   }

   void dial_base::end_tracking(context const& ctx, info& track_info)
   {
   }

   bool dial_base::scroll(context const& ctx, point dir, point p)
   {
      value(value() + dir.y * 0.005);
      ctx.view.refresh(ctx);
      return true;
   }

   void draw_indicator(canvas& cnv, circle cp, float val, color c)
   {
      constexpr float w_factor = 0.05; // relative width of the indicator
      constexpr float h_factor = 0.2;  // relative height of the indicator
      using namespace radial_consts;

      auto state = cnv.new_state();
      auto center = cp.center();
      cnv.translate({ center.x, center.y });
      cnv.rotate(offset + (val * range));

      float r = cp.radius * 0.85;
      float ind_w = r * w_factor;
      float ind_h = r * h_factor;
      rect  ind_r = { -ind_w, -ind_h, ind_w, ind_h };
      ind_r = ind_r.move(0, r*0.6);

      draw_indicator(cnv, ind_r, c);
   }

   void draw_radial_marks(canvas& cnv, circle cp, float size, color c)
   {
      using namespace radial_consts;
      auto state = cnv.new_state();
      auto center = cp.center();
      constexpr auto num_divs = 50;
      float div = range / num_divs;
      auto const& theme = get_theme();

      cnv.translate({ center.x, center.y });
      cnv.stroke_style(theme.ticks_color);
      for (int i = 0; i != num_divs+1; ++i)
      {
         float from = cp.radius;
         if (i % (num_divs / 10))
         {
            // Minor ticks
            from -= size / 4;
            cnv.line_width(theme.minor_ticks_width);
            cnv.stroke_style(c.level(theme.minor_ticks_level));
         }
         else
         {
            // Major ticks
            cnv.line_width(theme.major_ticks_width);
            cnv.stroke_style(c.level(theme.major_ticks_level));
         }

         float angle = offset + (M_PI / 2) + (i * div);
         float sin_ = std::sin(angle);
         float cos_ = std::cos(angle);
         float to = cp.radius - (size / 2);

         cnv.move_to({ from * cos_, from * sin_ });
         cnv.line_to({ to * cos_, to * sin_ });
         cnv.stroke();
      }
   }

   void draw_radial_labels(
      canvas& cnv
    , circle cp
    , float size
    , float font_size
    , std::string const labels[]
    , std::size_t num_labels
   )
   {
      if (num_labels < 2)
         return; // Nothing to do

      using namespace radial_consts;
      auto state = cnv.new_state();
      auto center = cp.center();
      float div = range / (num_labels-1);
      auto const& theme = get_theme();

      cnv.translate({ center.x, center.y });
      cnv.text_align(cnv.middle | cnv.center);
      cnv.fill_style(theme.label_font_color);

      cnv.font(
         theme.label_font,
         theme.label_font_size * font_size,
         theme.label_style
      );

      for (int i = 0; i != num_labels; ++i)
      {
         float angle = offset + (M_PI / 2) + (i * div);
         float sin_ = std::sin(angle);
         float cos_ = std::cos(angle);

         cnv.fill_text({ cp.radius * cos_, cp.radius * sin_ }, labels[i].c_str());
      }
   }
}}


text:
const eval_file = (() => {
   "use strict"

   const fs = require('fs')
   const path = require('path')

   return (source) => {
      if (path.extname(source) !== '.js') {
         return console.log('filename: "' + source + '" does not have .js extension')
      }
      fs.readFile(source, 'utf8', (err, data) => {
         if (err) {
            return console.log(err)
         }

         /* jshint evil:true */
         console.log(eval(data))
         /* jshint evil:false */
      })
   }
})()

if (process.argv.length != 3) {
   return console.log('Please specify file')
}

eval_file(process.argv[2])


text:
// (C) Copyright 2015 Martin Dougiamas
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import { Injector } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { AddonModAssignFeedbackHandler } from '../providers/feedback-delegate';

/**
 * Base handler for feedback plugins.
 *
 * This class is needed because parent classes cannot have @Injectable in Angular v6, so the default handler cannot be a
 * parent class.
 */
export class AddonModAssignBaseFeedbackHandler implements AddonModAssignFeedbackHandler {
    name = 'AddonModAssignBaseFeedbackHandler';
    type = 'base';

    constructor(protected translate: TranslateService) { }

    /**
     * Discard the draft data of the feedback plugin.
     *
     * @param {number} assignId The assignment ID.
     * @param {number} userId User ID.
     * @param {string} [siteId] Site ID. If not defined, current site.
     * @return {void|Promise<any>} If the function is async, it should return a Promise resolved when done.
     */
    discardDraft(assignId: number, userId: number, siteId?: string): void | Promise<any> {
        // Nothing to do.
    }

    /**
     * Return the Component to use to display the plugin data.
     * It's recommended to return the class of the component, but you can also return an instance of the component.
     *
     * @param {Injector} injector Injector.
     * @param {any} plugin The plugin object.
     * @return {any|Promise<any>} The component (or promise resolved with component) to use, undefined if not found.
     */
    getComponent(injector: Injector, plugin: any): any | Promise<any> {
        // Nothing to do.
    }

    /**
     * Return the draft saved data of the feedback plugin.
     *
     * @param {number} assignId The assignment ID.
     * @param {number} userId User ID.
     * @param {string} [siteId] Site ID. If not defined, current site.
     * @return {any|Promise<any>} Data (or promise resolved with the data).
     */
    getDraft(assignId: number, userId: number, siteId?: string): any | Promise<any> {
        // Nothing to do.
    }

    /**
     * Get files used by this plugin.
     * The files returned by this function will be prefetched when the user prefetches the assign.
     *
     * @param {any} assign The assignment.
     * @param {any} submission The submission.
     * @param {any} plugin The plugin object.
     * @param {string} [siteId] Site ID. If not defined, current site.
     * @return {any[]|Promise<any[]>} The files (or promise resolved with the files).
     */
    getPluginFiles(assign: any, submission: any, plugin: any, siteId?: string): any[] | Promise<any[]> {
        return [];
    }

    /**
     * Get a readable name to use for the plugin.
     *
     * @param {any} plugin The plugin object.
     * @return {string} The plugin name.
     */
    getPluginName(plugin: any): string {
        // Check if there's a translated string for the plugin.
        const translationId = 'addon.mod_assign_feedback_' + plugin.type + '.pluginname',
            translation = this.translate.instant(translationId);

        if (translationId != translation) {
            // Translation found, use it.
            return translation;
        }

        // Fallback to WS string.
        if (plugin.name) {
            return plugin.name;
        }
    }

    /**
     * Check if the feedback data has changed for this plugin.
     *
     * @param {any} assign The assignment.
     * @param {any} submission The submission.
     * @param {any} plugin The plugin object.
     * @param {any} inputData Data entered by the user for the feedback.
     * @return {boolean|Promise<boolean>} Boolean (or promise resolved with boolean): whether the data has changed.
     */
    hasDataChanged(assign: any, submission: any, plugin: any, inputData: any): boolean | Promise<boolean> {
        return false;
    }

    /**
     * Check whether the plugin has draft data stored.
     *
     * @param {number} assignId The assignment ID.
     * @param {number} userId User ID.
     * @param {string} [siteId] Site ID. If not defined, current site.
     * @return {boolean|Promise<boolean>} Boolean or promise resolved with boolean: whether the plugin has draft data.
     */
    hasDraftData(assignId: number, userId: number, siteId?: string): boolean | Promise<boolean> {
        return false;
    }

    /**
     * Whether or not the handler is enabled on a site level.
     *
     * @return {boolean|Promise<boolean>} True or promise resolved with true if enabled.
     */
    isEnabled(): boolean | Promise<boolean> {
        return true;
    }

    /**
     * Prefetch any required data for the plugin.
     * This should NOT prefetch files. Files to be prefetched should be returned by the getPluginFiles function.
     *
     * @param {any} assign The assignment.
     * @param {any} submission The submission.
     * @param {any} plugin The plugin object.
     * @param {string} [siteId] Site ID. If not defined, current site.
     * @return {Promise<any>} Promise resolved when done.
     */
    prefetch(assign: any, submission: any, plugin: any, siteId?: string): Promise<any> {
        return Promise.resolve();
    }

    /**
     * Prepare and add to pluginData the data to send to the server based on the draft data saved.
     *
     * @param {number} assignId The assignment ID.
     * @param {number} userId User ID.
     * @param {any} plugin The plugin object.
     * @param {any} pluginData Object where to store the data to send.
     * @param {string} [siteId] Site ID. If not defined, current site.
     * @return {void|Promise<any>} If the function is async, it should return a Promise resolved when done.
     */
    prepareFeedbackData(assignId: number, userId: number, plugin: any, pluginData: any, siteId?: string): void | Promise<any> {
        // Nothing to do.
    }

    /**
     * Save draft data of the feedback plugin.
     *
     * @param {number} assignId The assignment ID.
     * @param {number} userId User ID.
     * @param {any} plugin The plugin object.
     * @param {any} data The data to save.
     * @param {string} [siteId] Site ID. If not defined, current site.
     * @return {void|Promise<any>} If the function is async, it should return a Promise resolved when done.
     */
    saveDraft(assignId: number, userId: number, plugin: any, data: any, siteId?: string): void | Promise<any> {
        // Nothing to do.
    }
}


text:
import java.io.File

import testgen.TestSuiteBuilder._
import testgen._

object CryptoSquareTestGenerator {
  def main(args: Array[String]): Unit = {
    val file = new File("src/main/resources/crypto-square.json")

    val code = TestSuiteBuilder.build(file,
        fromLabeledTestAltFromInput("normalizedPlaintext" -> Seq("plaintext"), "plaintextSegments" -> Seq("plaintext"),
          "encoded" -> Seq("plaintext"), "ciphertext" -> Seq("plaintext")))
    println(s"-------------")
    println(code)
    println(s"-------------")
  }
}


text:
package main

import (
	"log"
)

var clients []*Client

func setupirc() {
	// Find all clients
	rows, err := db.Queryx("SELECT * FROM clients")
	if err != nil {
		log.Println(err)
	}

	// For each client we want to add it to our slice of clients
	for rows.Next() {
		var client Client
		if err := rows.StructScan(&client); err != nil {
			log.Println(err)
		}

		clients = append(clients, &client)
	}

	// Start each client
	for _, client := range clients {
		go client.Connect()
	}
}


text:
 Copyright 2016 ArmoIllevNormAfrika

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

## Objective
  This project is a proposal to OpenCompare.org in order to enhance the data quality with the implementation of a form. When the user use the form, he is now guided for wich type he can enter on the line he wants to create or modify. Furthermore, autocompletion is added so if the user try to type a text in a field, a list of proposition is showed and the user can select it.
  Finally, it is necessary to understand that the current project does not care about modifying the pcms's datas but is only an external addition to the [OpenCompare project](https://github.com/opencompare/opencompare).

## Architecture

* [OC_Form](https://github.com/ArmoIllevNormAfrika/OC_Form/)

The Java part, contains all necessary classes to generate the HTML code.

* [OC_Form_site](https://github.com/ArmoIllevNormAfrika/OC_Form_site)

The JavaScript part, manage the autocompletion, user interactions in the form. Bootstrap is only for the demonstration with buttons on the PCM.

## Technology used
* Boostrap
* JavaScript
* Java
* CasperJS / PhamtomJS

## Development tools
* [IntelliJ](https://www.jetbrains.com/idea/)
* [Maven](https://maven.apache.org)
* [WampServer](http://www.wampserver.com/) to run Website

## Getting started

### Get the repository
First, clone the repository :

    git clone https://github.com/ArmoIllevNormAfrika/OC_Form_site

Generate new pcm example with the main project "OC_Form" with main.java and set the name of the pcm on the run arguments configuration and enter the name of the .pcm you want to use. If you don't example.pcm will be generated automatically.

Then go where your file is generated, you will have a file named indexDDMMYYhhmmssSSS.html and rename the file generated with "index.html" and paste it on your wamp server path (see set up wamp server).

### Set up Wamp server

Put the folder project on this path:

    c:\wamp\www\OC_Form_site\

Run wampServer

### Use website
Now the server is running, you can connect on.

 * localhost/OC_Form_site

Now you are able to see how works our application.

### Tests

#### Install:

* [PhantomJS](https://bitbucket.org/ariya/phantomjs/downloads/)

Add the following on your build path :

    C:\phantomjs\

* [CasperJS](https://github.com/n1k0/casperjs/zipball/1.1-beta3)

Add the following on your build path :

    C:\casperjs\bin

#### Launching JavaScript tests

In cmd:

    casperjs test sample.js

It implements two tests:

* Verifying the number of columns (features) is the same number of field in the form.

* Check the type input in the form who won't accept any bad type.

* Check if the value in the PCM is the same than the one in the form for the good feature.

#### Launching Java tests

InteliJ : Launch the class PcmToHtmlTest with JUnit4

The class, check that the PCM is gerenated in the good HTML format.

It implements three methods:

* Verifying the number of rows, columns (features) contained in the generated HTML file. It must be equal to the number of rows and columns of the loaded PCM. It also verifies the proper structuration with the proper tags of the HTML file.

* A specific test on a PCM multifeatures. The purpose here is to verify that the number of features in the HTML file corresponds to the number of features and sub-features of the loaded PCM.

* A generic test on all test PCMs. Namely, the number of lines, the correct structuration of the HTML file (head, body, table).


text:
/*Сделайте сценарий, который проверяет, что при клике на товар открывается правильная страница
товара в учебном приложении litecart.
Более точно, нужно открыть главную страницу, выбрать первый товар в категории Campaigns и проверить следующее:
а) на главной странице и на странице товара совпадает текст названия товара
б) на главной странице и на странице товара совпадают цены (обычная и акционная)
в) обычная цена зачёркнутая и серая (можно считать, что "серый" цвет это такой,
у которого в RGBa представлении одинаковые значения для каналов R, G и B)
г) акционная жирная и красная (можно считать, что "красный" цвет это такой,
у которого в RGBa представлении каналы G и B имеют нулевые значения)
(цвета надо проверить на каждой странице независимо, при этом цвета на разных страницах могут не совпадать)
г) акционная цена крупнее, чем обычная (это тоже надо проверить на каждой странице независимо)
Необходимо убедиться, что тесты работают в разных браузерах, желательно проверить во всех трёх ключевых
браузерах (Chrome, Firefox, IE).*/
package ru.stqa.training.selenium;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;

import java.util.concurrent.TimeUnit;

/**
 * Created by Vladimir on 07.03.2017.
 */
public class Less05Task10 {
    private WebDriver driver;

    @Before
    public void start() {
        driver = new ChromeDriver();
        //driver = new FirefoxDriver();
        //driver = new InternetExplorerDriver();
        driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS);
    }

    @Test
    public void mainTest() throws InterruptedException {
        driver.get("http://localhost/litecart/en/");
        String [] listMainPage;
        String [] listItemPage;
        String result;

        WebElement item = driver.findElement(By.xpath(".//div[@id='box-campaigns']//li[1]"));
        listMainPage = fillList(item);
        listMainPage[0] = item.findElement(By.cssSelector("div.name")).getText();
        item.click();

        item = driver.findElement(By.cssSelector("div#box-product div.information"));
        listItemPage = fillList(item);
        listItemPage[0] = driver.findElement(By.cssSelector("div#box-product h1.title")).getText();

        System.out.println("*************** Point A ******************************");
        System.out.println("The item on Main Page: " + listMainPage[0]);
        System.out.println("The item on Item Page: " + listItemPage[0]);
        printResult(listMainPage[0], listItemPage[0], "name");

        System.out.println("*************** Point B ******************************");
        System.out.println("The regular price on Main Page: " + listMainPage[1]);
        System.out.println("The regular price on Item Page: " + listItemPage[1]);
        printResult(listMainPage[1], listItemPage[1], "regular price");

        System.out.println("The campaign price on Main Page: " + listMainPage[5]);
        System.out.println("The campaign price on Item Page: " + listItemPage[5]);
        printResult(listMainPage[5], listItemPage[5], "campaign price");

        System.out.println("*************** Point C ******************************");
        System.out.println("Main Page");
        System.out.println("Regular price (color): " + listMainPage[2]);
        System.out.println("Regular price (text decoration): " + listMainPage[3]);
        System.out.println("Campaign price (color): " + listMainPage[6]);
        System.out.println("Campaign price (weight): " + listMainPage[7]);
        System.out.println("Item Page");
        System.out.println("Regular price (color): " + listItemPage[2]);
        System.out.println("Regular price (text decoration): " + listItemPage[3]);
        System.out.println("Campaign price (color): " + listItemPage[6]);
        System.out.println("Campaign price (weight): " + listItemPage[7] + "\n");

        System.out.println("*************** Point D ******************************");
        System.out.println("Main Page");
        System.out.println("Regular price (font size):" + listMainPage[4]);
        System.out.println("Campaign price (font size): " + listMainPage[8]);
        printComp(listMainPage[8], listMainPage[4]);

        System.out.println("Item Page");
        System.out.println("Regular price (font size): " + listItemPage[4]);
        System.out.println("Campaign price (font size): " + listItemPage[8]);
        printComp(listItemPage[8], listItemPage[4]);
    }

    private String[] fillList (WebElement root) {
        String[] list = new String[9];
        list[1] = root.findElement(By.cssSelector("s.regular-price")).getText();
        list[2] = root.findElement(By.cssSelector("s.regular-price")).getCssValue("color");
        list[3] = root.findElement(By.cssSelector("s.regular-price")).getCssValue("text-decoration");
        list[4] = root.findElement(By.cssSelector("s.regular-price")).getCssValue("font-size");

        list[5] = root.findElement(By.cssSelector("strong.campaign-price")).getText();
        list[6] = root.findElement(By.cssSelector("strong.campaign-price")).getCssValue("color");
        list[7] = root.findElement(By.cssSelector("strong.campaign-price")).getCssValue("font-weight");
        list[8] = root.findElement(By.cssSelector("strong.campaign-price")).getCssValue("font-size");

        return list;
    }

    private void printList(String[] list){
        for (String s:list)
            System.out.println(s);
        System.out.println();
    }

    private void printResult(String s1, String s2, String key) {
        String result = "The " + key + " of the items is ";
        if (s1.equals(s2) )
            result += "the same.";
        else
            result += "diferent.";
        System.out.println(result);
    }

    private void printComp(String s1, String s2) {
        String result;
        if (s1.compareTo(s2) > 0)
            result = "bigger";
        else
            result = "smaller";
        System.out.println("CampaignPrice Font " + result + " then RegularPrice Font.");
    }

    @After
    public void stop() {
        driver.quit();
        driver = null;
    }
}


text:
require "rails_helper"

RSpec.describe GroupTypesController, :type => :routing do
  describe "routing" do

    it "routes to #index" do
      expect(:get => "/group_types").to route_to("group_types#index")
    end

    it "routes to #new" do
      expect(:get => "/group_types/new").to route_to("group_types#new")
    end

    it "routes to #show" do
      expect(:get => "/group_types/1").to route_to("group_types#show", :id => "1")
    end

    it "routes to #edit" do
      expect(:get => "/group_types/1/edit").to route_to("group_types#edit", :id => "1")
    end

    it "routes to #create" do
      expect(:post => "/group_types").to route_to("group_types#create")
    end

    it "routes to #update" do
      expect(:put => "/group_types/1").to route_to("group_types#update", :id => "1")
    end

    it "routes to #destroy" do
      expect(:delete => "/group_types/1").to route_to("group_types#destroy", :id => "1")
    end

  end
end


text:
var path = require('path')
  , _ = require('lodash')
  , Q = require('q')
  , globMerge = require('./globMerge')

exports.tree = require('./depTree')

/**
 * UTILS
 */

/**
 * MISC
 * TODO - clean-up
 */

function getDependencies(root, comps){
  var components = [];
  while(comps.length){
    components = _.union(comps, components);

    var deps = _.pick(root.packages, comps);
    deps = _.pluck(deps, "dependencies");
    //TODO semver
    comps = _.uniq(_.flatten(_.map(deps, _.keys)));
    comps = _.difference(comps, components); //Remove circular references
  }
  return components;
}

//getComponents(['angular-bootstrap'],['ui.router']).then(getComponentFiles).then(console.log);

function getComponentFiles(components){
  components = util.asArray(components)
  return getRepo().then(_.partialRight(componentFiles, components));
}

// TODO ordered dependencies
function componentFiles(root, comps){
  var deps = getDependencies(root, comps);
  deps = _.pick(root.packages, deps);

  var files = {};
  _.each(['scripts', 'styles', 'assets'], function(fileType){
    files[fileType] = _.flatten(_.pluck(deps, fileType));
  });
  return files;
}

/**
 * ITERATING with promise/callbacks
 */

exports.pMap = pMap;
function pMap(col, fn){
  return Q.all(_.map(col, promisify(2, fn)));
}

exports.pMapValues = pMapValues;
function pMapValues(col, fn){
  var toObject = _.partial(_.object, _.keys(col));
  return pMap(col, fn).then(toObject)
}

exports.pEach = pEach;
function pEach(col, fn){
  return pMap(col, fn).thenResolve(col)
}

/**
 * BATCH PROCESSING
 */

/**
 *
 * @param root {obj}
 * @param prop {string} property name
 * @param fnOrObj {Function|object}
 *
 bow.pAssign(root,'isLatest',function(pkg,pkgName){
        return findLatest(pkgName).then(function(ver){
            return ver == pkg.version;
        }
    }); // returns promise(root);

 bow.assign(root,'main',{
        "underscore" : "./underscore.js",
        "q": "q.js",
        "scriptjs": "dist/script.js",
        "socket.io": "lib/socket.io.js"
    }) // returns root;
 *
 */
exports.pAssign = pAssign;
function pAssign(root, prop, pData){
  if(_.isFunction(pData)){
    pData = pMapValues(root.packages, pData)
  }
  return Q.when(pData, _.partial(assign, root, prop));
}

exports.pMerge = pMerge;
function pMerge(root, prop, pData){
  if(_.isFunction(pData)){
    pData = pMapValues(root.packages, pData)
  }
  return Q.when(pData, _.partial(merge, root, prop));
}

/*
    assign(root,'main',{
        "underscore" : "./underscore.js",
        "q": "q.js",
        "scriptjs": "dist/script.js",
        "socket.io": "lib/socket.io.js"
    }) // returns root;
 */
exports.assign = assign;
function assign(root, prop, data){
  var pkgs = root.packages;
  assignTo(pkgs, prop, data);
  return root;
}

exports.merge = merge;
function merge(root, prop, data){
  var pkgs = root.packages;
  applyToProp(pkgs, prop, data, _.merge);
  return root;
}

// like modify but with glob-merge
exports.alter = alter;
function alter(root, prop, data){
  var pkgs = root.packages;
  applyToProp(pkgs, prop, data, globMerge);
  return root;
}

/**
 * PROCESSING HELPERS
 */

function assignTo(obj, prop, src){
  src = fitTo(obj, src);
  _.each(src, function(v, k){
    obj[k][prop] = v;
  })
}

function applyToProp(obj, prop, src, fn){
  src = fitTo(obj, src)
  src = unpluck(src, prop);
  return fn(obj, src);
}

function fitTo(obj, src){
  if(_.isFunction(src)){
    return _.mapValues(obj, src);
  }
  return _.pick(src, _.keys(obj));
}

// unpluck([1, 2],'key') -> [{key: 1},{key: 2}]
// unpluck({a: 1, b: 2},'key') -> {a: {key: 1}, b: {key: 2}}
function unpluck(data, prop){
  var mapFn = _.isArray(data) ? _.map : _.mapValues
  return mapFn(data, function(d){
    var o = {};
    o[prop] = d;
    return o;
  });
}

/**
 * PATHING
 */

  // path to package or packaged file
exports.pathTo = pathTo;
function pathTo(root, pkg, file){

  var base = path.resolve(root.base);

  if(_.isString(pkg))pkg = root.packages[pkg];

  if(pkg && pkg.base){
    base = path.join(base, pkg.base);
    if(file){
      base = path.join(base, file);
    }
  }
  return base;
}

/*
fullPaths(root,'bootstrap') -> ['bootstrap.js','bootstrap.css']
fullPaths(root,'bootstrap','scripts') -> ['bootstrap.js']
fullPaths(root,'bootstrap',['scripts','styles']) -> {'scripts': [..],'styles': [..]}

fullPaths(root) -> {'bootstrap': [..], ...}
fullPaths(root, null, 'scripts') -> same, but for scripts
fullPaths(root, null, ['scripts','styles']) -> ... {'bootstrap': {'scripts': [..],'styles': [..]}, ...}
*/
exports.fullPaths = fullPaths;
function fullPaths(root, pkgs, props){
  var depth = 0;
  if(_.isString(pkgs))depth++;
  if(!_.isArray(props))depth++;

  pkgs = pkgs ? _.pick(root.packages, pkgs) : root.packages;
  props = asArray(props || 'main');

  var res = _.mapValues(pkgs, function(pkg){
    var values = packagePaths(root, pkg, props);
    return (values.length == 1) ? values[0] : _.object(props, values);
  });

  return unnest(res, depth);
}

/**
 *
 * @param root object
 * @param {pkgs=all} string|string[]
 * @param {props='main'} string|string[]
 * @returns collection of paths
 */
exports.flatPaths = flatPaths;
function flatPaths(root, pkgs, props){
  pkgs = pkgs ? _.pick(root.packages, pkgs) : root.packages;
  props = asArray(props || 'main');

  // [pkgs[props[paths]]]
  var res = _.map(pkgs, function(pkg){
    return packagePaths(root, pkg, props);
  });

  // [props[paths]] Note: Zip should do nothing if length is 1 but instead zips the first element
  res = _.size(res) <= 1 ? (res[0] || [
    []
  ])
    : _.zip.apply(_, res);

  res = _.map(res, _.flatten);

  res = _.object(props, res);

  return unnest(res);
}

function packagePaths(root, pkg, props){
  var base = pathTo(root, pkg);
  return _.map(props, function(prop){
    var files = asArray(pkg[prop])
    return _.map(files, function(file){
      return normalizePath(path.join(base, file));
    });
  });
}

/**
 * PROMISES
 */

  // NOTE: must include exact number of arguments
exports.pcall = pcall;
function pcall(fn /*,...args*/){
  var args = _.rest(arguments);
  return papply(fn, args);
}

exports.papply = papply;
function papply(fn, args){
  if(fn.length > args.length){
    return Q.nfapply(fn, args);
  } else {
    return Q.fapply(fn, args);
  }
}

/*
- binds a function always return a promise
f1 = function(a,b,callback){...};
f2 = function(a,b){...}; // returns promise or val
fn = Math.random() > 0.5 ? f1 : f2;
f = promisify(2,fn); // f always returns promise
IMPORTANT: fn must not be bound or wrapped
 */
exports.promisify = promisify; // use pcall, papply instead
function promisify(nParams, fn){
  if(fn.length > nParams){
    return Q.denodeify(fn);
  } else {
    return Q.promised(fn);
  }
}

/**
 * HELPERS
 */

exports.asArray = asArray;
function asArray(x){
  return _.isString(x) ? [x] : _.toArray(x);
}

// returns unix-style path
exports.normalizePath = normalizePath;
function normalizePath(src, relTo){
  if(relTo)src = path.relative(relTo, src);
  return src.replace(/\\/g, '/');
}

// returns the path of a file relative to the first
exports.pathFrom = pathFrom;
function pathFrom(srcFile, relFile){
  return path.join(path.dirname(srcFile), relFile);
}

// {a:{b:{c:[1,2]}}} -> [1,2];
function unnest(obj, maxDepth){
  maxDepth = maxDepth || -1;
  while(maxDepth-- && _.isPlainObject(obj) && _.size(obj) == 1)obj = _.values(obj)[0];
  return obj;
}

exports.quote = quote;
function quote(s){
  return '"' + s + '"';
}


text:
<!--
  ~ MIT License
  ~
  ~ Copyright (c) 2016 Kartik Sharma
  ~
  ~ Permission is hereby granted, free of charge, to any person obtaining a copy
  ~ of this software and associated documentation files (the "Software"), to deal
  ~ in the Software without restriction, including without limitation the rights
  ~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  ~ copies of the Software, and to permit persons to whom the Software is
  ~ furnished to do so, subject to the following conditions:
  ~
  ~ The above copyright notice and this permission notice shall be included in all
  ~ copies or substantial portions of the Software.
  ~
  ~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  ~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  ~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  ~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  ~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  ~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  ~ SOFTWARE.
  -->

<resources xmlns:tools="http://schemas.android.com/tools">

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light">
        <item name="colorPrimary">@color/color_primary</item>
        <item name="colorPrimaryDark">@color/color_primary_dark</item>
        <item name="colorAccent">@color/color_accent</item>
        <item name="colorControlHighlight">@color/color_accent</item>
        <item name="android:colorEdgeEffect" tools:targetApi="lollipop">@color/color_accent</item>
        <item name="android:textColorPrimary">@color/text_color_primary</item>
        <item name="android:textColorSecondary">@color/text_color_secondary</item>
        <item name="android:textColorTertiary">@color/text_color_tertiary</item>
        <item name="android:textColorPrimaryInverse">@color/text_color_primary_inverse</item>
        <item name="android:textColorSecondaryInverse">@color/text_color_secondary_inverse</item>
        <item name="android:textColorTertiaryInverse">@color/text_color_tertiary_inverse</item>
        <item name="android:textAppearanceLarge">@style/TextAppearanceLarge</item>
        <item name="android:textAppearanceMedium">@style/TextAppearanceMedium</item>
        <item name="android:textAppearanceSmall">@style/TextAppearanceSmall</item>
        <item name="backgroundColor">@color/background_color</item>
        <item name="android:windowBackground">?attr/backgroundColor</item>
        <item name="navItemColor">@color/nav_item_color</item>
        <item name="appBarOverlay">@style/AppTheme.AppBarOverlay</item>
        <item name="popupOverlay">@style/AppTheme.PopupOverlay</item>
        <item name="colorDark">@color/color_dark</item>
        <item name="predatorButtonTextColor">@color/predator_button_text_color</item>
        <item name="postExtraDetailsColor">@color/post_extra_details_color</item>
        <item name="commentColor">@color/comment_color</item>
        <item name="commentExtraDetailsColor">@color/comment_extra_details_color</item>
        <item name="aboutVersionColor">@color/about_version_color</item>
        <item name="libraryLicenseColor">@color/library_license_color</item>
        <item name="userNameAlternativeColor">@color/username_alternative_color</item>
        <item name="defaultPlaceholderColor">@color/default_placeholder_color</item>
        <item name="defaultPlaceholderAlternativeColor">@color/default_placeholder_alternative_color</item>
        <item name="titlePlaceholderColor">@color/title_placeholder_color</item>
        <item name="drawableDone">@drawable/ic_done</item>
        <item name="drawableErrorAlternative">@drawable/ic_error_alternative</item>
        <item name="drawableImageBrokenError">@drawable/ic_image_broken_error</item>
        <item name="imageUserBorderColor">@color/image_user_border_color</item>
        <item name="dialogHeaderColor">@color/dialog_header_color</item>
    </style>

    <style name="AppThemeDark" parent="Theme.AppCompat">
        <item name="colorPrimary">@color/color_primary_inverse</item>
        <item name="colorPrimaryDark">@color/color_primary_dark_inverse</item>
        <item name="colorAccent">@color/color_accent_inverse</item>
        <item name="colorControlHighlight">@color/color_accent_inverse</item>
        <item name="android:colorEdgeEffect" tools:targetApi="lollipop">
            @color/color_accent_inverse
        </item>
        <item name="android:textColorPrimary">@color/text_color_primary_inverse</item>
        <item name="android:textColorSecondary">@color/text_color_secondary_inverse</item>
        <item name="android:textColorTertiary">@color/text_color_tertiary_inverse</item>
        <item name="android:textColorPrimaryInverse">@color/text_color_primary</item>
        <item name="android:textColorSecondaryInverse">@color/text_color_secondary</item>
        <item name="android:textColorTertiaryInverse">@color/text_color_tertiary</item>
        <item name="android:textAppearanceLarge">@style/TextAppearanceLarge</item>
        <item name="android:textAppearanceMedium">@style/TextAppearanceMedium</item>
        <item name="android:textAppearanceSmall">@style/TextAppearanceSmall</item>
        <item name="backgroundColor">@color/background_color_inverse</item>
        <item name="android:windowBackground">?attr/backgroundColor</item>
        <item name="navItemColor">@color/nav_item_color_inverse</item>
        <item name="appBarOverlay">@style/AppTheme.AppBarOverlayDark</item>
        <item name="popupOverlay">@style/AppTheme.PopupOverlayDark</item>
        <item name="colorDark">@color/color_dark_inverse</item>
        <item name="predatorButtonTextColor">@color/predator_button_text_color_inverse</item>
        <item name="postExtraDetailsColor">@color/post_extra_details_color_inverse</item>
        <item name="commentColor">@color/comment_color_inverse</item>
        <item name="commentExtraDetailsColor">@color/comment_extra_details_color_inverse</item>
        <item name="aboutVersionColor">@color/about_version_color_inverse</item>
        <item name="libraryLicenseColor">@color/library_license_color_inverse</item>
        <item name="userNameAlternativeColor">@color/username_alternative_color_inverse</item>
        <item name="defaultPlaceholderColor">@color/default_placeholder_color_inverse</item>
        <item name="defaultPlaceholderAlternativeColor">@color/default_placeholder_alternative_color_inverse</item>
        <item name="titlePlaceholderColor">@color/title_placeholder_color_inverse</item>
        <item name="drawableDone">@drawable/ic_done_inverse</item>
        <item name="drawableErrorAlternative">@drawable/ic_error_alternative_inverse</item>
        <item name="drawableImageBrokenError">@drawable/ic_image_broken_error_inverse</item>
        <item name="imageUserBorderColor">@color/image_user_border_color_inverse</item>
        <item name="dialogHeaderColor">@color/dialog_header_color_inverse</item>
    </style>

    <style name="AppThemeAmoled" parent="Theme.AppCompat">
        <item name="colorPrimary">@color/color_primary_inverse</item>
        <item name="colorPrimaryDark">@color/color_primary_dark_inverse</item>
        <item name="colorAccent">@color/color_accent_inverse</item>
        <item name="colorControlHighlight">@color/color_accent_inverse</item>
        <item name="android:colorEdgeEffect" tools:targetApi="lollipop">
            @color/color_accent_inverse
        </item>
        <item name="android:textColorPrimary">@color/text_color_primary_inverse</item>
        <item name="android:textColorSecondary">@color/text_color_secondary_inverse</item>
        <item name="android:textColorTertiary">@color/text_color_tertiary_inverse</item>
        <item name="android:textColorPrimaryInverse">@color/text_color_primary</item>
        <item name="android:textColorSecondaryInverse">@color/text_color_secondary</item>
        <item name="android:textColorTertiaryInverse">@color/text_color_tertiary</item>
        <item name="android:textAppearanceLarge">@style/TextAppearanceLarge</item>
        <item name="android:textAppearanceMedium">@style/TextAppearanceMedium</item>
        <item name="android:textAppearanceSmall">@style/TextAppearanceSmall</item>
        <item name="backgroundColor">@color/background_color_amoled</item>
        <item name="android:windowBackground">?attr/backgroundColor</item>
        <item name="navItemColor">@color/nav_item_color_inverse</item>
        <item name="appBarOverlay">@style/AppTheme.AppBarOverlayDark</item>
        <item name="popupOverlay">@style/AppTheme.PopupOverlayDark</item>
        <item name="colorDark">@color/color_dark_inverse</item>
        <item name="predatorButtonTextColor">@color/predator_button_text_color_inverse</item>
        <item name="postExtraDetailsColor">@color/post_extra_details_color_inverse</item>
        <item name="commentColor">@color/comment_color_inverse</item>
        <item name="commentExtraDetailsColor">@color/comment_extra_details_color_inverse</item>
        <item name="aboutVersionColor">@color/about_version_color_inverse</item>
        <item name="libraryLicenseColor">@color/library_license_color_inverse</item>
        <item name="userNameAlternativeColor">@color/username_alternative_color_inverse</item>
        <item name="defaultPlaceholderColor">@color/default_placeholder_color_inverse</item>
        <item name="defaultPlaceholderAlternativeColor">@color/default_placeholder_alternative_color_inverse</item>
        <item name="titlePlaceholderColor">@color/title_placeholder_color_inverse</item>
        <item name="drawableDone">@drawable/ic_done_inverse</item>
        <item name="drawableErrorAlternative">@drawable/ic_error_alternative_inverse</item>
        <item name="drawableImageBrokenError">@drawable/ic_image_broken_error_inverse</item>
        <item name="imageUserBorderColor">@color/image_user_border_color_amoled</item>
        <item name="dialogHeaderColor">@color/dialog_header_color_amoled</item>
    </style>

    <style name="AppTheme.NoActionBar">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    </style>

    <style name="AppThemeDark.NoActionBar">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    </style>

    <style name="AppThemeAmoled.NoActionBar">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    </style>

    <style name="AppTheme.Splash">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
        <item name="android:windowBackground">@drawable/ll_app_logo</item>
        <item name="android:windowAnimationStyle">@null</item>
    </style>

    <style name="DialogActivity" parent="Theme.AppCompat.Light.Dialog"></style>

    <style name="DialogActivity.NoTitle" parent="Theme.AppCompat.Light.Dialog">
        <item name="windowNoTitle">true</item>
    </style>

    <style name="DialogActivity.NoTitle.Light" parent="DialogActivity.NoTitle">
        <item name="colorPrimary">@color/color_primary</item>
        <item name="colorPrimaryDark">@color/color_primary_dark</item>
        <item name="colorAccent">@color/color_accent</item>
        <item name="colorControlHighlight">@color/color_accent</item>
        <item name="android:colorEdgeEffect" tools:targetApi="lollipop">@color/color_accent</item>
        <item name="android:textColorPrimary">@color/text_color_primary</item>
        <item name="android:textColorSecondary">@color/text_color_secondary</item>
        <item name="android:textColorTertiary">@color/text_color_tertiary</item>
        <item name="android:textColorPrimaryInverse">@color/text_color_primary_inverse</item>
        <item name="android:textColorSecondaryInverse">@color/text_color_secondary_inverse</item>
        <item name="android:textColorTertiaryInverse">@color/text_color_tertiary_inverse</item>
        <item name="android:textAppearanceLarge">@style/TextAppearanceLarge</item>
        <item name="android:textAppearanceMedium">@style/TextAppearanceMedium</item>
        <item name="android:textAppearanceSmall">@style/TextAppearanceSmall</item>
        <item name="backgroundColor">@color/background_color</item>
        <item name="drawableDone">@drawable/ic_done</item>
        <item name="drawableErrorAlternative">@drawable/ic_error_alternative</item>
        <item name="appLinkingHeaderColor">@color/app_linking_header_color</item>
        <item name="appLinkingSuccessColor">@color/app_linking_success_color</item>
        <item name="appLinkingFailureColor">@color/app_linking_failure_color</item>
        <item name="loadingDialogHeaderColor">@color/loading_dialog_header_color</item>
        <item name="loadingDialogSuccessColor">@color/loading_dialog_success_color</item>
        <item name="loadingDialogFailureColor">@color/loading_dialog_failure_color</item>
    </style>

    <style name="DialogActivity.NoTitle.Dark" parent="DialogActivity.NoTitle">
        <item name="colorPrimary">@color/color_primary_inverse</item>
        <item name="colorPrimaryDark">@color/color_primary_dark_inverse</item>
        <item name="colorAccent">@color/color_accent_inverse</item>
        <item name="colorControlHighlight">@color/color_accent_inverse</item>
        <item name="android:colorEdgeEffect" tools:targetApi="lollipop">
            @color/color_accent_inverse
        </item>
        <item name="android:textColorPrimary">@color/text_color_primary_inverse</item>
        <item name="android:textColorSecondary">@color/text_color_secondary_inverse</item>
        <item name="android:textColorTertiary">@color/text_color_tertiary_inverse</item>
        <item name="android:textColorPrimaryInverse">@color/text_color_primary</item>
        <item name="android:textColorSecondaryInverse">@color/text_color_secondary</item>
        <item name="android:textColorTertiaryInverse">@color/text_color_tertiary</item>
        <item name="android:textAppearanceLarge">@style/TextAppearanceLarge</item>
        <item name="android:textAppearanceMedium">@style/TextAppearanceMedium</item>
        <item name="android:textAppearanceSmall">@style/TextAppearanceSmall</item>
        <item name="backgroundColor">@color/background_color_inverse</item>
        <item name="drawableDone">@drawable/ic_done_inverse</item>
        <item name="drawableErrorAlternative">@drawable/ic_error_alternative_inverse</item>
        <item name="appLinkingHeaderColor">@color/app_linking_header_color_inverse</item>
        <item name="appLinkingSuccessColor">@color/app_linking_success_color_inverse</item>
        <item name="appLinkingFailureColor">@color/app_linking_failure_color_inverse</item>
        <item name="loadingDialogHeaderColor">@color/loading_dialog_header_color_inverse</item>
        <item name="loadingDialogSuccessColor">@color/loading_dialog_success_color_inverse</item>
        <item name="loadingDialogFailureColor">@color/loading_dialog_failure_color_inverse</item>
    </style>

    <style name="DialogActivity.NoTitle.Amoled" parent="DialogActivity.NoTitle">
        <item name="colorPrimary">@color/color_primary_inverse</item>
        <item name="colorPrimaryDark">@color/color_primary_dark_inverse</item>
        <item name="colorAccent">@color/color_accent_inverse</item>
        <item name="colorControlHighlight">@color/color_accent_inverse</item>
        <item name="android:colorEdgeEffect" tools:targetApi="lollipop">
            @color/color_accent_inverse
        </item>
        <item name="android:textColorPrimary">@color/text_color_primary_inverse</item>
        <item name="android:textColorSecondary">@color/text_color_secondary_inverse</item>
        <item name="android:textColorTertiary">@color/text_color_tertiary_inverse</item>
        <item name="android:textColorPrimaryInverse">@color/text_color_primary</item>
        <item name="android:textColorSecondaryInverse">@color/text_color_secondary</item>
        <item name="android:textColorTertiaryInverse">@color/text_color_tertiary</item>
        <item name="android:textAppearanceLarge">@style/TextAppearanceLarge</item>
        <item name="android:textAppearanceMedium">@style/TextAppearanceMedium</item>
        <item name="android:textAppearanceSmall">@style/TextAppearanceSmall</item>
        <item name="backgroundColor">@color/background_color_amoled</item>
        <item name="drawableDone">@drawable/ic_done_inverse</item>
        <item name="drawableErrorAlternative">@drawable/ic_error_alternative_inverse</item>
        <item name="appLinkingHeaderColor">@color/app_linking_header_color_amoled</item>
        <item name="appLinkingSuccessColor">@color/app_linking_success_color_amoled</item>
        <item name="appLinkingFailureColor">@color/app_linking_failure_color_amoled</item>
        <item name="loadingDialogHeaderColor">@color/loading_dialog_header_color_amoled</item>
        <item name="loadingDialogSuccessColor">@color/loading_dialog_success_color_amoled</item>
        <item name="loadingDialogFailureColor">@color/loading_dialog_failure_color_amoled</item>
    </style>

    <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Light">
        <item name="colorControlHighlight">?attr/colorAccent</item>
        <item name="android:textColorSecondary">?android:attr/textColorPrimary</item>
    </style>

    <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

    <style name="AppTheme.AppBarOverlayDark" parent="ThemeOverlay.AppCompat">
        <item name="colorControlHighlight">?attr/colorAccent</item>
        <item name="android:textColorSecondary">?android:attr/textColorPrimary</item>
    </style>

    <style name="AppTheme.PopupOverlayDark" parent="ThemeOverlay.AppCompat" />

    <style name="PredatorButton" parent="Theme.AppCompat.Light">
        <item name="colorControlHighlight">?attr/colorPrimaryDark</item>
        <item name="colorButtonNormal">?attr/colorDark</item>
        <item name="android:textColorPrimary">?attr/predatorButtonTextColor</item>
    </style>

    <style name="TextAppearanceLarge" parent="TextAppearance.AppCompat.Large">
        <item name="android:textSize">@dimen/text_size_large</item>
        <item name="android:textColor">?android:attr/textColorPrimary</item>
    </style>

    <style name="TextAppearanceMedium" parent="TextAppearance.AppCompat.Medium">
        <item name="android:textSize">@dimen/text_size_medium</item>
        <item name="android:textColor">?android:attr/textColorPrimary</item>
    </style>

    <style name="TextAppearanceSmall" parent="TextAppearance.AppCompat.Small">
        <item name="android:textSize">@dimen/text_size_small</item>
        <item name="android:textColor">?android:attr/textColorPrimary</item>
    </style>

    <style name="TextAppearanceDate" parent="@style/TextAppearance.AppCompat.Display1">
        <item name="android:textColor">?attr/colorAccent</item>
        <item name="android:textStyle">bold</item>
    </style>

    <style name="TextAppearancePostTitle" parent="TextAppearanceLarge">
        <item name="android:textColor">?attr/colorDark</item>
        <item name="android:textStyle">bold</item>
    </style>

    <style name="TextAppearancePostDesc" parent="TextAppearanceMedium">
        <item name="android:textColor">?android:attr/textColorSecondary</item>
    </style>

    <style name="TextAppearancePostExtraDetails" parent="TextAppearanceSmall">
        <item name="android:textColor">?attr/postExtraDetailsColor</item>
    </style>

    <style name="Divider">
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">1dp</item>
        <item name="android:background">?android:attr/listDivider</item>
    </style>

    <style name="TextAppearanceComment" parent="@style/TextAppearance.AppCompat.Small">
        <item name="android:textColor">?attr/commentColor</item>
    </style>

    <style name="TextAppearanceCommentExtraDetails" parent="TextAppearanceSmall">
        <item name="android:textColor">?attr/commentExtraDetailsColor</item>
    </style>

    <style name="TextAppearanceCollectionTitle" parent="@style/TextAppearance.AppCompat.Medium">
        <item name="android:textColor">?android:attr/textColorPrimary</item>
        <item name="android:textStyle">bold</item>
    </style>

    <style name="TextAppearanceCollectionDesc" parent="@style/TextAppearance.AppCompat.Small">
        <item name="android:textColor">?android:attr/textColorSecondary</item>
    </style>

    <style name="TextAppearanceCollectionDetailTitle" parent="TextAppearanceLarge">
        <item name="android:textColor">?android:attr/textColorPrimary</item>
        <item name="android:textStyle">bold</item>
    </style>

    <style name="TextAppearanceCollectionDetailDesc" parent="TextAppearanceMedium">
        <item name="android:textColor">?android:attr/textColorSecondary</item>
    </style>

    <style name="TextAppearanceAboutTitle" parent="TextAppearanceLarge">
        <item name="android:textColor">?android:attr/textColorPrimary</item>
        <item name="android:textStyle">bold</item>
    </style>

    <style name="TextAppearanceAboutDesc" parent="TextAppearanceMedium">
        <item name="android:textColor">?android:attr/textColorSecondary</item>
    </style>

    <style name="TextAppearanceAboutVersion" parent="TextAppearanceSmall">
        <item name="android:textColor">?attr/aboutVersionColor</item>
    </style>

    <style name="TextAppearanceMediaImageNumber" parent="TextAppearanceMedium">
        <item name="android:textColor">@color/material_grey_100</item>
        <item name="android:textStyle">bold</item>
    </style>

    <style name="MediaTypeTextViewStyle" parent="android:Widget.TextView">
        <item name="android:textColor">@color/material_grey_200</item>
        <item name="android:textStyle">bold</item>
        <item name="android:textAppearance">@style/TextAppearance.AppCompat.Caption</item>
        <item name="android:background">@drawable/bg_rect_dark_black_rounded</item>
    </style>

    <style name="TextAppearanceLibraryName" parent="TextAppearanceMedium">
        <item name="android:textColor">?attr/colorAccent</item>
    </style>

    <style name="TextAppearanceLibraryCreator" parent="TextAppearance.AppCompat.Small">
        <item name="android:textColor">?android:attr/textColorPrimary</item>
    </style>

    <style name="TextAppearanceLibraryLicense" parent="TextAppearanceSmall">
        <item name="android:textColor">?attr/libraryLicenseColor</item>
    </style>

    <style name="TextAppearanceUserName" parent="TextAppearanceMedium">
        <item name="android:textColor">?attr/colorAccent</item>
    </style>

    <style name="TextAppearanceUserType" parent="TextAppearance.AppCompat.Small">
        <item name="android:textColor">?android:attr/textColorPrimary</item>
    </style>

    <style name="TextAppearanceUserNameAlternate" parent="TextAppearanceSmall">
        <item name="android:textColor">?attr/userNameAlternativeColor</item>
    </style>

    <style name="TextAppearanceWidgetPostTitle" parent="TextAppearanceMedium">
        <item name="android:textColor">@color/material_grey_300</item>
    </style>

    <style name="TextAppearanceWidgetPostDesc" parent="TextAppearance.AppCompat.Small">
        <item name="android:textColor">@color/material_grey_500</item>
    </style>

    <style name="TextAppearanceUserProfile.Name" parent="TextAppearanceLarge">
        <item name="android:textColor">?attr/colorDark</item>
        <item name="android:textStyle">bold</item>
    </style>

    <style name="TextAppearanceUserProfile.Tagline" parent="TextAppearanceMedium">
        <item name="android:textColor">?android:attr/textColorSecondary</item>
    </style>

    <style name="TextAppearanceUserProfile.ExtraDetails" parent="TextAppearanceSmall">
        <item name="android:textColor">?attr/postExtraDetailsColor</item>
    </style>

</resources>


text:
# rAsync - async rethinked

This module is a wrapper to the popular async module, providing an easy way to combine serial/waterfall and parallel task execution. With this you can define a workflow of function calls using nested arrays. It helps to your code keep simple and readable.

## Usage

```
var rAsync = require('r-async');
rAsync(initialData /* object (optional) */, tasks /* array */, finally /* function */);
```

The `r-async` module gives you a single function, which requires three parameters:

- **initialData** : *object* (optional) - you can pass initial data to your tasks, this will be passed to the first codes to be executed as parameter (see below)
- **tasks** : *array* - pass the functions, that you would like to execute. The given funcions will execute in series, while nesting further arrays of function calls will alternate between parallel and series execution, as you go more deep in nesting (see the example)
- **finally** : *function* - pass a function here, which gets executed after the tasks, whether there was any errors or everything run fine

## The tasks

Each task must be defined in the following form, recieving two parameters

```
function(params /* object */, callback /* function */){ ... }
```

- **params** : *object* - parameters recieved from previously executed tasks or initialData
- **callback** : *function* - you must execute this, to mark, that the task is finished. If you don't call the callback the process is breaked and the other tasks doesn't calls.

The callback must be called with two parameters:

```
callback(error /* null or any */, params /* object */)
```

- **error** : *Any (for example Error object) or null* - if there was any errors during the execution of the task, then this should recieve the Error object, or any truthy value which describing the error, else it should be null
- **params** : *object* - the recieved, and optionally altered params object should be sent back to rAsync through this

### Defining serial and parallel execution

Let's look at the task definitions through an example. Supposingly we have five functions, as seen below:

```
function A(params, callback){
	console.log('A');
	callback(null, params);
}
function B(params, callback){
	console.log('B');
	callback(null, params);
}
function C(params, callback){
	console.log('C');
	callback(null, params);
}
function D(params, callback){
	console.log('D');
	callback(null, params);
}
function E(params, callback){
	console.log('E');
	callback(null, params);
}
```

By default, if we just dump these into an array, then rAsync will execute these in series:

```
var tasks = [A, B, C, D, E]; // A -> B -> C -> D -> E
rAsync({}, tasks, function(){});
```

If we introduce an array in the array of tasks, then it's contents will execute in parallel:

```
var tasks = [A, [B, C], D, E]; // A --> B ---> D -> E
                                    \-> C -/
```

Another level of nesting will provide us with changing back to serial execution and further nesting will keep shifting from the two modes.
```
var tasks = [A, [B, [C, D], E]; // A ---> B ----> E
                                    \-> C -> D -/
```
It is not possible to change the initial mode of execution, but we can always wrap the tasks in multiple arrays and there is no limit for how deep the nesting can go.

```
var tasks = [[A, B, C, D, E]]; // all executed in parallel
```
## Conditional execution
```
//...require your modules
var rAsync = require('r-async');
rAsync({}, [
    yourFirstTask,
    rAsync.ifTask(yourConditionTask, yourTrueBranchTask, yourElseBranchTask)
    ],function(err,params){
        console.log(err,params)
    });

```
Where `yourConditionTask` must fill the `ifresult` property in the params. For example:

```
function yourConditionTask(params, callback){
    params.ifresult = params.xy==42; //calculate your result of condition
    callback(null, params);
}
```


text:
module XMonad.Util.Run (
                          -- * Usage
                          -- $usage
                          runProcessWithInput,
                          runProcessWithInputAndWait,
                          safeSpawn,
                          safeSpawnProg,
                          unsafeSpawn,
                          runInTerm,
                          safeRunInTerm,
                          seconds,
                          spawnPipe,

                          hPutStr, hPutStrLn  -- re-export for convenience
                         ) where

import Codec.Binary.UTF8.String
import System.Posix.IO
import System.Posix.Process (createSession, executeFile, forkProcess)
import Control.Concurrent (threadDelay)
import System.IO
import System.Process (runInteractiveProcess)
import XMonad
import Control.Monad

-- $usage
-- For an example usage of 'runInTerm' see "XMonad.Prompt.Ssh"
--
-- For an example usage of 'runProcessWithInput' see
-- "XMonad.Prompt.DirectoryPrompt", "XMonad.Util.Dmenu",
-- "XMonad.Prompt.ShellPrompt", "XMonad.Actions.WmiiActions",
-- "XMonad.Prompt.WorkspaceDir"
--
-- For an example usage of 'runProcessWithInputAndWait' see
-- "XMonad.Util.Dzen"

-- | Returns the output.
runProcessWithInput :: MonadIO m => FilePath -> [String] -> String -> m String
runProcessWithInput cmd args input = io $ do
    (pin, pout, perr, _) <- runInteractiveProcess (encodeString cmd)
                                            (map encodeString args) Nothing Nothing
    hPutStr pin input
    hClose pin
    output <- hGetContents pout
    when (output == output) $ return ()
    hClose pout
    hClose perr
    -- no need to waitForProcess, we ignore SIGCHLD
    return output

-- | Wait is in μ (microseconds)
runProcessWithInputAndWait :: MonadIO m => FilePath -> [String] -> String -> Int -> m ()
runProcessWithInputAndWait cmd args input timeout = io $ do
    _ <- xfork $ do
        (pin, pout, perr, _) <- runInteractiveProcess (encodeString cmd)
                                            (map encodeString args) Nothing Nothing
        hPutStr pin input
        hFlush pin
        threadDelay timeout
        hClose pin
        hClose pout
        hClose perr
        -- no need to waitForProcess, we ignore SIGCHLD
        return ()
    return ()

-- | Multiplies by ONE MILLION, for functions that take microseconds.
--
-- Use like:
--
-- > (5.5 `seconds`)
--
-- In GHC 7 and later, you must either enable the PostfixOperators extension
-- (by adding
--
-- > {-# LANGUAGE PostfixOperators #-}
--
-- to the top of your file) or use seconds in prefix form:
--
-- > 5.5 seconds
seconds :: Rational -> Int
seconds = fromEnum . (* 1000000)

{- | 'safeSpawn' bypasses 'spawn', because spawn passes
strings to \/bin\/sh to be interpreted as shell commands. This is
often what one wants, but in many cases the passed string will contain
shell metacharacters which one does not want interpreted as such (URLs
particularly often have shell metacharacters like \'&\' in them). In
this case, it is more useful to specify a file or program to be run
and a string to give it as an argument so as to bypass the shell and
be certain the program will receive the string as you typed it.

Examples:

> , ((modm, xK_Print), unsafeSpawn "import -window root $HOME/xwd-$(date +%s)$$.png")
> , ((modm, xK_d    ), safeSpawn "firefox" [])

Note that the unsafeSpawn example must be unsafe and not safe because
it makes use of shell interpretation by relying on @$HOME@ and
interpolation, whereas the safeSpawn example can be safe because
Firefox doesn't need any arguments if it is just being started. -}
safeSpawn :: MonadIO m => FilePath -> [String] -> m ()
safeSpawn prog args = io $ void_ $ forkProcess $ do
  uninstallSignalHandlers
  _ <- createSession
  executeFile (encodeString prog) True (map encodeString args) Nothing
    where void_ = (>> return ()) -- TODO: replace with Control.Monad.void / void not in ghc6 apparently

-- | Simplified 'safeSpawn'; only takes a program (and no arguments):
--
-- > , ((modm, xK_d    ), safeSpawnProg "firefox")
safeSpawnProg :: MonadIO m => FilePath -> m ()
safeSpawnProg = flip safeSpawn []

-- | An alias for 'spawn'; the name emphasizes that one is calling out to a
--   Turing-complete interpreter which may do things one dislikes; for details, see 'safeSpawn'.
unsafeSpawn :: MonadIO m => String -> m ()
unsafeSpawn = spawn

-- | Open a terminal emulator. The terminal emulator is specified in the default configuration as xterm by default. It is then
-- asked to pass the shell a command with certain options. This is unsafe in the sense of 'unsafeSpawn'
unsafeRunInTerm, runInTerm :: String -> String -> X ()
unsafeRunInTerm options command = asks (terminal . config) >>= \t -> unsafeSpawn $ t ++ " " ++ options ++ " -e " ++ command
runInTerm = unsafeRunInTerm

-- | Run a given program in the preferred terminal emulator; see 'runInTerm'. This makes use of 'safeSpawn'.
safeRunInTerm :: String -> String -> X ()
safeRunInTerm options command = asks (terminal . config) >>= \t -> safeSpawn t [options, " -e " ++ command]

-- | Launch an external application through the system shell and return a @Handle@ to its standard input.
spawnPipe :: MonadIO m => String -> m Handle
spawnPipe x = io $ do
    (rd, wr) <- createPipe
    setFdOption wr CloseOnExec True
    h <- fdToHandle wr
    hSetBuffering h LineBuffering
    _ <- xfork $ do
          _ <- dupTo rd stdInput
          executeFile "/bin/sh" False ["-c", encodeString x] Nothing
    closeFd rd
    return h


text:
namespace Loon.Action {

	public class RotateTo : ActionEvent {

		private float dstAngle;

		private float diffAngle;

		private float startAngle;

		private float speed;

		public RotateTo(float dstAngle_0, float speed_1) {
			this.dstAngle = dstAngle_0;
			if (this.dstAngle > 360) {
				this.dstAngle = 360;
			} else if (this.dstAngle < 0) {
				this.dstAngle = 0;
			}
			this.speed = speed_1;
		}

		public override bool IsComplete() {
			return isComplete;
		}

		public override void OnLoad() {
			startAngle = original.GetRotation();
			diffAngle = 1;
		}

		public override void Update(long elapsedTime) {
			startAngle += diffAngle * speed;
			original.SetRotation(startAngle);
			if (startAngle >= dstAngle) {
				isComplete = true;
			}
		}

	}
}