text:
#ifndef _UAPI_LINUX_ION_H
#define _UAPI_LINUX_ION_H

#include <linux/ioctl.h>
#include <linux/types.h>

typedef int ion_user_handle_t;

/**
 * enum ion_heap_types - list of all possible types of heaps
 * @ION_HEAP_TYPE_SYSTEM:	 memory allocated via vmalloc
 * @ION_HEAP_TYPE_SYSTEM_CONTIG: memory allocated via kmalloc
 * @ION_HEAP_TYPE_CARVEOUT:	 memory allocated from a prereserved
 * 				 carveout heap, allocations are physically
 * 				 contiguous
 * @ION_HEAP_TYPE_DMA:		 memory allocated via DMA API
 * @ION_NUM_HEAPS:		 helper for iterating over heaps, a bit mask
 * 				 is used to identify the heaps, so only 32
 * 				 total heap types are supported
 */
enum ion_heap_type {
	ION_HEAP_TYPE_SYSTEM,
	ION_HEAP_TYPE_SYSTEM_CONTIG,
	ION_HEAP_TYPE_CARVEOUT,
	ION_HEAP_TYPE_CHUNK,
	ION_HEAP_TYPE_DMA,
	ION_HEAP_TYPE_CUSTOM, /* must be last so device specific heaps always
				 are at the end of this enum */
	ION_NUM_HEAPS = 16,
};

#define ION_HEAP_SYSTEM_MASK		(1 << ION_HEAP_TYPE_SYSTEM)
#define ION_HEAP_SYSTEM_CONTIG_MASK	(1 << ION_HEAP_TYPE_SYSTEM_CONTIG)
#define ION_HEAP_CARVEOUT_MASK		(1 << ION_HEAP_TYPE_CARVEOUT)
#define ION_HEAP_TYPE_DMA_MASK		(1 << ION_HEAP_TYPE_DMA)

#define ION_NUM_HEAP_IDS		sizeof(unsigned int) * 8

/**
 * allocation flags - the lower 16 bits are used by core ion, the upper 16
 * bits are reserved for use by the heaps themselves.
 */
#define ION_FLAG_CACHED 1		/* mappings of this buffer should be
					   cached, ion will do cache
					   maintenance when the buffer is
					   mapped for dma */
#define ION_FLAG_CACHED_NEEDS_SYNC 2	/* mappings of this buffer will created
					   at mmap time, if this is set
					   caches must be managed manually */
#define ION_FLAG_PRESERVE_KMAP 4 	/* deprecated. ignored. */
#define ION_FLAG_NOZEROED 8		/* Allocated buffer is not initialized
					   with zero value and userspace is not
					   able to access the buffer
					 */
#define ION_FLAG_PROTECTED 16		/* this buffer would be used in secure
					   world. if this is set, all cpu accesses
					   are prohibited.
					 */
#define ION_FLAG_SYNC_FORCE 32		/* cache sync forcely at allocation */
/**
 * DOC: Ion Userspace API
 *
 * create a client by opening /dev/ion
 * most operations handled via following ioctls
 *
 */

/**
 * struct ion_allocation_data - metadata passed from userspace for allocations
 * @len:		size of the allocation
 * @align:		required alignment of the allocation
 * @heap_id_mask:	mask of heap ids to allocate from
 * @flags:		flags passed to heap
 * @handle:		pointer that will be populated with a cookie to use to
 *			refer to this allocation
 *
 * Provided by userspace as an argument to the ioctl
 */
struct ion_allocation_data {
	size_t len;
	size_t align;
	unsigned int heap_id_mask;
	unsigned int flags;
	ion_user_handle_t handle;
};

/**
 * struct ion_fd_data - metadata passed to/from userspace for a handle/fd pair
 * @handle:	a handle
 * @fd:		a file descriptor representing that handle
 *
 * For ION_IOC_SHARE or ION_IOC_MAP userspace populates the handle field with
 * the handle returned from ion alloc, and the kernel returns the file
 * descriptor to share or map in the fd field.  For ION_IOC_IMPORT, userspace
 * provides the file descriptor and the kernel returns the handle.
 */
struct ion_fd_data {
	ion_user_handle_t handle;
	int fd;
};

struct ion_fd_partial_data {
	ion_user_handle_t handle;
	int fd;
	off_t offset;
	size_t len;
};

/**
 * struct ion_handle_data - a handle passed to/from the kernel
 * @handle:	a handle
 */
struct ion_handle_data {
	ion_user_handle_t handle;
};

/**
 * struct ion_custom_data - metadata passed to/from userspace for a custom ioctl
 * @cmd:	the custom ioctl function to call
 * @arg:	additional data to pass to the custom ioctl, typically a user
 *		pointer to a predefined structure
 *
 * This works just like the regular cmd and arg fields of an ioctl.
 */
struct ion_custom_data {
	unsigned int cmd;
	unsigned long arg;
};

/**
 * struct ion_preload_data - metadata for preload buffers
 * @heap_id_mask:	mask of heap ids to allocate from
 * @len:		size of the allocation
 * @flags:		flags passed to heap
 * @count:		number of buffers of the allocation
 *
 * Provided by userspace as an argument to the ioctl
 */
struct ion_preload_object {
	size_t len;
	unsigned int count;
};

struct ion_preload_data {
	unsigned int heap_id_mask;
	unsigned int flags;
	unsigned int count;
	struct ion_preload_object *obj;
};

#define ION_IOC_MAGIC		'I'

/**
 * DOC: ION_IOC_ALLOC - allocate memory
 *
 * Takes an ion_allocation_data struct and returns it with the handle field
 * populated with the opaque handle for the allocation.
 */
#define ION_IOC_ALLOC		_IOWR(ION_IOC_MAGIC, 0, \
				      struct ion_allocation_data)

/**
 * DOC: ION_IOC_FREE - free memory
 *
 * Takes an ion_handle_data struct and frees the handle.
 */
#define ION_IOC_FREE		_IOWR(ION_IOC_MAGIC, 1, struct ion_handle_data)

/**
 * DOC: ION_IOC_MAP - get a file descriptor to mmap
 *
 * Takes an ion_fd_data struct with the handle field populated with a valid
 * opaque handle.  Returns the struct with the fd field set to a file
 * descriptor open in the current address space.  This file descriptor
 * can then be used as an argument to mmap.
 */
#define ION_IOC_MAP		_IOWR(ION_IOC_MAGIC, 2, struct ion_fd_data)

/**
 * DOC: ION_IOC_SHARE - creates a file descriptor to use to share an allocation
 *
 * Takes an ion_fd_data struct with the handle field populated with a valid
 * opaque handle.  Returns the struct with the fd field set to a file
 * descriptor open in the current address space.  This file descriptor
 * can then be passed to another process.  The corresponding opaque handle can
 * be retrieved via ION_IOC_IMPORT.
 */
#define ION_IOC_SHARE		_IOWR(ION_IOC_MAGIC, 4, struct ion_fd_data)

/**
 * DOC: ION_IOC_IMPORT - imports a shared file descriptor
 *
 * Takes an ion_fd_data struct with the fd field populated with a valid file
 * descriptor obtained from ION_IOC_SHARE and returns the struct with the handle
 * filed set to the corresponding opaque handle.
 */
#define ION_IOC_IMPORT		_IOWR(ION_IOC_MAGIC, 5, struct ion_fd_data)

/**
 * DOC: ION_IOC_SYNC - syncs a shared file descriptors to memory
 *
 * Deprecated in favor of using the dma_buf api's correctly (syncing
 * will happend automatically when the buffer is mapped to a device).
 * If necessary should be used after touching a cached buffer from the cpu,
 * this will make the buffer in memory coherent.
 */
#define ION_IOC_SYNC		_IOWR(ION_IOC_MAGIC, 7, struct ion_fd_data)
#define ION_IOC_SYNC_PARTIAL	_IOWR(ION_IOC_MAGIC, 9, struct ion_fd_partial_data)

/**
 * DOC: ION_IOC_PRELOAD_ALLOC - prefetches pages to page pool
 */
#define ION_IOC_PRELOAD_ALLOC	_IOW(ION_IOC_MAGIC, 8, struct ion_preload_data)

/**
 * DOC: ION_IOC_CUSTOM - call architecture specific ion ioctl
 *
 * Takes the argument of the architecture specific ioctl to call and
 * passes appropriate userdata for that ioctl
 */
#define ION_IOC_CUSTOM		_IOWR(ION_IOC_MAGIC, 6, struct ion_custom_data)

#endif /* _UAPI_LINUX_ION_H */


text:
package com.intellij.ide.ui.laf.modernWhite;

import com.intellij.ide.ui.laf.ideaOld.IdeaBlueMetalTheme;
import com.intellij.ide.ui.laf.modernDark.ModernDarkLaf;

import javax.swing.plaf.metal.DefaultMetalTheme;

/**
 * @author VISTALL
 * @since 02.03.14
 */
public class ModernWhiteLaf extends ModernDarkLaf {
  @Override
  public String getName() {
    return "Modern White";
  }

  @Override
  protected String getPrefix() {
    return "modernWhite";
  }

  @Override
  public boolean isDark() {
    return false;
  }

  @Override
  protected DefaultMetalTheme createMetalTheme() {
    return new IdeaBlueMetalTheme();
  }
}

redpajama_set_name: RedPajamaGithub


text:
<?php

$displayData = Sploosh::sites();
 echo $displayData;


text:
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using Nova.Controls;
using Nova.Library.ChangeTracking;

namespace Nova.Library
{
    /// <summary>
    /// The base class for any ViewModel.
    /// </summary>
    /// <typeparam name="TView">The type of the linked View.</typeparam>
    /// <typeparam name="TViewModel">The type of the view model.</typeparam>
    public abstract partial class ViewModel<TView, TViewModel> : ChangeTrackingBase, IViewModel
        where TView : class, IView
        where TViewModel : ViewModel<TView, TViewModel>, new()
    {
        /// <summary>
		/// Gets the view.
		/// </summary>
        public TView View { get; private set; }

        /// <summary>
        /// Gets the view.
        /// </summary>
        IView IViewModel.View
        {
            get { return View; }
        }

        private Guid _id = Guid.NewGuid();

        /// <summary>
        /// Gets or sets the ViewModel ID.
        /// </summary>
        /// <value>
        /// The ID.
        /// </value>
        /// <exception cref="System.ArgumentException">Guid.Empty is not allowed.</exception>
        public Guid ID
        {
            get { return _id; }
            protected set
            {
                if (value == Guid.Empty)
                    throw new ArgumentException(@"Guid.Empty is not allowed.", "value");

                _id = value;
            }
        }

        /// <summary>
        /// Checks if the private member changed. If it did, it will set the new value and call the PropertyChanged event handler
        /// </summary>
        /// <typeparam name="TMember">The type of the member.</typeparam>
        /// <param name="privateMember">The member that is being set.</param>
        /// <param name="value">The new value.</param>
        /// <param name="comparer">The comparer.</param>
        /// <param name="propertyName">The property that changed.</param>
        /// <returns>
        /// True if the property changed.
        /// </returns>
        protected bool SetValue<TMember>(ref TMember privateMember, TMember value, EqualityComparer<TMember> comparer = null, [CallerMemberName] string propertyName = null)
		{
            if (comparer == null)
            {
                comparer = EqualityComparer<TMember>.Default;
            }

		    if (comparer.Equals(privateMember, value))
		    {
		        return false;
		    }

		    privateMember = value;

// ReSharper disable ExplicitCallerInfoArgument
		    OnPropertyChanged(propertyName);
// ReSharper restore ExplicitCallerInfoArgument

		    return true;
		}
    }
}


