text:
import React from 'react';

import FittedImage from '../FittedImage/FittedImage';
import moment from '../../utils/moment/moment';
import LeftRight from '../LeftRight/LeftRight';
import css from './BookingRequestPreview.css';
import Icon from '../Icon/Icon';

type BookingRequest = {
  id: number,
  idea_name: string,
  idea_category: string,
  start_on: string,
  end_on: string,
  primary_photo_thumbnail_url: string,
  tooltip: string,
  complete: boolean,
}

type Props = {
  bookingRequests: Array<BookingRequest>,
  className?: string,
}

const BookingRequestPreview = ({ bookingRequests, className, ...rest }: Props) => {
  const keyedBookingRequests = bookingRequests.reduce((obj, next) => {
    const state = next.tooltip;
    const currentRequests = obj[state] || [];
    return Object.assign(obj, {
      [state]: [...currentRequests, next],
    });
  }, {});

  return (

      {Object.keys(keyedBookingRequests).map(state => {
        const requests = keyedBookingRequests[state];

        return (

{state}

            {requests.map(request => (
              <LeftRight
                className={css.request}
                key={request.id}
                primarySide="right"
                leftChildren={
                  <FittedImage
                    className={css.image}
                    src={request.primary_photo_thumbnail_url}
                    alt={request.idea_name}
                  />
                }
                rightChildren={

{request.idea_name}

                      {moment(request.start_on).format('L')}
                      <Icon className={css.untilIcon} name="arrow" />
                      {moment(request.end_on).format('L')}

                }
              />
            ))}

        );
      })}

  );
};

export default BookingRequestPreview;


text: yum install sysstat -y

redpajama_set_name: RedPajamaGithub


text:
package com.thoughtworks.go.config.update;

import com.thoughtworks.go.config.*;
import com.thoughtworks.go.config.commands.EntityConfigUpdateCommand;
import com.thoughtworks.go.plugin.api.response.validation.ValidationResult;
import com.thoughtworks.go.server.domain.Username;
import com.thoughtworks.go.server.service.GoConfigService;
import com.thoughtworks.go.server.service.PluginProfileNotFoundException;
import com.thoughtworks.go.server.service.result.LocalizedOperationResult;
import org.apache.commons.lang3.StringUtils;

import java.util.Map;

import static com.thoughtworks.go.i18n.LocalizedMessage.resourceNotFound;
import static com.thoughtworks.go.serverhealth.HealthStateType.notFound;

public abstract class PluginProfileCommand<T extends PluginProfile, M extends PluginProfiles<T>> implements EntityConfigUpdateCommand<T> {
    protected final GoConfigService goConfigService;
    protected final T profile;
    protected final Username currentUser;
    protected final LocalizedOperationResult result;
    protected T preprocessedProfile;

    public PluginProfileCommand(GoConfigService goConfigService, T profile, Username currentUser, LocalizedOperationResult result) {
        this.goConfigService = goConfigService;
        this.profile = profile;
        this.currentUser = currentUser;
        this.result = result;
    }

    protected abstract M getPluginProfiles(CruiseConfig preprocessedConfig);

    public abstract ValidationResult validateUsingExtension(final String pluginId, final Map<String, String> configuration);

    protected abstract String getObjectDescriptor();

    @Override
    public void clearErrors() {
        BasicCruiseConfig.clearErrors(profile);
    }

    @Override
    public T getPreprocessedEntityConfig() {
        return preprocessedProfile;
    }

    @Override
    public boolean canContinue(CruiseConfig cruiseConfig) {
        return isAuthorized();
    }

    protected boolean isValidForCreateOrUpdate(CruiseConfig preprocessedConfig) {
        preprocessedProfile = findExistingProfile(preprocessedConfig);
        preprocessedProfile.validateTree(null);

        if (preprocessedProfile.getAllErrors().isEmpty()) {
            getPluginProfiles(preprocessedConfig).validate(null);
            BasicCruiseConfig.copyErrors(preprocessedProfile, profile);
            return preprocessedProfile.getAllErrors().isEmpty();
        }

        BasicCruiseConfig.copyErrors(preprocessedProfile, profile);
        return false;
    }

    protected final T findExistingProfile(CruiseConfig cruiseConfig) {
        if (profile == null || StringUtils.isBlank(profile.getId())) {
            if (profile != null) {
                profile.addError("id", getObjectDescriptor() + " cannot have a blank id.");
            }
            result.unprocessableEntity("The " + getObjectDescriptor().toLowerCase() + " config is invalid. Attribute 'id' cannot be null.");
            throw new IllegalArgumentException(getObjectDescriptor() + " id cannot be null.");
        } else {
            T t = getPluginProfiles(cruiseConfig).find(profile.getId());
            if (t == null) {
                result.notFound(resourceNotFound(getTagName(), profile.getId()), notFound());
                throw new PluginProfileNotFoundException(getObjectDescriptor() + " `" + profile.getId() + "` does not exist.");
            }
            return t;
        }
    }

    private String getTagName() {
        return profile.getClass().getAnnotation(ConfigTag.class).value();
    }

    protected abstract boolean isAuthorized();

}


text:
namespace blink {

// A interface represents ArrayBuffer payload type in WebMessage.
class BLINK_COMMON_EXPORT WebMessageArrayBufferPayload {
 public:
  virtual ~WebMessageArrayBufferPayload() = default;

  // Returns the length of the payload.
  virtual size_t GetLength() const = 0;

  // Convert the underlying buffer to a span if possible. Or return empty if
  // can't (like Java ByteArray). JNI API does not provide a way to get a
  // pointer to the underlying array memory, so another API |CopyInto| should be
  // used instead to avoid an extra copy.
  virtual absl::optional<base::span<const uint8_t>> GetAsSpanIfPossible()
      const = 0;

  // Copy the underlying buffer into the given destination. The |dest| must be
  // larger than or equal to the payload. This method is always available
  // regarding various backing stores.
  virtual void CopyInto(base::span<uint8_t> dest) const = 0;

