text:
<?php

namespace monitorbacklinks\yii2wp;

use HieuLe\WordpressXmlrpcClient\WordpressClient;
use yii\base\Component;
use yii\base\ErrorException;
use yii\base\InvalidConfigException;
use yii\caching\Cache;
use yii\validators\UrlValidator;
use Yii;

/**
 * Yii2 component for integration with Wordpress CMS via XML-RPC API.
 *
 * This component is built on top of [Wordpress XML-RPC PHP Client](https://github.com/letrunghieu/wordpress-xmlrpc-client)
 * by [Hieu Le Trung](https://github.com/letrunghieu).
 *
 * @method array getPost(integer $postId, array $fields = array()) Retrieve a post of any registered post type.
 * @method array getPosts(array $filters = array(), array $fields = array()) Retrieve list of posts of any registered post type.
 * @method integer|boolean newPost(string $title, string $body, array $content = array()) Create a new post of any registered post type.
 * @method boolean editPost(integer $postId, string $content) Edit an existing post of any registered post type.
 * @method boolean deletePost(integer $postId) Delete an existing post of any registered post type.
 * @method array getPostType(string $postTypeName, array $fields = array()) Retrieve a registered post type.
 * @method array getPostTypes(array $filter = array(), array $fields = array()) Retrieve list of registered post types.
 * @method array getPostFormats() Retrieve list of post formats.
 * @method array getPostStatusList() Retrieve list of supported values for post_status field on posts.
 * @method array getTaxonomy(string $taxonomy) Retrieve information about a taxonomy.
 * @method array getTaxonomies() Retrieve a list of taxonomies.
 * @method array getTerm(integer $termId, string $taxonomy) Retrieve a taxonomy term.
 * @method array getTerms(string $taxonomy, array $filter = array()) Retrieve list of terms in a taxonomy.
 * @method integer|boolean newTerm(string $name, string $taxomony, string $slug = null, string $description = null, integer $parentId = null) Create a new taxonomy term.
 * @method boolean editTerm(integer $termId, string $taxonomy, array $content = array()) Edit an existing taxonomy term.
 * @method boolean deleteTerm(integer $termId, string $taxonomy) Delete an existing taxonomy term.
 * @method array getMediaItem(integer $itemId) Retrieve a media item (i.e, attachment).
 * @method array getMediaLibrary(array $filter = array()) Retrieve list of media items.
 * @method array uploadFile(string $name, string $mime, string $bits) Upload a media file.
 * @method integer|boolean getCommentCount(integer $postId) Retrieve comment count for a specific post.
 * @method array getComment(integer $commentId) Retrieve a comment.
 * @method array getComments(array $filter = array()) Retrieve list of comments.
 * @method integer|boolean newComment(integer $post_id, array $comment) Create a new comment.
 * @method boolean editComment(integer $commentId, array $comment) Edit an existing comment.
 * @method boolean deleteComment(integer $commentId) Remove an existing comment.
 * @method array getCommentStatusList() Retrieve list of comment statuses.
 * @method array getOptions(array $options = array()) Retrieve blog options.
 * @method array setOptions(array $options) Edit blog options.
 * @method array getUsersBlogs() Retrieve list of blogs for this user.
 * @method array getUser(integer $userId, array $fields = array()) Retrieve a user.
 * @method array getUsers(array $filters = array(), array $fields = array()) Retrieve list of users.
 * @method array getProfile(array $fields = array()) Retrieve profile of the requesting user.
 * @method boolean editProfile(array $content) Edit profile of the requesting user.
 *
 * @link      https://github.com/monitorbacklinks/yii2-wordpress Yii2 Wordpress project page.
 * @license   https://github.com/monitorbacklinks/yii2-wordpress/blob/master/LICENSE.md MIT
 * @version   1.1.0
 */
class Wordpress extends Component
{
    /**
     * @var string $endpoint Wordpress XML-RPC API endpoint.
     */
    public $endpoint;

    /**
     * @var string $username Wordpress authentication username.
     * Please note, that any actions made by XML-RPC will be made on behalf of this user.
     */
    public $username;

    /**
     * @var string $password Wordpress authentication password.
     */
    public $password;

    /**
     * @var array $proxyConfig Proxy configuration array has these fields:
     *

     *
proxy_ip: the ip of the proxy server (WITHOUT port)

     *
proxy_port: the port of the proxy server

     *
proxy_user: the username for proxy authorization

     *
proxy_pass: the password for proxy authorization

     *
proxy_mode: value for CURLOPT_PROXYAUTH option (default to CURLAUTH_BASIC)

     *

     */
    public $proxyConfig = [];

    /**
     * @var array $httpAuthConfig HTTP Auth configuration array has these fields:
     *

     *
auth_user: the username for server authentication

     *
auth_pass: the password for server authentication

     *
auth_mode: value for CURLOPT_HTTPAUTH option (default to CURLAUTH_BASIC)

     *

     */
    public $httpAuthConfig = [];

    /**
     * @var boolean $enableQueryCache Whether to enable query caching.
     * Note that in order to enable query caching, a valid cache component as specified by [[queryCache]] must be
     * enabled and [[enableQueryCache]] must be set true.
     * Also, only the results of the queries enclosed within [[cache()]] will be cached.
     * @see $queryCache
     * @see cache()
     * @see noCache()
     */
    public $enableQueryCache = true;

    /**
     * @var integer $queryCacheDuration The default number of seconds that query results can remain valid in cache.
     * Use 0 to indicate that the cached data will never expire.
     * Defaults to 3600, meaning 3600 seconds, or one hour. Use 0 to indicate that the cached data will never expire.
     * The value of this property will be used when [[cache()]] is called without a cache duration.
     * @see $enableQueryCache
     * @see cache()
     */
    public $queryCacheDuration = 3600;

    /**
     * @var Cache|string $queryCache The cache object or the ID of the cache application component that is used for query caching.
     * @see $enableQueryCache
     */
    public $queryCache = 'cache';

    /**
     * @var bool $catchExceptions Whether to catch exceptions thrown by Wordpress API, pass them to the log and return
     * default value, or transmit them further along the call chain.
     */
    public $catchExceptions = true;

    /**
     * @var array $methodMap An internal storage for allowed methods and their values in case of error.
     * @internal
     */
    protected $methodMap = [
        'getPost' => [],
        'getPosts' => [],
        'newPost' => false,
        'editPost' => false,
        'deletePost' => false,
        'getPostType' => [],
        'getPostTypes' => [],
        'getPostFormats' => [],
        'getPostStatusList' => [],
        'getTaxonomy' => [],
        'getTaxonomies' => [],
        'getTerm' => [],
        'getTerms' => [],
        'newTerm' => false,
        'editTerm' => false,
        'deleteTerm' => false,
        'getMediaItem' => [],
        'getMediaLibrary' => [],
        'uploadFile' => [],
        'getCommentCount' => false,
        'getComment' => [],
        'getComments' => [],
        'newComment' => false,
        'editComment' => false,
        'deleteComment' => false,
        'getCommentStatusList' => [],
        'getOptions' => [],
        'setOptions' => [],
        'getUsersBlogs' => [],
        'getUser' => [],
        'getUsers' => [],
        'getProfile' => [],
        'editProfile' => false,
        'callCustomMethod' => false,
    ];

    /**
     * @var array $_queryCacheInfo Query cache parameters for the [[cache()]] calls.
     * @see getQueryCacheInfo()
     */
    private $_queryCacheInfo = [];

    /**
     * @var WordpressClient $_clientInstance Wordpress API client instance.
     */
    private $_clientInstance;

    /**
     * @inheritdoc
     */
    public function init()
    {
        parent::init();

        // Validate given parameters
        $className = self::className();
        $urlValidator = new UrlValidator([
            'enableIDN' => extension_loaded('intl')
        ]);
        if (empty($this->endpoint) || !$urlValidator->validate($this->endpoint)) {
            throw new InvalidConfigException("Class \"{$className}\" requires a valid URL to Wordpress XML-RPC API endpoint to be set in \"\$endpoint\" attribute.");
        }
        if (empty($this->username) || empty($this->password)) {
            throw new InvalidConfigException("Class \"{$className}\" requires a valid Wordpress credentials to be set in \"\$username\" and \"\$password\" attributes.");
        }
        if (!is_array($this->proxyConfig)) {
            throw new InvalidConfigException("Class \"{$className}\" requires \"\$proxyConfig\" to be given in array format.");
        }
        if (!is_array($this->httpAuthConfig)) {
            throw new InvalidConfigException("Class \"{$className}\" requires \"\$httpAuthConfig\" to be given in array format.");
        }

        // Create API client
        $this->_clientInstance = new WordpressClient($this->endpoint, $this->username, $this->password);
        $this->_clientInstance->setProxy($this->proxyConfig);
        $this->_clientInstance->setAuth($this->httpAuthConfig);
    }

    /**
     * Calls the named method which is not a class method.
     *
     * This method will check if Wordpress client has the named method and will execute it if available.
     * Do not call this method directly as it is a PHP magic method that will be implicitly called when an unknown
     * method is being invoked.
     *
     * @param string $name The method name.
     * @param array $params Method parameters.
     *
     * @throws \Exception If error occurred an $catchExceptions set to false.
     * @return mixed The method return value.
     */
    public function __call($name, $params)
    {
        // If method exists
        $client = $this->getClient();
        if (method_exists($client, $name) && array_key_exists($name, $this->methodMap) && is_callable([$client, $name])) {
            $profile = "Running an XML-RPC API call: {$name}";
            $token = "monitorbacklinks\\yii2wp\\Wordpress::{$name}";
            $dataRetrieval = (strpos($name, 'get') === 0);
            try {

                Yii::beginProfile($profile);

                // Initialize cache
                $cacheKey = [__CLASS__, $name, $params];
                $info = $this->getQueryCacheInfo();
                if (is_array($info)) {
                    /* @var $cache \yii\caching\Cache */
                    $cache = $info[0];
                }

                // Search result in the cache
                if (isset($cache) && $dataRetrieval) {
                    if (($result = $cache->get($cacheKey)) !== false) {
                        Yii::trace('Query result served from cache', $token);
                        Yii::endProfile($profile);
                        return $result;
                    }
                }

                // Get result and but it to the cache
                $result = call_user_func_array([$client, $name], $params);
                if (isset($cache) && $dataRetrieval) {
                    $cache->set($cacheKey, $result, $info[1], $info[2]);
                    Yii::trace('Saved query result in cache', $token);
                }

                Yii::endProfile($profile);
                return $result;

            } catch (\Exception $exception) {
                Yii::endProfile($profile);
                if ($this->catchExceptions) {
                    Yii::error($exception->getMessage(), $token);
                    return $this->methodMap[$name];
                } else {
                    throw $exception;
                }
            }
        }

        return parent::__call($name, $params);
    }

    /**
     * Get wordpress API client instance.
     *
     * @return WordpressClient Wordpress API client instance.
     */
    public function getClient()
    {
        return $this->_clientInstance;
    }

