text:
<?php

/**
 * @see Zend_Loader_PluginLoader
 */
require_once 'Zend/Loader/PluginLoader.php';

/**
 * @category   Zend
 * @package    Zend_Paginator
 * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */
class Zend_Paginator implements Countable, IteratorAggregate
{
	/**
     * Specifies that the factory should try to detect the proper adapter type first
     *
     * @var string
     */
    const INTERNAL_ADAPTER = 'Zend_Paginator_Adapter_Internal';

    /**
     * Adapter plugin loader
     *
     * @var Zend_Loader_PluginLoader
     */
    protected static $_adapterLoader = null;

    /**
     * Config file
     *
     * @var Zend_Config
     */
    protected static $_config = null;

    /**
     * Default scrolling style
     *
     * @var string
     */
    protected static $_defaultScrollingStyle = 'Sliding';

    /**
     * Scrolling style plugin loader
     *
     * @var Zend_Loader_PluginLoader
     */
    protected static $_scrollingStyleLoader = null;

    /**
     * Adapter
     *
     * @var Zend_Paginator_Adapter_Interface
     */
    protected $_adapter = null;

    /**
     * Number of items in the current page
     *
     * @var integer
     */
    protected $_currentItemCount = null;

    /**
     * Current page items
     *
     * @var Traversable
     */
    protected $_currentItems = null;

    /**
     * Current page number (starting from 1)
     *
     * @var integer
     */
    protected $_currentPageNumber = 1;

    /**
     * Number of items per page
     *
     * @var integer
     */
    protected $_itemCountPerPage = 10;

    /**
     * Number of pages
     *
     * @var integer
     */
    protected $_pageCount = null;

    /**
     * A collection of page items used as temporary page cache
     *
     * @var array
     */
    protected $_pageItems = array();

    /**
     * Number of local pages (i.e., the number of discrete page numbers
     * that will be displayed, including the current page number)
     *
     * @var integer
     */
    protected $_pageRange = 10;

    /**
     * Pages
     *
     * @var array
     */
    protected $_pages = null;

    /**
     * View instance used for self rendering
     *
     * @var Zend_View_Interface
     */
    protected $_view = null;

	/**
     * Adds an adapter prefix path to the plugin loader.
     *
     * @param string $prefix
     * @param string $path
     */
    public static function addAdapterPrefixPath($prefix, $path)
    {
        self::getAdapterLoader()->addPrefixPath($prefix, $path);
    }

	/**
     * Adds an array of adapter prefix paths to the plugin
     * loader.
     *
     *
     * $prefixPaths = array(
     *     'My_Paginator_Adapter'   => 'My/Paginator/Adapter/',
     *     'Your_Paginator_Adapter' => 'Your/Paginator/Adapter/'
     * );
     *
     *
     * @param array $prefixPaths
     */
    public static function addAdapterPrefixPaths(array $prefixPaths)
    {
        if (isset($prefixPaths['prefix']) and isset($prefixPaths['path'])) {
            self::addAdapterPrefixPath($prefixPaths['prefix'], $prefixPaths['path']);
        } else {
            foreach ($prefixPaths as $prefix => $path) {
                if (is_array($path) and isset($path['prefix']) and isset($path['path'])) {
                    $prefix = $path['prefix'];
                    $path   = $path['path'];
                }

                self::addAdapterPrefixPath($prefix, $path);
            }
        }
    }

	/**
     * Adds a scrolling style prefix path to the plugin loader.
     *
     * @param string $prefix
     * @param string $path
     */
    public static function addScrollingStylePrefixPath($prefix, $path)
    {
        self::getScrollingStyleLoader()->addPrefixPath($prefix, $path);
    }

    /**
     * Adds an array of scrolling style prefix paths to the plugin
     * loader.
     *
     *
     * $prefixPaths = array(
     *     'My_Paginator_ScrollingStyle'   => 'My/Paginator/ScrollingStyle/',
     *     'Your_Paginator_ScrollingStyle' => 'Your/Paginator/ScrollingStyle/'
     * );
     *
     *
     * @param array $prefixPaths
     */
    public static function addScrollingStylePrefixPaths(array $prefixPaths)
    {
        if (isset($prefixPaths['prefix']) and isset($prefixPaths['path'])) {
            self::addScrollingStylePrefixPath($prefixPaths['prefix'], $prefixPaths['path']);
        } else {
            foreach ($prefixPaths as $prefix => $path) {
                if (is_array($path) and isset($path['prefix']) and isset($path['path'])) {
                    $prefix = $path['prefix'];
                    $path   = $path['path'];
                }

                self::addScrollingStylePrefixPath($prefix, $path);
            }
        }
    }

	/**
     * Factory
     *
     * @param mixed $data
     * @param string $adapter
     * @param array $prefixPaths
     * @return Zend_Paginator
     */
	public static function factory($data, $adapter = self::INTERNAL_ADAPTER,
								   array $prefixPaths = null)
    {
        if ($adapter == self::INTERNAL_ADAPTER) {
        	if (is_array($data)) {
        		$adapter = 'Array';
	        } else if ($data instanceof Zend_Db_Select) {
	            $adapter = 'DbSelect';
	        } else if ($data instanceof Iterator) {
	            $adapter = 'Iterator';
	        } else if (is_integer($data)) {
	            $adapter = 'Null';
	        } else {
	            $type = (is_object($data)) ? get_class($data) : gettype($data);

	            /**
	             * @see Zend_Paginator_Exception
	             */
	            require_once 'Zend/Paginator/Exception.php';

	            throw new Zend_Paginator_Exception('No adapter for type ' . $type);
	        }
        }

        $pluginLoader = self::getAdapterLoader();

        if (null !== $prefixPaths) {
        	foreach ($prefixPaths as $prefix => $path) {
        		$pluginLoader->addPrefixPath($prefix, $path);
        	}
        }

        $adapterClassName = $pluginLoader->load($adapter);

        return new self(new $adapterClassName($data));
    }

	/**
     * Returns the adapter loader.  If it doesn't exist it's
     * created.
     *
     * @return Zend_Loader_PluginLoader
     */
    public static function getAdapterLoader()
    {
        if (self::$_adapterLoader === null) {
            self::$_adapterLoader = new Zend_Loader_PluginLoader(
                array('Zend_Paginator_Adapter' => 'Zend/Paginator/Adapter')
            );
        }

        return self::$_adapterLoader;
    }

	/**
     * Set a global config
     *
     * @param Zend_Config $config
     */
    public static function setConfig(Zend_Config $config)
    {
        self::$_config = $config;

        $adapterPaths = $config->get('adapterpaths');

        if ($adapterPaths != null) {
            self::addAdapterPrefixPaths($adapterPaths->adapterpath->toArray());
        }

        $prefixPaths = $config->get('prefixpaths');

        if ($prefixPaths != null) {
            self::addScrollingStylePrefixPaths($prefixPaths->prefixpath->toArray());
        }

    	$scrollingStyle = $config->get('scrollingstyle');

        if ($scrollingStyle != null) {
            self::setDefaultScrollingStyle($scrollingStyle);
        }
    }

	/**
     * Gets the default scrolling style.
     *
     * @return  string
     */
    public static function getDefaultScrollingStyle()
    {
        return self::$_defaultScrollingStyle;
    }

    /**
     * Sets the default scrolling style.
     *
     * @param  string $scrollingStyle
     */
    public static function setDefaultScrollingStyle($scrollingStyle = 'Sliding')
    {
        self::$_defaultScrollingStyle = $scrollingStyle;
    }

    /**
     * Returns the scrolling style loader.  If it doesn't exist it's
     * created.
     *
     * @return Zend_Loader_PluginLoader
     */
    public static function getScrollingStyleLoader()
    {
        if (self::$_scrollingStyleLoader === null) {
            self::$_scrollingStyleLoader = new Zend_Loader_PluginLoader(
                array('Zend_Paginator_ScrollingStyle' => 'Zend/Paginator/ScrollingStyle')
            );
        }

        return self::$_scrollingStyleLoader;
    }

    /**
     * Constructor.
     */
    public function __construct(Zend_Paginator_Adapter_Interface $adapter)
    {
        $this->_adapter = $adapter;

        $config = self::$_config;

        if ($config != null) {
            $setupMethods = array('ItemCountPerPage', 'PageRange');

            foreach ($setupMethods as $setupMethod) {
                $value = $config->get(strtolower($setupMethod));

                if ($value != null) {
                    $setupMethod = 'set' . $setupMethod;
                    $this->$setupMethod($value);
                }
            }
        }
    }

    /**
     * Serialize as string
     *
     * Proxies to {@link render()}.
     *
     * @return string
     */
    public function __toString()
    {
        try {
            $return = $this->render();
            return $return;
        } catch (Exception $e) {
            trigger_error($e->getMessage(), E_USER_WARNING);
        }

        return '';
    }

    /**
     * Returns the number of pages.
     *
     * @return integer
     */
    public function count()
    {
        if (!$this->_pageCount) {
            $this->_pageCount = $this->_calculatePageCount();
        }

        return $this->_pageCount;
    }

    /**
     * Get the absolute item number for the specified item
     *
     * @param  integer $relativeItemNumber Relative item number
     * @param  integer $pageNumber Page number
     * @return integer
     */
    public function getAbsoluteItemNumber($relativeItemNumber, $pageNumber = null)
    {
        $relativeItemNumber = $this->normalizeItemNumber($relativeItemNumber);

        if ($pageNumber == null) {
            $pageNumber = $this->getCurrentPageNumber();
        }

        $pageNumber = $this->normalizePageNumber($pageNumber);

        return (($pageNumber - 1) * $this->getItemCountPerPage()) + $relativeItemNumber;
    }

    /**
     * Get the adapter
     *
     * @return Zend_Paginator_Adapter_Interface
     */
    public function getAdapter()
    {
        return $this->_adapter;
    }

    /**
     * Returns the number of items for the current page.
     *
     * @return integer
     */
    public function getCurrentItemCount()
    {
        if ($this->_currentItemCount === null) {
            $this->_currentItemCount = $this->getItemCount($this->getCurrentItems());
        }

        return $this->_currentItemCount;
    }

    /**
     * Returns the items for the current page.
     *
     * @return Traversable
     */
    public function getCurrentItems()
    {
        if ($this->_currentItems === null) {
            $this->_currentItems = $this->getItemsByPage($this->getCurrentPageNumber());
        }

        return $this->_currentItems;
    }

    /**
     * Returns the current page number.
     *
     * @return integer
     */
    public function getCurrentPageNumber()
    {
        return $this->normalizePageNumber($this->_currentPageNumber);
    }