text:
//----------------------------------------------------------------------------
/** @file GoUctPlayoutPolicy.h */
//----------------------------------------------------------------------------

#ifndef GOUCT_PLAYOUTPOLICY_H
#define GOUCT_PLAYOUTPOLICY_H

#include <iostream>
#include <boost/array.hpp>
#include "../go/GoBoardUtil.h"
#include "../go/GoEyeUtil.h"
#include "../gouct/GoUctPatterns.h"
#include "../gouct/GoUctPureRandomGenerator.h"
#include "../gouct/GoUctGammaMoveGenerator.h"

//----------------------------------------------------------------------------

/** Knowledge Type is used for GoUctKnowledgeFactory*/
enum KnowledgeType
{
    KNOWLEDGE_GREENPEEP,
    KNOWLEDGE_RULEBASED
};

/** Parameters for GoUctPlayoutPolicy. */
class GoUctPlayoutPolicyParam
{
public:
    /** Enable collection of statistics.
        Has a negative impact on performance. Default is false. */
    bool m_statisticsEnabled;

    /** Use Nakade heuristic.
        See section 6.2 of: Chatriot, Gelly, Hoock, Perez, Rimmel, Teytaud:

        Combining expert, offline, transient and online learning in
        Monte-Carlo exploration */
    bool m_useNakadeHeuristic;

    /** Bias pattern moves in playouts by learned probabilities.
        This applies to the pattren move generator in the playout policy only.
    	If true, a probability of choosing each of the matching pattern
        moves is computed from machine learned 3x3 pattern weights.
        If false, the playout policy chooses uniformly random among all
        matching patterns as in the original MoGo paper */
    bool m_usePatternsInPlayout;

    /** Use learned pattern probabilities in prior knowledge */
    bool m_usePatternsInPriorKnowledge;

    /** See GoUctPureRandomGenerator::GenerateFillboardMove.
        Default is 0 */
    int m_fillboardTries;

    /** Lower threshold of gamma values for which patterns to select */
    float m_patternGammaThreshold;

    /** To select knowledge type in GoUctKnowledgeFactory */
    KnowledgeType m_knowledgeType;

    GoUctPlayoutPolicyParam();
};

//----------------------------------------------------------------------------

/** Move types used in GoUctPlayoutPolicy. */
enum GoUctPlayoutPolicyType
{
    GOUCT_FILLBOARD,

    GOUCT_NAKADE,

    GOUCT_ATARI_CAPTURE,

    GOUCT_ATARI_DEFEND,

    GOUCT_LOWLIB,

    GOUCT_PATTERN,

    GOUCT_GAMMA_PATTERN,

    GOUCT_REPLACE_CAPTURE,

    GOUCT_CAPTURE,

    GOUCT_RANDOM,

    GOUCT_SELFATARI_CORRECTION,

    GOUCT_CLUMP_CORRECTION,

    GOUCT_PASS,

    _GOUCT_NU_DEFAULT_PLAYOUT_TYPE
};

const char* GoUctPlayoutPolicyTypeStr(GoUctPlayoutPolicyType type);

//----------------------------------------------------------------------------

/** Statistics collected by GoUctPlayoutPolicy */
struct GoUctPlayoutPolicyStat
{
    /** Number of moves generated. */
    std::size_t m_nuMoves;

    /** Length of sequences of consecutive non-pure-random moves. */
    SgUctStatistics m_nonRandLen;

    /** Length of list of equivalent best moves.
        Does not include the length of the move list for pure random moves. */
    SgUctStatistics m_moveListLen;

    /** Number of moves of a certain type. */
    boost::array<std::size_t,_GOUCT_NU_DEFAULT_PLAYOUT_TYPE> m_nuMoveType;

    void Clear();

    void Write(std::ostream& out) const;
};

/** Smallest allowed gamma value */
const float GAMMA_LOWER_LIMIT = 0.00000000001;

//----------------------------------------------------------------------------

/** Default playout policy for usage in GoUctGlobalSearch.
    Parameterized by the board class to make it usable with both GoBoard
    and GoUctBoard.
    If all heuristics are disabled, the policy plays purely random moves.
    The order and types of the heuristics were originally inspired by
    the first technical report about the MoGo program, but have evolved
    considerably.
    Instances of this class must be thread-safe during a search. */
template<class BOARD>
class GoUctPlayoutPolicy
{
public:
    /** Constructor.
        @param bd
        @param param The parameters. The policy stores a reference to @c param
        to allow changing the parameters of a group of playout policies later.
        Therefore the lifetime of @c param must exceed the lifetime of the
        policy. */
    GoUctPlayoutPolicy(const BOARD& bd, const GoUctPlayoutPolicyParam& param);

    /** @name Functions needed by all playout policies. */
    // @{

    /** Generate a move
        Generates a random move in the following order:
        -# Atari heuristic (if enabled)
        -# Proximity heuristic (if enabled) (using patterns if enabled)
        -# Capture heuristic (if enabled)
        -# Purely random */
    SgPoint GenerateMove();

    void EndPlayout();

    void StartPlayout();

    void OnPlay();

    /** Return the type of the last move generated. */
    GoUctPlayoutPolicyType MoveType() const;

    // @} // @name

    /** @name Statistics */
    // @{

    /** Return current statistics.
        The statistics are only collected, if enabled with
        EnableStatistics(). */
    const GoUctPlayoutPolicyStat& Statistics(SgBlackWhite color) const;

    void ClearStatistics();

    // @} // @name

    /** Return the list of equivalent best moves from last move generation.
        The played move was randomly selected from this list. */
    GoPointList GetEquivalentBestMoves() const;

    /** @see GoUctPlayoutPolicyParam */
    const GoUctPlayoutPolicyParam& Param() const;

    /** Make pattern matcher available for other uses.
        Avoids that a user of the playout policy who also wants to use the
        pattern matcher for other purposes needs to allocate a second
        matcher (Use case: prior knowledge) */
    const GoUctPatterns<BOARD>& Patterns() const;

    /** @see GoUctGammaMoveGenerator */
    const GoUctGammaMoveGenerator<BOARD>& GammaGenerator() const;

    /** A function that tries to correct a given move if it is bad.
     Returns true of the move was replaced.
     */
    typedef bool Corrector(const BOARD&, SgPoint&);

    /** Try to correct the proposed move, typically by moving it to a
     'better' point such as other liberty or neighbor.
     Examples implemented: self-ataries, clumps. */
    bool CorrectMove(typename GoUctPlayoutPolicy<BOARD>::Corrector&
                     corrFunction,
                     SgPoint& move,
                     GoUctPlayoutPolicyType moveType);

    /** Make defensive-move detector available for other uses.
        Includes calls to StartPlayout and EndPlayout, and will interfere
        with any other in-progress use of this GoUctPlayoutPolicy.
    */
    GoPointList GetAtariDefenseMoves();

    /** Make global pattern matcher available for other uses.
	 Avoids that a user of the playout policy who also wants to use the
	 pattern matcher for other purposes needs to allocate a second
	 matcher (Use case: prior knowledge) */
    const GoUctPatterns<BOARD>& GlobalPatterns() const;

private:

    /** Incrementally keeps track of blocks in atari. */
    class CaptureGenerator
    {
    public:
        CaptureGenerator(const BOARD& bd);

        void StartPlayout();

        void OnPlay();

        /** Generate capture moves.
            @param[out] moves The resulting list of capture moves. The passed
            in list is expected to be empty. */
        void Generate(GoPointList& moves);

    private:
        const BOARD& m_bd;

        /** Anchor stones of blocks that need to be checked for atari. */
        std::vector<SgPoint> m_candidates;
    };

    /** Use patterns around last own move, too */
    static const bool SECOND_LAST_MOVE_PATTERNS = true;

    /** Shift move to neighbor if it would make an ugly clump.
        See GoUctUtil::DoClumpCorrection */
    static const bool USE_CLUMP_CORRECTION = false;

    static const bool DEBUG_CORRECT_MOVE = false;

    const BOARD& m_bd;

    const GoUctPlayoutPolicyParam& m_param;

    GoUctPatterns<BOARD> m_patterns;

    GoUctPatterns<BOARD> m_globalPatterns;

    /** Whether to skip GeneratePoint test. Are m_moves already checked?  */
    bool m_checked;

    /** Type of the last generated move. */
    GoUctPlayoutPolicyType m_moveType;

    /** See GoUctPlayoutPolicyStat::m_nonRandLen. */
    std::size_t m_nonRandLen;

    /** Last move.
        Stored in member variable to avoid multiple calls to
        GoBoard::GetLastMove during GenerateMove. */
    SgPoint m_lastMove;

    /** List of equivalent best moves generated by the policy.
        The highest priority heuristic will generate all moves in this list.
        Moves in this list are not yet checked, if they are legal.
        This list is not used in GenerateMove(), if a pure random move
        is generated. */
    GoPointList m_moves;

    SgRandom m_random;

    GoUctGammaMoveGenerator<BOARD> m_gammaGenerator;

    CaptureGenerator m_captureGenerator;

    GoUctPureRandomGenerator<BOARD> m_pureRandomGenerator;

    SgBWArray<GoUctPlayoutPolicyStat> m_statistics;

    /** Captures if last move was self-atari */
    bool GenerateAtariCaptureMove();

    /** Generate escapes if last move was atari. */
    bool GenerateAtariDefenseMove();

    /** Generate low lib moves around lastMove */
    bool GenerateLowLibMove(SgPoint lastMove);

    bool GenerateNakadeMove();

    void GenerateNakadeMove(SgPoint p);

    /** Generate pattern move around last two moves */
    bool GeneratePatternMove();

    void GeneratePatternMove(SgPoint p);

    void GeneratePatternMove2(SgPoint p, SgPoint lastMove);

    void GeneratePureRandom();

    bool GeneratePoint(SgPoint p) const;

    /** Does playing on a liberty increase number of liberties for block?
        If yes, add to m_moves.
        Disabled if both liberties are simple chain libs, e.g. bamboo. */
    void PlayGoodLiberties(SgPoint block);

    /** see GoUctUtil::SelectRandom */
    SgPoint SelectRandom();

    /** Add statistics for most recently generated move. */
    void UpdateStatistics();
};

template<class BOARD>
inline const GoUctPlayoutPolicyParam& GoUctPlayoutPolicy<BOARD>::Param() const
{
	return m_param;
}