    /**
     * Uses query cache for the queries performed with the callable.
     * When query caching is enabled ([[enableQueryCache]] is true and [[queryCache]] refers to a valid cache),
     * queries performed within the callable will be cached and their results will be fetched from cache if available.
     * For example,
     *
     * ```php
     * // The user profile will be fetched from cache if available.
     * // If not, the query will be made against XML-RPC API and cached for use next time.
     * $profile = Yii::$app->blog->cache(function (Wordpress $blog) {
     *     return $blog->getProfile();
     * });
     * ```
     *
     * Note that query cache is only meaningful for queries that return results. For queries that create, update or
     * delete records, query cache will not be used.
     *
     * @param callable $callable A PHP callable that contains XML-RPC API queries which will make use of query cache.
     * The signature of the callable is `function (Wordpress $blog)`.
     * @param integer $duration The number of seconds that query results can remain valid in the cache. If this is
     * not set, the value of [[queryCacheDuration]] will be used instead.
     * Use 0 to indicate that the cached data will never expire.
     * @param \yii\caching\Dependency $dependency The cache dependency associated with the cached query results.
     * @return mixed The return result of the callable.
     * @throws \Exception If there is any exception during query.
     * @see enableQueryCache
     * @see queryCache
     * @see noCache()
     */
    public function cache(callable $callable, $duration = null, $dependency = null)
    {
        $this->_queryCacheInfo[] = [$duration === null ? $this->queryCacheDuration : $duration, $dependency];
        try {
            $result = call_user_func($callable, $this);
            array_pop($this->_queryCacheInfo);
            return $result;
        } catch (\Exception $e) {
            array_pop($this->_queryCacheInfo);
            throw $e;
        }
    }

    /**
     * Disables query cache temporarily.
     * Queries performed within the callable will not use query cache at all. For example,
     *
     * ```php
     * $blogPosts = Yii::$app->blog->cache(function (Wordpress $blog) {
     *
     *     // ... queries that use query cache ...
     *
     *     return $blog->noCache(function (Wordpress $blog) {
     *         // this query will not use query cache
     *         return $blog->getPosts();
     *     });
     * });
     * ```
     *
     * @param callable $callable A PHP callable that contains XML-RPC API queries which should not use query cache.
     * The signature of the callable is `function (Wordpress $blog)`.
     * @return mixed The return result of the callable.
     * @throws \Exception If there is any exception during query.
     * @see enableQueryCache
     * @see queryCache
     * @see cache()
     */
    public function noCache(callable $callable)
    {
        $this->_queryCacheInfo[] = false;
        try {
            $result = call_user_func($callable, $this);
            array_pop($this->_queryCacheInfo);
            return $result;
        } catch (\Exception $e) {
            array_pop($this->_queryCacheInfo);
            throw $e;
        }
    }

    /**
     * Returns the current query cache information.
     * This method is used internally by [[Wordpress]].
     * @return array The current query cache information, or null if query cache is not enabled.
     * @internal
     */
    protected function getQueryCacheInfo()
    {
        $info = end($this->_queryCacheInfo);
        if ($this->enableQueryCache) {
            if (is_string($this->queryCache) && Yii::$app) {
                $cache = Yii::$app->get($this->queryCache, false);
            } else {
                $cache = $this->queryCache;
            }
            if ($cache instanceof Cache) {
                return is_array($info) ? [$cache, $info[0], $info[1]] : null;
            }
        }
        return null;
    }
}


text:
using BlockTypes;
using Jobs;
using NPC;
using Pandaros.Settlers.NBT;
using Pipliz;
using Pipliz.Mods.BaseGame.Construction;
using Shared;
using System.Collections.Generic;
using System.Linq;

namespace Pandaros.Settlers.Jobs.Construction
{
    [ModLoader.ModManager]
    public class SchematicBuilder : IConstructionType
    {
        private static List<SchematicIterator> _needsChunkLoaded = new List<SchematicIterator>();

        [ModLoader.ModCallback(ModLoader.EModCallbackType.OnShouldKeepChunkLoaded, GameLoader.NAMESPACE + ".Jobs.Construction.SchematicBuilder.OnShouldKeepChunkLoaded")]
        public static void OnShouldKeepChunkLoaded(ChunkUpdating.KeepChunkLoadedData data)
        {
            foreach (var iterator in _needsChunkLoaded)
            {
                if (iterator.CurrentPosition.IsWithinBounds(data.CheckedChunk.Position, data.CheckedChunk.Bounds))
                    data.Result = true;
            }
        }

        List<ItemTypes.ItemTypeDrops> _gatherResults = new List<ItemTypes.ItemTypeDrops>();

        public void DoJob(IIterationType iterationType, IAreaJob areaJob, ConstructionJobInstance job, ref NPCBase.NPCState state)
        {
            int i = 0;
            var bpi = iterationType as SchematicIterator;

            if (bpi == null)
            {
                PandaLogger.Log(ChatColor.yellow, "iterationType must be of type SchematicIterator for the SchematicBuilder.");
                state.SetIndicator(new Shared.IndicatorState(5f, ColonyBuiltIn.ItemTypes.ERRORIDLE.Name));
                AreaJobTracker.RemoveJob(areaJob);
                return;
            }

            while (true) // This is to move past air.
            {
                if (i > 4000)
                    break;

                var adjX = iterationType.CurrentPosition.x - bpi.BuilderSchematic.StartPos.x;
                var adjY = iterationType.CurrentPosition.y - bpi.BuilderSchematic.StartPos.y;
                var adjZ = iterationType.CurrentPosition.z - bpi.BuilderSchematic.StartPos.z;
                var block = bpi.BuilderSchematic.GetBlock(adjX, adjY, adjZ);
                var mapped = block.MappedBlock;
                var buildType = ItemTypes.GetType(mapped.CSIndex);

                if (buildType == null)
                {
                    state.SetIndicator(new Shared.IndicatorState(5f, ColonyBuiltIn.ItemTypes.ERRORIDLE.Name));
                    AreaJobTracker.RemoveJob(areaJob);
                    return;
                }

                if (World.TryGetTypeAt(iterationType.CurrentPosition, out ushort foundTypeIndex))
                {
                    i++;

                    if (foundTypeIndex == buildType.ItemIndex) // check if the blocks are the same, if they are, move past. Most of the time this will be air.
                        if (iterationType.MoveNext())
                            continue;
                        else
                        {
                            if (_needsChunkLoaded.Contains(bpi))
                                _needsChunkLoaded.Remove(bpi);

                            state.SetIndicator(new Shared.IndicatorState(5f, ColonyBuiltIn.ItemTypes.ERRORIDLE.Name));
                            AreaJobTracker.RemoveJob(areaJob);
                            return;
                        }

                    Stockpile ownerStockPile = areaJob.Owner.Stockpile;

                    bool ok = buildType.ItemIndex == ColonyBuiltIn.ItemTypes.AIR.Id;

                    if (!ok && ownerStockPile.Contains(buildType.ItemIndex))
                        ok = true;

                    if (!ok && !string.IsNullOrWhiteSpace(buildType.ParentType))
                    {
                       var parentType = ItemTypes.GetType(buildType.ParentType);

                        if (!ok && ownerStockPile.Contains(parentType.ItemIndex))
                            ok = true;
                    }

                    if (ok)
                    {
                        if (foundTypeIndex != ColonyBuiltIn.ItemTypes.AIR.Id && foundTypeIndex != ColonyBuiltIn.ItemTypes.WATER.Id)
                        {
                            var foundItem = ItemTypes.GetType(foundTypeIndex);

                            if (foundItem != null && foundItem.ItemIndex != ColonyBuiltIn.ItemTypes.AIR.Id && foundItem.OnRemoveItems != null && foundItem.OnRemoveItems.Count > 0)
                                ownerStockPile.Add(foundItem.OnRemoveItems.Select(itm => itm.item).ToList());
                        }

                        if (ServerManager.TryChangeBlock(iterationType.CurrentPosition, foundTypeIndex, buildType.ItemIndex, areaJob.Owner, ESetBlockFlags.DefaultAudio) == EServerChangeBlockResult.Success)
                        {
                            if (buildType.ItemIndex != ColonyBuiltIn.ItemTypes.AIR.Id)
                            {
                                if (--job.StoredItemCount <= 0)
                                {
                                    job.ShouldTakeItems = true;
                                    state.JobIsDone = true;
                                }

                                ownerStockPile.TryRemove(buildType.ItemIndex);
                            }
                        }
                        else
                        {
                            if (!_needsChunkLoaded.Contains(bpi))
                                _needsChunkLoaded.Add(bpi);

                            state.SetIndicator(new Shared.IndicatorState(5f, ColonyBuiltIn.ItemTypes.ERRORIDLE.Name));
                            ChunkQueue.QueuePlayerSurrounding(iterationType.CurrentPosition);
                            return;
                        }
                    }
                }
                else
                {
                    if (!_needsChunkLoaded.Contains(bpi))
                        _needsChunkLoaded.Add(bpi);

                    state.SetIndicator(new Shared.IndicatorState(5f, ColonyBuiltIn.ItemTypes.ERRORIDLE.Name));
                    ChunkQueue.QueuePlayerSurrounding(iterationType.CurrentPosition);
                    return;
                }

                if (iterationType.MoveNext())
                {
                    if (buildType.ItemIndex != ColonyBuiltIn.ItemTypes.AIR.Id)
                        state.SetIndicator(new Shared.IndicatorState(GetCooldown(), buildType.ItemIndex));
                    else
                        state.SetIndicator(new Shared.IndicatorState(GetCooldown(), foundTypeIndex));

                    return;
                }
                else
                {
                    if (_needsChunkLoaded.Contains(bpi))
                        _needsChunkLoaded.Remove(bpi);

                    // failed to find next position to do job at, self-destruct
                    state.SetIndicator(new Shared.IndicatorState(5f, ColonyBuiltIn.ItemTypes.ERRORIDLE.Name));
                    AreaJobTracker.RemoveJob(areaJob);
                    return;
                }
            }

            if (iterationType.MoveNext())
            {
                state.SetIndicator(new Shared.IndicatorState(5f, ColonyBuiltIn.ItemTypes.ERRORIDLE.Name));
                return;
            }
            else
            {
                if (_needsChunkLoaded.Contains(bpi))
                    _needsChunkLoaded.Remove(bpi);

                // failed to find next position to do job at, self-destruct
                state.SetIndicator(new Shared.IndicatorState(5f, ColonyBuiltIn.ItemTypes.ERRORIDLE.Name));
                AreaJobTracker.RemoveJob(areaJob);
                PandaLogger.Log(ChatColor.yellow, "Failed to MoveNext after while. Iterator position: {0}.", iterationType.CurrentPosition);
                return;
            }
        }