    /**
     * Sets the current page number.
     *
     * @param  integer $pageNumber Page number
     * @return Zend_Paginator $this
     */
    public function setCurrentPageNumber($pageNumber)
    {
        $this->_currentPageNumber = (integer) $pageNumber;
        $this->_currentItems      = null;
        $this->_currentItemCount  = null;

        return $this;
    }

    /**
     * Get an item from a page. The current page is used if there's no page sepcified.
     *
     * @param  integer $itemNumber Item number (1 to itemCountPerPage)
     * @param  integer $pageNumber
     * @return mixed
     */
    public function getItem($itemNumber, $pageNumber = null)
    {
        $itemNumber = $this->normalizeItemNumber($itemNumber);

        if ($pageNumber == null) {
            $pageNumber = $this->getCurrentPageNumber();
        }

        $page = $this->getItemsByPage($pageNumber);
        $itemCount = $this->getItemCount($page);

        if ($itemCount == 0) {
            /**
             * @see Zend_Paginator_Exception
             */
            require_once 'Zend/Paginator/Exception.php';

            throw new Zend_Paginator_Exception('Page ' . $pageNumber . ' does not exist');
        }

        if ($itemNumber > $itemCount) {
            /**
             * @see Zend_Paginator_Exception
             */
            require_once 'Zend/Paginator/Exception.php';

            throw new Zend_Paginator_Exception('Page ' . $pageNumber . ' does not'
                                             . ' contain item number ' . $itemNumber);
        }

        return $page[$itemNumber - 1];
    }

    /**
     * Returns the number of items per page.
     *
     * @return integer
     */
    public function getItemCountPerPage()
    {
        return $this->_itemCountPerPage;
    }

    /**
     * Sets the number of items per page.
     *
     * @param  integer $itemCountPerPage
     * @return Zend_Paginator $this
     */
    public function setItemCountPerPage($itemCountPerPage)
    {
        $this->_itemCountPerPage = (integer) $itemCountPerPage;
        $this->_pageCount        = $this->_calculatePageCount();
        $this->_pageItems        = array();
        $this->_currentItems     = null;
        $this->_currentItemCount = null;

        return $this;
    }

    /**
     * Returns the number of items in a collection.
     *
     * @param  mixed $items Items
     * @return integer
     */
    public function getItemCount($items)
    {
        $itemCount = 0;

        if (is_array($items) or $items instanceof Countable) {
            $itemCount = count($items);
        } else { // $items is something like LimitIterator
            foreach ($items as $item) {
                $itemCount++;
            }
        }

        return $itemCount;
    }

    /**
     * Returns the items for a given page.
     *
     * @return Traversable
     */
    public function getItemsByPage($pageNumber)
    {
        $pageNumber = $this->normalizePageNumber($pageNumber);

        if (isset($this->_pageItems[$pageNumber])) {
            return $this->_pageItems[$pageNumber];
        }

        $offset = ($pageNumber - 1) * $this->_itemCountPerPage;

        $items = $this->_adapter->getItems($offset, $this->_itemCountPerPage);

        if (!$items instanceof Traversable) {
            $items = new ArrayIterator($items);
        }

        $this->_pageItems[$pageNumber] = $items;

        return $items;
    }

    /**
     * Returns a foreach-compatible iterator.
     *
     * @return Traversable
     */
    public function getIterator()
    {
        return $this->getCurrentItems();
    }

    /**
     * Returns the page range (see property declaration above).
     *
     * @return integer
     */
    public function getPageRange()
    {
        return $this->_pageRange;
    }

    /**
     * Sets the page range (see property declaration above).
     *
     * @param  integer $pageRange
     * @return Zend_Paginator $this
     */
    public function setPageRange($pageRange)
    {
        $this->_pageRange = (integer) $pageRange;

        return $this;
    }

    /**
     * Returns the page collection.
     *
     * @param  string $scrollingStyle Scrolling style
     * @return array
     */
    public function getPages($scrollingStyle = null)
    {
        if ($this->_pages === null) {
            $this->_pages = $this->_createPages($scrollingStyle);
        }

        return $this->_pages;
    }

    /**
     * Returns a subset of pages within a given range.
     *
     * @param  integer $lowerBound Lower bound of the range
     * @param  integer $upperBound Upper bound of the range
     * @return array
     */
    public function getPagesInRange($lowerBound, $upperBound)
    {
        $lowerBound = $this->normalizePageNumber($lowerBound);
        $upperBound = $this->normalizePageNumber($upperBound);

        $pages = array();

        for ($pageNumber = $lowerBound; $pageNumber <= $upperBound; $pageNumber++) {
            $pages[$pageNumber] = $pageNumber;
        }

        return $pages;
    }

    /**
     * Retrieve view object
     *
     * If none registered, attempts to pull from ViewRenderer.
     *
     * @return Zend_View_Interface|null
     */
    public function getView()
    {
        if (null === $this->_view) {
            /**
             * @see Zend_Controller_Action_HelperBroker
             */
            require_once 'Zend/Controller/Action/HelperBroker.php';

            $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
            if (null === $viewRenderer->view) {
                $viewRenderer->initView();
            }
            $this->_view = $viewRenderer->view;
        }

        return $this->_view;
    }

    /**
     * Set view object
     *
     * @param  Zend_View_Interface $view
     * @return Zend_Paginator
     */
    public function setView(Zend_View_Interface $view = null)
    {
        $this->_view = $view;

        return $this;
    }

    /**
     * Bring the item number in range of the page
     *
     * @param  integer $itemNumber
     * @return integer
     */
    public function normalizeItemNumber($itemNumber)
    {
        if ($itemNumber < 1) {
            $itemNumber = 1;
        }

        if ($itemNumber > $this->_itemCountPerPage) {
            $itemNumber = $this->_itemCountPerPage;
        }

        return $itemNumber;
    }

    /**
     * Bring the page number in range of the paginator
     *
     * @param  integer $pageNumber
     * @return integer
     */
    public function normalizePageNumber($pageNumber)
    {
        if ($pageNumber < 1) {
            $pageNumber = 1;
        }

        $pageCount = $this->count();

        if ($pageCount > 0 and $pageNumber > $pageCount) {
            $pageNumber = $pageCount;
        }

        return $pageNumber;
    }

    /**
     * Render the paginator
     *
     * @param  Zend_View_Interface $view
     * @return string
     */
    public function render(Zend_View_Interface $view = null)
    {
        if (null !== $view) {
            $this->setView($view);
        }

        $view = $this->getView();

        return $view->paginationControl($this);
    }

    /**
     * Calculate the page count
     *
     * @return integer
     */
    protected function _calculatePageCount()
    {
        return (integer) ceil($this->_adapter->count() / $this->_itemCountPerPage);
    }

    /**
     * Creates the page collection.
     *
     * @param  string $scrollingStyle Scrolling style
     * @return stdClass
     */
    protected function _createPages($scrollingStyle = null)
    {
        $pageCount = $this->count();
        $currentPageNumber = $this->getCurrentPageNumber();

        $pages = new stdClass();
        $pages->pageCount        = $pageCount;
        $pages->itemCountPerPage = $this->getItemCountPerPage();
        $pages->first            = 1;
        $pages->current          = $currentPageNumber;
        $pages->last             = $pageCount;

        // Previous and next
        if ($currentPageNumber - 1 > 0) {
            $pages->previous = $currentPageNumber - 1;
        }

        if ($currentPageNumber + 1 <= $pageCount) {
            $pages->next = $currentPageNumber + 1;
        }

        // Pages in range
        $scrollingStyle = $this->_loadScrollingStyle($scrollingStyle);
        $pages->pagesInRange     = $scrollingStyle->getPages($this);
        $pages->firstPageInRange = min($pages->pagesInRange);
        $pages->lastPageInRange  = max($pages->pagesInRange);

        // Item numbers
        if ($this->getCurrentItems() !== null) {
            $pages->currentItemCount = $this->getCurrentItemCount();
            $pages->totalItemCount   = $this->_adapter->count();
            $pages->firstItemNumber  = (($currentPageNumber - 1) * $this->_itemCountPerPage) + 1;
            $pages->lastItemNumber   = $pages->firstItemNumber + $pages->currentItemCount - 1;
        }

        return $pages;
    }

    /**
     * Load a ScrollingStyle
     *
     * @param string $scrollingStyle
     * @return Zend_Paginator_ScrollingStyle_Interface
     */
    protected function _loadScrollingStyle($scrollingStyle = null)
    {
        if ($scrollingStyle === null) {
            $scrollingStyle = self::$_defaultScrollingStyle;
        }

        if ($scrollingStyle === null) {
            /**
             * @see Zend_View_Exception
             */
            require_once 'Zend/View/Exception.php';

            throw new Zend_View_Exception('No scrolling style provided and no default set');
        }

        $className = self::getScrollingStyleLoader()->load($scrollingStyle);

        return new $className();
    }
}


text:
from django.db import IntegrityError
from django.db.models import ExpressionWrapper, F, FloatField, IntegerField
from django.forms import model_to_dict

from speedinfo.models import ViewProfiler
from speedinfo.storage.base import AbstractStorage
from speedinfo.storage.database.models import Storage