template<class BOARD>
GoUctPlayoutPolicy<BOARD>::CaptureGenerator::CaptureGenerator(const BOARD& bd)
    : m_bd(bd)
{
    m_candidates.reserve(GO_MAX_NUM_MOVES);
}

template<class BOARD>
void GoUctPlayoutPolicy<BOARD>::CaptureGenerator::StartPlayout()
{
    m_candidates.clear();
    for (typename BOARD::Iterator it(m_bd); it; ++it)
    {
        const SgPoint p = *it;
        if (m_bd.Occupied(p) && m_bd.Anchor(p) == p && m_bd.InAtari(p))
            m_candidates.push_back(p);
    }
}

template<class BOARD>
void GoUctPlayoutPolicy<BOARD>::CaptureGenerator::OnPlay()
{
    SgPoint lastMove = m_bd.GetLastMove();
    if (lastMove == SG_NULLMOVE || lastMove == SG_PASS)
        return;
    if (m_bd.OccupiedInAtari(lastMove))
        m_candidates.push_back(m_bd.Anchor(lastMove));
    if (m_bd.NumNeighbors(lastMove, m_bd.ToPlay()) == 0)
        return;
    if (m_bd.OccupiedInAtari(lastMove + SG_NS))
        m_candidates.push_back(m_bd.Anchor(lastMove + SG_NS));
    if (m_bd.OccupiedInAtari(lastMove - SG_NS))
        m_candidates.push_back(m_bd.Anchor(lastMove - SG_NS));
    if (m_bd.OccupiedInAtari(lastMove + SG_WE))
        m_candidates.push_back(m_bd.Anchor(lastMove + SG_WE));
    if (m_bd.OccupiedInAtari(lastMove - SG_WE))
        m_candidates.push_back(m_bd.Anchor(lastMove - SG_WE));
}

template<class BOARD>
void GoUctPlayoutPolicy<BOARD>::CaptureGenerator::Generate(GoPointList& moves)
{
    ////SG_ASSERT(moves.IsEmpty());
    const SgBlackWhite opp = m_bd.Opponent();
    // For efficiency reasons, this function does not check, if the same
    // move is generated multiple times (and will therefore played with
    // higher probabilty, if there are also other capture moves), because in
    // nearly all cases, there is zero or one global capture move on the
    // board. Most captures are done immediately by the atari heuristic
    for (size_t i = 0; i < m_candidates.size(); ++i)
    {
        const SgPoint p = m_candidates[i];
        if (! m_bd.OccupiedInAtari(p))
        {
            m_candidates[i] = m_candidates[m_candidates.size() - 1];
            m_candidates.pop_back();
            --i;
            continue;
        }
        if (m_bd.GetColor(p) == opp)
            moves.PushBack(m_bd.TheLiberty(p));
    }
}

template<class BOARD>
GoUctPlayoutPolicy<BOARD>::GoUctPlayoutPolicy(const BOARD& bd,
    const GoUctPlayoutPolicyParam& param)
    : m_bd(bd),
      m_param(param),
      m_patterns(bd, GoUctPatterns<BOARD>::PATTERN_LOCAL),
      m_globalPatterns(bd, GoUctPatterns<BOARD>::PATTERN_GLOBAL),
      m_checked(false),
      m_gammaGenerator(bd, param.m_patternGammaThreshold,
                       m_patterns, m_random),
      m_captureGenerator(bd),
      m_pureRandomGenerator(bd, m_random)
{
    ClearStatistics();
}

template<class BOARD>
void GoUctPlayoutPolicy<BOARD>::ClearStatistics()
{
    m_statistics[SG_BLACK].Clear();
    m_statistics[SG_WHITE].Clear();
}

template<class BOARD>
bool GoUctPlayoutPolicy<BOARD>::CorrectMove(
                    typename GoUctPlayoutPolicy<BOARD>::Corrector& corrFunction,
                    SgPoint& mv, GoUctPlayoutPolicyType moveType)
{
#if DEBUG
    const SgPoint oldMv = mv;
#endif
    if (! corrFunction(m_bd, mv))
        return false;

    m_moves.SetTo(mv);
    m_moveType = moveType;

#if DEBUG
    if (DEBUG_CORRECT_MOVE)
        SgDebug() << m_bd
                  << "Replace " << SgWriteMove(oldMv, m_bd.ToPlay())
                  << " by " << SgWriteMove(mv, m_bd.ToPlay()) << '\n';
#endif
    return true;
}

template<class BOARD>
void GoUctPlayoutPolicy<BOARD>::EndPlayout()
{ }

template<class BOARD>
bool GoUctPlayoutPolicy<BOARD>::GenerateAtariCaptureMove()
{
    ////SG_ASSERT(! SgIsSpecialMove(m_lastMove));
    if (m_bd.InAtari(m_lastMove))
    {
        SgMove mv = m_bd.TheLiberty(m_lastMove);
        m_moves.PushBack(mv);
        return true;
    }
    return false;
}

template<class BOARD>
bool GoUctPlayoutPolicy<BOARD>::GenerateAtariDefenseMove()
{
    return GoBoardUtil::AtariDefenseMoves(m_bd, m_lastMove, m_moves);
}

template<class BOARD>
void GoUctPlayoutPolicy<BOARD>::PlayGoodLiberties(SgPoint block)
{
    SgPoint ignoreOther;
    if (! GoBoardUtil::IsSimpleChain(m_bd, block, ignoreOther))
        for (typename BOARD::LibertyIterator it(m_bd, block); it; ++it)
            if (  GoUctUtil::GainsLiberties(m_bd, block, *it)
               && ! GoBoardUtil::SelfAtari(m_bd, *it)
               )
                m_moves.PushBack(*it);
}

template<class BOARD>
bool GoUctPlayoutPolicy<BOARD>::GenerateLowLibMove(SgPoint lastMove)
{
    ////SG_ASSERT(! SgIsSpecialMove(lastMove));
    ////SG_ASSERT(! m_bd.IsEmpty(lastMove));
    ////SG_ASSERT(m_moves.IsEmpty());

    const SgBlackWhite toPlay = m_bd.ToPlay();

    // take liberty of last move
    if (m_bd.NumLiberties(lastMove) == 2)
    {
        const SgPoint anchor = m_bd.Anchor(lastMove);
        PlayGoodLiberties(anchor);
    }

    if (m_bd.NumNeighbors(lastMove, toPlay) != 0)
    {
        // play liberties of neighbor blocks
        SgArrayList<SgPoint,4> ourLowLibBlocks;
        for (GoNb4Iterator<BOARD> it(m_bd, lastMove); it; ++it)
        {
            if (m_bd.GetColor(*it) == toPlay
                && m_bd.NumLiberties(*it) == 2)
            {
                const SgPoint anchor = m_bd.Anchor(*it);
                if (! ourLowLibBlocks.Contains(anchor))
                {
                    ourLowLibBlocks.PushBack(anchor);
                    PlayGoodLiberties(anchor);
                }
            }
        }
    }

    return ! m_moves.IsEmpty();
}

template<class BOARD>
SG_ATTR_FLATTEN SgPoint GoUctPlayoutPolicy<BOARD>::GenerateMove()
{
    m_moves.Clear();
    m_checked = false;
    SgPoint mv = SG_NULLMOVE;

    if (m_param.m_fillboardTries > 0)
    {
        m_moveType = GOUCT_FILLBOARD;
        mv = m_pureRandomGenerator.
             GenerateFillboardMove(m_param.m_fillboardTries);
    }

    m_lastMove = m_bd.GetLastMove();

    if (  mv == SG_NULLMOVE
       && ! SgIsSpecialMove(m_lastMove) // skip if Pass or Null
       && ! m_bd.IsEmpty(m_lastMove) // skip if move was suicide
       )
    {
        if (m_param.m_useNakadeHeuristic && GenerateNakadeMove())
        {
            m_moveType = GOUCT_NAKADE;
            mv = SelectRandom();
        }
        if (mv == SG_NULLMOVE && GenerateAtariCaptureMove())
        {
            m_moveType = GOUCT_ATARI_CAPTURE;
            mv = SelectRandom();
        }
        if (mv == SG_NULLMOVE && GenerateAtariDefenseMove())
        {
            m_moveType = GOUCT_ATARI_DEFEND;
            mv = SelectRandom();
        }
        if (mv == SG_NULLMOVE && GenerateLowLibMove(m_lastMove))
        {
            m_moveType = GOUCT_LOWLIB;
            mv = SelectRandom();
        }
        if (mv == SG_NULLMOVE)
        {
        	if (m_param.m_usePatternsInPlayout)
            {
                m_moveType = GOUCT_GAMMA_PATTERN;
                mv = m_gammaGenerator.GenerateBiasedPatternMove();
            }
            else if (GeneratePatternMove())
            {
                m_moveType = GOUCT_PATTERN;
                mv = SelectRandom();
            }
        }
    }

    if (mv != SG_NULLMOVE)
        CorrectMove(GoUctUtil::DoFalseEyeToCaptureCorrection, mv,
                        GOUCT_REPLACE_CAPTURE);
    if (mv == SG_NULLMOVE)
    {
        m_moveType = GOUCT_CAPTURE;
        m_captureGenerator.Generate(m_moves);
        mv = SelectRandom();
    }
    if (mv == SG_NULLMOVE)
    {
        m_moveType = GOUCT_RANDOM;
        mv = m_pureRandomGenerator.Generate();
    }
    if (mv == SG_NULLMOVE)
    {
        m_moveType = GOUCT_PASS;
        mv = SG_PASS;
        m_checked = true;
    }
    else
    {
        ////SG_ASSERT(m_bd.IsLegal(mv));
        m_checked = CorrectMove(GoUctUtil::DoSelfAtariCorrection, mv,
                                GOUCT_SELFATARI_CORRECTION);
        if (USE_CLUMP_CORRECTION && ! m_checked)
            CorrectMove(GoUctUtil::DoClumpCorrection, mv,
                        GOUCT_CLUMP_CORRECTION);
    }
    ////SG_ASSERT(m_bd.IsLegal(mv));
    ////SG_ASSERT(mv == SG_PASS || ! m_bd.IsSuicide(mv));

    if (m_param.m_statisticsEnabled)
        UpdateStatistics();

    return mv;
}

/** Nakade heuristic.
    If there is a region of three empty points adjacent to last move, play in
    the center of the region. */
template<class BOARD>
bool GoUctPlayoutPolicy<BOARD>::GenerateNakadeMove()
{
    ////SG_ASSERT(m_moves.IsEmpty());
    ////SG_ASSERT(! SgIsSpecialMove(m_lastMove));
    GenerateNakadeMove(m_lastMove + SG_NS);
    GenerateNakadeMove(m_lastMove - SG_NS);
    GenerateNakadeMove(m_lastMove + SG_WE);
    GenerateNakadeMove(m_lastMove - SG_WE);
    // Ignore duplicates in move list, happens rarely
    return ! m_moves.IsEmpty();
}