  // Create a new WebMessageArrayBufferPayload from vector for testing.
  static std::unique_ptr<WebMessageArrayBufferPayload> CreateForTesting(
      std::vector<uint8_t> data);
};

// Represent WebMessage payload type between browser and renderer process.
using WebMessagePayload =
    absl::variant<std::u16string,
                  std::unique_ptr<WebMessageArrayBufferPayload>>;

// To support exposing HTML message ports to Java, it is necessary to be able
// to encode and decode message data using the same serialization format as V8.
// That format is an implementation detail of V8, but we cannot invoke V8 in
// the browser process. Rather than IPC over to the renderer process to execute
// the V8 serialization code, we duplicate some of the serialization logic
// (just for simple string or array buffer messages) here. This is
// a trade-off between overall complexity / performance and code duplication.
// Fortunately, we only need to handle string messages and this serialization
// format is static, as it is a format we currently persist to disk via
// IndexedDB.

BLINK_COMMON_EXPORT TransferableMessage
EncodeWebMessagePayload(const WebMessagePayload& payload);

BLINK_COMMON_EXPORT absl::optional<WebMessagePayload> DecodeToWebMessagePayload(
    TransferableMessage message);

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_PUBLIC_COMMON_MESSAGING_STRING_MESSAGE_CODEC_H_


text:
import { descendants, Kind, cloneAst, YAMLMapping, newScalar, parseNode } from "../approved-imports/yaml";
import { mergeYamls, identitySourceMapping } from "../source-map/merging";
import { Mapping } from "../approved-imports/sourceMap";
import { DataHandleRead, DataHandleWrite, DataStoreView } from "../data-store/dataStore";
import { parse as parseLiterate } from "./literate";
import { lines } from "./textUtility";

function tryMarkdown(rawMarkdownOrYaml: string): boolean {
  return /^#/gm.test(rawMarkdownOrYaml);
}

const commonmarkHeadingNodeType = "heading";
const commonmarkHeadingMaxLevel = 1000;

function commonmarkParentHeading(startNode: commonmark.Node): commonmark.Node | null {
  const currentLevel = startNode.type === commonmarkHeadingNodeType
    ? startNode.level
    : commonmarkHeadingMaxLevel;

  while (startNode != null && (startNode.type !== commonmarkHeadingNodeType || startNode.level >= currentLevel)) {
    startNode = startNode.prev || startNode.parent;
  }

  return startNode;
}

function* commonmarkSubHeadings(startNode: commonmark.Node): Iterable<commonmark.Node> {
  if (startNode.type === commonmarkHeadingNodeType) {
    const currentLevel = startNode.level;
    let maxLevel = commonmarkHeadingMaxLevel;

    startNode = startNode.next;
    while (startNode != null) {
      if (startNode.type === commonmarkHeadingNodeType) {
        if (currentLevel < startNode.level) {
          if (startNode.level <= maxLevel) {
            maxLevel = startNode.level;
            yield startNode;
          }
        } else {
          return;
        }
      }
      startNode = startNode.next;
    }
  }
}

function commonmarkHeadingText(headingNode: commonmark.Node): string {
  return headingNode.firstChild.literal;
}

function commonmarkHeadingFollowingText(rawMarkdown: string, headingNode: commonmark.Node): [number, number] {
  let subNode = headingNode.next;
  const startPos = subNode.sourcepos[0];
  while (subNode.next && subNode.next.type !== "code_block" && subNode.next.type !== commonmarkHeadingNodeType) {
    subNode = subNode.next;
  }
  const endPos = subNode.sourcepos[1];

  return [startPos[0], endPos[0]];
}

/**
 * Resolves path of headings, starting with given heading node.
 * @param startHeading  Heading node to start from
 * @param path          List of headings to resolve starting with the `startHeading` INCLUSIVE
 * @returns Resolved heading node or null if heading was not found.
 */
function resolveMarkdownPathAt(startHeading: commonmark.Node, path: string[]): commonmark.Node | null {
  // unexpected node or path?
  if (startHeading.type !== commonmarkHeadingNodeType || path.length === 0 || commonmarkHeadingText(startHeading) !== path[0]) {
    return null;
  }
  path = path.slice(1);
  // found
  if (path.length == 0) {
    return startHeading;
  }
  // traverse down
  for (const subHeading of commonmarkSubHeadings(startHeading)) {
    const subResult = resolveMarkdownPathAt(subHeading, path);
    if (subResult !== null) {
      return subResult;
    }
  }
  return null;
}

/**
 * Tries resolving path of headings, moving up the hierachy of headings.
 */
function resolveMarkdownPath(startNode: commonmark.Node, path: string[]): commonmark.Node | null {
  const heading = commonmarkParentHeading(startNode);
  if (heading == null) {
    // last chance: start with root path
    return resolveMarkdownPathAt(startNode, path);
  }
  // try resolve from here
  const resolveResult = resolveMarkdownPathAt(heading, [commonmarkHeadingText(heading)].concat(path));
  if (resolveResult != null) {
    return resolveResult;
  }
  // move up hierachy
  return resolveMarkdownPath(heading, path);
}

export async function parse(hLiterate: DataHandleRead, hResult: DataHandleWrite, intermediateScope: DataStoreView): Promise<DataHandleRead> {
  let hsConfigFileBlocks: DataHandleRead[] = [];

  const rawMarkdown = await hLiterate.readData();

  // try parsing as literate YAML
  if (tryMarkdown(rawMarkdown)) {
    const scopeRawCodeBlocks = intermediateScope.createScope("raw");
    const scopeEnlightenedCodeBlocks = intermediateScope.createScope("enlightened");
    const hsConfigFileBlocksWithContext = await parseLiterate(hLiterate, scopeRawCodeBlocks);

    // resolve md documentation (ALPHA)
    let codeBlockIndex = 0;
    for (const { data, codeBlock } of hsConfigFileBlocksWithContext) {
      ++codeBlockIndex;
      const yamlAst = cloneAst(await (await data.readMetadata()).yamlAst);
      let mapping: Mapping[] = [];
      for (const { path, node } of descendants(yamlAst)) {
        if (path[path.length - 1] === "description" && node.kind === Kind.SEQ) {
          // resolve documentation
          const mdPath = parseNode<string[]>(node);
          const heading = resolveMarkdownPath(codeBlock, mdPath);
          if (heading == null) {
            throw new Error(`Heading at path ${mdPath} not found`); // TODO: uniform error reporting with blaming!
          }

          // extract markdown part
          const headingTextRange = commonmarkHeadingFollowingText(rawMarkdown, heading);
          const markdownLines = lines(rawMarkdown).slice(headingTextRange[0] - 1, headingTextRange[1]);
          const headingText = markdownLines.join("\n");

          // inject documentation
          (node.parent as YAMLMapping).value = newScalar(headingText);
          mapping.push({
            source: hLiterate.key,
            name: `literate ref ${JSON.stringify(mdPath)}`,
            generated: { path: path },
            original: <sourceMap.Position>{
              column: 0,
              line: headingTextRange[0]
            }
          });
        }
      }
      // detect changes. If any, remap, otherwise forward data
      if (mapping.length > 0) {
        mapping = mapping.concat(Array.from(identitySourceMapping(data.key, yamlAst)));
        const hTarget = await scopeEnlightenedCodeBlocks.write(`${codeBlockIndex}.yaml`);
        hsConfigFileBlocks.push(await hTarget.writeObject(parseNode(yamlAst), mapping, [hLiterate, data]));
      } else {
        hsConfigFileBlocks.push(data);
      }
    }
  }

  // fall back to raw YAML
  if (hsConfigFileBlocks.length === 0) {
    hsConfigFileBlocks = [hLiterate];
  }

  // merge
  return await mergeYamls(hsConfigFileBlocks, hResult);
}


text:
<?php

namespace OroCRM\Bundle\ContactBundle\Controller\Api\Rest;

use FOS\RestBundle\Controller\Annotations\NamePrefix;
use FOS\RestBundle\Controller\Annotations\RouteResource;
use FOS\RestBundle\Controller\Annotations\QueryParam;
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
use Oro\Bundle\SecurityBundle\Annotation\Acl;
use Oro\Bundle\SecurityBundle\Annotation\AclAncestor;

use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Response;
use FOS\RestBundle\Routing\ClassResourceInterface;
use Oro\Bundle\SoapBundle\Form\Handler\ApiFormHandler;
use Oro\Bundle\SoapBundle\Controller\Api\Rest\RestController;
use Oro\Bundle\SoapBundle\Entity\Manager\ApiEntityManager;

/**
 * @RouteResource("contactgroup")
 * @NamePrefix("oro_api_")
 */
class ContactGroupController extends RestController implements ClassResourceInterface
{
    /**
     * REST GET list
     *
     * @QueryParam(
     *      name="page",
     *      requirements="\d+",
     *      nullable=true, description="Page number, starting from 1. Defaults to 1."
     * )
     * @QueryParam(
     *      name="limit",
     *      requirements="\d+",
     *      nullable=true,
     *      description="Number of items per page. defaults to 10."
     * )
     * @ApiDoc(
     *      description="Get all contact group items",
     *      resource=true
     * )
     * @AclAncestor("orocrm_contact_group_view")
     * @return Response
     */
    public function cgetAction()
    {
        $page = (int)$this->getRequest()->get('page', 1);
        $limit = (int)$this->getRequest()->get('limit', self::ITEMS_PER_PAGE);

        return $this->handleGetListRequest($page, $limit);
    }

    /**
     * REST GET item
     *
     * @param string $id
     *
     * @ApiDoc(
     *      description="Get contact item",
     *      resource=true
     * )
     * @AclAncestor("orocrm_contact_group_view")
     * @return Response
     */
    public function getAction($id)
    {
        return $this->handleGetRequest($id);
    }

    /**
     * REST PUT
     *
     * @param int $id
     *
     * @ApiDoc(
     *      description="Update contact group",
     *      resource=true
     * )
     * @AclAncestor("orocrm_contact_group_update")
     * @return Response
     */
    public function putAction($id)
    {
        return $this->handleUpdateRequest($id);
    }

    /**
     * Create new contact group
     *
     * @ApiDoc(
     *      description="Create new contact group",
     *      resource=true
     * )
     * @AclAncestor("orocrm_contact_group_create")
     */
    public function postAction()
    {
        return $this->handleCreateRequest();
    }