class DatabaseStorage(AbstractStorage):
    def add(self, view_name, method, is_anon_call, is_cache_hit, sql_time, sql_count, view_execution_time):
        try:
            vp, created = Storage.objects.get_or_create(view_name=view_name, method=method)
        except IntegrityError:
            # IntegrityError raised in the case of concurrent access
            # to get_or_create method from another application worker/thread
            vp = Storage.objects.get(view_name=view_name, method=method)

        vp.anon_calls = F("anon_calls") + (is_anon_call and 1 or 0)
        vp.cache_hits = F("cache_hits") + (is_cache_hit and 1 or 0)
        vp.sql_total_time = F("sql_total_time") + sql_time
        vp.sql_total_count = F("sql_total_count") + sql_count
        vp.total_calls = F("total_calls") + 1
        vp.total_time = F("total_time") + view_execution_time
        vp.save()

    def fetch_all(self, ordering=None):
        qs = Storage.objects.annotate(
            anon_calls_ratio=ExpressionWrapper(100.0 * F("anon_calls") / F("total_calls"), output_field=FloatField()),
            cache_hits_ratio=ExpressionWrapper(100.0 * F("cache_hits") / F("total_calls"), output_field=FloatField()),
            sql_count_per_call=ExpressionWrapper(F("sql_total_count") / F("total_calls"), output_field=IntegerField()),
            sql_time_ratio=ExpressionWrapper(100.0 * F("sql_total_time") / F("total_time"), output_field=FloatField()),
            time_per_call=ExpressionWrapper(F("total_time") / F("total_calls"), output_field=FloatField()),
        )

        if ordering:
            qs = qs.order_by(*ordering)

        return [ViewProfiler(**model_to_dict(item)) for item in qs]

    def reset(self):
        Storage.objects.all().delete()

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd">

	<!-- 自定义标签 -->
	<bean id="apiTemplateDirectiveModel" class="com.cool.freemarker.APITemplateDirectiveModel"/>
	<!-- 配置freeMarker的模板路径 -->
	<bean id="freemarkerConfig"
		class="com.cool.shiro.FreeMarkerConfigExtend">
		<!-- 模板页面放置位置 -->
		<property name="templateLoaderPaths" value="/WEB-INF/views/" />
		<property name="freemarkerVariables">
			<map>
                <entry key="tags" value-ref="apiTemplateDirectiveModel"/>
            </map>
		</property>
		<property name="freemarkerSettings">
			<props>
				<prop key="tag_syntax">auto_detect</prop>
				<prop key="template_update_delay">0</prop>
				<prop key="default_encoding">UTF-8</prop>
				<prop key="output_encoding">UTF-8</prop>
				<prop key="locale">zh_CN</prop>
				<prop key="number_format">0.##########</prop>
				<prop key="boolean_format">true,false</prop>
				<prop key="datetime_format">yyyy-MM-dd HH:mm:ss</prop>
				<prop key="date_format">yyyy-MM-dd</prop>
				<prop key="time_format">HH:mm:ss</prop>
				<prop key="classic_compatible">true</prop>
				<prop key="whitespace_stripping">true</prop>
				<prop key="template_exception_handler">ignore</prop>
			</props>
		</property>
	</bean>

	<!--  -->
	<bean id="viewResolver" class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
        <!-- 解决freemarker中文乱码 -->
        <property name="contentType" value="text/html;charset=UTF-8"/>
        <property name="suffix" value=".html"/>
    </bean>
</beans>


text:
namespace NGraphics.Custom.Models.Operations
{
    public class CurveTo : PathOperation
    {
        public CurveTo(Point start, Point firstControlPoint, Point secondControlPoint)
        {
            Start = start;
            FirstControlPoint = firstControlPoint;
            SecondControlPoint = secondControlPoint;
        }

        public CurveTo(Point start, Point firstControlPoint, Point secondControlPoint, Point end)
        {
            Start = start;
            FirstControlPoint = firstControlPoint;
            SecondControlPoint = secondControlPoint;
            End = end;
        }

        public Point End;
        public Point FirstControlPoint;
        public Point SecondControlPoint;
        public Point Start;
    }
}


text:
module CandyCheck
  module CLI
    module Commands
      # Command to verify an PlayStore purchase
      class PlayStore < Base
        # Prepare a verification run from the terminal
        # @param package_name [String]
        # @param product_id [String]
        # @param token [String]
        # @param options [Hash]
        # @option options [String] :json_key_file to use for API access
        def initialize(package_name, product_id, token, options)
          @package = package_name
          @product_id = product_id
          @token = token
          super(options)
        end

        # Print the result of the verification to the terminal
        def run
          verifier = CandyCheck::PlayStore::Verifier.new(authorization: authorization)
          result = verifier.verify_product_purchase(
            package_name: @package,
            product_id: @product_id,
            token: @token,
          )
          out.print "#{result.class}:"
          out.pretty result
        end

        private

        def authorization
          CandyCheck::PlayStore.authorization(options["json_key_file"])
        end
      end
    end
  end
end


text:
package com.kirillr.application;

import android.os.Bundle;

import com.kirillr.strictmodehelper.StrictModeCompat;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    @Override
    protected void onPostCreate(@Nullable Bundle savedInstanceState) {
        super.onPostCreate(savedInstanceState);
        StrictModeCompat.noteSlowCall("Sample");
    }
}


text:
package com.yungoushangcheng.yungou.service;

import com.yungoushangcheng.yungou.model.Gamester;
import com.yungoushangcheng.yungou.service.core.BaseService;

/**
 * Created by bonismo@hotmail.com
 * 下午8:19 on 16/8/20.
 */
public interface GamesterService extends BaseService<Gamester> {
}


text:
<?php
namespace Concrete\Core\Workflow\Request;

use Config;
use Loader;
use Page;
use Stack;
use Concrete\Core\Workflow\Description as WorkflowDescription;
use PermissionKey;
use Concrete\Core\Workflow\Progress\Progress as WorkflowProgress;
use URL;
use Concrete\Core\Workflow\Progress\Response as WorkflowProgressResponse;

class DeletePageRequest extends PageRequest
{
    protected $wrStatusNum = 100;

    public function __construct()
    {
        $pk = PermissionKey::getByHandle('delete_page');
        parent::__construct($pk);
    }

    public function getWorkflowRequestDescriptionObject()
    {
        $d = new WorkflowDescription();
        $c = Page::getByID($this->cID, 'ACTIVE');
        $item = t('page');
        if ($c->getPageTypeHandle() == STACKS_PAGE_TYPE) {
            $item = t('stack');
        }
        $link = Loader::helper('navigation')->getLinkToCollection($c, true);
        $d->setEmailDescription(t("\"%s\" has been marked for deletion. View the page here: %s.", $c->getCollectionName(), $link));
        $d->setInContextDescription(t("This %s has been marked for deletion. ", $item));
        $d->setDescription(t("%s has been marked for deletion. ", $link, $c->getCollectionName()));
        $d->setShortStatus(t("Pending Delete"));

        return $d;
    }

    public function getWorkflowRequestStyleClass()
    {
        return 'danger';
    }

    public function getWorkflowRequestApproveButtonClass()
    {
        return '';
    }

    public function getWorkflowRequestApproveButtonInnerButtonRightHTML()
    {
        return '';
    }

    public function getWorkflowRequestApproveButtonText()
    {
        return t('Approve Delete');
    }

    public function approve(WorkflowProgress $wp)
    {
        $c = Page::getByID($this->getRequestedPageID());
        if ($c->getPageTypeHandle() == STACKS_PAGE_TYPE) {
            $c = Stack::getByID($this->getRequestedPageID());
            $c->delete();
            $wpr = new WorkflowProgressResponse();
            $wpr->setWorkflowProgressResponseURL(URL::to(STACKS_LISTING_PAGE_PATH, 'stack_deleted'));

            return $wpr;
        }

        $cParentID = $c->getCollectionParentID();
        if (Config::get('concrete.misc.enable_trash_can')) {
            $c->moveToTrash();
        } else {
            $c->delete();
        }
        $wpr = new WorkflowProgressResponse();
        $parent = Page::getByID($cParentID, 'ACTIVE');
        $wpr->setWorkflowProgressResponseURL(\URL::to($parent));

        return $wpr;
    }
}


text:
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
#import "GameViewController.h"
#include "jai_game/jai_game.h"
#include "jai_utility/jai_ticker.h"

namespace jai {

	struct Game_ {
		GameViewController * mViewController = nil;
		AppDelegate * mApp = nil;

		GameDelegate * mDelegate = nullptr;

		jai::Ticker mGameTicker;
		jai::Ticker mRealTicker;
		jai::Pt2 mWindowSize = jai::Pt2(0, 0);
		bool mIsInitialized = false;
		bool mIsLoaded = false;
		bool mIsSuspendable = true;
		bool mIsVSync = true;
		bool mIsAccEnable = false;
		bool mIsMultipleTouch = false;
		bool mIsAutoRotate = true;
		bool mIsShowStatus = true;
		float mFPS = 60.f;
	};

	extern Game_ gGame;
}


text:
// Karma configuration
// http://karma-runner.github.io/0.12/config/configuration-file.html
// Generated on 2014-06-09 using
// generator-karma 0.8.2

module.exports = function (config) {
    'use strict';
    config.set({
        // enable / disable watching file and executing tests whenever any file changes
        autoWatch: true,

        // base path, that will be used to resolve files and exclude
        basePath: '.',

        // testing framework to use (jasmine/mocha/qunit/...)
        frameworks: ['jasmine'],

        preprocessors: {
            'app/!(bower_components)/**/*.html': ['ng-html2js']
        },

        // list of files / patterns to load in the browser
        files: [
            'app/bower_components/jquery/dist/jquery.js',
            'app/bower_components/angular/angular.js',
            'app/bower_components/angular-mocks/angular-mocks.js',
            'app/bower_components/angular-ui-bootstrap-bower/ui-bootstrap-tpls.js',
            'app/!(bower_components)/**/*.module.js',
            'app/!(bower_components)/**/*.service.js',
            'app/!(bower_components)/**/*.controller.js',
            'app/!(bower_components)/**/*.directive.js',
            'app/!(bower_components)/**/*.html',
            'app/!(bower_components)/**/*.spec.js'
        ],

        // list of files / patterns to exclude
        exclude: [],

        // web server port
        port: 7777,

        // Start these browsers, currently available:
        // - Chrome
        // - ChromeCanary
        // - Firefox
        // - Opera
        // - Safari (only Mac)
        // - PhantomJS
        // - IE (only Windows)
        browsers: [
            'PhantomJS'
        ],

        // Which plugins to enable
        plugins: [
            'karma-phantomjs-launcher', 'karma-chrome-launcher', 'karma-jasmine', 'karma-ng-html2js-preprocessor'
        ],

        // Continuous Integration mode
        // if true, it capture browsers, run tests and exit
        singleRun: false,

        colors: true,

        // level of logging
        // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
        logLevel: config.LOG_INFO,

        ngHtml2JsPreprocessor: {
            moduleName: 'app.templates',
            stripPrefix: 'app/'
        }
    });
};


text:
package com.sri.ai.grinder.api;

import static com.sri.ai.grinder.library.indexexpression.IndexExpressions.makeIndexExpressions;

import java.util.List;

import com.sri.ai.expresso.api.Expression;
import com.sri.ai.expresso.core.ExtensionalIndexExpressionsSet;
import com.sri.ai.grinder.group.AssociativeCommutativeGroup;
import com.sri.ai.grinder.library.controlflow.IfThenElse;

public interface MultiQuantifierEliminationProblem {

	AssociativeCommutativeGroup getGroup();

	List<Expression> getIndices();

	List<Expression> getIndicesTypes();

	Expression getConstraint();

	Expression getBody();

	MultiQuantifierEliminationProblem makeWithNewIndexConstraint(Expression newConstraint);

	MultiQuantifierEliminationProblem makeWithNewBody(Expression newBody);