template<class BOARD>
void GoUctPlayoutPolicy<BOARD>::GenerateNakadeMove(SgPoint p)
{
    SgBlackWhite toPlay = m_bd.ToPlay();
    if (m_bd.IsEmpty(p) && m_bd.NumNeighbors(p, toPlay) == 0)
    {
        int numEmptyNeighbors = m_bd.NumEmptyNeighbors(p);
        if (numEmptyNeighbors == 2)
        {
            int n = 0;
            for (GoNb4Iterator<BOARD> it(m_bd, p); it; ++it)
                if (m_bd.IsEmpty(*it))
                {
                    if (  m_bd.NumEmptyNeighbors(*it) != 1
                       || m_bd.NumNeighbors(*it, toPlay) > 0
                       )
                        return;
                    if (++n > 2)
                        break;
                }
            m_moves.PushBack(p);
        }
        else if (numEmptyNeighbors == 1)
        {
            for (GoNb4Iterator<BOARD> it(m_bd, p); it; ++it)
                if (m_bd.IsEmpty(*it))
                {
                    if (  m_bd.NumEmptyNeighbors(*it) != 2
                       || m_bd.NumNeighbors(*it, toPlay) > 0
                       )
                        return;
                    for (GoNb4Iterator<BOARD> it2(m_bd, *it); it2; ++it2)
                        if (m_bd.IsEmpty(*it2) && *it2 != p)
                        {
                            if (  m_bd.NumEmptyNeighbors(*it2) == 1
                               && m_bd.NumNeighbors(*it2, toPlay) == 0
                               )
                                m_moves.PushBack(*it);
                            break;
                        }
                    break;
                }

        }
    }
}

/** Pattern heuristic.
    Use patterns (only in 3x3 neighborhood of last move)
    @see GoUctPatterns */
template<class BOARD>
bool GoUctPlayoutPolicy<BOARD>::GeneratePatternMove()
{
    ////SG_ASSERT(m_moves.IsEmpty());
    ////SG_ASSERT(! SgIsSpecialMove(m_lastMove));
    GeneratePatternMove(m_lastMove + SG_NS - SG_WE);
    GeneratePatternMove(m_lastMove + SG_NS);
    GeneratePatternMove(m_lastMove + SG_NS + SG_WE);
    GeneratePatternMove(m_lastMove - SG_WE);
    GeneratePatternMove(m_lastMove + SG_WE);
    GeneratePatternMove(m_lastMove - SG_NS - SG_WE);
    GeneratePatternMove(m_lastMove - SG_NS);
    GeneratePatternMove(m_lastMove - SG_NS + SG_WE);
    if (SECOND_LAST_MOVE_PATTERNS)
    {
        const SgPoint lastMove2 = m_bd.Get2ndLastMove();
        if (! SgIsSpecialMove(lastMove2))
        {
            GeneratePatternMove2(lastMove2 + SG_NS - SG_WE, m_lastMove);
            GeneratePatternMove2(lastMove2 + SG_NS,         m_lastMove);
            GeneratePatternMove2(lastMove2 + SG_NS + SG_WE, m_lastMove);
            GeneratePatternMove2(lastMove2 - SG_WE,         m_lastMove);
            GeneratePatternMove2(lastMove2 + SG_WE,         m_lastMove);
            GeneratePatternMove2(lastMove2 - SG_NS - SG_WE, m_lastMove);
            GeneratePatternMove2(lastMove2 - SG_NS,         m_lastMove);
            GeneratePatternMove2(lastMove2 - SG_NS + SG_WE, m_lastMove);
        }
    }
    return ! m_moves.IsEmpty();
}

template<class BOARD>
inline void GoUctPlayoutPolicy<BOARD>::GeneratePatternMove(SgPoint p)
{
    if (m_bd.IsEmpty(p)
        && m_patterns.MatchAny(p)
        && ! GoBoardUtil::SelfAtari(m_bd, p))
        m_moves.PushBack(p);
}

template<class BOARD>
inline void GoUctPlayoutPolicy<BOARD>::GeneratePatternMove2(SgPoint p,
                                                            SgPoint lastMove)
{
    if (m_bd.IsEmpty(p)
        && ! SgPointUtil::In8Neighborhood(lastMove, p)
        && m_patterns.MatchAny(p)
        && ! GoBoardUtil::SelfAtari(m_bd, p))
        m_moves.PushBack(p);
}

template<class BOARD>
inline bool GoUctPlayoutPolicy<BOARD>::GeneratePoint(SgPoint p) const
{
    return GoUctUtil::GeneratePoint(m_bd, p, m_bd.ToPlay());
}

template<class BOARD>
GoPointList GoUctPlayoutPolicy<BOARD>::GetEquivalentBestMoves() const
{
    GoPointList result;
    if (m_moveType == GOUCT_RANDOM)
    {
        for (typename BOARD::Iterator it(m_bd); it; ++it)
            if (m_bd.IsEmpty(*it) && GeneratePoint(*it))
                result.PushBack(*it);
    }
    // Move in m_moves are not checked yet, if legal etc.
    for (GoPointList::Iterator it(m_moves); it; ++it)
        if (m_checked || GeneratePoint(*it))
            result.PushBack(*it);
    return result;
}

template<class BOARD>
GoPointList GoUctPlayoutPolicy<BOARD>::GetAtariDefenseMoves()
{
    StartPlayout();
    m_moves.Clear();
    m_lastMove = m_bd.GetLastMove();
    if (  ! SgIsSpecialMove(m_lastMove) // skip if Pass or Null
       && ! m_bd.IsEmpty(m_lastMove) // skip if move was suicide
       )
    {
        GenerateAtariDefenseMove();
    }
    EndPlayout();
    return m_moves;
}

template<class BOARD>
GoUctPlayoutPolicyType GoUctPlayoutPolicy<BOARD>::MoveType()
    const
{
    return m_moveType;
}

template<class BOARD>
void GoUctPlayoutPolicy<BOARD>::OnPlay()
{
    m_captureGenerator.OnPlay();
    m_pureRandomGenerator.OnPlay();
}

template<class BOARD>
const GoUctGammaMoveGenerator<BOARD>&
GoUctPlayoutPolicy<BOARD>::GammaGenerator() const
{
    return m_gammaGenerator;
}

template<class BOARD>
const GoUctPatterns<BOARD>&
GoUctPlayoutPolicy<BOARD>::GlobalPatterns() const
{
    return m_globalPatterns;
}

template<class BOARD>
const GoUctPatterns<BOARD>&
GoUctPlayoutPolicy<BOARD>::Patterns() const
{
    return m_patterns;
}

template<class BOARD>
inline SgPoint GoUctPlayoutPolicy<BOARD>::SelectRandom()
{
    return GoUctUtil::SelectRandom(m_bd, m_bd.ToPlay(), m_moves, m_random);
}

template<class BOARD>
const GoUctPlayoutPolicyStat&
GoUctPlayoutPolicy<BOARD>::Statistics(SgBlackWhite color) const
{
    return m_statistics[color];
}

template<class BOARD>
void GoUctPlayoutPolicy<BOARD>::StartPlayout()
{
    m_captureGenerator.StartPlayout();
    m_pureRandomGenerator.Start();
    m_nonRandLen = 0;
}

template<class BOARD>
void GoUctPlayoutPolicy<BOARD>::UpdateStatistics()
{
    GoUctPlayoutPolicyStat& statistics = m_statistics[m_bd.ToPlay()];
    ++statistics.m_nuMoves;
    ++statistics.m_nuMoveType[m_moveType];
    if (m_moveType == GOUCT_RANDOM)
    {
        if (m_nonRandLen > 0)
        {
            statistics.m_nonRandLen.Add(float(m_nonRandLen));
            m_nonRandLen = 0;
        }
    }
    else
    {
        ++m_nonRandLen;
        statistics.m_moveListLen.Add(float(GetEquivalentBestMoves().Length()));
    }
}

//----------------------------------------------------------------------------

template<class BOARD>
class GoUctPlayoutPolicyFactory
{
public:
    /** Constructor.
        @param param Playout policy parameters. Stores a reference. Lifetime
        of the argument must exceed the lifetime of this factory and created
        objects. */
    GoUctPlayoutPolicyFactory(const GoUctPlayoutPolicyParam& param);

    GoUctPlayoutPolicy<BOARD>* Create(const BOARD& bd);

private:
    const GoUctPlayoutPolicyParam& m_param;
};

template<class BOARD>
GoUctPlayoutPolicyFactory<BOARD>
::GoUctPlayoutPolicyFactory(const GoUctPlayoutPolicyParam& param)
    : m_param(param)
{ }

template<class BOARD>
GoUctPlayoutPolicy<BOARD>*
GoUctPlayoutPolicyFactory<BOARD>::Create(const BOARD& bd)
{
    return new GoUctPlayoutPolicy<BOARD>(bd, m_param);
}

//----------------------------------------------------------------------------

#endif // GOUCT_PLAYOUTPOLICY_H


text:
New meeting insertion

                <iit-meetings-form></iit-meetings-form>

Last inserted meetings

        <iit-meetings-list meetings="vm.meetings" filter-active="false" counting-active="false" limit="5"></iit-meetings-list>
        View All


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

<title>com.imie.component.view</title>
<meta name="date" content="2016-06-29">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

com.imie.component.view

Classes

CustomerView

DefaultView

DeliveryView

InvoiceView

OrderDetailView

OrderView

ProductView

VaadinUI


text:
from __future__ import unicode_literals

from babel.dates import format_date, get_day_names, format_time
from google.appengine.ext.deferred import deferred

from mcfw.exceptions import HttpBadRequestException
from rogerthat.bizz.communities.homescreen import maybe_publish_home_screens
from rogerthat.bizz.opening_hours import is_always_open, is_always_closed
from rogerthat.models import OpeningHours, OpeningPeriod, OpeningHourException
from rogerthat.to.maps import OpeningHoursTO
from solutions import translate
from solutions.common.bizz import broadcast_updates_pending
from solutions.common.dal import get_solution_settings

class HoursOverlapException(HttpBadRequestException):
    def __init__(self, message):
        super(HoursOverlapException, self).__init__('oca.error', {'message': message})

def get_opening_hours(service_user, service_identity):
    # type: (users.User, str) -> OpeningHours
    key = OpeningHours.create_key(service_user, service_identity)
    return key.get() or OpeningHours(key=key, type=OpeningHours.TYPE_TEXTUAL, text='')

def populate_opening_hours(data, model):
    # type: (OpeningHoursTO, OpeningHours) -> OpeningHours
    model.type = data.type
    model.text = data.text and data.text.strip()
    model.title = data.title
    model.periods = [OpeningPeriod.from_to(period) for period in data.periods]
    model.exceptional_opening_hours = [OpeningHourException.from_to(exception)
                                       for exception in data.exceptional_opening_hours]
    return model