        public static float GetCooldown()
        {
            return Random.NextFloat(1.5f, 2.5f);
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
/*Copyright: 2006 Apple Computer, Inc. All rights reserved.*/

#import <PluginManager/PROAPIAccessing.h>
#import "ApertureSDKCommon.h"
#import "ApertureExportManager.h"

/*!
 @typedef		ApertureExportProgress
 @abstract		Provides values for UI progress display during export.
 @field			currentValue Current progress.
 @field			totalValue   Total to do.
 @field			message      Progress message.
 @field			indeterminateProgress   Set to YES to display an indeterminate progress bar.
 @discussion		Aperture uses the values in this structure to display the export progress in the
 UI. Aperture starts calling this method after a plug-in calls -shouldBeginExport
 and stops calling this method after the plug-in calls -shouldFinishExport or
 -shouldCancelExport.
 */
typedef struct
{
	unsigned long	currentValue;
	unsigned long	totalValue;
	NSString		*message;
	BOOL			indeterminateProgress;
} ApertureExportProgress;

/*!
	@protocol		ApertureExportPlugIn
	@abstract		Specifies the methods that all Aperture export plug-ins must implement.
	@discussion		Any plug-in that does not implement the entire protocol fails when a user
					selects the plug-in.
 */
@protocol ApertureExportPlugIn

/*!
	@abstract		Brokers version management between a plug-in and the host application.
	@param			apiManager The ProPlug plug-in manager object.
	@result			An initialized plug-in controller object.
	@discussion		The apiManager object is the protocol broker between a plug-in and the host. It
					ensures that a plug-in supporting a particular version of the API is given the host
					objects that correspond to this version. A plug-in should call -apiForProtocol on
					the apiManager object to obtain a reference to the host export manager for use
					throughout the export process. If the plug-in fails to obtain a reference to the
					host export manager, it should fail to initialize.
 */
- (id)initWithAPIManager:(id<PROAPIAccessing>)apiManager;

/*!
	@abstract		Creates an NSBox for plug-in controls.
	@result			The subclass of NSBox that contains all of the plug-ins UI and controls.
	@discussion		Aperture currently limits the size of the export window to 1100px wide by 750px
					tall. If the size of the window plus the settings view is too large, Aperture
					places the view in the window and then resizes to the maximum. For best results,
					make sure your settings view can resize if necessary. (This is also useful if
					future versions of Aperture change the maximum size.) Visually, plug-ins should
					attempt to separate their controls from the items Aperture provides. Placing
					plug-in controls inside an NSBox is generally the best way to do this.
 */
- (NSView *)settingsView;

/*!
	@abstract	Returns a reference to first item of settingsView.
	@result		Returns a reference to the first item in the tab order of settingsView.
*/
- (NSView *)firstView;

/*!
	@abstract	Returns a reference to the last item of settingsView.
	@result		Returns a reference to the last item in the tab order of settingsView.
*/
- (NSView *)lastView;

/*!
	@abstract	Called when the user displays a plug-in's export UI, or when the export window
				becomes the active window.
*/
- (void)willBeActivated;

/*!
	@abstract	Called when a plug-in's export UI is no longer the active view.
*/
- (void)willBeDeactivated;

/*!
	@abstract	Controls visibility of presets.
	@result		If a plug-in includes a file called "Export Presets.plist" in the Resources folder
				of its bundle and if this file contains valid definitions for one or more export
				presets, then these presets are included in the user's export preset list when the
				plug-in is active and when the user is exporting Versions. If the plug-in also
				returns YES from this method, then only the supplied presets are visible in the
				list. If the plug-in returns NO from this method, then all the user's existing
				presets are visible in addition to the plug-in presets. If the plug-in does not
				provide an "Export Presets.plist" file, or if the file does not contain any
				valid preset definitions, then the return value of this method	has no effect and
				Aperture displays the users existing list.
*/
- (BOOL)allowsOnlyPlugInPresets;

/*!
	@abstract	Controls type of export.
	@result		Returning YES allows the user to export Master images that contain the original, unmodified camera data in its original format. Returning NO allows only Version export.
*/
- (BOOL)allowsMasterExport;

/*!
 	@abstract	Controls type of export.
	@result		Returning YES allows the user to export Version images. (Versions contain all modifications and adjustments to an image	and are processed with the options contained in the currently-selected Export Preset.) Returning NO means Aperture only allows the export of Master images.
*/
- (BOOL)allowsVersionExport;

/*!
 	@abstract	Controls visibility of File Naming Policy options.
	@result		Returning YES allows the user to use Aperture's File Naming Policy options to specify the file name and folder hierarchy for exported images. Returning NO hides the File Naming Policy controls on the export window. The UI elements affected include the Export Name Format popup menu, the Custom Name field, and the Example Name field.
*/
- (BOOL)wantsFileNamingControls;

/*!
 	@abstract	Alerts plug-in that user has switched type of export.
	@discussion	This method indicates that the user has switched between Master and Version export. The plug-in can use -isMasterExport to ask the export manager for the type of export now being used. Because several version images may be based on a single master, the total count of images, along with the properties for each image, may have changed. The plug-in can use -imageCount to get the new image count before calling any other methods on the export manager.
*/
- (void)exportManagerExportTypeDidChange;

/*!
 	@abstract	Controls user prompt for destination path.
	@result		If this method returns YES, Aperture prompts the user for a destination path for an exported image or images. If this method returns NO, Aperture assumes a valid path is provided by -destinationPath.
*/
- (BOOL)wantsDestinationPathPrompt;

/*!
 	@abstract	Returns starting directory.
	@return		If the user is prompted for a destination path (-wantsDestinationPathPrompt return YES), this method should return the starting directory for the dialog box.
*/
- (NSString *)defaultDirectory;

/*!
 	@abstract	Returns a valid destination path for writing the file.
	@result		A valid destination path when Aperture is writing the file (-exportManagerShouldWriteImageData: returns YES) and when no user prompt is requested (-wantsDestinationPathPrompt returns NO). If nil is returned, and if the plug-in asks Aperture to write image data, it will be written to ~/Pictures/Aperture Exports/.
*/
- (NSString *)destinationPath;

/*!
 	@abstract	Alerts plug-in that user has clicked Export button.
	@discussion	Aperture calls this plug-in method when the user clicks the Export button. The plug-in should perform any UI validations here. When the plug-in is ready to begin the export process, it should call Aperture's -shouldBeginExport method to begin the export process.
*/
- (void)exportManagerShouldBeginExport;

/*!
	@abstract	Indicates the base directory where images will be written.
	@param		path The base file system path where images will be written.
	@discussion	The path designations for each image will be relative to this path. The path is provided by the plug-in or by the user, depending on whether the plug-in asked Aperture to display a destination prompt or not. Because the File Naming Policy controls allow the user to specify a hierarchy of export directories based on image data, other export calls may specify a series of subdirectories. The plug-in should retain a reference to this path in order to build the full destination path.
*/
- (void)exportManagerWillBeginExportToPath:(NSString *)path;

/*!
	@abstract	Gives the plug-in the option to selectively export an image.
	@param		index The index of an image.
	@result		Returning YES causes Aperture to export the image at the specified index. Returning NO does nothing.
	@discussion Aperture generates image data for the specified image, either reading Master data from disk or generating the Version data based on the currently-selected options.
 */
- (BOOL)exportManagerShouldExportImageAtIndex:(unsigned)index;

/*!
	@abstract	Confirms indexed image to be exported.
	@param		index The index of an image.
	@discussion	This method confirms the index value that the plug-in returned to -exportManagerShouldExportImageAtIndex:.
*/
- (void)exportManagerWillExportImageAtIndex:(unsigned)index;

/*!
	@abstract	Provides option for plug-in itself to handle image data.
	@param	    imageData An object containing all the data for an image and the specified index.
	@param		path The relative path where the object should be written. (The base path is set in -exportManagerWillBeginExportToPath:.) The file name is the last component of this parameter.
	@param		index The index for the image.
	@result		Returning YES instructs Aperture to write the image data. Returning NO means the plug-in itself retains the data object and can process the image as appropriate.
	@discussion	This method is called every time the plug-in asks Aperture to export and image. NOTE: This method may be called on a secondary thread.
*/
- (BOOL)exportManagerShouldWriteImageData:(NSData *)imageData
						   toRelativePath:(NSString *)path
						  forImageAtIndex:(unsigned)index;

/*!
	@abstract	Confirms that Aperture has written an image.
	@param		path The relative path where the object was written.
	@param		index	The index of the specified image.
	@discussion	This method is only called if the plug-in returned YES from the -exportManagerShouldWriteImageData: method. NOTE: This method may be called on a secondary thread.

*/
- (void)exportManagerDidWriteImageDataToRelativePath:(NSString *)path
								     forImageAtIndex:(unsigned)index;

/*!
	@abstract	Confirms that Aperture has completed processing all export images.
	@discussion	Aperture calls this method once if it has completed generating and (optionally) writing data for the export images requested by the plug-in. Aperture assumes that the plug-in is still performing export operations until the plug-in calls either -shouldCancelExport or -shouldFinishExport. NOTE: This method may be called on a secondary thread.
*/
- (void)exportManagerDidFinishExport;

/*!
	@abstract	Indicates that export should be cancelled.
	@discussion	Indicates that Aperture has encountered an error, or that the user has clicked the Cancel button. Aperture has stopped exporting image data but waits for the plug-in to signal that it is ready to cancel by calling -shouldCancelExport.  Aperture then cleans up the export or progress windows.
  */
- (void)exportManagerShouldCancelExport;

/*!
	@abstract	Displays progress information.
	@result		A pointer to a valid ApertureExportProgress structure.
	@discussion	Aperture uses the values in this structure to display the progress UI. Aperture begins calling this method after the plug-in calls -shouldBeginExport and stops calling this method after the plug-in calls -shouldFinishExport or -shouldCancelExport.
*/
- (ApertureExportProgress *)progress;

/*!
	@abstract	Locks ApertureExportProgress structures.
	@discussion	The plug-in should maintain an NSLock or similar object and perform any necessary locking here. Aperture will always call this method from the main thread before calling -progress.
*/
- (void)lockProgress;

/*!
	@abstract	Alerts plug-in to unlock objects.
	@discussion	The plug-in should maintain an NSLock or similar object and perform any necessary unlocking here. Aperture will always call this method from the main thread after calling -progress.
*/
- (void)unlockProgress;

@end


text:
namespace slang {

/// A wrapper around a pointer that indicates that it should never be null.
/// It deletes some operators and assignments from null, but it can only enforce at
/// runtime, via asserts, that the value is not actually null.
///
/// The real value of this type is in documenting in the API the intentions of the pointer,
/// so that consumers don't need to add explicit null checks.
template<typename T>
class SLANG_EXPORT not_null {
public:
    static_assert(std::is_assignable<T&, std::nullptr_t>::value, "T cannot be assigned nullptr.");

    template<typename U, typename = std::enable_if_t<std::is_convertible<U, T>::value>>
    constexpr not_null(U&& u) : ptr(std::forward<U>(u)) {
        ASSERT(ptr);
    }

    template<typename U, typename = std::enable_if_t<std::is_convertible<U, T>::value>>
    constexpr not_null(const not_null<U>& other) : not_null(other.get()) {}

    not_null(not_null&& other) noexcept = default;
    not_null(const not_null& other) = default;
    not_null& operator=(const not_null& other) = default;

    constexpr T get() const {
        ASSERT(ptr);
        return ptr;
    }

    constexpr operator T() const { return get(); }
    constexpr T operator->() const { return get(); }
    constexpr decltype(auto) operator*() const { return *get(); }

    // prevents compilation when someone attempts to assign a null pointer constant
    not_null(std::nullptr_t) = delete;
    not_null& operator=(std::nullptr_t) = delete;

    // unwanted operators... pointers only point to single objects!
    not_null& operator++() = delete;
    not_null& operator--() = delete;
    not_null operator++(int) = delete;
    not_null operator--(int) = delete;
    not_null& operator+=(std::ptrdiff_t) = delete;
    not_null& operator-=(std::ptrdiff_t) = delete;
    void operator[](std::ptrdiff_t) const = delete;

private:
    T ptr;
};

template<typename T>
std::ostream& operator<<(std::ostream& os, const not_null<T>& val) {
    os << val.get();
    return os;
}

template<typename T, typename U>
auto operator==(const not_null<T>& lhs, const not_null<U>& rhs)
    -> decltype(lhs.get() == rhs.get()) {
    return lhs.get() == rhs.get();
}

template<typename T, typename U>
auto operator!=(const not_null<T>& lhs, const not_null<U>& rhs)
    -> decltype(lhs.get() != rhs.get()) {
    return lhs.get() != rhs.get();
}

template<typename T, typename U>
auto operator<(const not_null<T>& lhs, const not_null<U>& rhs) -> decltype(lhs.get() < rhs.get()) {
    return lhs.get() < rhs.get();
}

template<typename T, typename U>
auto operator<=(const not_null<T>& lhs, const not_null<U>& rhs)
    -> decltype(lhs.get() <= rhs.get()) {
    return lhs.get() <= rhs.get();
}

template<typename T, typename U>
auto operator>(const not_null<T>& lhs, const not_null<U>& rhs) -> decltype(lhs.get() > rhs.get()) {
    return lhs.get() > rhs.get();
}

template<typename T, typename U>
auto operator>=(const not_null<T>& lhs, const not_null<U>& rhs)
    -> decltype(lhs.get() >= rhs.get()) {
    return lhs.get() >= rhs.get();
}

// more unwanted operators
template<typename T, typename U>
std::ptrdiff_t operator-(const not_null<T>&, const not_null<U>&) = delete;
template<class T>
not_null<T> operator-(const not_null<T>&, std::ptrdiff_t) = delete;
template<class T>
not_null<T> operator+(const not_null<T>&, std::ptrdiff_t) = delete;
template<class T>
not_null<T> operator+(std::ptrdiff_t, const not_null<T>&) = delete;

} // namespace slang

namespace std {

template<typename T>
struct hash<slang::not_null<T>> {
    std::size_t operator()(const slang::not_null<T>& value) const { return hash<T>{}(value); }
};

} // namespace std


text:
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

// ReSharper disable once CheckNamespace
namespace Telegram.Bot.Types.InlineQueryResults
{
    /// <summary>
    /// Represents a <see cref="Game"/>.
    /// </summary>
    [JsonObject(MemberSerialization.OptIn, NamingStrategyType = typeof(SnakeCaseNamingStrategy))]
    public class InlineQueryResultGame : InlineQueryResult
    {
        /// <summary>
        /// Type of the result, must be game
        /// </summary>
        [JsonProperty(Required = Required.Always)]
        public override InlineQueryResultType Type => InlineQueryResultType.Game;

        /// <summary>
        /// Short name of the game
        /// </summary>
        [JsonProperty(Required = Required.Always)]
        public string GameShortName { get; }

        /// <summary>
        /// Initializes a new inline query result
        /// </summary>
        /// <param name="id">Unique identifier of this result</param>
        /// <param name="gameShortName">Short name of the game</param>
        public InlineQueryResultGame(string id, string gameShortName)
            : base(id)
        {
            GameShortName = gameShortName;
        }
    }
}


text:
/*
 * BOOOS.h
 *
 *  Created on: Aug 14, 2014
 */

#include "Queue.h"

namespace BOOOS {

// Queue constructor: must initialize queue's attributes
Queue::Queue() {

}

// Queue destructor: must finalize queue's attributes
Queue::~Queue() {

}

// insert method: must insert the Element at the end of the queue
// Error messages:
//   01: invalid Element (if elem == 0)
//   02: duplicated Element (if elem already is on the queue)
void Queue::insert(Queue::Element * elem) {

}

// remove: must search and remove the element from the queue
// Error messages:
//   01: queue is empty
Queue::Element * Queue::remove() {

}

}


text:
<?php

namespace doc\MotoBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use doc\MotoBundle\Entity\Annonce;
use doc\MotoBundle\Entity\Moto;
use doc\MotoBundle\Entity\Departement;
use doc\MotoBundle\Form\AnnonceType;
use doc\MotoBundle\Form\AnnonceDeleteType;
use doc\MotoBundle\Form\AnnonceEditType;
use doc\MotoBundle\Form\PasswordType;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;

class DefaultController extends Controller
{
    public function indexAction(Request $request)
    {

		$repository = $this
		  ->getDoctrine()
		  ->getManager()
		  ->getRepository('docMotoBundle:Annonce');

		//$listeAnnonces = $repository->findByAutorisee(true);
		$listeAnnonces = $repository->findBy(
			array('autorisee' => true),
			array('date' => 'desc')
		);

		$messagesTableau = $request->getSession()->getFlashBag()->get('notice');

		$message = end($messagesTableau);

        return $this->render('docMotoBundle:Default:index.html.twig', array('listeAnnonces' => $listeAnnonces, 'message' => $message));
    }

    public function ajouterAction(Request $request)
    {
		// On crée un objet Annonce
		$annonce = new Annonce();

		$form = $this->get('form.factory')->create(new AnnonceType, $annonce);
		$form->handleRequest($request);

		// On vérifie que les valeurs entrées sont correctes
		// (Nous verrons la validation des objets en détail dans le prochain chapitre)
		if ($form->isValid())
		{
		  $factory = $this->get('security.encoder_factory');
          $encoder = $factory->getEncoder($annonce);
          $password = $encoder->encodePassword($form->get('password')->getData(), $annonce->getSalt());
          $annonce->setPassword($password);

		  // On enregistre notre objet $annonce dans la base de données, par exemple
		  $em = $this->getDoctrine()->getManager();
		  $em->persist($annonce);
		  $em->flush();

		  $request->getSession()->getFlashBag()->add('notice', 'Annonce bien enregistrée. Vous allez recevoir un mail pour la valider.');

		  // Envoi du mail
		  $message = \Swift_Message::newInstance()
			->setSubject('Valider votre annonce "'.$annonce->getTitre().'" sur Moto Echange')
			->setFrom('admin@moto-echange.com')
			->setTo($annonce->getMail())
			->setBody($this->renderView('docMotoBundle:Mails:valider.html.twig', array('lien' => $this->generateUrl('doc_moto_pageValider', array('code' => $annonce->getCodeValidation()), true))), 'text/html')
			;
			$this->get('mailer')->send($message);

		  return $this->redirect($this->generateUrl('doc_moto_accueil'));
		}

		// À ce stade, le formulaire n'est pas valide car :
		// - Soit la requête est de type GET, donc le visiteur vient d'arriver sur la page et veut voir le formulaire
		// - Soit la requête est de type POST, mais le formulaire contient des valeurs invalides, donc on l'affiche de nouveau
		return $this->render('docMotoBundle:Default:ajouter.html.twig', array('form' => $form->createView(), ));
    }

	public function editerAction($id, Request $request)
    {
		$annonce = $this->getDoctrine()
		  ->getManager()
		  ->getRepository('docMotoBundle:Annonce')
		  ->findOneBy(array('id' => $id, 'autorisee' => true))
		;

		if ($annonce == null)
		{
			throw new NotFoundHttpException('Page inexistante.');
		}

		$form2 = $this->createForm(new PasswordType());
		$form2->handleRequest($request);

		$factory = $this->get('security.encoder_factory');
        $encoder = $factory->getEncoder($annonce);

		$passwordCorrect = $annonce->getPassword() === $encoder->encodePassword($form2->get('password')->getData(), $annonce->getSalt());

		$form = $this->get('form.factory')->create(new AnnonceEditType, $annonce);
		$form->handleRequest($request);

		$messagesTableau = $request->getSession()->getFlashBag()->get('notice');
		$message = end($messagesTableau);

		if (($form2->isValid() AND $passwordCorrect == true) OR $form->isValid())
		{

			// On vérifie que les valeurs entrées sont correctes
			if ($form->isValid())
			{

			//On modifie la date d'édition
			$annonce->setDate(new \Datetime());

			  // On enregistre notre objet $annonce dans la base de données, par exemple
			  $em = $this->getDoctrine()->getManager();
			  $em->persist($annonce);
			  $em->flush();

			  $request->getSession()->getFlashBag()->add('notice', 'Annonce bien modifiée.');

			  // On redirige vers la page de visualisation de l'annonce nouvellement modifiée
			  return $this->redirect($this->generateUrl('doc_moto_annonce', array('id' => $annonce->getId(), 'message' => $message)));
			}

			// À ce stade, le formulaire n'est pas valide car :
			// - Soit la requête est de type GET, donc le visiteur vient d'arriver sur la page et veut voir le formulaire
			// - Soit la requête est de type POST, mais le formulaire contient des valeurs invalides, donc on l'affiche de nouveau
			return $this->render('docMotoBundle:Default:editer.html.twig', array('form' => $form->createView(), 'passwordOk' => true, 'message' => $message ));

		}
		else
		{
			if ($form2->get('password')->getData() != null)
			{
				$messageErreur = 'Mot de passe incorrect';
			}
			else
			{
				$messageErreur = null;
			}

			return $this->render('docMotoBundle:Default:editer.html.twig', array('form2' => $form2->createView(), 'annonce' => $annonce, 'passwordOk' => false, 'messageErreur' => $messageErreur, 'message' => $message));
		}
    }

	public function supprimerAction($id, Request $request)
    {

		$em = $this->getDoctrine()->getManager();

		// On récupère l'annonce $id
		$annonce = $em->getRepository('docMotoBundle:Annonce')->findOneBy(array('id' => $id, 'autorisee' => true));

		if (null === $annonce) {
			throw new NotFoundHttpException("L'annonce d'id ".$id." n'existe pas.");
		}

		$form = $this->get('form.factory')->create(new PasswordType);

		$form->handleRequest($request);

		$factory = $this->get('security.encoder_factory');
        $encoder = $factory->getEncoder($annonce);

		// On vérifie que les valeurs entrées sont correctes
		// (Nous verrons la validation des objets en détail dans le prochain chapitre)
		$passwordCorrect = $annonce->getPassword() === $encoder->encodePassword($form->get('password')->getData(), $annonce->getSalt());

		if ($form->isValid() AND $passwordCorrect == true)
		{
		  $em->remove($annonce);
		  $em->flush();

		  $request->getSession()->getFlashBag()->add('notice', 'Annonce supprimée.');

		  return $this->redirect($this->generateUrl('doc_moto_accueil'));
		}

		if ($form->get('password')->getData() != null)
		{
			$messageErreur = 'Mot de passe incorrect';
		}
		else
		{
			$messageErreur = null;
		}

		// À ce stade, le formulaire n'est pas valide car :
		// - Soit la requête est de type GET, donc le visiteur vient d'arriver sur la page et veut voir le formulaire
		// - Soit la requête est de type POST, mais le formulaire contient des valeurs invalides, donc on l'affiche de nouveau
		return $this->render('docMotoBundle:Default:supprimer.html.twig', array('form' => $form->createView(), 'annonce' => $annonce, 'messageErreur' => $messageErreur));
    }

    public function annoncescompatiblesAction($id)
    {
		$repository = $this
		  ->getDoctrine()
		  ->getManager()
		  ->getRepository('docMotoBundle:Annonce');

		$listeAnnonces = $repository->getAnnoncesCompatibles($id);

        return $this->render('docMotoBundle:Default:annoncescompatibles.html.twig', array('listeAnnonces' => $listeAnnonces));
    }

    public function annonceAction($id, Request $request)
    {
		$repository = $this
		  ->getDoctrine()
		  ->getManager()
		  ->getRepository('docMotoBundle:Annonce');

		$annonce = $repository->findOneBy(array('id' => $id, 'autorisee' => true));

		$messagesTableau = $request->getSession()->getFlashBag()->get('notice');
		$message = end($messagesTableau);

        return $this->render('docMotoBundle:Default:annonce.html.twig', array('annonce' => $annonce, 'message' => $message));
    }

	public function pageValiderAction($code)
    {
		$em = $this->getDoctrine()->getManager();
		$repository = $em->getRepository('docMotoBundle:Annonce');

		$annonce = $repository->findOneByCodeValidation($code);

		$em->persist($annonce);

		if (!$annonce == null)
		{
			$annonce->setValidee(true);
		}

		$em->flush();

        return $this->render('docMotoBundle:Default:pageValider.html.twig', array('annonce' => $annonce));
    }

	/**
    * @Security("has_role('ROLE_ADMIN')")
    */
	public function activerAction($id)
    {

		$em = $this->getDoctrine()->getManager();
		$repository = $em->getRepository('docMotoBundle:Annonce');

		if ($id > 0)
		{
			$annonce = $repository->find($id);
			$em->persist($annonce);
			$annonce->setAutorisee(true);
			$em->flush();
		}

		$listeAnnonces = $repository->findBy(array('validee' => true, 'autorisee' => false));

		if ($id == -1)
		{
			foreach ($listeAnnonces as $annonce)
			{
				$em->persist($annonce);
				$annonce->setAutorisee(true);
				$em->flush();
			}

			return $this->render('docMotoBundle:Default:activer.html.twig', array('listeAnnonces' => null));
		}

        return $this->render('docMotoBundle:Default:activer.html.twig', array('listeAnnonces' => $listeAnnonces));
    }

}


text:
'use strict';

module.exports = function(app) {
	var users = require('../../app/controllers/users.server.controller');
	var usuarios = require('../../app/controllers/usuarios.server.controller');

	// Usuarios Routes
	app.route('/usuarios')
		.get(usuarios.list)
		.post(users.requiresLogin, usuarios.create);

	app.route('/usuarios/:usuarioId')
		.get(usuarios.read)
		.put(users.requiresLogin, usuarios.update)
		.delete(users.requiresLogin, usuarios.delete);

	// Finish by binding the Usuario middleware
	app.param('usuarioId', usuarios.usuarioByID);
};


text:
from __future__ import absolute_import
__author__ = 'Joe Linn'
__docformat__ = 'epytext'

from . import aggregation
from . import bulk
from .client import *
from . import cluster
from .connection import *
from .document import *
from . import doc_type
from . import exception
from . import facet
from . import filter
from . import index
# from .log import *
from . import node
# from .param import *
from .percolator import *
from . import query
from .request import *
from .response import *
from .resultset import *
from . import river
from .script import *
from .scriptfields import *
from .search import *
from .status import *
from . import suggest
# from .searchable import *
# from . import transport
# from . import util


text:
package com.microsoft.azure.management.storagecache.v2020_03_01;

import com.microsoft.azure.arm.model.HasInner;
import com.microsoft.azure.arm.resources.models.HasManager;
import com.microsoft.azure.management.storagecache.v2020_03_01.implementation.StorageCacheManager;
import com.microsoft.azure.management.storagecache.v2020_03_01.implementation.ApiOperationInner;

/**
 * Type representing ApiOperation.
 */
public interface ApiOperation extends HasInner<ApiOperationInner>, HasManager<StorageCacheManager> {
    /**
     * @return the display value.
     */
    ApiOperationDisplay display();

    /**
     * @return the name value.
     */
    String name();

}


text:
blog.lozoyavalley.org
=====================

This is the code and content of the Lozoya Valley initiative's blog.

It's a simple Tumblr blog, content is published manually.

### License
MIT


text:
<?php

/**
 * Observerinformation for a current game
 */
namespace JeffreyVdb\LeagueWrap\Dto;

class Observer extends AbstractDto {

}


text:
<?php session_start();
require_once("models/Base.php");
require_once("models/Paginacao.php");
require_once("models/Contapagar.php");
require_once('models/Login.php');

$login = new Login();
$confirmacao = $login->verificar();
if($confirmacao == false){
	?>

	<?php
}
$contapagar = new Contapagar();
$qtd = 10;

if (empty ($contapagar->anti_injection($_GET['inicial'])) && empty ($contapagar->anti_injection($_GET['final'])) && $contapagar->anti_injection($_GET['id_formapg']) == "" && $contapagar->anti_injection($_GET['status']) == "") {
	$filtro .= " and month(vencimento) = month(now()) ";
}

if (($contapagar->anti_injection($_GET["inicial"])!="") and ($contapagar->anti_injection($_GET["final"])!="")){
	$filtro = $filtro. " and vencimento between '".$contapagar->date_transform($contapagar->anti_injection($_GET['inicial']))."' and '".$contapagar->date_transform($contapagar->anti_injection($_GET['final']))."'";
}

$resposta = $contapagar->listarContapagarpag($filtro, $qtd);
$contapg = $resposta['contapagar'];
$paginacao = $resposta['paginacao'];

?>

Contas a pagar

	<form action="index.php?pac=contapagar&tela=contapagarGrid"	name="filtros" method="get">
		<input type="hidden" name="tela" value="contapagarGrid" />
		<input type="hidden" name="pac"	value="contapagar" />

		Data inicial:
		<input type="text" name="inicial" readonly id="datepicker"
			class="inputsize" value="" style="width: 50px;" />
		Data final:
		<input type="text" name="final" readonly id="datepicker1"
			class="inputsize" value="" style="width: 50px;" />
		<input name="submit" type="submit" value="Pesquisar">

	</form>

Inserir

Excluir

Imprimir

<?php if($_SESSION['alert'] != ""){echo $_SESSION['alert']; $_SESSION['alert'] = "";}?>

	<form action="controllers/contapagar.php" method="post" id="formContapagar">
		<input type="hidden" name="op" value="Deletar" />
		<input type="hidden" name="tela" value="contapagar" />
		<input type="hidden" name="pacote" value="contapagar" />

			<input type="checkbox" name="selecionatodos" id="selecionatodos" />

		Beneficiado
		Emissão
		Vencimento
		Valor
		<?php echo "Ação";?>

	<?php
	$total=0;
	if($contapg){
		foreach($contapg as $dados){?>

				<input type="checkbox" name="id[]" class="checkbox"	value="<?php echo $dados['id_contapagar'];?>" />

			<?php  echo $dados['beneficiado'];?>
			<?php echo $contapagar->date_transform($dados['emissao']);?>
			<?php echo $contapagar->date_transform($dados['vencimento']);?>
			R$ <?php $total += $dados['valor'];
					echo number_format($dados['valor'],2,',','.');?>

				<a href="?pac=contapagar&tela=contapagarForm&op=Editar&i=<?php echo $dados['id_contapagar'];?>"	id="edit">

	<?php }}?>

		Total:
		R$ <?php echo number_format($total,2,',','.');?>

	Resultado de <?php if($paginacao->TotalDeElementos == '0'){
			echo '0';
	}else{
		if($paginacao->Inicial == 0){
			echo '1';
		}else{
			echo $paginacao->Inicial;
			}
		}

	?> a <?php if(($paginacao->Inicial+$paginacao->NumeroRegistroPagina) > $paginacao->TotalDeElementos){
			echo $paginacao->TotalDeElementos;
		}else{
			echo ($paginacao->Inicial+$paginacao->NumeroRegistroPagina);
		}?> de <?php echo $paginacao->TotalDeElementos;?>
		registros.

		Página: <?php echo $paginacao->MontarPaginacao($paginacao->PaginaAtual, $paginacao->UltimaPagina) ?>


text:
<?php
namespace AzureBlob;

use MicrosoftAzure\Storage\Blob\Internal\IBlob;
use MicrosoftAzure\Storage\Blob\Models\BlobBlockType;
use MicrosoftAzure\Storage\Blob\Models\Block;
use MicrosoftAzure\Storage\Blob\Models\CommitBlobBlocksOptions;
use MicrosoftAzure\Storage\Blob\Models\ListBlobsResult;
use MicrosoftAzure\Storage\Blob\Models\ListContainersResult;
use WindowsAzure\Common\ServicesBuilder;
use WindowsAzure\Common\ServiceException;

class AzureBlob
{
    const AZBLOB_PROTO_HTTP = 'http';
    const AZBLOB_PROTO_HTTPS = 'https';
    const AZBLOB_CHUNK_SIZE = 1048576;
    const AZBLOB_DEF_TYPE = 'application/octet-stream';
    /**
     * @var string The HTTP protocol used for connecting with Microsoft Azure
     * endpoints: 'http' or 'https'
     */
    protected $endpointProtocol;
    /**
     * @var string The name of your storage account
     */
    protected $accountName;
    /**
     * @var string The key associated with your storage account
     */
    protected $accountKey;
    /**
     * @var IBlob The proxy interface to interact with
     * Microsoft Azure Blob Storage
     */
    protected $blobProxy;

    public function __construct($accountName = null, $accountKey = null, $protocol = self::AZBLOB_PROTO_HTTP)
    {
        if (null !== $accountName && null !== $accountKey) {
            $this->setAccountName($accountName)
                ->setAccountKey($accountKey)
                ->setEndpointProtocol($protocol);
            $this->init();
        }
    }

    protected function init()
    {
        $connectionString = sprintf(
            'DefaultEndpointsProtocol=%s;AccountName=%s;AccountKey=%s',
            $this->getEndpointProtocol(),
            $this->getAccountName(),
            $this->getAccountKey()
        );
        $this->blobProxy = ServicesBuilder::getInstance()->createBlobService($connectionString);
    }

    /**
     * @return string
     */
    public function getEndpointProtocol()
    {
        if (null === $this->endpointProtocol) {
            $this->setEndpointProtocol(self::AZBLOB_PROTO_HTTPS);
        }
        return $this->endpointProtocol;
    }

    /**
     * @param string $endpointProtocol
     * @return AzureBlob
     */
    public function setEndpointProtocol($endpointProtocol)
    {
        $this->endpointProtocol = $endpointProtocol;
        return $this;
    }

    /**
     * @return string
     */
    public function getAccountName()
    {
        if (null === $this->accountName) {
            throw new \RuntimeException(
                'Please provide your Microsoft Azure Storage account name'
            );
        }
        return $this->accountName;
    }

    /**
     * @param string $accountName
     * @return AzureBlob
     */
    public function setAccountName($accountName)
    {
        $this->accountName = $accountName;
        return $this;
    }

    /**
     * @return string
     */
    public function getAccountKey()
    {
        if (null === $this->accountKey) {
            throw new \RuntimeException(
                'Please provide your Microsoft Azure Storage account key'
            );
        }
        return $this->accountKey;
    }

    /**
     * @param string $accountKey
     * @return AzureBlob
     */
    public function setAccountKey($accountKey)
    {
        $this->accountKey = $accountKey;
        return $this;
    }

    /**
     * @return IBlob
     */
    public function getBlobProxy()
    {
        if (null === $this->blobProxy) {
            $this->init();
        }
        return $this->blobProxy;
    }

    /**
     * @param IBlob $blobProxy
     */
    public function setBlobProxy($blobProxy)
    {
        $this->blobProxy = $blobProxy;
    }

    /**
     * List all containers for this storage account
     *
     * @return ListContainersResult
     */
    public function listContainers()
    {
        $containerList = new ListContainersResult();
        try {
            $containerList = $this->getBlobProxy()->listContainers();
        } catch (ServiceException $serviceException) {
            throw $serviceException;
        }
        return $containerList;
    }

    /**
     * Creates a new container with given name in the storage account
     *
     * @param string $containerName
     * @param null $options
     * @return bool
     */
    public function createContainer($containerName, $options = null)
    {
        try {
            $this->getBlobProxy()->createContainer($containerName, $options);
            return true;
        } catch (ServiceException $serviceException) {
            throw $serviceException;
        }
        return false;
    }

    public function removeContainer($containerName, $options = null)
    {
        try {
            $this->getBlobProxy()->deleteContainer($containerName, $options);
            return true;
        } catch (ServiceException $serviceException) {
            throw $serviceException;
        }
        return false;
    }

    /**
     * @param $container
     * @return ListBlobsResult
     */
    public function listBlobs($container)
    {
        $blobList = new ListBlobsResult();
        try {
            $blobList = $this->getBlobProxy()->listBlobs($container);
        } catch (ServiceException $serviceException) {
            throw $serviceException;
        }
        return $blobList;
    }

    /**
     * Allows you to upload large binary files onto the Microsoft Azure
     * blob storage, which will be executed in chunks of 1MB.
     *
     * @param string $container The name of the Azure Blob Storage Container
     * @param string $file The location of the uploaded file
     * @param string $fileType The content-type (MIME-Type) of file that's being uploaded
     * @param string $fileName The filename you want to give the blob
     * @param string $prefix The prefix of the file for segmentation within the container
     * @example $azureBlob->uploadFile('demo', '/path/to/file.png', 'image/png', 'demo.png', 'mydemo/files')
     */
    public function uploadFile($container, $file, $fileType, $fileName, $prefix = null)
    {
        $counter = 1;
        $blockIds = [];

        $start = microtime(1);
        if (!is_readable($file)) {
            throw new \RuntimeException('File ' . $file . ' is not accessible for reading');
        }
        if (false === ($fh = fopen($file, 'r'))) {
            throw new \RuntimeException('Cannot open ' . $file);
        }

        if (null !== $prefix) {
            $prefix = rtrim($prefix, '/\\');
            $fileName = $prefix . '/' . $fileName;
        }

        while (!feof($fh)) {
            $blockId = str_pad($counter, 6, "0", STR_PAD_LEFT);
            $block = new Block();
            $block->setBlockId(base64_encode($blockId));
            $block->setType(BlobBlockType::UNCOMMITTED_TYPE);
            $blockIds[] = $block;
            $data = fread($fh, self::AZBLOB_CHUNK_SIZE);
            try {
                $this->getBlobProxy()->createBlobBlock($container, $fileName, base64_encode($blockId), $data);
                $this->log('Uploading block ' . $blockId . ' in ' . $container);
            } catch (ServiceException $serviceException) {
                $this->log('Committing blob ' . $fileName . ' with total of ' . count($blockIds) . ' blocks');
                throw $serviceException;
            }
            $counter++;
        }
        fclose($fh);

        $stop = microtime(1);
        $this->log('Completed upload of ' . $fileName . ' in ' . ($stop - $start) . ' seconds');

        $options = new CommitBlobBlocksOptions();
        $options->setContentType($fileType);
        try {
            $this->getBlobProxy()->commitBlobBlocks($container, $fileName, $blockIds, $options);
            $this->log('Committing blob ' . $fileName . ' with total of ' . count($blockIds) . ' blocks');
        } catch (ServiceException $serviceException) {
            $this->log('Unable to commit ' . $fileName . ' with total of ' . count($blockIds) . ' blocks');
            throw $serviceException;
        }
    }

    public function removeBlob($container, $blobName)
    {
        try {
            $this->getBlobProxy()->deleteBlob($container, $blobName);
        } catch (ServiceException $serviceException) {
            throw $serviceException;
        }
    }

    protected function log($message)
    {
        echo $message . '<br>' . PHP_EOL;
    }

    public static function shortenString($string, $maxLength = 24, $stringSplitter = '...')
    {
        if ($maxLength >= strlen($string)) {
            return $string;
        }
        $middle = floor($maxLength / 2) - 1;
        return substr($string, 0, $middle) . $stringSplitter . substr($string, 0 - $middle);
    }
}


text:
@class AvatarCache, GravatarService;

@interface GravatarServiceFactory : NSObject
{
    IBOutlet NSObject<ConfigReader> * configReader;
    IBOutlet AvatarCache * avatarCache;
}

- (GravatarService *)createGravatarService;

@end


text:
namespace base {
class FilePath;
}

namespace blink {
struct WebPluginParams;
}

namespace content {
class RenderFrame;
}

namespace plugins {
class PluginPlaceholder;
}

class NonLoadablePluginPlaceholder {
 public:
  NonLoadablePluginPlaceholder() = delete;
  NonLoadablePluginPlaceholder(const NonLoadablePluginPlaceholder&) = delete;
  NonLoadablePluginPlaceholder& operator=(const NonLoadablePluginPlaceholder&) =
      delete;

  // Creates a non-loadable plugin placeholder for platforms without plugins.
  static plugins::PluginPlaceholder* CreateNotSupportedPlugin(
      content::RenderFrame* render_frame,
      const blink::WebPluginParams& params);

  static plugins::PluginPlaceholder* CreateFlashDeprecatedPlaceholder(
      content::RenderFrame* render_frame,
      const blink::WebPluginParams& params);

#if BUILDFLAG(ENABLE_PLUGINS)
  static plugins::PluginPlaceholder* CreateErrorPlugin(
      content::RenderFrame* render_frame,
      const base::FilePath& file_path);
#endif
};

#endif  // CHROME_RENDERER_PLUGINS_NON_LOADABLE_PLUGIN_PLACEHOLDER_H_


text:
package org.apache.hadoop.hdfs;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.UnknownHostException;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLSession;

import org.apache.hadoop.conf.Configuration;

/** An implementation of a protocol for accessing filesystems over HTTPS.
 * The following implementation provides a limited, read-only interface
 * to a filesystem over HTTPS.
 * @see org.apache.hadoop.hdfs.server.namenode.ListPathsServlet
 * @see org.apache.hadoop.hdfs.server.namenode.FileDataServlet
 */
public class HsftpFileSystem extends HftpFileSystem {

  @Override
  public void initialize(URI name, Configuration conf) throws IOException {
    super.initialize(name, conf);
    setupSsl(conf);
  }

  /** Set up SSL resources */
  private static void setupSsl(Configuration conf) {
    Configuration sslConf = new Configuration(false);
    sslConf.addResource(conf.get("dfs.https.client.keystore.resource",
        "ssl-client.xml"));
    System.setProperty("javax.net.ssl.trustStore", sslConf.get(
        "ssl.client.truststore.location", ""));
    System.setProperty("javax.net.ssl.trustStorePassword", sslConf.get(
        "ssl.client.truststore.password", ""));
    System.setProperty("javax.net.ssl.trustStoreType", sslConf.get(
        "ssl.client.truststore.type", "jks"));
    System.setProperty("javax.net.ssl.keyStore", sslConf.get(
        "ssl.client.keystore.location", ""));
    System.setProperty("javax.net.ssl.keyStorePassword", sslConf.get(
        "ssl.client.keystore.password", ""));
    System.setProperty("javax.net.ssl.keyPassword", sslConf.get(
        "ssl.client.keystore.keypassword", ""));
    System.setProperty("javax.net.ssl.keyStoreType", sslConf.get(
        "ssl.client.keystore.type", "jks"));
  }

  @Override
  protected HttpURLConnection openConnection(String path, String query)
      throws IOException {
    try {
      final URL url = new URI("https", null, pickOneAddress(nnAddr.getHostName()),
          nnAddr.getPort(), path, query, null).toURL();
      HttpsURLConnection conn = (HttpsURLConnection)url.openConnection();
      // bypass hostname verification
      conn.setHostnameVerifier(new DummyHostnameVerifier());
      return (HttpURLConnection)conn;
    } catch (URISyntaxException e) {
      throw (IOException)new IOException().initCause(e);
    }
  }

  @Override
  public URI getUri() {
    try {
      return new URI("hsftp", null, pickOneAddress(nnAddr.getHostName()), nnAddr.getPort(),
                     null, null, null);
    } catch (URISyntaxException e) {
      return null;
    } catch (UnknownHostException e) {
      return null;
    }
  }

  /**
   * Dummy hostname verifier that is used to bypass hostname checking
   */
  protected static class DummyHostnameVerifier implements HostnameVerifier {
    public boolean verify(String hostname, SSLSession session) {
      return true;
    }
  }

}


text:
// Copyright Dirk Lemstra https://github.com/dlemstra/Magick.NET.
// Licensed under the Apache License, Version 2.0.

using System;
using ImageMagick;
using Xunit;

namespace Magick.NET.Tests
{
    public partial class DrawablesTests
    {
        public class TheCompositeMethod
        {
            public class WithOffsetAndImage
            {
                [Fact]
                public void ShouldThrowExceptionWhenOffsetIsNull()
                {
                    Assert.Throws<ArgumentNullException>("offset", () =>
                    {
                        new Drawables().Composite(null, new MagickImage());
                    });
                }

                [Fact]
                public void ShouldThrowExceptionWhenImageIsNull()
                {
                    Assert.Throws<ArgumentNullException>("image", () =>
                    {
                        new Drawables().Composite(new MagickGeometry(), null);
                    });
                }

                [Fact]
                public void ShouldCopyPixelsOfTheImage()
                {
                    using (var image = new MagickImage(MagickColors.Green, 3, 1))
                    {
                        using (var inner = new MagickImage(MagickColors.Purple, 2, 2))
                        {
                            new Drawables()
                                .Composite(new MagickGeometry(1, 0, 1, 1), inner)
                                .Draw(image);
                        }

                        ColorAssert.Equal(MagickColors.Green, image, 0, 0);
                        ColorAssert.Equal(MagickColors.Purple, image, 1, 0);
                        ColorAssert.Equal(MagickColors.Green, image, 2, 0);
                    }
                }
            }

            public class WithOffsetAndCompositeOperatorAndImage
            {
                [Fact]
                public void ShouldThrowExceptionWhenOffsetIsNull()
                {
                    Assert.Throws<ArgumentNullException>("offset", () =>
                    {
                        new Drawables().Composite(null, CompositeOperator.Over, new MagickImage());
                    });
                }

                [Fact]
                public void ShouldThrowExceptionWhenImageIsNull()
                {
                    Assert.Throws<ArgumentNullException>("image", () =>
                    {
                        new Drawables().Composite(new MagickGeometry(), CompositeOperator.Over, null);
                    });
                }

                [Fact]
                public void ShouldUseTheCompositeOperator()
                {
                    using (var image = new MagickImage(MagickColors.Green, 3, 1))
                    {
                        using (var inner = new MagickImage(MagickColors.Purple, 2, 2))
                        {
                            new Drawables()
                                .Composite(new MagickGeometry(1, 0, 1, 1), CompositeOperator.Plus, inner)
                                .Draw(image);
                        }

                        ColorAssert.Equal(MagickColors.Green, image, 0, 0);
                        ColorAssert.Equal(MagickColors.Gray, image, 1, 0);
                        ColorAssert.Equal(MagickColors.Green, image, 2, 0);
                    }
                }
            }

            public class WithXYAndImage
            {
                [Fact]
                public void ShouldThrowExceptionWhenImageIsNull()
                {
                    Assert.Throws<ArgumentNullException>("image", () =>
                    {
                        new Drawables().Composite(0, 0, null);
                    });
                }

                [Fact]
                public void ShouldCopyPixelsOfTheImage()
                {
                    using (var image = new MagickImage(MagickColors.Green, 3, 1))
                    {
                        using (var inner = new MagickImage(MagickColors.Purple, 2, 2))
                        {
                            new Drawables()
                                .Composite(1, 0, inner)
                                .Draw(image);
                        }

                        ColorAssert.Equal(MagickColors.Green, image, 0, 0);
                        ColorAssert.Equal(MagickColors.Purple, image, 1, 0);
                        ColorAssert.Equal(MagickColors.Purple, image, 2, 0);
                    }
                }
            }

            public class WithXYAndCompositeOperatorAndImage
            {
                [Fact]
                public void ShouldThrowExceptionWhenImageIsNull()
                {
                    Assert.Throws<ArgumentNullException>("image", () =>
                    {
                        new Drawables().Composite(0, 0, CompositeOperator.Over, null);
                    });
                }

                [Fact]
                public void ShouldUseTheCompositeOperator()
                {
                    using (var image = new MagickImage(MagickColors.Green, 3, 1))
                    {
                        using (var inner = new MagickImage(MagickColors.Purple, 2, 2))
                        {
                            new Drawables()
                                .Composite(1, 0, CompositeOperator.Plus, inner)
                                .Draw(image);
                        }

                        ColorAssert.Equal(MagickColors.Green, image, 0, 0);
                        ColorAssert.Equal(MagickColors.Gray, image, 1, 0);
                        ColorAssert.Equal(MagickColors.Gray, image, 2, 0);
                    }
                }
            }
        }
    }
}


text:
<!DOCTYPE html>

		<title>Sri Laxminarayana Designers</title>

		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.2" />
		<meta name="format-detection" content="telephone=no" />
		<meta name="keywords" content="Construction, Renovation" />
		<meta name="description" content="Responsive Construction Renovation Template" />

		<link rel="stylesheet" type="text/css" href="rs-plugin/css/settings.css" media="screen" />

		<link href='https://fonts.googleapis.com/css?family=Raleway:100,300,400,500,600,700,900' rel='stylesheet' type='text/css'>
		<link rel="stylesheet" type="text/css" href="style/reset.css">
		<link rel="stylesheet" type="text/css" href="style/superfish.css">
		<link rel="stylesheet" type="text/css" href="style/prettyPhoto.css">
		<link rel="stylesheet" type="text/css" href="style/jquery.qtip.css">
		<link rel="stylesheet" type="text/css" href="style/style.css">
		<link rel="stylesheet" type="text/css" href="style/animations.css">
		<link rel="stylesheet" type="text/css" href="style/responsive.css">
		<link rel="stylesheet" type="text/css" href="style/odometer-theme-default.css">

		<link rel="stylesheet" type="text/css" href="fonts/streamline-small/styles.css">
		<link rel="stylesheet" type="text/css" href="fonts/streamline-large/styles.css">
		<link rel="stylesheet" type="text/css" href="fonts/template/styles.css">
		<link rel="stylesheet" type="text/css" href="fonts/social/styles.css">
		<link rel="shortcut icon" href="images/favicon.ico">

											HOME

											SERVICES

													Temple Construction, Renovation

													Stone Cutting & Supply

													Stone Art & Interior Desiging

											PROJECTS

											ABOUT US

												HOME

												SERVICES

														Temple Construction, Renovation

														Stone Cutting & Supply

														Stone Art & Interior Desiging

												PROJECTS

											ABOUT US

PROJECTS

									You Are Here:

												OUR PROJECTS

SWAGATHA GOPURA

 DESCRIPTION

Positioned at the enterance with 28ft height and 30ft width, the Stonecut Swagathgopura stands as magnificent welcome pillars to the town. These are considered to be one of biggest Stone made SwagathaGopura in the country.

AT A GLANCE

										Project Type
										Gopura

										Client
										Private

										Completion Date
										July 2016

										Location
										Marnakatte

AANEKERE PARK

 DESCRIPTION

This public park symbolizes the respect towards freedom fighters,martyrs of the nation. On public interest the park was designed and built on stone to presreve memory of the great soldiers. It is located at Karkala, Karnataka.

AT A GLANCE

										Project Type
										Theme Park

										Client
										Public Ogranization

										Completion Date
										January 2014

										Location
										Karkala

PUSHKARNI

 DESCRIPTION

Pushkarni at Tekkate Sri Mahalingeshwara Temple stands for its holistic purtiy, and the construction involed pioneer architecture and plan to build the same.

AT A GLANCE

										Project Type
										Pushkarni

										Client
										Temple Management

										Completion Date
										Septemebr 2015

										Location
										Tekatte

JARANDHAYA GUDI

 DESCRIPTION

This temple was built as a tribute to Jarandhaya from the trust and the devotees, the shilamayi structure beautifies the slush architrcture of the temple. It is located in Kubeoor at Mulki.

AT A GLANCE

										Project Type
										Temple

										Client
										Devi Trust

										Completion Date
										April 2016

										Location
										Mulki

Phone:

								+91 9880 191 020

								+91 9482 098 221

Sri Laxminarayana Designers,
Jarkala, Karkala

								Udupi(D), Karnataka

E-mail:

								nagarajthantri[at]gmail.com

About Us

Sri Laxminarayana Designers has estabilished itself as one of the greatest and prestigious providers of construction focused interior renovation services and building.

Our Services

Temple Construction and Renovation

Stone Cutting and Supply

Stone Art and Interior Designing

Social Media

				© Copyright 2016 Sri Laxminarayana Designers


text:
package com.github.pg4j.spring.data.specification;

import javax.persistence.metamodel.SingularAttribute;

import org.springframework.data.domain.Persistable;
import org.springframework.data.jpa.domain.Specification;

import com.github.pg4j.commons.jpa.criteria.ExpressionHelper;

/**
 * Basic Spring-Data helper for using ltree operations.
 *
 * @author Roman Chukh
 */
public final class LTreeSpecs {

	private LTreeSpecs() {
	}

	public static <T extends Persistable<?>> Specification<T> isDescendant(final SingularAttribute<T, String> field,
	                                                                       final String value) {
		return (root, query, cb) -> cb.isTrue(ExpressionHelper.ltreeIsDescendant(cb, root.get(field), value));
	}

	public static <T extends Persistable<?>> Specification<T> isAncestor(final SingularAttribute<T, String> field,
	                                                                     final String value) {
		return (root, query, cb) -> cb.isTrue(ExpressionHelper.ltreeIsAncestor(cb, root.get(field), value));
	}

	public static <T extends Persistable<?>> Specification<T> isMatch(final SingularAttribute<T, String> field,
	                                                                  final String pattern) {
		return (root, query, cb) -> cb.isTrue(ExpressionHelper.ltreeMatch(cb, root.get(field), pattern));
	}
}


text:
package javax.ccpp;

import javax.servlet.http.HttpServletRequest;

/**
 * @version $Rev$ $Date$
 */
public abstract class ProfileFactory {

    private static ProfileFactory instance;

    public static ProfileFactory getInstance() {
        return instance;
    }

    public static void setInstance(ProfileFactory instance) {
        ProfileFactory.instance = instance;
    }

    public abstract Profile newProfile(HttpServletRequest request);

    public Profile newProfile(ProfileFragment[] profileFragments) {
        return newProfile(profileFragments, ValidationMode.VALIDATIONMODE_NONE);
    }

    public abstract Profile newProfile(ProfileFragment[] profileFragments, int validation);

}


text:
  Chassagny est
      une ville géographiquement positionnée dans le département de Rhône en Rhône-Alpes. Elle totalisait 1 204 habitants en 2008.

Le parc d'habitations, à Chassagny, était réparti en 2011 en 15 appartements et 431 maisons soit
 un marché relativement équilibré.

La ville offre quelques  aménagements, elle dispose, entre autres, de un terrain de sport et une boucle de randonnée.

À Chassagny, le prix moyen à l'achat d'un appartement se situe à zero € du m² en vente. Le prix moyen d'une maison à l'achat se situe à 1 797 € du m². À la location la valorisation moyenne se situe à 8,05 € du m² mensuel.

À coté de Chassagny sont situées les villes de
Millery située à 4 km, 3 450 habitants,
Mornant à 4 km, 5 229 habitants,
Grigny à 4 km, 8 477 habitants,
Taluyers localisée à 3 km, 1 979 habitants,
Givors localisée à 3 km, 18 454 habitants,
Saint-Romain-en-Gier localisée à 4 km, 481 habitants,
 entre autres. De plus, Chassagny est située à seulement 19 km de Lyon.


text:
import unittest
import TestAuth
import TestAuthReversal
import TestBatch
import TestBatchTcp
import TestCapture
import TestCaptureGivenAuth
import TestCredit
import TestEcheckCredit
import TestEcheckRedeposit
import TestEcheckSale
import TestEcheckVerification
import TestEcheckVoid
import TestForceCapture
import TestFraudCheck
import TestSale
import TestToken
import TestUpdateCardValidationNumOnToken
import TestUtf8

testauth = TestAuth.suite()
testauthreverasal = TestAuthReversal.suite()

testbatch = TestBatch.suite()
testbatchtcp = TestBatchTcp.suite()

testcapture = TestCapture.suite()
testcapturegivenauth = TestCaptureGivenAuth.suite()
testcredit = TestCredit.suite()

testecheckcredit = TestEcheckCredit.suite()
testecheckredeposit = TestEcheckRedeposit.suite()
testechecksale = TestEcheckSale.suite()
testecheckverfication = TestEcheckVerification.suite()

testecheckvoid = TestEcheckVoid.suite()
testforcecapture = TestForceCapture.suite()
testfraudcheck = TestFraudCheck.suite()
testsale = TestSale.suite()
testtoken = TestToken.suite()

testUpdateCardValidationNumOnToken = TestUpdateCardValidationNumOnToken.suite()

testutf8 = TestUtf8.suite()

unittest.TextTestRunner().run(testauth)
unittest.TextTestRunner().run(testauthreverasal)
unittest.TextTestRunner().run(testbatch)
unittest.TextTestRunner().run(testbatchtcp)
unittest.TextTestRunner().run(testcapture)
unittest.TextTestRunner().run(testcapturegivenauth)
unittest.TextTestRunner().run(testcredit)

unittest.TextTestRunner().run(testecheckcredit)
unittest.TextTestRunner().run(testecheckredeposit)
unittest.TextTestRunner().run(testechecksale)
unittest.TextTestRunner().run(testecheckverfication)

unittest.TextTestRunner().run(testecheckvoid)
unittest.TextTestRunner().run(testforcecapture)
unittest.TextTestRunner().run(testfraudcheck)
unittest.TextTestRunner().run(testsale)
unittest.TextTestRunner().run(testtoken)
unittest.TextTestRunner().run(testUpdateCardValidationNumOnToken)

unittest.TextTestRunner().run(testutf8)


text:
using System.Reflection;
using cmstar.WebApi.Slim;

namespace cmstar.WebApi
{
    /// <summary>
    /// Example 4:
    /// 此示例演示使用setup.Auto和setup.FromType进行批量注册。
    /// </summary>
    public class AutoSetupExample : SlimApiHttpHandler
    {
        public override void Setup(ApiSetup setup)
        {
            // 此方式等同于使用反射获取MethodInfo并批量注册,写法上更为便利
            setup.Auto(new SimpleServiceProvider(), false, BindingFlags.Public | BindingFlags.Static);

            // 注册利用ApiMethodAttribute标记的方法,该特性上已经定义了方法注册配置的相关信息
            setup.Auto(new AttributedServiceProvider());

            // 注册抽象类的静态方法
            setup.FromType(typeof(AbstractServiceProvider), false);

            // 注册异步方法
            setup.FromType(typeof(AsyncServiceProvider));
        }
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Poco.Sql
{
    public class PropertyMap
    {
        public string PropertyName { get; private set; }
        public string ColumnName { get; private set; }
        public bool Required { get; private set; }
        public bool Ignored { get; private set; }
        public int MaxLength { get; private set; }
        public Type FieldType { get; private set; }

        public PropertyMap(string propertyName)
        {
            PropertyName = propertyName;
            ColumnName = propertyName;
        }

        public PropertyMap HasColumnName(string columnName)
        {
            ColumnName = columnName;
            return this;
        }

        public PropertyMap Ignore()
        {
            Ignored = true;
            return this;
        }

        public PropertyMap IsRequired() //TODO: validate this property when building the query
        {
            return IsRequired(true);
        }

        public PropertyMap IsRequired(bool required)
        {
            Required = required;
            return this;
        }

        public PropertyMap HasMaxLength(int maxLength) //TODO: validate this property when building the query
        {
            MaxLength = maxLength;
            return this;
        }
    }
}


text:
'use strict';

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

const RN_CLI_CONFIG = 'rn-cli.config.js';
let cachedConfig = null;

/**
 * Module capable of getting the configuration that should be used for
 * the `rn-cli`. The configuration file is a JS file named `rn-cli.conf.js`.
 * It has to be on any parent directory of the cli.
 */
const Config = {
  get() {
    if (cachedConfig) {
      return cachedConfig;
    }

    const parentDir = findParentDirectory(__dirname, RN_CLI_CONFIG);

    if (!parentDir) {
      throw new Error(
        'Can\'t find "rn-cli.config.js" file in any parent folder of "' +
        __dirname + '"'
      );
    }

    cachedConfig = require(path.join(parentDir, RN_CLI_CONFIG));
    return cachedConfig;
  }
};

// Finds the most near ancestor starting at `currentFullPath` that has
// a file named `filename`
function findParentDirectory(currentFullPath, filename) {
  const root = path.parse(currentFullPath).root;
  const testDir = (parts) => {
    if (parts.length === 0) {
      return null;
    }

    const fullPath = path.join(root, parts.join(path.sep));

    var exists = fs.existsSync(path.join(fullPath, filename));
    return exists ? fullPath : testDir(parts.slice(0, -1));
  };

  return testDir(currentFullPath.substring(1).split(path.sep));
}

module.exports = Config;


text:
<?php

namespace Oryzone\MediaStorage\Filesystem;

use League\Flysystem\Filesystem,
    Oryzone\MediaStorage\Exception\InvalidArgumentException,
    Oryzone\MediaStorage\Exception\InvalidConfigurationException;

/**
 * Factory for flysystem filesystems (to decouple the library from the symfony bundle for flysystem)
 */
class FilesystemFactory implements FilesystemFactoryInterface, \IteratorAggregate
{
    /**
     * Map of filesystems indexed by their name
     *
     * @var array
     */
    protected $map;

    /**
     * Instantiates a new filesystem map
     *
     * @param array $map
     */
    public function __construct(array $map)
    {
        $this->map = $map;
    }

    /**
     * {@inheritDoc}
     */
    public function get($filesystemName)
    {
        if (!isset($this->map[$filesystemName]))
            throw new InvalidArgumentException(sprintf('No filesystem register for name "%s"', $filesystemName));

        $filesystem = $this->map[$filesystemName];

        if(! $filesystem instanceof Filesystem)
            throw new InvalidConfigurationException(sprintf('The filesystem registered with the name "%s" is not an instance of "\League\Flysystem\Filesystem"', $filesystemName));

        return $filesystem;
    }

    /**
     * {@inheritDoc}
     */
    public function getIterator()
    {
        return new \ArrayIterator($this->map);
    }
}


text:
package lib.graphics;

import lejos.hardware.Button;
import lejos.hardware.lcd.LCD;
import lejos.robotics.geometry.RectangleInt32;
import java.util.List;

/**
 * Allows user to make easy and simple but powerful textual selections from list.
 * @author Enginecrafter77
 */
public class Selection implements GraphicalView {

	private final String[] list;
	private final String title;
	private final int capacity;
	private int cursor, selection;

	/**
	 * Constructs Selection from a array of options.
	 * @param title The title of the selection.
	 * @param options Array of strings containing available options.
	 */
	public Selection(String title, String... options)
	{
		this.title = title;
		this.list = options;
		this.capacity = options.length > 7 ? 7 : options.length;
		this.reset();
	}

	/**
	 * Constructs Selection from a list of options.
	 * @param title The title of the selection.
	 * @param options List of strings containing available options.
	 */
	public Selection(String title, List<String> options)
	{
		this(title, options.toArray(new String[0]));
	}

	/**
	 * Constructs Selection from a array of options, which are converted to strings using toString().
	 * @param title The title of the selection.
	 * @param options Array of strings containing available options.
	 */
	public Selection(String title, Object... options)
	{
		this.title = title;
		this.list = new String[options.length];
		this.selection = 0;
		this.capacity = options.length > 7 ? 7 : options.length;
		for(int i = 0; i < options.length; i++)
		{
			this.list[i] = options[i].toString();
		}
	}

	/**
	 * Constructs Selection from Enum, so user can select from available constants.
	 * @param title The title of the selection.
	 * @param sources The source enum, typically used with EnumClass.values()
	 */
	public Selection(String title, Enum<?>[] sources)
	{
		this(title, new String[sources.length]);
		for(int i = 0; i < sources.length; i++)
		{
			list[i] = sources[i].name();
		}
	}

	@Override
	public final void reset()
	{
		this.selection = 0;
		this.cursor = 0;
	}

	@Override
	public void open()
	{
		int button = 0;

		while(button != Button.ID_ENTER)
		{
			this.draw();
			button = this.readButton();
			switch(button)
			{
			case Button.ID_DOWN:
				if(cursor < (capacity - 1)) cursor++; //Move cursor down, if possible.
				selection++;
				break;
			case Button.ID_UP:
				if(cursor != 0) cursor--; //Move cursor up, if possible.
				selection--;
				break;
			case Button.ID_ENTER:
				this.onSelected();
				break;
			case Button.ID_ESCAPE:
				selection = -1;
				return;
			}

			//Bound-Checking & so-called overflow, after trying to move up on the top, fall to the most bottom, and vice-versa.
			if(selection < 0) selection = 0;
			if(selection >= this.list.length) selection = this.list.length - 1;
		}
	}

	/**
	 * Returns the index of selected item.
	 * @return
	 */
	public int getChoice()
	{
		return this.selection;
	}

	/**
	 * @return If the selection was not interrupted (By pressing ESCAPE).
	 */
	public boolean isValid()
	{
		return selection > -1;
	}

	/**
	 * Method fired when the user presses enter while hovering overspecific item.
	 */
	protected void onSelected() {}
	/**
	 * @return The pressed button
	 */
	public int readButton()
	{
		return Button.waitForAnyPress();
	}

	private final void draw()
	{
		/* Start expression gets the begin of the displayed sequence (index of element on line 2) by subtracting cursor from selection
		 * Stop expression gets the end of the displayed sequence (index of element on line 8) by adding missing part from seven to the selection.
		 *
		 * Example:
		 * You have list with 25 values. You have your cursor at position 4 (5th line), and selection at element 10.
		 * Element in the second line (1st line of selection) will be then 10 - 4 = 6. The first element displayed will be on index 6.
		 * Element in the last line will be 10 + (7 - 4) = 10 + 3 = 13. The last element displayed will be on index 13.
		 * Test: You have 7 lines in total (1st is occupied by the title). stop - start = 13 - 6 = 7. The result is really 7, so our calculations are right.
		 */
		int start = selection - cursor;
		int stop = selection + (capacity - cursor);
		LCD.clear();
		for(int i = 0; i < (stop - start); i++)
		{
			drawItem(this.list[start + i], i + 1);
		}
		//Used for debugging drawTitle("+S" + start + ";-S" + stop + ";.S" + selection + ";C" + cursor);
		drawTitle(title);
		drawPointer(this.list[selection], cursor + 1);
	}

	/**
	 * Returns the selected string.
	 */
	public String getString() throws InterruptedException
	{
		if(!this.isValid())
		{
			throw new InterruptedException("The selection was interrupted by user.");
		}

		return this.list[selection];
	}

	@Override
	public String toString()
	{
		try
		{
			return this.getString();
		}
		catch(Exception e)
		{
			return e.toString();
		}
	}

	/**
	 * Draws pointer every time the menu is reloaded.
	 * @param word The word to be drawn after the pointer.
	 * @param y The line to draw pointer on.
	 */
	protected void drawPointer(String word, int y)
	{
		Graphics.setColor(true);
		Graphics.drawFrame(new RectangleInt32(20, y * 16, word.length() * 10, 16));
	}

	/**
	 * Draws menu item on the given line.
	 * @param word
	 * @param x The word to be drawn (Equal to list[selection])
	 * @param y The line to draw on.
	 */
	protected void drawItem(String word, int y)
	{
		LCD.drawString(word, 2, y);
	}

	/**
	 * Draws the title on the 1st line. Can be used for debugging or custom purposes.
	 * @param title The title to be drawn.
	 */
	protected void drawTitle(String title)
	{
		Graphics.drawCenteredString(title, 0);
	}
}


text:
package completefuture;

import java.util.Date;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;

/**
 * Created by zhaocaiwen on 2017/2/27.
 */
public class Main1 {

    private Future<Integer> longrunAsyncMethod() {
        CompletableFuture<Integer> completableFuture = new CompletableFuture<>();
        new Thread(()->{
            try {
                int result = longrunmethod();
                completableFuture.complete(result);
            } catch (Exception e) {
                completableFuture.completeExceptionally(e);
            }
        }).start();
        return completableFuture;
    }

    private int longrunmethod() {
        try {
            Thread.sleep(10*1000);
            //return 1;
            throw new RuntimeException("bad");
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return 0;
    }

    public static void main(String[] args) throws ExecutionException, InterruptedException {
        Main1 main1 = new Main1();
        Future<Integer> f = main1.longrunAsyncMethod();
        System.out.println(new Date()+"--long run called, here do sth else.");
        Integer result = f.get();//blocked
        System.out.println(new Date()+"--result="+result);
    }
}


text:
require File.join(File.dirname(__FILE__), 'resource_database_user')
require File.join(File.dirname(__FILE__), 'provider_database_sql_server_user')

class Chef
  class Resource
    class SqlServerDatabaseUser < Chef::Resource::DatabaseUser

      def initialize(name, run_context=nil)
        super
        @resource_name = :sql_server_database_user
        @provider = Chef::Provider::Database::SqlServerUser
      end

    end
  end
end


text:
import React, {Component} from 'react';

import styles from '../styles/tags.css';

export default class Tags extends Component {

  renderTags() {
    const {tags, room} = this.props.item;
    const hashtags = [`#${room}`];
    hashtags.push.apply(hashtags, tags);
    return hashtags.map((hashtag, index) => {
      return (
        {hashtag}
      );
    });
  }

  render() {
    return (

{this.renderTags()}

    );
  }

}

Tags.propTypes = {
  item: React.PropTypes.object.isRequired
};


text:
/**
 * @author Uma Govindaraj
 * @description Action file to make the API call
 */
import Swagger from 'swagger-client';

/**
 * Invoke the getTaskList API
 * @param {*the access token for the user who is logged in} accessToken
 */
export const getTaskList = (access_token) => {

  return function (dispatch) {
    return Swagger(process.env.REACT_APP_API_URI,
      {
        requestInterceptor: (req) => {
          req.headers['Authorization'] = access_token;
          return req;
        },
      })
      .then((client) => {

        return client
          .apis
          .task
          .task_listPendingTasks();
      });
  }
}
export const updateTaskInfo = (type, taskInfo) => {
  return {
    type: type,
    payload: taskInfo
  }
}

/**
* Approves the specified task
* @param {*the access token for the user who is logged in} accessToken
* @param {*the task id that is to be approved} taskId
*/
export const approveTask = (access_token, taskId) => {

  return function (dispatch) {
    return Swagger(process.env.REACT_APP_API_URI,
      {
        requestInterceptor: (req) => {
          req.headers['Authorization'] = access_token;
          return req;
        },
      })
      .then((client) => {

        let putBody = { "status": "approved" };
        putBody = JSON.stringify(putBody);

        return client
          .apis
          .task
          .task_prototype_patchAttributes({ id: taskId, data: putBody });
      });
  }

}