	SingleQuantifierEliminationProblem getFirstIndexVersion();

	Expression toExpression();

	default Expression getConditionedBody() {
		return IfThenElse.make(getConstraint(), getBody(), getGroup().additiveIdentityElement());
	}

	default ExtensionalIndexExpressionsSet getIndexExpressions() {
		ExtensionalIndexExpressionsSet result = new ExtensionalIndexExpressionsSet(makeIndexExpressions(getIndices(), getIndicesTypes()));
		return result;
	}

	default Context extend(Context context) {
		Context result = context.extendWith(getIndexExpressions());
		return result;
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView
        android:layout_width="300dp"
        android:layout_height="300dp"
        android:drawableTop="@drawable/ic_splash"
        android:text="Android 2016/01"
        android:gravity="center_horizontal"
        android:textAppearance="?android:textAppearanceLarge"
        android:textStyle="bold"
        android:layout_gravity="center" />

</FrameLayout>


text:
'use strict';
var Cesium = require('cesium');
var clone = require('clone');

var MergeDuplicateProperties = require('../../lib/MergeDuplicateProperties');

var WebGLConstants = Cesium.WebGLConstants;

describe('MergeDuplicateProperties', function() {
    var mergeAccessors = MergeDuplicateProperties.mergeAccessors;
    describe('mergeAccessors', function() {
        var testGltf = {
            accessors: {
                accessorA: {
                    bufferView: 'bufferView',
                    byteOffset: 0,
                    byteStride: 0,
                    componentType: WebGLConstants.BYTE,
                    count: 3,
                    type: 'SCALAR'
                },
                accessorB: {
                    bufferView: 'bufferView',
                    byteOffset: 3,
                    byteStride: 0,
                    componentType: WebGLConstants.BYTE,
                    count: 3,
                    type: 'SCALAR'
                }
            },
            bufferViews: {
                bufferView: {
                    buffer: 'buffer',
                    byteOffset: 0
                }
            },
            buffers: {
                buffer: {
                    type: 'arraybuffer',
                    extras : {
                        _pipeline : {}
                    }
                }
            },
            meshes: {
                meshA: {
                    primitives : [
                        {
                            attributes: {
                                TEST: 'accessorA'
                            }
                        }
                    ]
                },
                meshB: {
                    primitives : [
                        {
                            attributes: {
                                TEST: 'accessorB'
                            }
                        }
                    ]
                }
            }
        };
        it('merges a single duplicate accessor', function () {
            var buffer = Buffer.from([1, 2, 3, 1, 2, 3]);
            var gltf = clone(testGltf);
            var gltfBuffer = gltf.buffers.buffer;
            gltfBuffer.extras._pipeline.source = buffer;
            gltfBuffer.byteLength = buffer.length;
            gltf.bufferViews.bufferView.byteLength = buffer.length;
            mergeAccessors(gltf);
            expect(Object.keys(gltf.accessors).length).toEqual(1);
            expect(gltf.meshes.meshA.primitives[0].attributes.TEST).toEqual(gltf.meshes.meshB.primitives[0].attributes.TEST);
        });

        it ('merges multiple duplicate accessors', function () {
            var buffer = Buffer.from([1, 2, 3, 1, 2, 3, 1, 2, 3]);
            var gltf = clone(testGltf);
            var gltfBuffer = gltf.buffers.buffer;
            gltfBuffer.extras._pipeline.source = buffer;
            gltfBuffer.byteLength = buffer.length;
            gltf.bufferViews.bufferView.byteLength = buffer.length;
            gltf.accessors.accessorC = {
                bufferView: 'bufferView',
                byteOffset: 6,
                byteStride: 0,
                componentType: WebGLConstants.BYTE,
                count: 3,
                type: 'SCALAR'
            };
            gltf.meshes.meshC = {
                primitives : [
                    {
                        attributes : {
                            TEST: 'accessorC'
                        }
                    }
                ]
            };
            mergeAccessors(gltf);
            expect(Object.keys(gltf.accessors).length).toEqual(1);
            expect(gltf.meshes.meshA.primitives[0].attributes.TEST).toEqual(gltf.meshes.meshB.primitives[0].attributes.TEST);
            expect(gltf.meshes.meshA.primitives[0].attributes.TEST).toEqual(gltf.meshes.meshC.primitives[0].attributes.TEST);
        });

        it ('leaves a non-duplicate accessor alone', function () {
            var buffer = Buffer.from([1, 2, 3, 1, 2, 3, 3, 2, 1]);
            var gltf = clone(testGltf);
            var gltfBuffer = gltf.buffers.buffer;
            gltfBuffer.extras._pipeline.source = buffer;
            gltfBuffer.byteLength = buffer.length;
            gltf.bufferViews.bufferView.byteLength = buffer.length;
            gltf.accessors.accessorC = {
                bufferView: 'bufferView',
                byteOffset: 6,
                byteStride: 0,
                componentType: WebGLConstants.BYTE,
                count: 3,
                type: 'SCALAR'
            };
            gltf.meshes.meshC = {
                primitives : [
                    {
                        attributes : {
                            TEST: 'accessorC'
                        }
                    }
                ]

            };
            mergeAccessors(gltf);
            expect(Object.keys(gltf.accessors).length).toEqual(2);
            expect(gltf.meshes.meshA.primitives[0].attributes.TEST).toEqual(gltf.meshes.meshB.primitives[0].attributes.TEST);
            expect(gltf.meshes.meshA.primitives[0].attributes.TEST).not.toEqual(gltf.meshes.meshC.primitives[0].attributes.TEST);
        });
    });

    var mergeShaders = MergeDuplicateProperties.mergeShaders;
    describe('mergeShaders', function() {
        it('merges duplicate shaders', function() {
            var gltf = {
                programs : {
                    programOne : {
                        fragmentShader : 'FSOne',
                        vertexShader : 'VSOne'
                    },
                    programTwo : {
                        fragmentShader : 'FSTwo',
                        vertexShader : 'VSTwo'
                    }
                },
                shaders : {
                    VSOne : {
                        type : WebGLConstants.VERTEX_SHADER,
                        extras : {
                            _pipeline : {
                                source : 'test shader one'
                            }
                        }
                    },
                    FSOne : {
                        type : WebGLConstants.FRAGMENT_SHADER,
                        extras : {
                            _pipeline : {
                                source : 'test shader one'
                            }
                        }
                    },
                    VSTwo : {
                        type : WebGLConstants.VERTEX_SHADER,
                        extras : {
                            _pipeline : {
                                source : 'test shader two'
                            }
                        }
                    },
                    FSTwo : {
                        type : WebGLConstants.FRAGMENT_SHADER,
                        extras : {
                            _pipeline : {
                                source : 'test shader one'
                            }
                        }
                    }
                }
            };
            mergeShaders(gltf);
            var programs = gltf.programs;
            expect(programs.programOne.fragmentShader).toBe('FSOne');
            expect(programs.programOne.vertexShader).toBe('VSOne');
            expect(programs.programTwo.fragmentShader).toBe('FSOne');
            expect(programs.programTwo.vertexShader).toBe('VSTwo');
        });
    });

    var mergePrograms = MergeDuplicateProperties.mergePrograms;
    describe('mergePrograms', function() {
        it('merges duplicate programs', function() {
            var gltf = {
                programs: {
                    programOne: {
                        fragmentShader: 'FSOne',
                        vertexShader: 'VSOne',
                        extras : {}
                    },
                    programTwo: {
                        fragmentShader: 'FSOne',
                        vertexShader: 'VSOne'
                    },
                    programThree: {
                        fragmentShader: 'FSOne',
                        vertexShader: 'VSTwo',
                        extras : {}
                    }
                },
                techniques: {
                    techniqueOne: {
                        program: 'programOne',
                        extras: {}
                    },
                    techniqueTwo: {
                        program: 'programTwo',
                        extras: {}
                    },
                    techniqueThree: {
                        program: 'programThree'
                    }
                }
            };
            mergePrograms(gltf);
            var techniques = gltf.techniques;
            expect(techniques.techniqueOne.program).toBe('programOne');
            expect(techniques.techniqueTwo.program).toBe('programOne');
            expect(techniques.techniqueThree.program).toBe('programThree');
        });
    });

    var mergeTechniques = MergeDuplicateProperties.mergeTechniques;
    describe('mergeTechniques', function() {
        it('merges duplicate techniques', function() {
            var gltf = {
                techniques : {
                    techniqueOne : {
                        key : 'value',
                        arrayOf : ['values'],
                        nested : {
                            key : 'value'
                        },
                        extras : {}
                    },
                    techniqueTwo : {
                        key : 'value',
                        arrayOf : ['different', 'values'],
                        nested : {
                            key : 'value'
                        }
                    },
                    techniqueThree : {
                        key : 'value',
                        arrayOf : ['values'],
                        nested : {
                            key : 'value'
                        },
                        extras : {}
                    }
                },
                materials : {
                    materialOne : {
                        technique : 'techniqueOne',
                        extras : {}
                    },
                    materialTwo : {
                        technique : 'techniqueTwo',
                        extras : {}
                    },
                    materialThree : {
                        technique : 'techniqueThree'
                    }
                }
            };
            mergeTechniques(gltf);
            var materials = gltf.materials;
            expect(materials.materialOne.technique).toBe('techniqueOne');
            expect(materials.materialTwo.technique).toBe('techniqueTwo');
            expect(materials.materialThree.technique).toBe('techniqueOne');
        });
    });

    var mergeMaterials = MergeDuplicateProperties.mergeMaterials;
    describe('mergeMaterials', function() {
        it('merges duplicate materials', function() {
            var gltf = {
                meshes : {
                    meshOne : {
                        primitives : [
                            {
                                material : 'materialOne'
                            },
                            {
                                material : 'materialThree'
                            }
                        ]
                    },
                    meshTwo : {
                        primitives : [
                            {
                                material : 'materialTwo'
                            },
                            {
                                material : 'materialThree'
                            }
                        ]
                    }
                },
                materials : {
                    materialOne : {
                        key : 'value',
                        arrayOf : ['values'],
                        nested : {
                            key : 'value'
                        },
                        extras : {}
                    },
                    materialTwo : {
                        key : 'value',
                        arrayOf : ['different', 'values'],
                        nested : {
                            key : 'value'
                        },
                        extras : {}
                    },
                    materialThree : {
                        key : 'value',
                        arrayOf : ['values'],
                        nested : {
                            key : 'value'
                        }
                    }
                }
            };
            mergeMaterials(gltf);
            var meshes = gltf.meshes;
            var meshOne = meshes.meshOne;
            var meshOnePrimitives = meshOne.primitives;
            expect(meshOnePrimitives[0].material).toBe('materialOne');
            expect(meshOnePrimitives[1].material).toBe('materialOne');
            var meshTwo = meshes.meshTwo;
            var meshTwoPrimitives = meshTwo.primitives;
            expect(meshTwoPrimitives[0].material).toBe('materialTwo');
            expect(meshTwoPrimitives[1].material).toBe('materialOne');
        });
    });

    it('mergeAccessors is called if optimizeDrawCalls is false', function() {
        var spyAccessors = spyOn(MergeDuplicateProperties, 'mergeAccessors');
        var spyShaders = spyOn(MergeDuplicateProperties, 'mergeShaders');
        var spyPrograms = spyOn(MergeDuplicateProperties, 'mergePrograms');
        var spyTechniques = spyOn(MergeDuplicateProperties, 'mergeTechniques');
        var spyMaterials = spyOn(MergeDuplicateProperties, 'mergeMaterials');

        MergeDuplicateProperties.mergeAll({}, false);

        expect(spyAccessors).toHaveBeenCalled();
        expect(spyShaders).toHaveBeenCalled();
        expect(spyPrograms).toHaveBeenCalled();
        expect(spyTechniques).toHaveBeenCalled();
        expect(spyMaterials).toHaveBeenCalled();
    });

    it('mergeAccessors isn\'t called if optimizeDrawCalls is true', function() {
        var spyAccessors = spyOn(MergeDuplicateProperties, 'mergeAccessors');
        var spyShaders = spyOn(MergeDuplicateProperties, 'mergeShaders');
        var spyPrograms = spyOn(MergeDuplicateProperties, 'mergePrograms');
        var spyTechniques = spyOn(MergeDuplicateProperties, 'mergeTechniques');
        var spyMaterials = spyOn(MergeDuplicateProperties, 'mergeMaterials');

        MergeDuplicateProperties.mergeAll({}, true);

        expect(spyAccessors).not.toHaveBeenCalled();
        expect(spyShaders).toHaveBeenCalled();
        expect(spyPrograms).toHaveBeenCalled();
        expect(spyTechniques).toHaveBeenCalled();
        expect(spyMaterials).toHaveBeenCalled();
    });
});


text:
import {PropTypes} from 'react'
import {stringify as queryify} from 'query-string'

export default AudioPlayer

function AudioPlayer({podbeanId}) {
  return (
    <iframe
      id="audio_iframe"
      src={getSource(podbeanId)}
      height="100"
      width="100%"
      frameBorder="0"
      scrolling="no"
      data-name="pb-iframe-player"
    />
  )
}

AudioPlayer.propTypes = {
  podbeanId: PropTypes.string.isRequired,
}

function getSource(podbeanId) {
  const query = {
    from: 'yiiadmin',
    skin: '103',
    postId: '5953402', // TODO see if this is unique for shows
    download: 1,
    share: 1,
    fonts: 'Helvetica',
    auth: 0,
  }
  const url = `https://www.podbean.com/media/player/${podbeanId}`
  return `${url}?${queryify(query)}`
}


text:
import pylab as plt

from retrieve_SkipGram_weights import plot_CG_chord2vec_weights, plot_SGD_chord2vec_weights
from retrieve_model_tools import retrieve_SkipGramNN, retrieve_SkipGramNN_SGD

def plot_SGD_embedding(highlight_syms=None, zoom=False):
    if highlight_syms is None:
        highlight_syms = ['C', 'F', 'G', 'Cm', 'B-', 'A-',
                          'Fmaj7', 'Fmaj7/A', 'Am']

    print '====== SGD ======'
    plt.figure()
    plot_SGD_chord2vec_weights(highlight_syms=highlight_syms,
                               zoom=zoom)

def highlight_syms_compare():
    highlight_syms = ['C', 'F', 'G', 'D', 'A', 'E', 'E-', 'Cm', 'B-', 'A-',
                      'Fmaj7', 'Fmaj7/A', 'Am']

    plot_SGD_embedding(highlight_syms, zoom=True)

    print '====== CG ======'
    plt.figure()
    plot_CG_chord2vec_weights(highlight_syms=highlight_syms)

def query_neighborhood_compare(query_chord, topn, nn, nn_sgd):
    chords = nn.most_similar(query_chord, topn=topn, return_scores=False)
    print 'CG most similar chord for %s:' % query_chord, chords

    chords = nn_sgd.most_similar(query_chord, topn=topn, return_scores=False)
    print 'SGD most similar chord for %s:' % query_chord, chords
    print

def neighborhood_compare():
    topn = 7

    nn = retrieve_SkipGramNN()
    nn_sgd = retrieve_SkipGramNN_SGD()

    query_neighborhood_compare('Am', topn, nn, nn_sgd)
    query_neighborhood_compare('F', topn, nn, nn_sgd)
    query_neighborhood_compare('C', topn, nn, nn_sgd)
    query_neighborhood_compare('G', topn, nn, nn_sgd)

if __name__ == '__main__':
    highlight_syms_compare()
    # neighborhood_compare()

    # plot_SGD_embedding()


text:
require 'rubygems'
require 'json'
require 'httparty'
require File.dirname(__FILE__) + '/../../../infrastructure/vagrant/Servers.rb'
require File.dirname(__FILE__) + '/../../../infrastructure/vagrant/aws/VagrantfileUtil.rb'

class JDSCache
  @username = "tomcat"
  @password = "tomcat"
  @timeout = 240

  def self.clear_cache(env)
    case env
    when "aws"
      set_endpoints(env)
    else
      set_endpoints("virtualbox")
    end

    stop_tomcat = "https://#{@ehmp_ip}:8443/manager/text/stop?path=/"
    start_tomcat = "https://#{@ehmp_ip}:8443/manager/text/start?path=/"
    auth = { :username => @username, :password => @password }

    # Stop Tomcat
    p "Stopping Tomcat..."
    p "Waiting up to #{@timeout} seconds for shutdown to complete..."
    response = HTTParty.get(stop_tomcat, { :verify => false, :basic_auth => auth, :timeout => @timeout })

    # Check that the stop command was successful
    unless response.code == 200 then
      fail "Incorrect response received: #{response.code} #{response.body}"
    end

    # Clear JDS
    p "Clearing the JDS cache"
    response = HTTParty.delete("http://#{@jds_ip}:9080/vpr?confirm=true", {:timeout => 20})
    unless response.code == 200 then
      fail "Incorrect response received: #{response.code} #{response.body}"
    end
    response = HTTParty.delete("http://#{@jds_ip}:9080/data?confirm=true", {:timeout => 20})
    unless response.code == 200 then
      fail "Incorrect response received: #{response.code} #{response.body}"
    end

    # Start Tomcat
    p "Starting Tomcat..."
    response = HTTParty.get(start_tomcat, { :verify => false, :basic_auth => auth, :timeout => @timeout})

    # Check that the start command was successful
    unless response.code == 200 then
      fail "Incorrect response received: #{response.code} #{response.body}"
    end

    p "Complete. ODC sync will begin shortly.\n"
  end
end

def set_endpoints(env)
    case env
    when "virtualbox"
      p "Running with virtualbox environments"
      @ehmp_ip = Servers::EHMP.localIP
      @jds_ip = Servers::JDS.localIP
    when "aws"
      p "Running with aws environments"
      @ehmp_ip = VagrantfileUtil::AWS.get_private_ip("vista-exchange", "ehmp")
      @jds_ip = VagrantfileUtil::AWS.get_private_ip("vista-exchange", "jds")
    else
      fail "Unrecognized environment type: #{env}. Allowable types are: 'virtualbox' and 'aws'"
    end
  end


text:
ACCEPTED

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

#### Published in
Annls mycol. 17(2/6): 141 (1920)

#### Original name
Phyllachora cantonensis Syd. & P. Syd., 1920

### Remarks
null


text:
<?php

namespace Symfony\Component\Form\Tests;

use Symfony\Component\Form\Test\FormIntegrationTestCase as BaseFormIntegrationTestCase;

/**
 * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use Symfony\Component\Form\Test\FormIntegrationTestCase instead.
 */
abstract class FormIntegrationTestCase extends BaseFormIntegrationTestCase
{
    /**
    * {@inheritdoc}
    */
    protected function setUp()
    {
        trigger_error('This class is deprecated. Use Symfony\Component\Form\Test\FormIntegrationTestCase instead.', E_USER_DEPRECATED);
        parent::setUp();
    }
}


text:
module JermHelper
  RESPONSE_STATUS_IMAGES={:fail=>"error",:success=>"tick",:skipped=>"skipped",:warning=>"warning"}

  def status_image status
    image_name=RESPONSE_STATUS_IMAGES[status]
    image(image_name)
  end

  def the_jerm options={:size=>50}
    logo_filename=icon_filename_for_key("jerm_logo")
    size=options[:size]
    image_tag logo_filename,
      :alt => "The JERM",
      :size => "#{size}x#{size}",
      :class => 'framed',
      :style=>"padding: 2px;",
      :title=>"The JERM"
  end

  def jerm_harvester_name
    "JERM"
  end

  def generate_resource_title_from_filename filename
    last_dot=filename.rindex(".")
    if(!last_dot.nil? && last_dot > filename.length-6) #only handle dots close to the end
      filename=filename[0..last_dot-1]
    end
    filename.gsub("_"," ").capitalize
  end

  def generate_resource_title resource
    filename=resource.original_filename
    generate_resource_title_from_filename filename
  end

end


text:
      // No map operator can follow an Agg.
      // TODO(ionel): At the moment we only support Agg on multiple columns that
      // have the same type. FIX!
      if ({{CONDITION}}) {
        if ({{GROUP_BY}} == -1) {
          for (int i = 0; i < aggValues.length; i++) {
            {{TYPE}} col_val = {{TYPE}}.valueOf({{REL_NAME}}[indexArray[i]]);
            if (aggValues[i] == null) {
              aggValues[i] = col_val;
            } else {
              aggValues[i] = aggValues[i] {{OPERATOR}} col_val;
            }
          }
        } else {
          String outputValue = {{REL_NAME}}[indexArray[0]];
          for (int i = 1; i < aggValues.length; i++) {
            outputValue += " " + {{REL_NAME}}[indexArray[i]];
          }
          context.write(new Text({{GROUP_BY_KEY}}), new Text(outputValue));
        }
      }


text:
<TITLE>Review for Fifth Element, The (1997)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">

Fifth Element, The (1997)

reviewed by
Paul-Michael Agapow

                                  THE FIFTH ELEMENT
                       A film review by Paul-Michael Agapow
                        Copyright 1997 Paul-Michael Agapow

It is 250 years in the future.  Dallas (Willis), an ex-soldier,
drives taxis in the swarming metropolis of New York.  One day a
orange-haired nymphet Leeloo (Jovovich) speaking an unknown
language crash-lands in his taxi.  Soon she is doing the "speed
learn from an encyclopedia" shtick and with the help of a priest
(Holm, and by the look of his acolyte's headgear his religion
must worship of early 80s rock bands) we find out the universe is
doomed.  Unless, of course, four widgets are obtained from a
remote location and assembled in a Dungeons and Dragons puzzle
room, against the wishes of the evil businessman Zorg (Oldman)
and a group of unexplained shape-changing aliens.

Did that sound silly?  You have no idea ...  There are several
types of logical blunders in fiction.  In "The Fifth Element" the
first type betrays perhaps nothing more than carelessness on
director Besson's part: black holes mentioned in 1914,
temperatures of -5000 C, a (apparently) three hour flight during
which the passengers cryosleep to avert boredom, a planet "in the
constellation of ...".  Stupid, but the plot does not in any way
depend on these points - they are at most distracting.  You
shouldn't get too upset about such trivia.  A second might be the
absurd fact that once accepted allows the rest of the story
to proceed - a flying, invulnerable superhero; a rapid growing,
parasitic alien that can lay eggs in any humanoid; or (in this
case) the assembly of four artifacts to save the universe.

But "The Fifth Element" abounds with another type of mistake,
in the logic that leads the story from one point to another.
Although the moment to moment action is straightforward and the
plot is essentially simple, upon analysis it is completely
nonsensical.  The President, the fate of the entire universe at
stake mind you, orders a low-key one-man mission.  Leeloo is
surprised and shattered by the human concept of war, forgetting
that her race has spent eons fighting genocidal forces intent on
obliterating all life, that her ship was destroyed by hostile
forces, and that she has been karate-chopping and waving guns
about for the past hour.  Zorg's motives are murky and his
controller totally unexplained.  Several times the plot powers
itself out of dead-ends using "with one mighty leap he was free!"
logic.  Possibly there is a lot of footage on the cutting room
floor, possibly a lot of explanatory material was excised from
the script.  Or maybe the film is just plain dumb.

The cast is crowded with superfluous characters and execrable
acting.  Gary Oldman, sounding like a cross between Gomer Pyle
and Anthony Robbins, falls into both categories.  On the bright
side Willis does well, albeit as a caricature, while Jovovich is
surprisingly good even when required to utter stupid lines.  (The
more English she speaks, the less convincing her character
becomes.)  Mention should also be made of Luke "don't blink or
you'll miss me" Perry, who deserves bigger roles, and a bizarre
cameo as a mugger by Matthieu Kassovitz (director of "La Haine"
and star of "Un Heros Tres Discret").

And despite the above problems, the film is fairly enjoyable.

Besson has always favoured (and got away with) feel over logic
and look over plot.  For example, his "Subway" and "La Femme
Nikita" are fun despite also being plainly ridiculous.  But more
recently, with "Leon the Professional" he showed a masterful
handling of script, direction and character with more lucid and
intense plotting.  "The Fifth Element" is big step back to his
earlier work, a big, dumb but likeable film.  The whole is absurd
but the parts are quite good: a bioengineered opera diva,
residential blocks designed for police lockdown, the dizzying
heights of New York protruding from a smoggy abandoned surface,
cigarettes that are 75% filter.  In a way the correct film to
compare it to would be "Bladerunner", not for the narrative but
for the vision of a brash, busy and colourful future - a
three-way collision between Ridley Scott, Doc EE Smith and
Jean-Paul Gaultier.  It also helps that the central conflict is
at once broad (good vs.  evil) and very personal (Dallas fighting
for Leeloo), largely avoiding machismo and flag-waving.

It grieves me to recommend a picture to "switch your mind
off" at.  But unlike other big dumb pictures (like most anything
coming out of the Hollywood system), "The Fifth Element" is a
little different, more colourful, more exciting and less
offensive.  If you're going to take your mind candy, it may as
well taste good.  Unfortunately this film will probably not come
across well on video due to the diminishing of the visuals.
[**/ok] and on the Sid and Nancy scale.

"The Fifth Element"
Directed by Luc Besson.
Starring Bruce Willis, Milla Jovovich, Ian Holm, Gary Oldman,
Brion James, Luke Perry, Tom "Tiny" Lister Jr, Matthieu Kassovitz.
Released 1997.

------
paul-michael agapow (agapow@latcs1.oz.au), La Trobe Uni, Infocalypse
[archived at http://www.cs.latrobe.edu.au/~agapow/Postviews/]

The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).

The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.

Please direct comments/criticisms of the review to relevant newsgroups.

Broken URLs inthe reviews are the responsibility of the author.

The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.

Related links: index of all rec.arts.movies.reviews reviews


text:
Alagamento

Lista