def put_opening_hours(service_user, service_identity, data):
    # type: (users.User, str, OpeningHoursTO) -> OpeningHours
    opening_hours = get_opening_hours(service_user, service_identity)
    populate_opening_hours(data, opening_hours)
    opening_hours.put()

    sln_settings = get_solution_settings(service_user)
    if not sln_settings.updates_pending:
        sln_settings.updates_pending = True
        sln_settings.put()
    broadcast_updates_pending(sln_settings)
    deferred.defer(maybe_publish_home_screens, service_user)
    return opening_hours

def _get_open_hour_text(period, locale):
    # type: (OpeningPeriod, str) -> str
    if period.is_open_24_hours:
        return translate(locale, 'oca.open_24_hours')
    open_time = format_time(period.open.datetime, 'short', locale=locale)
    close_time = format_time(period.close.datetime, 'short', locale=locale)
    line = '%s — %s' % (open_time, close_time)
    if period.description:
        line += ' %s' % period.description
    return line

def _get_opening_periods_lines(opening_periods, day_names, locale):
    # type: (List[OpeningPeriod], List[str], str) -> List[str]
    lines = []
    previous_day_name = None
    for period in opening_periods:
        day_name = day_names[period.open.day]
        # Assumes these are sorted by day
        if previous_day_name != day_name:
            if lines:
                lines.append('')
            lines.append(day_name)
        lines.append(_get_open_hour_text(period, locale))
        previous_day_name = day_name
    return lines

def opening_hours_to_text(opening_hours, locale, current_datetime):
    # type: (OpeningHours, str, datetime) -> str
    if not opening_hours:
        return None
    if opening_hours.type in (OpeningHours.TYPE_TEXTUAL, OpeningHours.TYPE_NOT_RELEVANT,):
        return opening_hours.text
    day_names = get_day_names(locale=locale).values()  # Starts on monday
    day_names.insert(0, day_names.pop())  # Starts on sunday
    if is_always_open(opening_hours.periods):
        return translate(locale, 'always_open')
    if is_always_closed(opening_hours.periods):
        return translate(locale, 'always_closed')
    lines = _get_opening_periods_lines(opening_hours.periods, day_names, locale)
    if opening_hours.exceptional_opening_hours:
        lines.append('')
        lines.append(translate(locale, 'deviating_opening_hours'))
        lines.append('')
    current_date = current_datetime.date()
    for exception in opening_hours.exceptional_opening_hours:
        if exception.end_date < current_date:
            continue
        start_date = format_date(exception.start_date, 'short', locale)
        if exception.start_date == exception.end_date:
            day_str = start_date
        else:
            end_date = format_date(exception.end_date, 'short', locale)
            day_str = '%s — %s' % (start_date, end_date)
        if not exception.periods:
            closed = translate(locale, 'oca.closed')
            if exception.description:
                description = '%s — %s' % (exception.description, closed)
            else:
                description = closed
        else:
            description = exception.description
        lines.append('%s %s' % (day_str, description))
        if exception.periods:
            lines.extend(_get_opening_periods_lines(exception.periods, day_names, locale))
    return '\n'.join(lines)


text:
package me.common.tinydb;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.query.QueryBuilder;

import java.util.List;

/**
 * ******************(^_^)***********************

 * User: 11776610771@qq.com

 * Date: 2017/5/6

 * Time: 10:14

 * DESC: 通用的Dao helper,提供一些通用的表的CRUD;一般把子类写成单例模式并根据业务需求扩展自身来使用
 * T:为数据对象类型,对应一张表结构;I为本类自身(方便链式调用,在本类作用不大);PK:指代AbstractDao中所对应的某表的Primary key类型

 * ******************(^_^)***********************

 */

public abstract class AbsDaoHelper<T, I extends AbsDaoHelper<T, I,PK>,PK> {
    protected final String TAG = getClass().getSimpleName();
    protected AbstractDao<T, PK> curDao;//这里的Long类型指定了Dao的Primary key o Long 类型,一般的表的Primary key 为"_id"字段
    protected AbsDaoHelper(){
        curDao = provideDao();
    }
    protected abstract AbstractDao<T, PK> provideDao();
    /**
     * 往数据库的表中添加一条数据
     * @param data 要添加的数据
     * @return row id
     */
    public long addData(T data) {
        checkDaoNotNull();
        return curDao.insertOrReplace(data);
    }

    public I addData(T... datas) {
        checkDaoNotNull();
        curDao.insertOrReplaceInTx(datas);
        return self();
    }
    public List<T> getAllData() {
        checkDaoNotNull();
        return curDao.loadAll();
    }

    public long getTotalCount() {
        checkDaoNotNull();
        return queryBuilder().buildCount().count();
    }
    public T getDataByRowId(long rowId) {
        if (rowId < 0) {
            return null;
        }
        checkDaoNotNull();
        return curDao.loadByRowId(rowId);
    }

    /**
     * 根据 表的primaryKey的值来查找某条数据
     * @param primaryKey Primary key 对应的值,一般来讲一张表的Primary key为"_id"字段
     * @return
     */
    public T getDataByPkId(PK primaryKey) {
        checkDaoNotNull();
        return curDao.load(primaryKey);
    }

    public I deleteDataByPk(PK pk) {
        checkDaoNotNull();
        curDao.deleteByKey(pk);
        return self();
    }

    public I deleteDataByPk(PK... pks) {
        checkDaoNotNull();
        curDao.deleteByKeyInTx(pks);
        return self();
    }
    public I deleteData(T data) {
        checkDaoNotNull();
        curDao.delete(data);
        return self();
    }

    /**
     * 使用事务批量删除指定的数据
     * @param datas 要删除的数据
     * @return
     */
    public I deleteData(T... datas) {
        checkDaoNotNull();
        curDao.deleteInTx(datas);
        return self();
    }

    public I deleteAll() {
        checkDaoNotNull();
        curDao.deleteAll();
        return self();
    }

    public I update(T data) {
        if (data != null) {
            checkDaoNotNull();
            curDao.update(data);
        }
        return self();
    }
    public QueryBuilder<T> queryBuilder() {
        checkDaoNotNull();
        return curDao.queryBuilder();
    }
	/**
	 * 让子类可调用,但不可重载
	**/
    protected final void checkDaoNotNull() {
        if (curDao == null) {
            curDao = provideDao();
        }
        if (curDao == null) {
            throw new NullPointerException(" sorry! cur dao is null,can't excute...");
        }
    }

    public AbstractDao<T,PK> getDao() {
        return curDao;
    }
    protected I self() {
        return (I) this;
    }
}


text:
<?php

?>

<?php
global $full_tubename ;
$full_tubename  = "C:\\wamp\\www\\prototyping\\GMPWin\\GraphData\\upload\\videos\\";

global $pictureaddress ;
$pictureaddress  = "C:\\wamp\\www\\prototyping\\GMPWin\\GraphData\\media\\videos\\";

global $ffmpegaddress ;
$ffmpegaddress  = "C:\\wamp\\www\\prototyping\\GMPWin\\GraphData\\ffmpeg\\";

?>


text:
using namespace cv;

#define PI 3.14159265

#define MIN_DISPLAY_THRESHOLD 0.25

class HudObjectDrawer {

    public:
        HudObjectDrawer(const TrajectoryLibrary *trajlib, BotFrames *bot_frames, const OpenCvStereoCalibration *stereo_calibration, bool show_unremapped = false);

        void SetAutonomous(int autonomous) { is_autonomous_ = autonomous == 1; }
        void SetTrajBoxesInManualMode(bool traj_boxes_in_manual_mode) { traj_boxes_in_manual_mode_ = traj_boxes_in_manual_mode; }
        void SetTrajectoryNumber(int traj_number);
        void SetPose(const mav_pose_t *msg);

        void DrawTrajectory(Mat hud_img);

        void DrawObstacles(Mat hud_img, lcmt_stereo *msg);

        bool GetCurrentU0(Eigen::VectorXd *u0) const;

    private:
        int traj_number_;
        bool show_unremapped_;
        bool traj_boxes_in_manual_mode_ = false;

        Scalar hud_color_ = Scalar(0.45, 0.95, 0.48);
        BotFrames *bot_frames_;
        const TrajectoryLibrary *trajlib_ = nullptr;
        const OpenCvStereoCalibration *stereo_calibration_ = nullptr;

        std::vector<Point2d> DrawBox(Mat hud_img, double xyz[3], double rpy[3], double width, double height, Scalar color);
        void DrawCube(Mat hud_img, double xyz[3], double rpy[3], double width, double height, double length, Scalar color);

        void InitializeState(const mav_pose_t *msg);
        Eigen::VectorXd GetStateMinusInit(const mav_pose_t *msg);

        mav_pose_t *current_pose_msg_ = nullptr;
        double current_t_ = 0;

        int64_t t0_;
        bool state_initialized_ = false;
        bool is_autonomous_ = false;
        Eigen::VectorXd initial_state_;
        Eigen::VectorXd last_state_; // keep so we can do angle unwrapping
        Eigen::Matrix3d Mz_; // rotation matrix that transforms global state into local state by removing yaw

};

#endif


text:
package org.rioproject.test.associations;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.rioproject.config.Constants;
import org.rioproject.net.HostUtil;
import org.rioproject.opstring.ClassBundle;
import org.rioproject.opstring.OperationalStringManager;
import org.rioproject.opstring.ServiceBeanConfig;
import org.rioproject.opstring.ServiceElement;
import org.rioproject.test.RioTestRunner;
import org.rioproject.test.SetTestManager;
import org.rioproject.test.TestManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Test that serviceDiscoveryTimeout works
 *
 * @author Dennis Reedy
 */
@RunWith(RioTestRunner.class)
public class AssociationManagementTest {
    @SetTestManager
    static TestManager testManager;
    OperationalStringManager manager;
    Logger logger = LoggerFactory.getLogger(AssociationManagementTest.class);

    @Before
    public void setup() {
        manager = testManager.getOperationalStringManager();
        testManager.waitForDeployment(manager);
    }