    /**
     * REST DELETE
     *
     * @param int $id
     *
     * @ApiDoc(
     *      description="Delete Contact Group",
     *      resource=true
     * )
     * @Acl(
     *      id="orocrm_contact_group_delete",
     *      type="entity",
     *      permission="DELETE",
     *      class="OroCRMContactBundle:Group"
     * )
     * @return Response
     */
    public function deleteAction($id)
    {
        return $this->handleDeleteRequest($id);
    }

    /**
     * Get entity Manager
     *
     * @return ApiEntityManager
     */
    public function getManager()
    {
        return $this->get('orocrm_contact.group.manager.api');
    }

    /**
     * @return FormInterface
     */
    public function getForm()
    {
        return $this->get('orocrm_contact.form.group.api');
    }

    /**
     * @return ApiFormHandler
     */
    public function getFormHandler()
    {
        return $this->get('orocrm_contact.form.handler.group.api');
    }
}


text:
exports.command = 'install <name>';
exports.desc    = 'Add a new module for current project';
exports.builder = function () {};
exports.handler = function (argv) {
	var {modules, configs}  = require('../../loader')(argv);
	var path = require('path');
	var name = argv.name;
	// check if name is a local path
	if (name[0] == '/' || name[0] == '\\' || name.substr(0, 2) == '..') {
		name = path.join(process.cwd(), name);
	}
	try {
		modules.load(name);
		var actives = configs.get('modules');
		if (typeof actives !== 'object' || actives.length === undefined)
			actives = [];
		if (actives.indexOf(name) > -1) {
			console.error("Module is already installed.");
		} else {
			actives.push(name);
			configs.set('modules', actives);
		}
	} catch (e) {
		console.error(`Can not install module <${name}>`);
		console.error("\t", "Detail(s):", e.toString());
	}
};


text:
<!DOCTYPE frameset SYSTEM "frameset.dtd">
<frameset>
    <predicate lemma="culture">
        <note>
            Frames file for 'culture' based on sentences in ECTB 2.  No Verbnet
            entry.  Comparison with 'nurture'.
        </note>

        <roleset id="culture.01" name="grow, cultivate, groom or nurture for one's
  own purposes" vncls="-">
            <roles>
                <role descr="agent" n="0"/>
                <role descr="patient" n="1"/>
            </roles>

            <example name="active">
                <text>
                    She spent a great deal of time culturing new contacts on Capitol Hill.
                </text>
                <arg n="0">She</arg>
                <rel>culturing</rel>
                <arg n="1">new contacts on Capitol Hill</arg>
            </example>