		Adicionar

				You have a new message. Go to Inbox.

				Error. Please try again.

				Welcome back. View my account.

				Product added sucessfully. Add new one.

				ID
				Categoria
				Opções

				{id_materia_categoria}
				{materia_categoria}

{paginacao}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Hedwigia 41: 105 (1902)

#### Original name
Puccinia jambosae Henn.

### Remarks
null


text:
<template name="IncompleteReports">
  {{#if Template.subscriptionsReady }}

      {{#if reports.count}}

Incomplete Reports

          {{#each reports}}

                {{contributorName contributorId}}

              {{dateFormat dueDate}}

                Created on {{dateFormat dateCreated 'MMM Do'}}, last edited {{dateFormat dateModified 'MMM Do'}} at {{dateFormat
                dateModified 'h:mm a'}}

                  Edit

                  Delete

          {{/each}}

      {{/if}}

  {{else}}
    {{> AppLoading }}
  {{/if}}
</template>


text:
echo ""
echo "*** do not strip tabs ***"
cat <<EOF
a
	b
		c
EOF

echo ""
echo "*** strip tabs ***"
cat <<-EOF
a
	b
		c
EOF

echo ""
echo "*** put into variable ***"
read -r -d '' myheredoc1 <<EOF
a
        b
                c
EOF
echo "$myheredoc1"

echo ""
echo "*** with variables and subshell ***"
greeting="hello, world!"
cat <<EOF
$greeting
I am ${USER} in directory $(pwd)
$(for i in $(seq 1 9); do echo "hello $i"; done)
if you want a dollar sign, then \$escape it
last line
EOF

echo ""
echo "*** put into variable with subshell ***"
greeting="hello, world!"
# -r do not allow backslashes to escape, -d delimiter
read -r -d '' myheredoc2 <<EOF
$greeting
I am ${USER} in directory $(pwd)
$(for i in $(seq 1 9); do echo "hello $i"; done)
EOF
echo "$myheredoc2"

echo ""
echo "*** append to file /tmp/appendint.txt ***"
datestr=$(date +"%D %T")
cat <<EOF >> /tmp/appendint.txt
appended at $datestr
EOF


text:
package com.jiesoon;

public class Main {

    /**
     * @param args
     */
    public static void main(String[] args) {
        IMAPServer server = new IMAPServer();
        server.start();
    }

}


text:
<?php

/* Usage
 * ->pipe(new DiffernceColumn(array(
 *         "diff"=>"amount",
 * )))
 *
 */
namespace koolreport\processes;

use \koolreport\core\Process;
use \koolreport\core\Utility;

/**
 * This file contains process to create difference column from a column
 *
 * @category  Core
 * @package   KoolReport
 * @author    KoolPHP Inc <support@koolphp.net>
 * @copyright 2017-2028 KoolPHP Inc
 * @license   MIT License https://www.koolreport.com/license#mit-license
 * @link      https://www.koolphp.net
 */
class DifferenceColumn extends Process
{
    protected $previousRow;

    /**
     * Handle on meta received
     *
     * @param array $metaData The meta data
     *
     * @return array New meta data
     */
    protected function onMetaReceived($metaData)
    {
        foreach ($this->params as $copy => $original) {
            $metaData["columns"][$copy] = $metaData["columns"][$original];
            $metaData["columns"][$copy]["type"] = "number";
        }
        return $metaData;
    }

    /**
     * Handle on input start
     *
     * @return null
     */
    public function onInputStart()
    {
        $this->previousRow = null;
    }

    /**
     * Handle on data input
     *
     * @param array $row The input data row
     *
     * @return null
     */
    public function onInput($row)
    {
        //Process data here
        foreach ($this->params as $copy => $original) {
            $row[$copy] = $row[$original] - Utility::get($this->previousRow, $original, 0);
        }
        $this->previousRow = $row;
        $this->next($row);
    }
}


text:
module.exports = function (log) {
	return function verifySignature (request, response, next) {
		log.debug('verifySignature middleware')

		if (!request.localSignature) return next(new Error('missing localSignature'))

		if (!request.remoteSignature) return next(new Error('missing remoteSignature'))

		if (request.localSignature !== request.remoteSignature) {
			return next(new Error('signatures do not match'))
		}

		next()
	}
}


text:
"""
Eckert IV
=========

The Eckert IV projection, presented by the German cartographer Max
Eckert-Greiffendorff in 1906, is a pseudo-cylindrical equal-area projection. Central
meridian and all parallels are straight lines; other meridians are equally spaced
elliptical arcs. The scale is true along latitude 40°30'.

**kf**\ [*lon0/*]\ *scale* or **Kf**\ [*lon0/*]\ *width*

The projection is set with **kf** or **Kf**. The central meridian is set with the
optional *lon0*, and the figure size is set with *scale* or *width*.
"""
import pygmt

fig = pygmt.Figure()
# Use region "d" to specify global region (-180/180/-90/90)
fig.coast(region="d", projection="Kf12c", land="ivory", water="bisque4", frame="afg")
fig.show()


text:
/* @flow */

import React from 'react-native';
import AppText from '../AppText';
import LargeButton from './LargeButton';
import GoogleLogin from '../../modules/GoogleLogin';
import Facebook from '../../modules/Facebook';
import Colors from '../../../Colors.json';

const {
	StyleSheet,
	View,
	Image
} = React;

const styles = StyleSheet.create({
	container: {
		flex: 1,
		flexDirection: 'row',
		alignItems: 'stretch',
		backgroundColor: Colors.primary
	},
	cover: {
		flex: 1,
		width: null,
		height: null
	},
	overlay: {
		flex: 1,
		alignItems: 'stretch',
		padding: 32,
		backgroundColor: Colors.fadedBlack
	},
	image: {
		resizeMode: 'contain',
		margin: 4
	},
	imageLogo: {
		height: 59,
		width: 108
	},
	imageLogoType: {
		height: 35,
		width: 219
	},
	logoContainer: {
		flex: 1,
		alignItems: 'center',
		justifyContent: 'center',
		margin: 16
	},
	tip: {
		color: Colors.white,
		textAlign: 'center',
		paddingHorizontal: 4,
		marginVertical: 8
	},
	buttonContainer: {
		alignItems: 'stretch'
	},
	facebook: {
		backgroundColor: Colors.facebook
	},
	google: {
		backgroundColor: Colors.google
	}
});

const PROVIDER_GOOGLE = 'google';
const PROVIDER_FACEBOOK = 'facebook';
const PERMISSION_PUBLIC_PROFILE = 'public_profile';
const PERMISSION_EMAIL = 'email';

type State = {
	googleLoading: boolean;
	facebookLoading: boolean;
}

export default class SignIn extends React.Component {
	state: State = {
		googleLoading: false,
		facebookLoading: false
	};

	_onSignInSuccess = async (provider: string, token: string) => {
		try {
			await this.props.signIn({ provider, token });
		} catch (e) {
			this._onSignInFailure(provider);
		}
	};

	_onSignInFailure = (provider: string) => {
		switch (provider) {
		case PROVIDER_GOOGLE:
			this.setState({
				googleLoading: false
			});
			break;
		case PROVIDER_FACEBOOK:
			this.setState({
				facebookLoading: false
			});
			break;
		}
	};

	_signInWithFacebook = async (): Promise => {
		try {
			const result = await Facebook.logInWithReadPermissions([ PERMISSION_PUBLIC_PROFILE, PERMISSION_EMAIL ]);

			const {
				permissions_granted,
				token
			} = result;

			if (permissions_granted.length && permissions_granted.indexOf(PERMISSION_PUBLIC_PROFILE) > -1 && permissions_granted.indexOf(PERMISSION_EMAIL) > -1) {
				this._onSignInSuccess(PROVIDER_FACEBOOK, token);
			} else {
				this._onSignInFailure(PROVIDER_FACEBOOK);
			}
		} catch (e) {
			this._onSignInFailure(PROVIDER_FACEBOOK);
		}
	};

	_signInWithGoogle = async (): Promise => {
		try {
			const result = await GoogleLogin.logIn();

			this._onSignInSuccess(PROVIDER_GOOGLE, result.token);
		} catch (e) {
			this._onSignInFailure(PROVIDER_GOOGLE);
		}
	};

	_handleFacebookPress = () => {
		this.setState({
			facebookLoading: true
		});

		requestAnimationFrame(() => this._signInWithFacebook());
	};

	_handleGooglePress = () => {
		this.setState({
			googleLoading: true
		});

		requestAnimationFrame(() => this._signInWithGoogle());
	};

	render() {
		return (
			<View style={styles.container}>
				<Image source={require('../../../assets/signin_bg.jpg')} style={styles.cover}>
					<View style={styles.overlay}>
						<View style={styles.logoContainer}>
							<Image source={require('../../../assets/logo.png')} style={[ styles.image, styles.imageLogo ]} />
							<Image source={require('../../../assets/logotype.png')} style={[ styles.image, styles.imageLogoType ]} />
						</View>
						<View style={styles.buttonContainer}>
							<AppText style={styles.tip}>SIGN IN OR SIGN UP WITH</AppText>
							<LargeButton
								style={styles.facebook}
								spinner={this.state.facebookLoading}
								disabled={this.state.facebookLoading}
								label={this.state.facebookLoading ? '' : 'Facebook'}
								onPress={this._handleFacebookPress}
							/>
							<LargeButton
								style={styles.google}
								spinner={this.state.googleLoading}
								disabled={this.state.googleLoading}
								label={this.state.googleLoading ? '' : 'Google'}
								onPress={this._handleGooglePress}
							/>
						</View>
					</View>
				</Image>
			</View>
		);
	}
}

SignIn.propTypes = {
	signIn: React.PropTypes.func.isRequired
};


text:
export default   {
    ErrorMessage: {
        EmptySearchResults: 'Empty BLAT Search results'
    }
};


text:
from __future__ import unicode_literals
import logging

try:
    from urllib.parse import urlencode
except ImportError:
    from urllib import urlencode

import requests

from .exceptions import DadosGovBRException
from .factory import model_dict_factory, model_list_factory

logger = logging.getLogger(__name__)

class DadosGovBR(object):
    base_api_url = 'http://dados.gov.br/api'
    api_version = 3
    endpoint = '{}/{}/action'.format(base_api_url, api_version)
    timeout = 4

    def _request(self, resource, **params):
        for key, value in params.items():
            try:
                if isinstance(value, unicode):
                    params[key] = value.encode('utf-8')
                elif isinstance(value, str):
                    params[key] = value.decode('utf-8')
            except NameError:  # python3
                pass

        url = '{endpoint}/{resource}?{params}'.format(
            endpoint=self.endpoint, resource=resource, params=urlencode(params))
        logger.info('Request URL: {}'.format(url))

        response = requests.get(url, timeout=self.timeout)
        logger.info('Response: status {}'.format(response.status_code))

        data = response.json()
        if data['success']:
            return data['result']
        else:
            logger.debug('Response error: headers={}, content={}, '.format(response.headers, response.content))
            raise DadosGovBRException(data['error'])

    #
    # Public API
    #

    def search_resources(self, query, search_key='name', **kwargs):
        query = '{}:{}'.format(search_key, query)
        result = self._request('resource_search', query=query, **kwargs)
        return model_list_factory('resource', result['results'])

    def search_datasets(self, query, **kwargs):
        result = self._request('package_search', q=query, **kwargs)
        return model_list_factory('dataset', result['results'])

    def get_datasets(self):
        return model_list_factory('dataset item', self._request('package_list'))

    def get_dataset(self, dataset_id):
        dataset = self._request('package_show', id=dataset_id)
        return model_dict_factory('dataset', dataset)

    def get_tags(self):
        tags = self._request('tag_list')
        return model_list_factory('tag item', tags)

    def get_tag(self, tag_id):
        tag = self._request('tag_show', id=tag_id)
        return model_dict_factory('tag', tag)


text:
SALVADOR	ANNOUNCED	SPANIARDS
GOVERNMENT	EVACUATE	SPANIARDS
WHO	LIVE	SPANIARDS
TEJADA	TOLD	SPOUSES
EFE	INCLUDE	SPOUSES
WHO	EVACUATED	SPOUSES
MOST	ASKED	COUNTRY
SOME	RECEIVED	COUNTRY
MOST	ASKED	THREATS
SOME	RECEIVED	THREATS
OFFICIAL	SAID	PEOPLE
EMBASSY	HAVE	PEOPLE
MEANS	ACCOMPANY	PEOPLE
OFFICIAL	SAID	SECURITY
EMBASSY	HAVE	SECURITY
MEANS	ACCOMPANY	SECURITY
EVACUEES	LEAVE	SALVADOR
WHO	ARRIVED	SALVADOR
EVACUEES	LEAVE	FUNERAL
WHO	ARRIVED	FUNERAL


text:
package com.puresoltechnologies.commons.math.money;

import com.puresoltechnologies.commons.math.AbstractValue;

public class PhysicalValueWithMoney<T> extends AbstractValue<T> {

    private static final long serialVersionUID = -7173959637653740015L;

    public PhysicalValueWithMoney(T value,
	    PhysicalParameterWithMoney<T> parameter) {
	super(value, parameter);
    }

    @Override
    public PhysicalParameterWithMoney<T> getParameter() {
	return (PhysicalParameterWithMoney<T>) super.getParameter();
    }

}


text:
//
//  XVersionLabelFactory.h
//  xFace
//
//

#import <UIKit/UIKit.h>

@interface XVersionLabelFactory : NSObject

/**
    创建version label实例
    @param frame, the frame of super view
 */
+ (id) createWithFrame:(CGRect) frame;

@end


text:
// +build tools

package hack

import (
	_ "github.com/bazelbuild/bazel-gazelle/cmd/gazelle"
	_ "github.com/bazelbuild/buildtools/buildifier"
)


text:
package org.jbpm.services.task.utils;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.jbpm.services.task.impl.model.GroupImpl;
import org.jbpm.services.task.impl.model.I18NTextImpl;
import org.jbpm.services.task.impl.model.PeopleAssignmentsImpl;
import org.jbpm.services.task.impl.model.TaskDataImpl;
import org.jbpm.services.task.impl.model.TaskImpl;
import org.jbpm.services.task.impl.model.UserImpl;
import org.kie.api.task.model.I18NText;
import org.kie.api.task.model.OrganizationalEntity;
import org.kie.api.task.model.Task;

/**
 *
 * @author salaboy
*/
public class TaskFluent {

    private TaskImpl task;
    private PeopleAssignmentsImpl assignments;
    private List<I18NText> names;
    private List<I18NText> descriptions;
    private List<I18NText> subjects;

    public TaskFluent() {
        if (task == null) {
            task = new TaskImpl();
            task.setTaskData(new TaskDataImpl());
            assignments = new PeopleAssignmentsImpl();
            task.setPeopleAssignments(assignments);
            names = new ArrayList<I18NText>();
            task.setNames(names);
            descriptions = new ArrayList<I18NText>();
            task.setDescriptions(descriptions);
            subjects = new ArrayList<I18NText>();
            task.setSubjects(subjects);
        }
    }

    public Task getTask() {
        if(((TaskDataImpl)task.getTaskData()).getCreatedOn() == null){
            ((TaskDataImpl)task.getTaskData()).setCreatedOn(new Date());
        }
        return task;
    }

    public TaskFluent setName(String name) {
        task.setName(name);
        return this;
    }

    public TaskFluent setDescription(String description) {
        task.setDescription(description);
        return this;
    }

    public TaskFluent setSubject(String subject) {
        task.setSubject(subject);
        return this;
    }

    public TaskFluent setWorkItemId(long workItemId){
        ((TaskDataImpl)task.getTaskData()).setWorkItemId(workItemId);
        return this;
    }

    public TaskFluent setWorkItemId(String deploymentId){
        ((TaskDataImpl)task.getTaskData()).setDeploymentId(deploymentId);
        return this;
    }

    public TaskFluent setProcessId(String processId){
        ((TaskDataImpl)task.getTaskData()).setProcessId(processId);
        return this;
    }

    public TaskFluent setProcessInstanceId(long processInstanceId){
        ((TaskDataImpl)task.getTaskData()).setProcessInstanceId(processInstanceId);
        return this;
    }

    public TaskFluent setProcessSessionId(int processSessionId){
        ((TaskDataImpl)task.getTaskData()).setProcessSessionId(processSessionId);
        return this;
    }

    public TaskFluent setParentId(long parentId){
        ((TaskDataImpl)task.getTaskData()).setParentId(parentId);
        return this;
    }

    public TaskFluent setCreatedBy(String userId){
        ((TaskDataImpl)task.getTaskData()).setCreatedBy(new UserImpl(userId));
        return this;
    }

    public TaskFluent setCreatedOn(Date createdOn){
        ((TaskDataImpl)task.getTaskData()).setCreatedOn(createdOn);
        return this;
    }

    public TaskFluent setDueDate(Date dueDate){
        ((TaskDataImpl)task.getTaskData()).setExpirationTime(dueDate);
        return this;
    }

    public TaskFluent addI18NName(String language, String name){
        task.getNames().add(new I18NTextImpl(language, name));
        return this;
    }

    public TaskFluent addI18NDescription(String language, String description){
        task.getDescriptions().add(new I18NTextImpl(language, description));
        return this;
    }

    public TaskFluent addI18NSubject(String language, String subject){
        task.getSubjects().add(new I18NTextImpl(language, subject));
        return this;
    }

    public TaskFluent setPriority(int priority) {
        task.setPriority(priority);
        return this;
    }

    public TaskFluent addPotentialUser(String userId) {
        if(assignments.getPotentialOwners().isEmpty()){
            List<OrganizationalEntity> potentialOwners = new ArrayList<OrganizationalEntity>();
            assignments.setPotentialOwners(potentialOwners);
        }
        assignments.getPotentialOwners().add(new UserImpl(userId));

        return this;
    }

    public TaskFluent addPotentialGroup(String groupId) {
        if(assignments.getPotentialOwners().isEmpty()){
            List<OrganizationalEntity> potentialOwners = new ArrayList<OrganizationalEntity>();
            assignments.setPotentialOwners(potentialOwners);
        }
        assignments.getPotentialOwners().add(new GroupImpl(groupId));

        return this;
    }

    public TaskFluent setAdminUser(String userId) {
        if(assignments.getBusinessAdministrators().isEmpty()){
            List<OrganizationalEntity> businessAdmins = new ArrayList<OrganizationalEntity>();
            assignments.setBusinessAdministrators(businessAdmins);
        }
        assignments.getBusinessAdministrators().add(new UserImpl(userId));

        return this;
    }

     public TaskFluent setAdminGroup(String groupId) {
        if(assignments.getBusinessAdministrators().isEmpty()){
            List<OrganizationalEntity> businessAdmins = new ArrayList<OrganizationalEntity>();
            assignments.setBusinessAdministrators(businessAdmins);
        }
        assignments.getBusinessAdministrators().add(new GroupImpl(groupId));

        return this;
    }

    public TaskFluent setFormName(String formName){
        task.setFormName(formName);
        return this;
    }

    public TaskFluent setDeploymentID(String deploymentId){
        ((TaskDataImpl)task.getTaskData()).setDeploymentId(deploymentId);
        return this;
    }

}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">

<title>What Are Locales and How Do I Use Them?</title>

Locale-Sensitive Data

    What Are Locales and How Do I Use Them?

In JDK 1.1, a
Localeobject represents a specific
locale (remember, a locale is a geographic or political
region that shares the same language and customs).
A Locale object is just an identifier for a region--it
does not contain any application-specific data
for that region.

For example, the AroundTheWorld
program uses three Locale objects: one for the
United States, one for France, and one for the United Kingdom.
These Locale objects do not contain the population,
literacy rate, or any other AroundTheWorld specific
data. The application-specific data is contained in
resource bundles. The program uses a Locale
object to identify what the current locale is and to
decide which resource bundle to use to construct its
display.

Let's take a look at the source code for AroundTheWorld.
In particular, let's focus on the code that uses Locale objects.
The IntlWindow class
defines an array of Locales, called supportedLocales,
which is created and initialized as follows:

private Locale supportedLocales[] = {
    Locale.US,
    Locale.FRANCE,
    Locale.UK
};

This array indicates the number of locales supported by
the program and what those locales are. AroundTheWorld currently
supports three locales--the United States, France,
and the United Kingdom--and uses three of the Locale class's
convenient constants to create them.

The construct Locale.US is equivalent to:

new Locale("en", "US");

This particular Locale constructor requires two arguments:
The language code and the country code for the Locale that
you want to create.

The language codes are lower-case, two-letter codes defined by
ISO-639. These codes should only be used programmatically.
To display the language name to the user, use getDisplayLanguage.
You can find a full list of language codes at a number of sites, such as:
http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt

The country codes are upper-case, two-letter codes defined by
ISO-3166. Again, these codes should only be used programmatically.
To display the country name to the user, use getDisplayCountry.
You can find a full list of these codes at a number of sites, such as:
http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html

The Locale class has one other constructor that requires three
arguments: The language code, the country code as before, and
the variant code. For example, the following code snippet creates
a California Locale object.

Locale califLocale = new Locale("en", "US", "california");

Note: The JDK does not support a California
variant of the United States locale. If you tried to get a
number formatter or other similar object for this locale,
it will be suitable for the more general United States locale.
For information about adding support for your own locales
(such as the California locale), see [PENDING].

The variant codes are vendor and browser-specific.
Use WIN for Windows, MAC for Macintosh, and POSIX for POSIX.
Remember that if the Variant is not found, the more generic version
will be used. That is, if you ask for "en", "US", "MAC", and
there is no Macintosh version (the code may not even be running
on a Macintosh), then "en", "US" will be used. Where there are
two variants, separate them with an underscore, and put the most
important one first. For example, a Traditional Spanish collation
for Windows might be referenced, with "ES", "ES", "Traditional_WIN".

The JDK provides support for the following locales:

 Locale	 Language	 Country

 da_DK	 Danish	 Denmark

 de_AT	 German	 Austria

 de_CH	 German	 Switzerland

 de_DE	 German	 Germany

 el_GR	 Greek	 Greece

 en_CA	 English	 Canada

 en_GB	 English	 United Kingdom

 en_IE	 English	 Ireland

 en_US	 English	 United States

 es_ES	 Spanish	 Spain

 fi_FI	 Finnish	 Finland

 fr_BE	 French	 Belgium

 fr_CA	 French	 Canada

 fr_CH	 French	 Switzerland

 fr_FR	 French	 France

 it_CH	 Italian	 Switzerland

 it_IT	 Italian	 Italy

 ja_JP	 Japanese	 Japan

 ko_KR	 Korean	 Korea

 nl_BE	 Dutch	 Belgium

 nl_NL	 Dutch	 Netherlands

 no_NO	 Norwegian (Nynorsk)	 Norway

 no_NO_B	 Norwegian (Bokmål)	 Norway

 pt_PT	 Portuguese	 Portugal

 sv_SE	 Swedish	 Sweden

 tr_TR	 Turkish	 Turkey

 zh_CN	 Chinese (Simplified)	 China

 zh_TW	 Chinese (Traditional)	 Taiwan

[PENDING: define exactly what supported means]

You can explicitly create a Locale object as shown above
or you can get a Locale object from the application or
from an AWT
Component. When an IntlWindow is first created, it uses
its own Locale object to establish which locale
is initially selected (and thus which flag is highlighted
and which LinguaPanel is displayed):

private int selectedFlag = -1;

. . .

currentLocale = getLocale();

for (int i = 0; i < supportedLocales.length; i++) {
    if (currentLocale == supportedLocales[i])
        selectedFlag = i;
}

if (selectedFlag == -1) {
    currentLocale = supportedLocales[0];
    selectedFlag = 0;
}

Once you've got a Locale object, you can:

get information
from it about the locale

pass it to other objects that perform
Locale-Sensitive Operations

Getting Information from a Locale

The Locale class provides a number of "getter" methods for
retrieving information about the locale: getCountry,
getLanguage, getDisplayLanguage to
name a few.

The AroundTheWorld program uses Locale's getDisplayName
method to provide a unique name for each LinguaPanel to the CardLayout
layout manager:

cards.add(supportedLocales[i].getDisplayName(), linguaPanel);

The CardLayout layout manager uses this name to show the correct
LinguaPanel based on the currently selected locale:

((CardLayout)cards.getLayout()).show(cards, currentLocale.getDisplayName());

This form of getDisplayName returns the name of
the locale in the language of application's default locale.
The Locale class provides a locale-sensitive version
of getDisplayName which the LinguaPanel uses
to display the name of the currently selected locale to the user
in the language of the currently selected locale:

localeValue.setText(locale.getDisplayName(locale));

[PENDING: make it more explicit about why we couldn't use the locale-specific
getDisplayName in the first case]

Locale-Sensitive Operations

AroundTheWorld uses
an array of Locale objects to identify the locales that it
supports. The program also uses locales to inform
locale-sensitive operations (such as constructing the
LinguaPanels, and loading resource bundles) which
locale to use.

For example, look at the code in
IntlWindow
that creates the LinguaPanels:

// create a card panel
    cards = new Panel();
    cards.setLayout(new CardLayout());

// create the LinguaPanels that go into the card layout
    for (int i = 0; i < supportedLocales.length; i ++) {
        LinguaPanel linguaPanel = null;
        try {
            linguaPanel = new LinguaPanel(supportedLocales[i], parentApplet,
                                  defaultFont, boldFont, soundImages, soundNames);
        } catch (java.util.MissingResourceException e) {
            System.err.println("Couldn't load resource(s).");
            System.err.println(e);
        }

        // add it to the card layout
        cards.add(supportedLocales[i].getDisplayName(), linguaPanel);
    }

// add the card layout to this window
    add("Center", cards);

This code snippet steps through the supportedLocales
array and creates one LinguaPanel for each supported locale. Because
the creation of a LinguaPanel is locale-sensitive (it displays
text and numbers and other language-dependent elements) its
constructor requires a Locale object as an argument. What does
LinguaPanel do with its Locale object? Let's check it out.

The first thing the LinguaPanel
constructor does is to load resource bundles based on the locale argument.
These resource bundles contain text and numbers specific to
the locale. Resource bundles are covered in the next section:
Managing Locale-Sensitive Data.

LinguaPanel also uses the Locale object to get date, number,
currency and number formatters appropriate for the locale.
Formatting is covered along with data parsing in
How to Format Numbers, Dates and Times, and Messages.

Locale-Sensitive Data