    @Test
    public void testServiceDiscoveryTimeout() throws Exception {
        Dummy darrel = (Dummy) testManager.waitForService(Dummy.class);
        new Thread(new Runnable() {
            @Override public void run() {
                ServiceElement elem = new ServiceElement();
                elem.setPlanned(1);
                try {
                    String codebase = "http://"+HostUtil.getHostAddressFromProperty(Constants.RMI_HOST_ADDRESS)+":9010";
                    elem.setExportBundles(makeClassBundle(Dummy.class.getName(), codebase));
                    elem.setComponentBundle(makeClassBundle(DummyImpl.class.getName(), codebase));

                    ServiceBeanConfig sbc = new ServiceBeanConfig();
                    sbc.setName("Add");
                    sbc.setGroups(System.getProperty("org.rioproject.groups"));
                    sbc.setOperationalStringName("association stuff");
                    elem.setServiceBeanConfig(sbc);

                    logger.info("Wait 5 seconds to deploy another dummy...");
                    Thread.sleep(5*1000);
                    logger.info("Deploying another dummy...");
                    manager.addServiceElement(elem, null);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }).start();

        int index = darrel.getIndexFromAnotherDummy();
        logger.info("The other dummy returned: {}", index);
    }

    ClassBundle makeClassBundle(String className, String codebase) {
        ClassBundle classBundle = new ClassBundle();
        classBundle.addJAR("test-classes/");
        classBundle.setClassName(className);
        classBundle.setCodebase(codebase);
        return classBundle;
    }
}


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

using System;
using System.Linq;
using System.Collections.Generic;

using MonoTouch.Dialog;

using Foundation;
using UIKit;

using MailKit;

namespace ImapClientDemo.iOS
{
    public partial class MessageListViewController : DialogViewController
    {
        MessageViewController viewMessageViewController;

        public MessageListViewController (IMailFolder folder) : base (UITableViewStyle.Grouped, null, true)
        {
            Folder = folder;

            Root = new RootElement (folder.FullName) {
                new Section ()
            };
        }

        public IMailFolder Folder { get; private set; }

        public async override void ViewDidLoad ()
        {
            base.ViewDidLoad ();

            // Open the folder for reading
            await Folder.OpenAsync (FolderAccess.ReadOnly);

            // Get the message summaries
            var summaries = await Folder.FetchAsync (0, -1, MessageSummaryItems.UniqueId | MessageSummaryItems.Envelope | MessageSummaryItems.InternalDate);

            var sectionMessages = new Section ();

            // Loop through all the message summaries
            foreach (var s in summaries) {
                // Add an item to the UI section/list
                sectionMessages.Add (new MessageElement (async (viewController, tableView, indexPath) => {
                    // When a message is selected, fetch the actual message by UID
                    var msg = await Folder.GetMessageAsync (summaries [indexPath.Row].UniqueId);

                    // Show the message details view controller
                    viewMessageViewController = new MessageViewController (msg);
                    NavigationController.PushViewController (viewMessageViewController, true);
                }) {
                    Sender = s.Envelope.Sender.ToString (),
                    Subject = s.Envelope.Subject,
                    Body = "",
                    Date = s.Envelope.Date.Value.LocalDateTime,
                    NewFlag = false,
                    MessageCount = 0,
                });
            }

            Root.Clear ();
            Root.Add (sectionMessages);
        }
    }
}


text:
package com.jstorm.example.unittests.window;

import backtype.storm.Config;
import backtype.storm.topology.TopologyBuilder;
import backtype.storm.tuple.Fields;
import com.jstorm.example.unittests.utils.JStormUnitTestRunner;
import org.junit.Test;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by binyang.dby on 2016/7/11.
 *
 */
public class RollingTopWordsTest
{
    public final static int DEFAULT_COUNT = 5;

    @Test
    public void testRollingTopWords()
    {
        TopologyBuilder topologyBuilder = new TopologyBuilder();
        topologyBuilder.setSpout("windowTestWordSpout", new WindowTestWordSpout(), 5);
        topologyBuilder.setBolt("windowTestRollingCountBolt", new WindowTestRollingCountBolt(9, 3), 4)
                .fieldsGrouping("windowTestWordSpout", new Fields("word")).addConfiguration(Config.TOPOLOGY_TICK_TUPLE_FREQ_SECS, 3);
        topologyBuilder.setBolt("windowTestIntermediateRankingBolt", new WindowTestIntermediateRankingBolt(DEFAULT_COUNT), 4)
                .fieldsGrouping("windowTestRollingCountBolt", new Fields("obj"));
        topologyBuilder.setBolt("windowTestTotalRankingsBolt", new WindowTestTotalRankingsBolt(DEFAULT_COUNT))
                .globalGrouping("windowTestIntermediateRankingBolt");

        Map config = new HashMap();
        config.put(Config.TOPOLOGY_NAME, "RollingTopWordsTest");

        //I really don't know how to validate if the result is right since
        //the tick time is not precise. It makes the output after passing
        //a window is unpredictable.
        //Now I just let it pass all the time.
        //TODO:FIX ME: how to validate if the result is right?
        JStormUnitTestRunner.submitTopology(topologyBuilder.createTopology(), config, 90, null);
    }
}


text:
<?php

/**
 * 活动表单页面生成类
 * @category iCMS
 * @package iCMS_FrameWork1_RuleClass_Gen_CustomForm
 * @author 525
 */
class CustomFormManageGen extends BaseManageGen implements IBaseManageGen {

    /**
     * 节点表单查询结果 空
     */
    const SELECT_CUSTOM_FORM_LIST_RESULT_NULL = -1;
    /**
     * 表单字段名查询结果 空
     */
    const SELECT_CUSTOM_FORM_TABLE_NAME_LIST_RESULT_NULL = -2;
    /**
     * 新增表单写入数据库失败
     */
    const INSERT_NEW_CUSTOM_FORM_FAILED = -3;
    /**
     * 获取被修改表单原属性结果 空
     */
    const GET_CUSTOM_FORM_ATTRIBUTE_RESULT_NULL = -4;
    /**
     * 修改表单属性写入数据库失败
     */
    const UPDATE_CUSTOM_FORM_ATTRIBUTE_FAIL = -5;

    /**
     * 引导方法
     * @return string 返回执行结果
     */
    function Gen() {
        $result = "";
                $method = Control::GetRequest("m", "");
                switch ($method) {
                    case "create":
                        $result = self::GenCreate();
                        break;
                    case "modify":
                        $result = self::GenModify();
                        break;
                    case "list":
                        $result = self::GenList();
                        break;
                }
                $replaceArray = array(
                    "{method}" => $method
                );
                $result = strtr($result, $replaceArray);
        return $result;
    }

    /**
     * 新增表单
     * @return string 执行结果
     */
    private function GenCreate() {
        $tempContent = Template::Load("custom_form/custom_form_deal.html","common");
        $resultJavaScript="";
        $manageUserId = Control::GetManageUserId();
        $channelId = Control::GetRequest("channel_id", 0);
        parent::ReplaceFirst($tempContent);

        if ($channelId > 0) {
            $channelData = new ChannelManageData();
            $siteId = $channelData->GetSiteId($channelId,"");

            ///////////////判断是否有操作权限///////////////////
            $manageUserAuthority = new ManageUserAuthorityManageData();
            $can = $manageUserAuthority->CanChannelCreate($siteId, $channelId, $manageUserId);
            if ($can != 1) {
                Control::ShowMessage(Language::Load('custom_form', 3));
                return "";
            }

            if (!empty($_POST)) {
                $customFormManageData = new CustomFormManageData();
                $newId = $customFormManageData->Create($_POST);

                //记入操作log
                $operateContent = "Create CustomForm:CustomFormId:" . $newId .",POST FORM:".implode("|",$_POST).";\r\nResult:". $newId;
                self::CreateManageUserLog($operateContent);

                if($newId>0){

                    Control::ShowMessage(Language::Load('custom_form', 1));
                    $closeTab = Control::PostRequest("CloseTab",0);
                    if($closeTab == 1){
                        $resultJavaScript .= Control::GetCloseTab();
                    }else{
                        Control::GoUrl($_SERVER["PHP_SELF"]."?".$_SERVER['QUERY_STRING']);
                        //Control::GoUrl($_SERVER["PHP_SELF"].'?secu=manage&mod=custom_form&m=create');
                    }

                }else{
                    Control::ShowMessage(Language::Load('custom_form', 2));
                    return DefineCode::CUSTOM_FORM_MANAGE+self::INSERT_NEW_CUSTOM_FORM_FAILED;
                }

            }
            ////////////////////////////////////////////////////
            $crateDate=date('Y-m-d H:i:s');
            $replaceArray = array(
                "{SiteId}" => $siteId,
                "{ChannelId}" => $channelId,
                "{ManageUserId}" => $manageUserId,
                "{CreateDate}" => $crateDate,
                "{display}" => ""
            );
            $tempContent = strtr($tempContent, $replaceArray);

            $sourceCommonManageData = new SourceCommonManageData();
            $arrayOfTableNameList = $sourceCommonManageData->GetFields("cst_custom_form");
            if($arrayOfTableNameList>0){
                parent::ReplaceWhenCreate($tempContent, $arrayOfTableNameList);
            }else{
                return DefineCode::CUSTOM_FORM_MANAGE+self::SELECT_CUSTOM_FORM_TABLE_NAME_LIST_RESULT_NULL;
            }

            //去掉s开头的标记 {s_xxx_xxx}
            $patterns = '/\{s_(.*?)\}/';
            $tempContent = preg_replace($patterns, "", $tempContent);
            //去掉c开头的标记 {c_xxx}
            $patterns = '/\{c_(.*?)\}/';
            $tempContent = preg_replace($patterns, "", $tempContent);
            //去掉r开头的标记 {r_xxx_xxx}
            $patterns = '/\{r_(.*?)\}/';
            $tempContent = preg_replace($patterns, "", $tempContent);
        }

        parent::ReplaceEnd($tempContent);
        $tempContent = str_ireplace("{ResultJavascript}", $resultJavaScript, $tempContent);
        return $tempContent;
    }

    /**
     * 修改表单属性
     * @return string 执行结果
     */
    private function GenModify() {
        $tempContent = Template::Load("custom_form/custom_form_deal.html","common");
        $resultJavaScript="";
        parent::ReplaceFirst($tempContent);
        $customFormId = Control::GetRequest("custom_form_id", 0);

        if ($customFormId > 0) {
            $customFormManageData = new CustomFormManageData();
            $channelId = $customFormManageData->GetChannelId($customFormId, 0);
            $channelData = new ChannelManageData();
            $siteId = $channelData->GetSiteId($channelId,"");

            $nowManageUserId = Control::GetManageUserId();
            ///////////////判断是否有操作权限///////////////////
            $manageUserAuthority = new ManageUserAuthorityManageData();
            //编辑权限
            $can = $manageUserAuthority->CanChannelModify($siteId, $channelId, $nowManageUserId);
            if ($can != 1) {
                Control::ShowMessage(Language::Load('custom_form', 3));
                return "";
            }
            //操作他人的权限

            $createUserId = $customFormManageData->GetManageUserId($customFormId,FALSE);
            if ($createUserId !== $nowManageUserId) { //操作人不是发布人
                $can = $manageUserAuthority->CanChannelDoOthers($siteId, $channelId, $nowManageUserId);
                if ($can != 1) {
                    Control::ShowMessage(Language::Load('custom_form', 3));
                    return "";
                }
            }
            ////////////////////////////////////////////////////

            $replaceArray = array(
                "{SiteId}" => $siteId,
                "{ChannelId}" => $channelId,
                "{ManageUserId}" => $createUserId,
                "{CustomFormId}" => $customFormId,
                "{display}" => "none"
            );
            $tempContent = strtr($tempContent, $replaceArray);

            $arrayOfEditingData = $customFormManageData->GetOne($customFormId);
            Template::ReplaceOne($tempContent, $arrayOfEditingData, 0);

            //去掉s开头的标记 {s_xxx_xxx}
            $patterns = '/\{s_(.*?)\}/';
            $tempContent = preg_replace($patterns, "", $tempContent);
            //去掉c开头的标记 {c_xxx}
            $patterns = '/\{c_(.*?)\}/';
            $tempContent = preg_replace($patterns, "", $tempContent);
            //去掉r开头的标记 {r_xxx_xxx}
            $patterns = '/\{r_(.*?)\}/';
            $tempContent = preg_replace($patterns, "", $tempContent);

            if (!empty($_POST)) {
                $result = $customFormManageData->Modify($_POST,$customFormId);

                //记入操作log
                $operateContent = "Create CustomForm:CustomFormId:" . $customFormId .",POST FORM:".implode("|",$_POST).";\r\nResult:". $result;
                self::CreateManageUserLog($operateContent);

                if ($result > 0) {

                    Control::ShowMessage(Language::Load('custom_form', 1));
                    $closeTab = Control::PostRequest("CloseTab",0);
                    if($closeTab == 1){
                        $resultJavaScript .= Control::GetCloseTab();
                    }else{
                        Control::GoUrl($_SERVER["PHP_SELF"]."?".$_SERVER['QUERY_STRING']);
                        //Control::GoUrl($_SERVER["PHP_SELF"].'?secu=manage&mod=custom_form&m=list&site_id='.$siteId.'&channel_id='.$channelId);
                    }

                } else {

                    Control::ShowMessage(Language::Load('custom_form', 2));
                    return DefineCode::CUSTOM_FORM_MANAGE+self::UPDATE_CUSTOM_FORM_ATTRIBUTE_FAIL;
                }
            }
        }else{
            return DefineCode::CUSTOM_FORM_MANAGE+self::GET_CUSTOM_FORM_ATTRIBUTE_RESULT_NULL;
        }

        parent::ReplaceEnd($tempContent);
        $tempContent = str_ireplace("{ResultJavascript}", $resultJavaScript, $tempContent);
        return $tempContent;
    }

    /**
     * 取得表单列表
     * @return string 表单列表数据集页面html
     */
    private function GenList() {
        $channelId = Control::GetRequest("channel_id", 0);
        $resultJavaScript="";
        $manageUserId = Control::GetManageUserId();
        $channelData = new ChannelManageData();
        $siteId = $channelData->GetSiteId($channelId,FALSE);
        ///////////////判断是否有操作权限///////////////////
        $manageUserAuthority = new ManageUserAuthorityManageData();
        $can = $manageUserAuthority->CanChannelExplore($siteId, $channelId, $manageUserId);
        if ($can != 1) {
            Control::ShowMessage(Language::Load('custom_form', 3));//您尚未开通操作此功能的权限,如需开通此权限,请联系管理人员!
            return "";
        }
        $result = Language::Load('custom_form', 4);
        $tempContent = Template::Load("custom_form/custom_form_list.html","common");

        $type = Control::GetRequest("type", "");
        $pageSize = Control::GetRequest("ps", 20);
        $pageIndex = Control::GetRequest("p", 1);
        $searchKey = Control::GetRequest("search_key", "");
        $searchKey = urldecode($searchKey);
        if (isset($searchKey) && strlen($searchKey) > 0) {
            ///////////////判断是否有操作权限///////////////////
            $can = $manageUserAuthority->CanChannelSearch($siteId, $channelId, $manageUserId);
            if ($can != 1) {
                Control::ShowMessage(Language::Load('custom_form', 3));
                return "";
            }
        }

        if ($pageIndex > 0 && $channelId > 0) {

            $pageBegin = ($pageIndex - 1) * $pageSize;
            $listName = "custom_form";
            $allCount = 0;
            $customFormData = new CustomFormManageData();
            $arrListOfCustomForm = $customFormData->GetListPager($channelId, $pageBegin, $pageSize, $allCount, $searchKey, $type);
            if (count($arrListOfCustomForm) > 0) {
                Template::ReplaceList($tempContent, $arrListOfCustomForm, $listName);

                $styleNumber = 1;
                $pagerTemplate = Template::Load("pager/pager_style$styleNumber.html", "common");
                $isJs = FALSE;
                $navUrl = "default.php?secu=manage&mod=custom_form&m=list&channel_id=$channelId&p={0}&ps=$pageSize";
                $jsFunctionName = "";
                $jsParamList = "";
                $pagerButton = Pager::ShowPageButton($pagerTemplate, $navUrl, $allCount, $pageSize, $pageIndex ,$styleNumber = 1, $isJs, $jsFunctionName, $jsParamList);
                $replaceArray = array(
                    "{channel_id}" => $channelId,
                    "{cid}" => $channelId,
                    "{id}" => 0,
                    "{PagerButton}" => $pagerButton
                );
                $tempContent = strtr($tempContent, $replaceArray);
            }else{
                Template::RemoveCustomTag($tempContent, $listName);
                $tempContent = str_ireplace("{PagerButton}", Language::Load("custom_form", 4), $tempContent);

            }

            parent::ReplaceEnd($tempContent);
            $tempContent = str_ireplace("{ResultJavascript}", $resultJavaScript, $tempContent);
            $result = $tempContent;
        }
        return $result;
    }

}

?>


text:
<!--
 ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 ~
 ~ WSO2 Inc. licenses this file to you under the Apache License,
 ~ Version 2.0 (the "License"); you may not use this file except
 ~ in compliance with the License.
 ~ You may obtain a copy of the License at
 ~
 ~    http://www.apache.org/licenses/LICENSE-2.0
 ~
 ~ Unless required by applicable law or agreed to in writing,
 ~ software distributed under the License is distributed on an
 ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 ~ KIND, either express or implied.  See the License for the
 ~ specific language governing permissions and limitations
 ~ under the License.
 -->
<serviceGroup>
    <service name="LibraryService" scope="application">
        <parameter name="useOriginalwsdl">true</parameter>
        <messageReceivers>
            <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out"
                             class="org.wso2.appserver.jibx.services.LibraryServiceMessageReceiverInOut"/>
        </messageReceivers>
        <parameter locked="false" name="ServiceClass">org.wso2.appserver.jibx.services.LibraryService</parameter>
        <!--All public methods of the service class are exposed by default-->
    </service>
</serviceGroup>


text:
<?php
	session_start();

	function message(){
		if(isset($_SESSION["message"])){
			$output = "
";
			$output .= htmlentities($_SESSION["message"]);
			$output .= "
";

			$_SESSION["message"] = null;

			return $output;
		}
	}
 ?>


text:
$("p").click(function () {
    $(this).slideToggle('slow');
});


text:
package geomesa.tutorial;

import geomesa.tutorial.GdeltFeature.Attributes;
import org.apache.commons.cli.BasicParser;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.Options;
import org.geotools.data.DataStore;
import org.geotools.data.DataStoreFinder;
import org.geotools.data.FeatureSource;
import org.geotools.data.Query;
import org.geotools.data.wfs.WFSDataStore;
import org.geotools.data.wfs.WFSDataStoreFactory;
import org.geotools.factory.CommonFactoryFinder;
import org.geotools.feature.FeatureCollection;
import org.geotools.feature.FeatureIterator;
import org.geotools.filter.text.cql2.CQLException;
import org.opengis.feature.Feature;
import org.opengis.feature.Property;
import org.opengis.filter.Filter;
import org.opengis.filter.FilterFactory2;
import org.opengis.referencing.FactoryException;

import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

public class GeoServerAuthorizationsTutorial {

    /**
     * Creates a base filter that will return a small subset of our results. This can be tweaked to
     * return different results if desired. Currently it should return 16 results.
     *
     * @return
     *
     * @throws org.geotools.filter.text.cql2.CQLException
     * @throws java.io.IOException
     */
    static Filter createBaseFilter()
            throws CQLException, IOException {

        // Get a FilterFactory2 to build up our query
        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();

        // We are going to query for events in Ukraine during the
        // civil unrest.

        // We'll start by looking at a particular time frame
        Filter timeFilter =
                ff.between(ff.property(Attributes.SQLDATE.getName()),
                           ff.literal("2013-01-01T05:00:00.000Z"),
                           ff.literal("2014-04-30T23:00:00.000Z"));

        // We'll bound our query spatially to Ukraine
        Filter spatialFilter =
                ff.bbox(Attributes.geom.getName(),
                        31.6, 44, 37.4, 47.75,
                        "EPSG:4326");

        // we'll also restrict our query to only articles about the US, UK or UN
        Filter attributeFilter = ff.like(ff.property(Attributes.Actor1Name.getName()), "UNITED%");

        // Now we can combine our filters using a boolean AND operator
        Filter conjunction = ff.and(Arrays.asList(timeFilter, spatialFilter, attributeFilter));

        return conjunction;
    }

    /**
     * Executes a basic bounding box query
     *
     * @param typeName
     * @param dataStore
     *
     * @throws java.io.IOException
     * @throws org.geotools.filter.text.cql2.CQLException
     */
    static void executeQuery(String typeName, DataStore dataStore)
            throws IOException, CQLException, FactoryException {

        // start with our basic filter to narrow the results
        Filter cqlFilter = createBaseFilter();

        // use the 2-arg constructor for the query - this will not restrict the attributes returned
        Query query = new Query(typeName, cqlFilter, new String[] {"geom"});

        // restrict the max features coming back for performance
        query.setMaxFeatures(10);

        // get the feature store used to query the GeoMesa data
        FeatureSource featureSource = dataStore.getFeatureSource(
                typeName);

        // execute the query
        FeatureCollection results = featureSource.getFeatures(query);

        // loop through all results
        FeatureIterator iterator = results.features();
        try {
            printResults(iterator, Attributes.geom.getName());
        } finally {
            iterator.close();
        }
    }

    /**
     * Iterates through the given iterator and prints out the properties (attributes) for each entry.
     *
     * @param iterator
     */
    private static void printResults(FeatureIterator iterator, String... attributes) {

        if (iterator.hasNext()) {
            System.out.println("Results:");
        } else {
            System.out.println("No results");
        }
        int n = 0;
        while (iterator.hasNext()) {
            Feature feature = iterator.next();
            StringBuilder result = new StringBuilder();
            result.append(++n);

            for (String attribute : attributes) {
                Property property = feature.getProperty(attribute);
                result.append("|")
                      .append(property.getName())
                      .append('=')
                      .append(property.getValue());
            }
            System.out.println(result.toString());
        }
        System.out.println();
    }

    /**
     * Main entry point. Executes queries against an existing GDELT dataset.
     *
     * @param args
     *
     * @throws Exception
     */
    public static void main(String[] args)
            throws Exception {
        // read command line options - this contains the path to geoserver and the data store to query
        CommandLineParser parser = new BasicParser();
        Options options = SetupUtil.getWfsOptions();
        CommandLine cmd = parser.parse(options, args);

        String geoserverHost = cmd.getOptionValue(SetupUtil.GEOSERVER_URL);
        if (!geoserverHost.endsWith("/")) {
            geoserverHost += "/";
        }

        // create the URL to GeoServer. Note that we need to point to the 'GetCapabilities' request,
        // and that we are using WFS version 1.0.0
        String geoserverUrl = geoserverHost + "wfs?request=GetCapabilities&version=1.0.0";

        // create the geotools configuration for a WFS data store
        Map<String, String> configuration = new HashMap<String, String>();
        configuration.put(WFSDataStoreFactory.URL.key, geoserverUrl);
        configuration.put(WFSDataStoreFactory.WFS_STRATEGY.key, "geoserver");
        configuration.put(WFSDataStoreFactory.TIMEOUT.key, cmd.getOptionValue(SetupUtil.TIMEOUT, "99999"));

        System.out.println("Executing query against '" + geoserverHost +
                           "' with client keystore '" + System.getProperty("javax.net.ssl.keyStore") +
                           "'");

        // verify we have gotten the correct datastore
        WFSDataStore wfsDataStore = (WFSDataStore) DataStoreFinder.getDataStore(configuration);
        assert wfsDataStore != null;

        // the geoserver data store to query
        String geoserverDataStore = cmd.getOptionValue(SetupUtil.FEATURE_STORE);

        executeQuery(geoserverDataStore, wfsDataStore);
    }

}


text:
package de.atomfrede.mate.domain.dao.account;

import org.springframework.stereotype.Repository;

import de.atomfrede.mate.domain.dao.AbstractDAO;
import de.atomfrede.mate.domain.entities.account.Account;

@Repository(value = "accountDao")
public class AccountDaoImpl extends AbstractDAO<Account> implements AccountDao {

	public AccountDaoImpl() {
		super(Account.class);
	}
}


text:
[![Gem Version](https://img.shields.io/badge/gem-v3.1.4-brightgreen.svg)](https://rubygems.org/gems/snow_sync) [![Dependency Status](https://img.shields.io/badge/dependencies-up--to--date-blue.svg)](https://rubygems.org/gems/snow_sync) [![Downloads](https://img.shields.io/badge/downloads-5k%2B-lightgrey.svg)](https://rubygems.org/gems/snow_sync)

SnowSync is a file sync utility tool and API which provides a bridge for off platform ServiceNow development using an IDE or text editor locally.

SnowSync syncronizes configured fields (scripts) for a ServiceNow instance locally, then watches for file changes and syncs back changes to the corresponding record.

## Installation

```bash
mkdir snow_sync
```

```bash
cd snow_sync
```

```ruby
gem install --install-dir <path-to-the-snow_sync-dir> snow_sync
```

## Setup & Usage

```ruby
gem install bundler
```

```bash
cd <path-to-the-snow_sync-dir>/gems/snow_sync-<version>
```

OSX users run the following command:

```bash
brew install terminal-notifier
```

Create a Gemfile and add the following Gem dependencies:

```ruby
source "https://rubygems.org"
gem "facets", "~> 3.1.0"
gem "guard", "~> 2.14.0"
gem "guard-yield", "~> 0.1.0"
gem "json", ">= 1.8.3", "~> 1.8.0"
gem "libnotify", "~> 0.9.1"
gem "rake", "~> 10.0.0"
gem "rest-client", "~> 2.0.0"
gem "rspec", "~> 3.5.0"
gem "terminal-notifier-guard", "~> 1.7"
gem "thor", "0.19.1"
```

```bash
bundle install
```

```bash
cd /lib/snow_sync
```

* Setup the configurations in the configs.yml
* Now supports multi-table map configurations
* Configuration path is the current working directory
* Append /api/now/table/ to the base_url

```bash
guard -i
```

**Note:** if the sync directory is deleted after a successful sync, reset the credential configs in the configs.yml so they can be re-encrypted on the next sync

## Running the Tests

```bash
cd <path-to-the-snow_sync-dir>/gems/snow_sync-<version>
```

* Integration tests use a test record in the instance (e.g. a script include)
* Unit tests are all stubbed out
* Setup the test configurations in the test_configs.yml
* Configuration path is the current working directory
* Append /api/now/table/ to the base_url

```ruby
rspec spec/sync_util_spec.rb
```

**Note:** if the sync directory is deleted after a successful sync, reset the credential configs in the test_configs.yml so they can be re-encrypted on the next sync

## License

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).


text:
<ivy-module version="2.0">
  <info organisation="com.eyeline.mnp" module="mnp-core"/>
  <dependencies>
    <dependency org="log4j" name="log4j" rev="1.2.17" transitive="false"/>
    <dependency org="junit" name="junit" rev="4.12" transitive="true"/>
    <!--dependency org="org.hamcrest" name="hamcrest-all" rev="1.3"/ -->
  </dependencies>
</ivy-module>


text:
namespace content_settings {

// This class manages the Plugins field trials.
class PluginsFieldTrial {
 public:
  // Returns the effective content setting for plugins. Passes non-plugin
  // content settings through without modification.
  static ContentSetting EffectiveContentSetting(ContentSettingsType type,
                                                ContentSetting setting);

 private:
  DISALLOW_IMPLICIT_CONSTRUCTORS(PluginsFieldTrial);
};

}  // namespace content_settings

#endif  // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_H_


text:
package org.wso2.carbon.identity.entitlement.policy.version;

import org.wso2.carbon.identity.entitlement.EntitlementException;
import org.wso2.carbon.identity.entitlement.dto.PolicyDTO;

import java.util.Properties;

/**
 * This manages the policy versions
 */
public interface PolicyVersionManager {

    /**
     * init policy version handler
     *
     * @param properties
     */
    public void init(Properties properties);

    /**
     *
     * @param policyId
     * @param version
     * @return
     * @throws EntitlementException
     */
    public PolicyDTO getPolicy(String policyId, String version) throws EntitlementException;

    /**
     *
     * @param policyDTO
     * @return
     * @throws EntitlementException
     */
    public String createVersion(PolicyDTO policyDTO) throws EntitlementException;

    /**
     *
     * @param policyId
     * @throws EntitlementException
     */
    public void deletePolicy(String policyId) throws EntitlementException;

    /**
     *
     * @param policyId
     * @return
     * @throws EntitlementException
     */
    public String[] getVersions(String policyId) throws EntitlementException;
}


text:
struct city
{
    boost::geometry::model::point<float, 2, boost::geometry::cs::geographic<boost::geometry::degree> > location;
    std::string name;
};

namespace soci
{
    template <>
    struct type_conversion<city>
    {
        typedef soci::values base_type;

        static void from_base(const base_type& v, soci::indicator ind, city& value)
        {
            try
            {
                value.name = v.get<std::string>("name");
                boost::geometry::read_wkt(v.get<std::string>("wkt"), value.location);
            }
            catch(const std::exception& e)
            {
                std::cout << e.what() << std::endl;
            }
        }

        static void to_base(const city& value, base_type& v, soci::indicator& ind)
        {
            v.set("name", value.name);
            std::ostringstream out;
            out << boost::geometry::wkt(value.location);
            v.set("wkt", out.str());
            ind = i_ok;
        }
    };
}

int main()
{
    try
    {
        soci::session sql(soci::postgresql, "dbname=ggl user=ggl password=ggl");

        typedef std::vector<city> V;

        soci::rowset<city> rows = sql.prepare << "select name,astext(location) as wkt from cities";
        V vec;
        std::copy(rows.begin(), rows.end(), std::back_inserter(vec));

        for (V::const_iterator it = vec.begin(); it != vec.end(); ++it)
        {
            static const double sqrkm = 1000.0 * 1000.0;
            std::cout << it->name
                << "    " << boost::geometry::dsv(it->location)
                //<< "    " << boost::geometry::area(it->shape) / sqrkm << " km2"
                <<  std::endl;
        }
    }
    catch (std::exception const &e)
    {
        std::cerr << "Error: " << e.what() << '\n';
    }
    return 0;
}


text:
module.exports = function when() {

};


text:
<!--//Copyright © 2014 - 2016, Sequømics Corporation, All rights reserved.//-->
<!DOCTYPE html>
<html class="error" lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <base href="/">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Bad Request!</title>
    <link rel="shortcut icon" type="image/x-icon" href="http://static.sequomics.com/assets/favicon.ico">
    <link rel="stylesheet" type="text/css" href="en/assets/style/common.css">
    <script type="text/javascript">function goBack(){window.history.back();}</script>
  </head>


text:
package com.thoughtworks.go.apiv1.buildcause;

import com.thoughtworks.go.api.ApiController;
import com.thoughtworks.go.api.ApiVersion;
import com.thoughtworks.go.api.spring.ApiAuthenticationHelper;
import com.thoughtworks.go.apiv1.buildcause.representers.BuildCauseRepresenter;
import com.thoughtworks.go.config.exceptions.BadRequestException;
import com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel;
import com.thoughtworks.go.server.service.PipelineHistoryService;
import com.thoughtworks.go.server.service.result.HttpOperationResult;
import com.thoughtworks.go.spark.Routes;
import com.thoughtworks.go.spark.spring.SparkSpringController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import spark.Request;
import spark.Response;

import java.io.IOException;

import static spark.Spark.*;

@Component
public class BuildCauseController extends ApiController implements SparkSpringController {
    private final PipelineHistoryService pipelineHistoryService;
    private final ApiAuthenticationHelper apiAuthenticationHelper;

    @Autowired
    public BuildCauseController(PipelineHistoryService pipelineHistoryService, ApiAuthenticationHelper apiAuthenticationHelper) {
        super(ApiVersion.v1);
        this.pipelineHistoryService = pipelineHistoryService;
        this.apiAuthenticationHelper = apiAuthenticationHelper;
    }

    @Override
    public String controllerBasePath() {
        return Routes.BuildCause.BASE;
    }

    @Override
    public void setupRoutes() {
        path(controllerPath(Routes.BuildCause.PATH), () -> {
            before("", mimeType, this::setContentType);
            before("/*", mimeType, this::setContentType);

            before("", mimeType, apiAuthenticationHelper::checkPipelineViewPermissionsAnd403);
            before("/*", mimeType, apiAuthenticationHelper::checkPipelineViewPermissionsAnd403);

            before("", mimeType, this::verifyContentType);
            before("/*", mimeType, this::verifyContentType);

            get("", mimeType, this::index);
        });
    }

    public String index(Request req, Response res) throws IOException {
        HttpOperationResult httpOperationResult = new HttpOperationResult();

        int result;
        try {
            result = Integer.parseInt(req.params(":pipeline_counter"));
        } catch (NumberFormatException nfe) {
            throw new BadRequestException("Parameter `pipeline_counter` must be an integer.");
        }

        String pipelineName = req.params("pipeline_name");

        PipelineInstanceModel pipelineInstance = pipelineHistoryService.findPipelineInstance(pipelineName, result, currentUsername(), httpOperationResult);
        if (httpOperationResult.isSuccess()) {
            return writerForTopLevelObject(req, res, outputWriter -> BuildCauseRepresenter.toJSON(outputWriter, pipelineInstance.getBuildCause()));
        } else {
            return renderHTTPOperationResult(httpOperationResult, req, res);
        }
    }

}