            <example name="adjective">
                <text>
                    Their films, however, help serious cinema-goers in Taiwan and around the
                    world to better confront life, and at the same time win international
                    exposure for Taiwan, * enabling [the island's more cultured aspects]-1
                    [*]-1 to break through in the face of international political taboos and wrangling.
                </text>
                <rel>cultured</rel>
                <arg n="1">aspect</arg>
            </example>

            <note>
                Frame file created by Arrick
            </note>

        </roleset>
    </predicate>
</frameset>


text:
//[-------------------------------------------------------]
//[ Header guard                                          ]
//[-------------------------------------------------------]
#pragma once

//[-------------------------------------------------------]
//[ Includes                                              ]
//[-------------------------------------------------------]
#include "Renderer/Public/Resource/ResourceManager.h"

//[-------------------------------------------------------]
//[ Forward declarations                                  ]
//[-------------------------------------------------------]
namespace Renderer
{
	class IRenderer;
	class RenderPassManager;
	class FramebufferManager;
	class ICompositorPassFactory;
	class CompositorNodeResource;
	class RenderTargetTextureManager;
	class CompositorNodeResourceLoader;
	template <class TYPE, class LOADER_TYPE, typename ID_TYPE, uint32_t MAXIMUM_NUMBER_OF_ELEMENTS> class ResourceManagerTemplate;
}

//[-------------------------------------------------------]
//[ Namespace                                             ]
//[-------------------------------------------------------]
namespace Renderer
{

	//[-------------------------------------------------------]
	//[ Global definitions                                    ]
	//[-------------------------------------------------------]
	typedef uint32_t CompositorNodeResourceId;	///< POD compositor node resource identifier

	//[-------------------------------------------------------]
	//[ Classes                                               ]
	//[-------------------------------------------------------]
	class CompositorNodeResourceManager final : public ResourceManager<CompositorNodeResource>
	{

	//[-------------------------------------------------------]
	//[ Friends                                               ]
	//[-------------------------------------------------------]
		friend class RendererImpl;

	//[-------------------------------------------------------]
	//[ Public methods                                        ]
	//[-------------------------------------------------------]
	public:
		[[nodiscard]] inline IRenderer& getRenderer() const
		{
			return mRenderer;
		}

		RENDERER_API_EXPORT void loadCompositorNodeResourceByAssetId(AssetId assetId, CompositorNodeResourceId& compositorNodeResourceId, IResourceListener* resourceListener = nullptr, bool reload = false, ResourceLoaderTypeId resourceLoaderTypeId = getInvalid<ResourceLoaderTypeId>());	// Asynchronous
		RENDERER_API_EXPORT void setInvalidResourceId(CompositorNodeResourceId& compositorNodeResourceId, IResourceListener& resourceListener) const;

		[[nodiscard]] inline const ICompositorPassFactory& getCompositorPassFactory() const
		{
			// We know that this pointer is always valid
			return *mCompositorPassFactory;
		}

		RENDERER_API_EXPORT void setCompositorPassFactory(const ICompositorPassFactory* compositorPassFactory);

		[[nodiscard]] inline RenderTargetTextureManager& getRenderTargetTextureManager()
		{
			ASSERT(nullptr != mRenderTargetTextureManager, "Invalid render target texture manager")
			return *mRenderTargetTextureManager;
		}

		[[nodiscard]] inline RenderPassManager& getRenderPassManager()
		{
			ASSERT(nullptr != mRenderPassManager, "Invalid render pass manager")
			return *mRenderPassManager;
		}

		[[nodiscard]] inline FramebufferManager& getFramebufferManager()
		{
			ASSERT(nullptr != mFramebufferManager, "Invalid framebuffer manager")
			return *mFramebufferManager;
		}

	//[-------------------------------------------------------]
	//[ Public virtual Renderer::IResourceManager methods     ]
	//[-------------------------------------------------------]
	public:
		[[nodiscard]] virtual uint32_t getNumberOfResources() const override;
		[[nodiscard]] virtual IResource& getResourceByIndex(uint32_t index) const override;
		[[nodiscard]] virtual IResource& getResourceByResourceId(ResourceId resourceId) const override;
		[[nodiscard]] virtual IResource* tryGetResourceByResourceId(ResourceId resourceId) const override;
		virtual void reloadResourceByAssetId(AssetId assetId) override;

		inline virtual void update() override
		{
			// Nothing here
		}

	//[-------------------------------------------------------]
	//[ Private virtual Renderer::IResourceManager methods    ]
	//[-------------------------------------------------------]
	private:
		[[nodiscard]] virtual IResourceLoader* createResourceLoaderInstance(ResourceLoaderTypeId resourceLoaderTypeId) override;

	//[-------------------------------------------------------]
	//[ Private methods                                       ]
	//[-------------------------------------------------------]
	private:
		explicit CompositorNodeResourceManager(IRenderer& renderer);
		virtual ~CompositorNodeResourceManager() override;
		explicit CompositorNodeResourceManager(const CompositorNodeResourceManager&) = delete;
		CompositorNodeResourceManager& operator=(const CompositorNodeResourceManager&) = delete;

	//[-------------------------------------------------------]
	//[ Private data                                          ]
	//[-------------------------------------------------------]
	private:
		IRenderer&					  mRenderer;					///< Renderer instance, do not destroy the instance
		const ICompositorPassFactory* mCompositorPassFactory;		///< Compositor pass factory, always valid, do not destroy the instance
		RenderTargetTextureManager*	  mRenderTargetTextureManager;	///< Render target texture manager, always valid, we're responsible for destroying it if we no longer need it
		RenderPassManager*			  mRenderPassManager;			///< Render pass manager, always valid, we're responsible for destroying it if we no longer need it
		FramebufferManager*			  mFramebufferManager;			///< Framebuffer manager, always valid, we're responsible for destroying it if we no longer need it

		// Internal resource manager implementation
		ResourceManagerTemplate<CompositorNodeResource, CompositorNodeResourceLoader, CompositorNodeResourceId, 32>* mInternalResourceManager;

	};

//[-------------------------------------------------------]
//[ Namespace                                             ]
//[-------------------------------------------------------]
} // Renderer


text:
package com.jd.mvc.core.interceptot;

import java.lang.reflect.Method;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public  class DefaultInterceptotImpl implements DefaultInterceptot {

	private Log logger=LogFactory.getLog(getClass());
	@Override
	public Boolean preInterceptot(Class<?> cls, String routepath,
			Method method, Object... params) {
		// TODO Auto-generated method stub
		logger.info("访问路径:"+routepath);
		return true;
	}

	@Override
	public void afterInterceptot(Class<?> cls, String routepath, Method method,
			Object... params) {
		// TODO Auto-generated method stub
	}

}


text:
#ifndef itkQuadEdgeMeshTopologyChecker_h
#define itkQuadEdgeMeshTopologyChecker_h

#include "itkQuadEdgeMeshBoundaryEdgesMeshFunction.h"

namespace itk
{
/** \class QuadEdgeMeshTopologyChecker
 *  \brief Make some basic checks in order to verify that the considered
 *         mesh is not degenerated and correctly represents a surface
 *         with a potential boundary.
 *
 * We check that they are no isolated vertices, no isolated edges and
 * that the Euler formula is possible.
 *
 * \author Alexandre Gouaillard, Leonardo Florez-Valencia, Eric Boix
 *
 * This implementation was contributed as a paper to the Insight Journal
 * https://hdl.handle.net/1926/306
 *
 * \ingroup ITKQuadEdgeMesh
 */
template< typename TMesh >
class QuadEdgeMeshTopologyChecker:public Object
{
public:
  // Standard types
  typedef QuadEdgeMeshTopologyChecker Self;
  typedef Object                      Superclass;
  typedef SmartPointer< Self >        Pointer;
  typedef SmartPointer< const Self >  ConstPointer;

  typedef TMesh                                             MeshType;
  typedef typename MeshType::QEPrimal                       QEPrimal;
  typedef typename MeshType::EdgeCellType                   EdgeCellType;
  typedef typename MeshType::CellsContainerConstIterator    CellsContainerConstIterator;
  typedef QuadEdgeMeshBoundaryEdgesMeshFunction< MeshType > BoundaryEdges;

  typedef typename MeshType::PointIdentifier                PointIdentifier;
  typedef typename MeshType::CellIdentifier                 CellIdentifier;

public:
  itkNewMacro(Self);
  itkTypeMacro(QuadEdgeMeshTopologyChecker, Object);

  itkSetConstObjectMacro(Mesh, MeshType);

  typedef ::itk::IdentifierType     IdentifierType;
  typedef ::itk::OffsetValueType    OffsetValueType;

  itkSetMacro(ExpectedNumberOfPoints, PointIdentifier);
  itkSetMacro(ExpectedNumberOfEdges, CellIdentifier);
  itkSetMacro(ExpectedNumberOfFaces, CellIdentifier);
  itkSetMacro(ExpectedNumberOfBoundaries, CellIdentifier);
  itkSetMacro(ExpectedGenus, OffsetValueType);

  bool ValidateEulerCharacteristic() const;

protected:
  QuadEdgeMeshTopologyChecker();
  ~QuadEdgeMeshTopologyChecker(){}
  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;

private:
  ITK_DISALLOW_COPY_AND_ASSIGN(QuadEdgeMeshTopologyChecker);

  typedef typename MeshType::ConstPointer MeshPointer;

  MeshPointer m_Mesh;

  PointIdentifier  m_ExpectedNumberOfPoints;
  CellIdentifier   m_ExpectedNumberOfEdges;
  CellIdentifier   m_ExpectedNumberOfFaces;
  CellIdentifier   m_ExpectedNumberOfBoundaries;
  OffsetValueType  m_ExpectedGenus;
};
}

#ifndef ITK_MANUAL_INSTANTIATION
#include "itkQuadEdgeMeshTopologyChecker.hxx"
#endif

#endif


text:
package w2d.parser.rule;

import org.antlr.v4.runtime.tree.ParseTree;
import org.apache.log4j.Logger;
import w2d.antlr.ExceptionErrorStrategy;
import w2d.antlr.gen.GrammarParser;
import w2d.parser.question.QuestionParser;
import w2d.rule.IfStatement;
import w2d.rule.Rule;
import w2d.rule.StatementGroup;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class RuleParser {

	private final Logger log = Logger.getLogger(RuleParser.class);

	public static Map<String, Rule> rules = new HashMap<String, Rule>();

	private String variableName;

	public void parse(ParseTree tree) {
		variableName = parseVariableName(tree);

		Map<StatementGroup, Boolean> statementGroups = parseStatementGroups(tree.getChild(4));

		rules.put(variableName, new Rule(statementGroups));
	}

	private String parseVariableName(ParseTree tree) {
		return tree.getChild(0).getText();
	}

	private Map<StatementGroup, Boolean> parseStatementGroups(ParseTree tree) {
		Map<StatementGroup, Boolean> statementGroups =  new HashMap<StatementGroup, Boolean>();

		for (int i = 0; i < tree.getChildCount(); i ++) {
			if (tree.getChild(i) instanceof GrammarParser.StatementFieldContext) {
				statementGroups.put(parseStatementGroup(tree.getChild(i).getChild(2)), parseBoolean(tree.getChild(i)));
			}
		}
		return statementGroups;
	}

	private Boolean parseBoolean(ParseTree tree) {
		return Boolean.valueOf(tree.getChild(0).getText());
	}

	private StatementGroup parseStatementGroup(ParseTree tree) {
		List<IfStatement> statements = new ArrayList<IfStatement>();

		for (int i = 0; i < tree.getChildCount(); i ++) {
			if (tree.getChild(i) instanceof GrammarParser.ExpressionFieldContext) {
				statements.add(parseIfStatement(tree.getChild(i)));
			}
		}
		return new StatementGroup(statements);
	}

	private IfStatement parseIfStatement(ParseTree tree) {
		String questionVariable = tree.getChild(0).getText();

		if (!QuestionParser.questions.containsKey(questionVariable)) {
			ExceptionErrorStrategy.errors.add("Missing rule '" + questionVariable + "' in '" + variableName + "' Rule");
			return new IfStatement();
		}
		Boolean mustEqual = tree.getChild(1).getText().equals("is");

		return new IfStatement(QuestionParser.questions.get(questionVariable), tree.getChild(2).getText(), mustEqual);
	}
}


text:
  Massangis est
       un village
       situé dans le département de Yonne en Bourgogne. On dénombrait 404 habitants en 2008.

Le nombre de logements, à Massangis, était réparti en 2011 en dix appartements et 314 maisons soit
 un marché relativement équilibré.

À proximité de Massangis sont positionnées géographiquement les villes de
Coutarnoux située à 4 km, 100 habitants,
Provency à 8 km, 233 habitants,
Joux-la-Ville à 8 km, 1 160 habitants,
Sarry localisée à 8 km, 175 habitants,
Annoux située à 5 km, 93 habitants,
L'Isle-sur-Serein localisée à 4 km, 760 habitants,
 entre autres. De plus, Massangis est située à seulement 15 km de Avallon.

Si vous pensez demenager à Massangis, vous pourrez aisément trouver une maison à vendre.

La commune offre quelques  équipements sportifs, elle dispose, entre autres, de un terrain de sport et une boucle de randonnée.


text:
#ifndef AC_STRING_UTIL_H
#define AC_STRING_UTIL_H

#include <string>
using std::string;

typedef unsigned int acUINT;

double acStringScanDouble(const char *string, int *numScanned);
int    acStringScanInt(const char *string, int base, int *numScanned);
acUINT acStringScanUInt(const char *string, int base, int *numScanned);
acUINT acStringHash(const char *string);

string acStringFormat(const char *format, ...);

#endif


text:
package hqt.designpatterns.patterns.singleton;

/**
 * Warnings:
 * Be careful if using multiple class loaders; this could defeat the Singleton implementation
 * and result in multiple instances.
 *
 * If using JVM earlier than 1.2, you need to create registry of Singletons to defeat the garbage collector.
 *
 * @author Hai
 *
 */
public class EagerSingleton {
	private static EagerSingleton uniqueInstance = new EagerSingleton();

	private EagerSingleton() { }

	/**
	 * MULTITHREADING OPTIONS:
	 *
	 * 	1)
	 * 	Add synchronized: no two threads may enter the method at the same time.
	 *  However, synchronized is expensive and can decrease performance by a factor of 100,
	 *  so if high traffic is part of code that uses getInstances, you might have to reconsider.
	 *
	 *  2)
	 *  Move to an eagerly created instance rather than a lazily created one.
	 *
	 *  3)
	 *  Double-checked locking to reduce the use of synchronization in the getInstance().
	 *  We only synchronize the first time through, just what we want.
	 *
	 * @return
	 */
	public static EagerSingleton getInstance() {
		return uniqueInstance;
	}

	/**
	 * For testing purposes only.
	 */
	public static EagerSingleton getUniqueInstance() {
		return uniqueInstance;
	}

}


text:
export const UI_OPEN_EVENT_FORM = 'UI_OPEN_EVENT_FORM'
export const UI_CLOSE_EVENT_FORM = 'UI_CLOSE_EVENT_FORM'

export const UI_TOGGLE_CLUBBER = 'UI_TOGGLE_CLUBBER'
export const UI_TOGGLE_FILTER = 'UI_TOGGLE_FILTER'
export const UI_CHANGE_NB_MONTHS = 'UI_CHANGE_NB_MONTHS'
export const UI_CHANGE_START_MONTH = 'UI_CHANGE_START_MONTH'
export const UI_CHANGE_CONFIRMED = 'UI_CHANGE_CONFIRMED'
export const UI_CHANGE_INVOICED = 'UI_CHANGE_INVOICED'
export const UI_CHANGE_LAST_UPDATE = 'UI_CHANGE_LAST_UPDATE'
export const UI_TOGGLE_TAG = 'UI_TOGGLE_TAG'
export const UI_SEARCH = 'UI_SEARCH'

export const UI_SET_ONLINE = 'UI_SET_ONLINE'
export const UI_SET_OFFLINE = 'UI_SET_OFFLINE'

export const CREATE_EVENT = 'CREATE_EVENT'
export const UPDATE_EVENT = 'UPDATE_EVENT'
export const DELETE_EVENT = 'DELETE_EVENT'

export const CREATED_EVENT = 'CREATED_EVENT'
export const UPDATED_EVENT = 'UPDATED_EVENT'
export const DELETED_EVENT = 'DELETED_EVENT'

export const FETCH_EVENTS = 'FETCH_EVENTS'
export const FETCHED_EVENTS = 'FETCHED_EVENTS'

export const FETCHED_CONTACTS = 'FETCHED_CONTACTS'


text:
// ==UserScript==
// @name       Uncomment comments
// @namespace  http://github.com/gcochard/tdwtf-uncommenter
// @version    0.1
// @description  Uncomments humorous article body comments on TDWTF
// @match      http://thedailywtf.com
// Thanks to Yoshi
Node = Node || {
    COMMENT_NODE: 8
};

function getComments(elem) {
    var children = elem.childNodes;

    for (var i=0, len=children.length; i<len; i++) {
        if (children[i].nodeType == Node.COMMENT_NODE) {
            commentsArr.push(children[i]);
        } else if(children[i].childNodes.length) {
            getComments(children[i]);
        }
            }
}
/*
 * end ripped off section
 */
getComments(document.getElementById('MainContent'));
if(commentsArr.length){
    var temp = null;
    for(var i=0,ii=commentsArr.length;i<ii;i++){
        temp = document.createElement('span');
        temp.style.color='#7A7';
        temp.innerHTML = '<--'+commentsArr[i].nodeValue+'--&gt';
        commentsArr[i].parentNode.replaceChild(temp,commentsArr[i]);
        temp = null;
    }
    console.log('comments transformed!');
}


text:
(function($, body) {
    var PLUGIN_NAME = "ijTinder";

    var _default_settings = {
        likeIcon: null, // The icon that is displayed in the right top
        dislikeIcon: null, // The icon that is displayed in the left top
        minDragDistance: 150,
        returnAnimationTime: 100,
        lastAnimationSpeed: 500,
        lastAnimationForceDown: false // If you don't want the default tinder animation style and just want to force it to go down
    };

    // Private variables
    var start = {x: 0, y: 0};
    var mouse_down;

    var target;
    var target_bounds = {x: 0, y: 0};
    var self;
    var parent;
    var current_target;

    function Plugin(element, settings) {
        this.element = element;
        this.settings = $.extend({}, _default_settings, settings); // Merge the settings and default settings
        this.name = PLUGIN_NAME;

        self = this;

        this.init(element);
        this.setCurrentTarget();
    }

    Plugin.prototype = {
        setCurrentTarget: function() {
            target = $(self.element).find("li");

            current_target = $(target[target.length - 1]).last();

            self.like_button = current_target.find(self.settings.likeIcon);
            self.dislike_button = current_target.find(self.settings.dislikeIcon);

            target_bounds = {
                x: current_target.position().left,
                y: current_target.position().top,
                w: cssToNumber(current_target.css("width")),
                h: cssToNumber(current_target.css("height"))
            };

        },
        init: function(element) {
            target = $(element).find("li");

            parent = target.parent();

            //target.on("mousedown mouseup mousemove", this.mouseEvent);
            target.on("mousedown mousemove", this.mouseEvent);
            body.on("mouseup", this.mouseEvent);
            target.on("touchstart touchend touchmove", this.touchEvent);
        },
        animateAngle: function(obj, angle) {
            var _end = {x: obj.position().left, y: obj.position().top};
            var _angle = angle * (Math.PI / 180);

            var _distance = distance(target_bounds, _end);

            var _left = target_bounds.x - Math.cos(_angle) * (_distance + 500);
            var _top = target_bounds.y - Math.sin(_angle) * (_distance + 500);

            obj.animate({
                opacity: 0,
                left: _left+"px",
                top: _top+"px"
            }, self.settings.lastAnimationSpeed, function() {
                self.remove(obj);
            });
        },
        animate: function(obj) {
            var _end = {
                x: obj.position().left,
                y: obj.position().top
            };

            var _dif_x = _end.x - target_bounds.x;
            var _dif_y = _end.y - target_bounds.y;
            var _angle = angle({x: 0, y: 0}, {x: _dif_x, y: _dif_y});

            var _distance = distance(target_bounds, _end);

            var _left = target_bounds.x - Math.cos(_angle) * (_distance + 200);
            var _top = target_bounds.y - Math.sin(_angle) * (_distance + 200);

            // Reset the position
            if (self.settings.lastAnimationForceDown) {
                _top = parent.height();
                _left = _end.x;
            }

            obj.animate({
                opacity: 0,
                left: _left+"px",
                top: _top+"px"
            }, self.settings.lastAnimationSpeed, function() {
                self.remove(obj);
            });
        },
        like: function(obj) {
            if(self.settings.like) {
                self.settings.like.call(obj);
            }

            if(this !== self) {
                self.animateAngle(obj, 180);
            } else {
                self.animate(obj);
            }
        },
        dislike: function(obj) {
            if(self.settings.dislike) {
                self.settings.dislike.call(obj);
            }

            if(this !== self) {
                self.animateAngle(obj, 0);
            } else {
                self.animate(obj);
            }
        },
        remove: function(obj) {
            // How to remove the object, the default is the standard jQuery function
            if(self.settings.remove) {
                self.settings.remove.call(obj);
            } else {
                obj.remove();
            }

            this.setCurrentTarget();
        },
        touchEvent: function(e) { // Create a fake Event object, send that object to the mouseEvent function
            e.preventDefault();

            var _touch = e.originalEvent.changedTouches[0];
            var _x = _touch.pageX;
            var _y = _touch.pageY;
            var _type = "mousemove";

            if (e.type === "touchstart") {
                _type = "mousedown";
            } else if (e.type === "touchend") {
                _type = "mouseup";
            }

            var _fake_event = new Object();
            _fake_event.type = _type;
            _fake_event.pageX = _x;
            _fake_event.pageY = _y;
            _fake_event.preventDefault = function () {};

            self.mouseEvent.call(this, _fake_event);
        },
        mouseEvent: function(e) {
            e.preventDefault();

            var _x = e.pageX;
            var _y = e.pageY;

            if(e.type === "mousedown") {
                mouse_down = true;
                start.x = _x;
                start.y = _y;

            }  else if(e.type === "mouseup") {
                if(mouse_down) {
                    mouse_down = false;

                    // Calculate the distance from the starting point and now
                    var _end = {
                        x: _x - start.x,
                        y: _y - start.y
                    };

                    var _distance = distance(target_bounds, _end);

                    // Only if the target is in the given bounds
                    if (_distance > self.settings.minDragDistance) {
                        var _dif_x = _end.x - target_bounds.x;

                        var _sign_x = Math.sign(_dif_x);

                        if (_sign_x === 1) {
                            self.like(current_target);
                        } else {
                            self.dislike(current_target);
                        }
                    } else {
                        self.like_button.animate({opacity: "0"}, self.settings.returnAnimationTime);
                        self.dislike_button.animate({opacity: "0"}, self.settings.returnAnimationTime);

                        // Reset the position
                        current_target.animate({
                            transform: "rotate(0deg)",
                            left: "0px",
                            top: "0px"
                        }, self.settings.returnAnimationTime);
                    }
                }
            } else if(e.type === "mousemove") {
                if(mouse_down) {
                    var _dif = {
                        x: (_x - start.x),
                        y: (_y - start.y)
                    };

                    var _sign_x = Math.sign(_dif.x);

                    // Only if the user is in the distance bounds
                    current_target.css("left", target_bounds.x + _dif.x);
                    current_target.css("top", target_bounds.y + _dif.y);

                    var _distance = distance(target_bounds, _dif);
                    var _percentage = _distance / self.settings.minDragDistance;
                    if(_percentage > 1) {
                        _percentage = 1;
                    }

                    if(_sign_x > 0) {
                        self.like_button.css("opacity", _percentage);
                        self.dislike_button.css("opacity", 0);
                    } else {
                        self.like_button.css("opacity", 0);
                        self.dislike_button.css("opacity", _percentage);
                    }

                    current_target.css("transform", "rotate("+(_dif.x/30)+"deg)");
                }
            }
        }
    };

    function angle(start, end) {
        var _dx = start.x - end.x;
        var _dy = start.y - end.y;

        return Math.atan2(_dy, _dx);
    }

    function distance(start, end) {
        var _dx = start.x - end.x;
        var _dy = start.y - end.y;

        return Math.sqrt(_dx * _dx + _dy * _dy);
    }

    function cssToNumber(css) {
        css = css.replace("px", "");
        return parseFloat(css);
    }

    // Register the ijTinder function
    $.fn[PLUGIN_NAME] = function(settings) {
        this.each(function() {
            if(!$.data(this, "plugin_"+PLUGIN_NAME)) {
                $.data(this, "plugin_"+PLUGIN_NAME, new Plugin(this, settings));
            } else if($.isFunction(Plugin.prototype[settings])) {
                $.data(this, "plugin_"+PLUGIN_NAME)[settings].call(this, current_target);
            }
        });

        return this;
    };
}(jQuery, $("body")));


text:
package io.shardingsphere.core.parsing.antlr.sql.segment.condition;

import io.shardingsphere.core.parsing.antlr.sql.segment.SQLSegment;
import io.shardingsphere.core.parsing.parser.context.condition.OrCondition;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * Predicate segment.
 *
 * @author duhongjun
 */
@RequiredArgsConstructor
@Getter
public final class PredicateSegment implements SQLSegment {

    private final OrCondition orCondition;

}


text:
package com.alibaba.dubbo.registry.redis;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;
import redis.clients.jedis.JedisPubSub;

import com.alibaba.dubbo.common.Constants;
import com.alibaba.dubbo.common.URL;
import com.alibaba.dubbo.common.logger.Logger;
import com.alibaba.dubbo.common.logger.LoggerFactory;
import com.alibaba.dubbo.common.utils.NamedThreadFactory;
import com.alibaba.dubbo.common.utils.UrlUtils;
import com.alibaba.dubbo.registry.NotifyListener;
import com.alibaba.dubbo.registry.support.FailbackRegistry;
import com.alibaba.dubbo.rpc.RpcException;

/**
 * RedisRegistry
 *
 * @author william.liangf
 */
public class RedisRegistry extends FailbackRegistry {

    private static final Logger logger = LoggerFactory.getLogger(RedisRegistry.class);

    private static final int DEFAULT_REDIS_PORT = 6379;

    private final static String DEFAULT_ROOT = "dubbo";

    private final ScheduledExecutorService expireExecutor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("DubboRegistryExpireTimer", true));

    private final ScheduledFuture<?> expireFuture;

    private final String root;

    private final Map<String, JedisPool> jedisPools = new ConcurrentHashMap<String, JedisPool>();

    private final ConcurrentMap<String, Notifier> notifiers = new ConcurrentHashMap<String, Notifier>();

    private final int reconnectPeriod;

    private final int expirePeriod;

    private volatile boolean admin = false;

    private boolean replicate;

    public RedisRegistry(URL url) {
        super(url);
        if (url.isAnyHost()) {
    		throw new IllegalStateException("registry address == null");
    	}

        JedisPoolConfig config = new JedisPoolConfig();

        config.setTestOnBorrow ( url.getParameter("test.on.borrow", true));
        config.setTestOnReturn ( url.getParameter("test.on.return", false));
        config.setTestWhileIdle ( url.getParameter("test.while.idle", false));
        if (url.getParameter("max.idle", 0) > 0)
            config.setMaxIdle ( url.getParameter("max.idle", 0));
        if (url.getParameter("min.idle", 0) > 0)
            config.setMinIdle ( url.getParameter("min.idle", 0));
        if (url.getParameter("max.active", 0) > 0)
           config.setMaxTotal ( url.getParameter("max.active", 0));
        if (url.getParameter("max.wait", 0) > 0)
            config.setMaxWaitMillis ( url.getParameter("max.wait", 0));
        if (url.getParameter("num.tests.per.eviction.run", 0) > 0)
            config.setNumTestsPerEvictionRun ( url.getParameter("num.tests.per.eviction.run", 0));
        if (url.getParameter("time.between.eviction.runs.millis", 0) > 0)
            config.setTimeBetweenEvictionRunsMillis ( url.getParameter("time.between.eviction.runs.millis", 0));
        if (url.getParameter("min.evictable.idle.time.millis", 0) > 0)
            config.setMinEvictableIdleTimeMillis ( url.getParameter("min.evictable.idle.time.millis", 0));

        String cluster = url.getParameter("cluster", "failover");
        if (! "failover".equals(cluster) && ! "replicate".equals(cluster)) {
        	throw new IllegalArgumentException("Unsupported redis cluster: " + cluster + ". The redis cluster only supported failover or replicate.");
        }
        replicate = "replicate".equals(cluster);

        List<String> addresses = new ArrayList<String>();
        addresses.add(url.getAddress());
        String[] backups = url.getParameter(Constants.BACKUP_KEY, new String[0]);
        if (backups != null && backups.length > 0) {
            addresses.addAll(Arrays.asList(backups));
        }
        for (String address : addresses) {
            int i = address.indexOf(':');
            String host;
            int port;
            if (i > 0) {
                host = address.substring(0, i);
                port = Integer.parseInt(address.substring(i + 1));
            } else {
                host = address;
                port = DEFAULT_REDIS_PORT;
            }
            this.jedisPools.put(address, new JedisPool(config, host, port,
                    url.getParameter(Constants.TIMEOUT_KEY, Constants.DEFAULT_TIMEOUT)));
        }

        this.reconnectPeriod = url.getParameter(Constants.REGISTRY_RECONNECT_PERIOD_KEY, Constants.DEFAULT_REGISTRY_RECONNECT_PERIOD);
        String group = url.getParameter(Constants.GROUP_KEY, DEFAULT_ROOT);
        if (! group.startsWith(Constants.PATH_SEPARATOR)) {
            group = Constants.PATH_SEPARATOR + group;
        }
        if (! group.endsWith(Constants.PATH_SEPARATOR)) {
            group = group + Constants.PATH_SEPARATOR;
        }
        this.root = group;

        this.expirePeriod = url.getParameter(Constants.SESSION_TIMEOUT_KEY, Constants.DEFAULT_SESSION_TIMEOUT);
        this.expireFuture = expireExecutor.scheduleWithFixedDelay(new Runnable() {
            public void run() {
                try {
                    deferExpired(); // 延长过期时间
                } catch (Throwable t) { // 防御性容错
                    logger.error("Unexpected exception occur at defer expire time, cause: " + t.getMessage(), t);
                }
            }
        }, expirePeriod / 2, expirePeriod / 2, TimeUnit.MILLISECONDS);
    }

    private void deferExpired() {
        for (Map.Entry<String, JedisPool> entry : jedisPools.entrySet()) {
            JedisPool jedisPool = entry.getValue();
            try {
                Jedis jedis = jedisPool.getResource();
                try {
                    for (URL url : new HashSet<URL>(getRegistered())) {
                        if (url.getParameter(Constants.DYNAMIC_KEY, true)) {
                            String key = toCategoryPath(url);
                            if (jedis.hset(key, url.toFullString(), String.valueOf(System.currentTimeMillis() + expirePeriod)) == 1) {
                                jedis.publish(key, Constants.REGISTER);
                            }
                        }
                    }
                    if (admin) {
                        clean(jedis);
                    }
                    if (! replicate) {
                    	break;//  如果服务器端已同步数据,只需写入单台机器
                    }
                } finally {
                    jedisPool.returnResource(jedis);
                }
            } catch (Throwable t) {
                logger.warn("Failed to write provider heartbeat to redis registry. registry: " + entry.getKey() + ", cause: " + t.getMessage(), t);
            }
        }
    }

    // 监控中心负责删除过期脏数据
    private void clean(Jedis jedis) {
        Set<String> keys = jedis.keys(root + Constants.ANY_VALUE);
        if (keys != null && keys.size() > 0) {
            for (String key : keys) {
                Map<String, String> values = jedis.hgetAll(key);
                if (values != null && values.size() > 0) {
                    boolean delete = false;
                    long now = System.currentTimeMillis();
                    for (Map.Entry<String, String> entry : values.entrySet()) {
                        URL url = URL.valueOf(entry.getKey());
                        if (url.getParameter(Constants.DYNAMIC_KEY, true)) {
                            long expire = Long.parseLong(entry.getValue());
                            if (expire < now) {
                                jedis.hdel(key, entry.getKey());
                                delete = true;
                                if (logger.isWarnEnabled()) {
                                    logger.warn("Delete expired key: " + key + " -> value: " + entry.getKey() + ", expire: " + new Date(expire) + ", now: " + new Date(now));
                                }
                            }
                            }
                    }
                    if (delete) {
                        jedis.publish(key, Constants.UNREGISTER);
                    }
                }
            }
        }
    }

    public boolean isAvailable() {
        for (JedisPool jedisPool : jedisPools.values()) {
            try {
                Jedis jedis = jedisPool.getResource();
                try {
                	if (jedis.isConnected()) {
                        return true; // 至少需单台机器可用
                    }
                } finally {
                    jedisPool.returnResource(jedis);
                }
            } catch (Throwable t) {
            }
        }
        return false;
    }

    @Override
    public void destroy() {
        super.destroy();
        try {
            expireFuture.cancel(true);
        } catch (Throwable t) {
            logger.warn(t.getMessage(), t);
        }
        try {
            for (Notifier notifier : notifiers.values()) {
                notifier.shutdown();
            }
        } catch (Throwable t) {
            logger.warn(t.getMessage(), t);
        }
        for (Map.Entry<String, JedisPool> entry : jedisPools.entrySet()) {
            JedisPool jedisPool = entry.getValue();
            try {
                jedisPool.destroy();
            } catch (Throwable t) {
                logger.warn("Failed to destroy the redis registry client. registry: " + entry.getKey() + ", cause: " + t.getMessage(), t);
            }
        }
    }

    @Override
    public void doRegister(URL url) {
        String key = toCategoryPath(url);
        String value = url.toFullString();
        String expire = String.valueOf(System.currentTimeMillis() + expirePeriod);
        boolean success = false;
        RpcException exception = null;
        for (Map.Entry<String, JedisPool> entry : jedisPools.entrySet()) {
            JedisPool jedisPool = entry.getValue();
            try {
                Jedis jedis = jedisPool.getResource();
                try {
                    jedis.hset(key, value, expire);
                    jedis.publish(key, Constants.REGISTER);
                    success = true;
                    if (! replicate) {
                    	break; //  如果服务器端已同步数据,只需写入单台机器
                    }
                } finally {
                    jedisPool.returnResource(jedis);
                }
            } catch (Throwable t) {
                exception = new RpcException("Failed to register service to redis registry. registry: " + entry.getKey() + ", service: " + url + ", cause: " + t.getMessage(), t);
            }
        }
        if (exception != null) {
            if (success) {
                logger.warn(exception.getMessage(), exception);
            } else {
                throw exception;
            }
        }
    }

    @Override
    public void doUnregister(URL url) {
        String key = toCategoryPath(url);
        String value = url.toFullString();
        RpcException exception = null;
        boolean success = false;
        for (Map.Entry<String, JedisPool> entry : jedisPools.entrySet()) {
            JedisPool jedisPool = entry.getValue();
            try {
                Jedis jedis = jedisPool.getResource();
                try {
                    jedis.hdel(key, value);
                    jedis.publish(key, Constants.UNREGISTER);
                    success = true;
                    if (! replicate) {
                    	break; //  如果服务器端已同步数据,只需写入单台机器
                    }
                } finally {
                    jedisPool.returnResource(jedis);
                }
            } catch (Throwable t) {
                exception = new RpcException("Failed to unregister service to redis registry. registry: " + entry.getKey() + ", service: " + url + ", cause: " + t.getMessage(), t);
            }
        }
        if (exception != null) {
            if (success) {
                logger.warn(exception.getMessage(), exception);
            } else {
                throw exception;
            }
        }
    }

    @Override
    public void doSubscribe(final URL url, final NotifyListener listener) {
        String service = toServicePath(url);
        Notifier notifier = notifiers.get(service);
        if (notifier == null) {
            Notifier newNotifier = new Notifier(service);
            notifiers.putIfAbsent(service, newNotifier);
            notifier = notifiers.get(service);
            if (notifier == newNotifier) {
                notifier.start();
            }
        }
        boolean success = false;
        RpcException exception = null;
        for (Map.Entry<String, JedisPool> entry : jedisPools.entrySet()) {
            JedisPool jedisPool = entry.getValue();
            try {
                Jedis jedis = jedisPool.getResource();
                try {
                    if (service.endsWith(Constants.ANY_VALUE)) {
                        admin = true;
                        Set<String> keys = jedis.keys(service);
                        if (keys != null && keys.size() > 0) {
                            Map<String, Set<String>> serviceKeys = new HashMap<String, Set<String>>();
                            for (String key : keys) {
                                String serviceKey = toServicePath(key);
                                Set<String> sk = serviceKeys.get(serviceKey);
                                if (sk == null) {
                                    sk = new HashSet<String>();
                                    serviceKeys.put(serviceKey, sk);
                                }
                                sk.add(key);
                            }
                            for (Set<String> sk : serviceKeys.values()) {
                                doNotify(jedis, sk, url, Arrays.asList(listener));
                            }
                        }
                    } else {
                        doNotify(jedis, jedis.keys(service + Constants.PATH_SEPARATOR + Constants.ANY_VALUE), url, Arrays.asList(listener));
                    }
                    success = true;
                    break; // 只需读一个服务器的数据
                } finally {
                    jedisPool.returnResource(jedis);
                }
            } catch(Throwable t) { // 尝试下一个服务器
                exception = new RpcException("Failed to subscribe service from redis registry. registry: " + entry.getKey() + ", service: " + url + ", cause: " + t.getMessage(), t);
            }
        }
        if (exception != null) {
            if (success) {
                logger.warn(exception.getMessage(), exception);
            } else {
                throw exception;
            }
        }
    }

    @Override
    public void doUnsubscribe(URL url, NotifyListener listener) {
    }

    private void doNotify(Jedis jedis, String key) {
        for (Map.Entry<URL, Set<NotifyListener>> entry : new HashMap<URL, Set<NotifyListener>>(getSubscribed()).entrySet()) {
            doNotify(jedis, Arrays.asList(key), entry.getKey(), new HashSet<NotifyListener>(entry.getValue()));
        }
    }

    private void doNotify(Jedis jedis, Collection<String> keys, URL url, Collection<NotifyListener> listeners) {
        if (keys == null || keys.size() == 0
                || listeners == null || listeners.size() == 0) {
            return;
        }
        long now = System.currentTimeMillis();
        List<URL> result = new ArrayList<URL>();
        List<String> categories = Arrays.asList(url.getParameter(Constants.CATEGORY_KEY, new String[0]));
        String consumerService = url.getServiceInterface();
        for (String key : keys) {
            if (! Constants.ANY_VALUE.equals(consumerService)) {
                String prvoiderService = toServiceName(key);
                if (! prvoiderService.equals(consumerService)) {
                    continue;
                }
            }
            String category = toCategoryName(key);
            if (! categories.contains(Constants.ANY_VALUE) && ! categories.contains(category)) {
                continue;
            }
            List<URL> urls = new ArrayList<URL>();
            Map<String, String> values = jedis.hgetAll(key);
            if (values != null && values.size() > 0) {
                for (Map.Entry<String, String> entry : values.entrySet()) {
                    URL u = URL.valueOf(entry.getKey());
                    if (! u.getParameter(Constants.DYNAMIC_KEY, true)
                            || Long.parseLong(entry.getValue()) >= now) {
                        if (UrlUtils.isMatch(url, u)) {
                            urls.add(u);
                        }
                    }
                }
            }
            if (urls.isEmpty()) {
                urls.add(url.setProtocol(Constants.EMPTY_PROTOCOL)
                        .setAddress(Constants.ANYHOST_VALUE)
                        .setPath(toServiceName(key))
                        .addParameter(Constants.CATEGORY_KEY, category));
            }
            result.addAll(urls);
            if (logger.isInfoEnabled()) {
                logger.info("redis notify: " + key + " = " + urls);
            }
        }
        if (result == null || result.size() == 0) {
            return;
        }
        for (NotifyListener listener : listeners) {
            notify(url, listener, result);
        }
    }

    private String toServiceName(String categoryPath) {
        String servicePath = toServicePath(categoryPath);
        return servicePath.startsWith(root) ? servicePath.substring(root.length()) : servicePath;
    }

    private String toCategoryName(String categoryPath) {
        int i = categoryPath.lastIndexOf(Constants.PATH_SEPARATOR);
        return i > 0 ? categoryPath.substring(i + 1) : categoryPath;
    }

    private String toServicePath(String categoryPath) {
        int i;
        if (categoryPath.startsWith(root)) {
            i = categoryPath.indexOf(Constants.PATH_SEPARATOR, root.length());
        } else {
            i = categoryPath.indexOf(Constants.PATH_SEPARATOR);
        }
        return i > 0 ? categoryPath.substring(0, i) : categoryPath;
    }

    private String toServicePath(URL url) {
        return root + url.getServiceInterface();
    }

    private String toCategoryPath(URL url) {
        return toServicePath(url) + Constants.PATH_SEPARATOR + url.getParameter(Constants.CATEGORY_KEY, Constants.DEFAULT_CATEGORY);
    }

    private class NotifySub extends JedisPubSub {

        private final JedisPool jedisPool;

        public NotifySub(JedisPool jedisPool) {
            this.jedisPool = jedisPool;
        }

        @Override
        public void onMessage(String key, String msg) {
            if (logger.isInfoEnabled()) {
                logger.info("redis event: " + key + " = " + msg);
            }
            if (msg.equals(Constants.REGISTER)
                    || msg.equals(Constants.UNREGISTER)) {
                try {
                    Jedis jedis = jedisPool.getResource();
                    try {
                        doNotify(jedis, key);
                    } finally {
                        jedisPool.returnResource(jedis);
                    }
                } catch (Throwable t) { // TODO 通知失败没有恢复机制保障
                    logger.error(t.getMessage(), t);
                }
            }
        }

        @Override
        public void onPMessage(String pattern, String key, String msg) {
            onMessage(key, msg);
        }

        @Override
        public void onSubscribe(String key, int num) {
        }

        @Override
        public void onPSubscribe(String pattern, int num) {
        }

        @Override
        public void onUnsubscribe(String key, int num) {
        }

        @Override
        public void onPUnsubscribe(String pattern, int num) {
        }

    }

    private class Notifier extends Thread {

        private final String service;

        private volatile Jedis jedis;

        private volatile boolean first = true;

        private volatile boolean running = true;

        private final AtomicInteger connectSkip = new AtomicInteger();

        private final AtomicInteger connectSkiped = new AtomicInteger();

        private final Random random = new Random();

        private volatile int connectRandom;

        private void resetSkip() {
            connectSkip.set(0);
            connectSkiped.set(0);
            connectRandom = 0;
        }

        private boolean isSkip() {
            int skip = connectSkip.get(); // 跳过次数增长
            if (skip >= 10) { // 如果跳过次数增长超过10,取随机数
                if (connectRandom == 0) {
                    connectRandom = random.nextInt(10);
                }
                skip = 10 + connectRandom;
            }
            if (connectSkiped.getAndIncrement() < skip) { // 检查跳过次数
                return true;
            }
            connectSkip.incrementAndGet();
            connectSkiped.set(0);
            connectRandom = 0;
            return false;
        }

        public Notifier(String service) {
            super.setDaemon(true);
            super.setName("DubboRedisSubscribe");
            this.service = service;
        }

        @Override
        public void run() {
            while (running) {
                try {
                    if (! isSkip()) {
                        try {
                            for (Map.Entry<String, JedisPool> entry : jedisPools.entrySet()) {
                                JedisPool jedisPool = entry.getValue();
                                try {
                                    jedis = jedisPool.getResource();
                                    try {
                                        if (service.endsWith(Constants.ANY_VALUE)) {
                                            if (! first) {
                                                first = false;
                                                Set<String> keys = jedis.keys(service);
                                                if (keys != null && keys.size() > 0) {
                                                    for (String s : keys) {
                                                        doNotify(jedis, s);
                                                    }
                                                }
                                                resetSkip();
                                            }
                                            jedis.psubscribe(new NotifySub(jedisPool), service); // 阻塞
                                        } else {
                                            if (! first) {
                                                first = false;
                                                doNotify(jedis, service);
                                                resetSkip();
                                            }
                                            jedis.psubscribe(new NotifySub(jedisPool), service + Constants.PATH_SEPARATOR + Constants.ANY_VALUE); // 阻塞
                                        }
                                        break;
                                    } finally {
                                        jedisPool.returnBrokenResource(jedis);
                                    }
                                } catch (Throwable t) { // 重试另一台
                                    logger.warn("Failed to subscribe service from redis registry. registry: " + entry.getKey() + ", cause: " + t.getMessage(), t);
                                    // 如果在单台redis的情况下,需要休息一会,避免空转占用过多cpu资源
                                    sleep(reconnectPeriod);
                                }
                            }
                        } catch (Throwable t) {
                            logger.error(t.getMessage(), t);
                            sleep(reconnectPeriod);
                        }
                    }
                } catch (Throwable t) {
                    logger.error(t.getMessage(), t);
                }
            }
        }

        public void shutdown() {
            try {
                running = false;
                jedis.disconnect();
            } catch (Throwable t) {
                logger.warn(t.getMessage(), t);
            }
        }

    }

}


text:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF 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.
-->
<beans>

   <!-- Add Someco messages -->
   <bean id="com.someco.content-tutorial-share.resources" class="org.springframework.extensions.surf.util.ResourceBundleBootstrapComponent">
      <property name="resourceBundles">
         <list>
         	<value>alfresco.web-extension.messages.scModel</value>
         </list>
      </property>
   </bean>

</beans>


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <color name="white">#FFFFFF</color>
    <color name="red">#FF0000</color>
    <color name="light_gray">#606060</color>
    <color name="black">#000000</color>
    <color name="orange">#F7B36C</color>
    <color name="brown">#700E03</color>
    <color name="dark_blue">#1D406A</color>
    <color name="transparent">#00000000</color>
    <color name="dim_alpha">#E0000000</color>
    <color name="transparent_half_alpha">#80000000</color>
    <color name="background_half_trans">#C0242424</color>

</resources>