text:
#pragma once

#include "TTag.h"

NS_FT_BEGIN

namespace serialization_detail {
    template<typename T>
    struct has_serialize {
        struct dummy { /* something */ };

        template<typename C, typename P>
        static auto test(P *p) -> decltype(std::declval<C>().serialize(*p), std::true_type());

        template<typename, typename>
        static std::false_type test(...);

        typedef decltype(test<T, dummy>(nullptr)) type;
        static const bool value = std::is_same<std::true_type, decltype(test<T, dummy>(nullptr))>::value;
    };
}

template<typename Archiver, typename T>
struct Serializer {
    static_assert(serialization_detail::has_serialize<T>::value,
                  "Doesn't implement serialize - either add serialize member function of provide Serializer specialization");

    static void serialize(Archiver &a, T &val) {
        val.serialize(a);
    }
};

class OutputSerializer {
    ttvfs::File *file;
public:
    static const bool is_output = true;
    static const bool is_input = false;

    OutputSerializer(ttvfs::File *file) : file(file) {

    }

    template<typename T, typename std::enable_if<serialization_detail::TagID<T>::value, int>::type = 0>
    void operator&(const T &value) {
        serialization_detail::TagID<T>::writeID(file);
        serialization_detail::TTag<T>::writeData(value, file);
    }

    template<typename T, typename std::enable_if<!serialization_detail::TagID<T>::value, int>::type = 0>
    void operator&(T &value) {
        Serializer<OutputSerializer, T>::serialize(*this, value);
    }

    template<typename T, typename std::enable_if<serialization_detail::TagID<T>::value, int>::type = 0>
    void serializePrimitiveArray(T *value, size_t length) {
        serialization_detail::TagID<T[]>::writeID(file);
        for (size_t i = 0; i < length; i++) {
            serialization_detail::TTag<T>::writeData(value[i], file);
        }
    }
};

class InputSerializer {
    ttvfs::File *file;
public:
    static const bool is_output = false;
    static const bool is_input = true;

    InputSerializer(ttvfs::File *file) : file(file) {

    }

    template<typename T, typename std::enable_if<serialization_detail::TagID<T>::value, int>::type = 0>
    void operator&(T &value) {
        serialization_detail::TagID<T>::readID(file);
        serialization_detail::TTag<T>::readData(value, file);
    }

    template<typename T, typename std::enable_if<!serialization_detail::TagID<T>::value, int>::type = 0>
    void operator&(T &value) {
        Serializer<InputSerializer, T>::serialize(*this, value);
    }

    template<typename T, typename std::enable_if<serialization_detail::TagID<T>::value, int>::type = 0>
    void serializePrimitiveArray(T *value, size_t length) {
        serialization_detail::TagID<T[]>::readID(file);
        for (size_t i = 0; i < length; i++) {
            serialization_detail::TTag<T>::readData(value[i], file);
        }
    }
};

NS_FT_END


text:
title: Overview
page_title: Mobile Support Overview | RadRotator for ASP.NET AJAX Documentation
description: Overview
slug: rotator/mobile-support/overview
tags: overview
published: True
position: 0
---

# Mobile Support Overview

This article explains the **responsive design capabilities RadRotator offers**. The control supports **responsive design since Q2 2014**.

Generally, responsive design means that the page and its content are able to adapt to different screen resolutions without deteriorating the user experience. This often includes changing the font size and having dimensions set in percent.

## Responsive design

**RadRotator** is a control that moves its content dynamically in order to display parts of it in a sequence. The size of the rotator and its items is usually set in pixels according to the instructions in the [How to configure RadRotator]({%slug rotator/getting-started/overview%}) help article so that the control can calculate how much items will be visible in its view port.

**RadRotator** supports setting its **Width** property in percentage as of the Q2 2014 release of UI for ASP.NET AJAX. This means that the control can adapt to the width of the current screen resolution. You can try the responsive capabilities of **RadRotator** with **Example 1**.

>caption **Example 1**: **RadRotator** with 100% width.

````ASP.NET
<telerik:RadRotator runat="server" ID="RadRotator1" RotatorType="Buttons" Width="100%" ItemWidth="200px" Height="50px">
	<ItemTemplate>
		RadRotatorItem <%# Container.DataItem %>
	</ItemTemplate>
</telerik:RadRotator>
````
````C#
protected void Page_Load(object sender, EventArgs e)
{
	if (!IsPostBack)
	{
		RadRotator1.DataSource = Enumerable.Range(1, 20);
		RadRotator1.DataBind();
	}
}
````
````VB
Protected Sub Page_Load(sender As Object, e As EventArgs)
	If Not IsPostBack Then
		RadRotator1.DataSource = Enumerable.Range(1, 20)
		RadRotator1.DataBind()
	End If
End Sub
````

>note When you set the width of **RadRotator** in percentage the number of items in its view port cannot be controlled, because the width will change dynamically, however the items' width is fixed. As a result the first and last item in the view port may be partially visible.

## Responsiveness of Carousel and CoverFlow rotators

If you have set the RotatorType property to **Carousel**, **CarouselButtons**, **CoverFlow** or **CoverFlowButtons**, changing the screen width will trigger the resizing of the rotator container, however, the position of the items inside will remain the same and part of them may be hidden. You can handle this scenario manually by attaching to an event that is fired when the width of the rotator changes and calling the Client-Side function **repaint()**. **Example 2** shows a possible approach to achieve this.

>caption **Example 2**: **RadRotator** is repainted on window resize so that its items are adjusted according to its size.

````ASP.NET
<script type="text/javascript">
	var rotator = null;
	function OnClientLoad(sender, args) {
		rotator = sender;
	}

	window.onresize = function () {
		rotator.repaint();
	}
</script>
<telerik:RadRotator runat="server" ID="RadRotator2" RotatorType="CarouselButtons" Width="100%" ItemWidth="200px" Height="450px"
	OnClientLoad="OnClientLoad" >
	<ItemTemplate>
		RadRotatorItem <%# Container.DataItem %>
	</ItemTemplate>
</telerik:RadRotator>
````

>note The **repaint()** functions redraws the entire rotator control. If you call it repeatedly you will most probably encounter performance issues. This is why it is suggested to invoke this function with an interval to achieve as smooth resizing as possible.

# See Also

 * [RadRotator - Elastic capabilities]({%slug rotator/mobile-support/elastic-capabilities%})

 * [RadRotator - How to configure RadRotator]({%slug rotator/getting-started/overview%})

 * [RadRotator - RadRotator types]({%slug rotator/functionality/radrotator-types%})

redpajama_set_name: RedPajamaGithub


text:
r_text_mining_simple is a collection of simple R script about the text mining.

## List

* [Lemmatization](lemmatization/code.R)
* Lemmatization with reverse(prevalent)

## Software that I used

* [R](https://www.r-project.org)

## Authors

* **Alessio Napolitano** - [alessionapolitano93](https://github.com/alessionapolitano93)

## License

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details


text:
#ifndef APR_ALLOCATOR_H
#define APR_ALLOCATOR_H

/**
 * @file apr_allocator.h
 * @brief APR Internal Memory Allocation
 */

#include "apr.h"
#include "apr_errno.h"
#define APR_WANT_MEMFUNC /**< For no good reason? */
#include "apr_want.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @defgroup apr_allocator Internal Memory Allocation
 * @ingroup APR
 * @{
 */

/** the allocator structure */
typedef struct apr_allocator_t apr_allocator_t;
/** the structure which holds information about the allocation */
typedef struct apr_memnode_t apr_memnode_t;

/** basic memory node structure */
struct apr_memnode_t {
    apr_memnode_t *next;            /**< next memnode */
    apr_memnode_t **ref;            /**< reference to self */
    apr_uint32_t   index;           /**< size */
    apr_uint32_t   free_index;      /**< how much free */
    char          *first_avail;     /**< pointer to first free memory */
    char          *endp;            /**< pointer to end of free memory */
};

/** The base size of a memory node - aligned.  */
#define APR_MEMNODE_T_SIZE APR_ALIGN_DEFAULT(sizeof(apr_memnode_t))

/** Symbolic constants */
#define APR_ALLOCATOR_MAX_FREE_UNLIMITED 0

/**
 * Create a new allocator
 * @param allocator The allocator we have just created.
 *
 */
APR_DECLARE(apr_status_t) apr_allocator_create(apr_allocator_t **allocator);

/**
 * Destroy an allocator
 * @param allocator The allocator to be destroyed
 * @remark Any memnodes not given back to the allocator prior to destroying
 *         will _not_ be free()d.
 */
APR_DECLARE(void) apr_allocator_destroy(apr_allocator_t *allocator);

/**
 * Allocate a block of mem from the allocator
 * @param allocator The allocator to allocate from
 * @param size The size of the mem to allocate (excluding the
 *        memnode structure)
 */
APR_DECLARE(apr_memnode_t *) apr_allocator_alloc(apr_allocator_t *allocator,
                                                 apr_size_t size);

/**
 * Free a block of mem, giving it back to the allocator
 * @param allocator The allocator to give the mem back to
 * @param memnode The memory node to return
 */
APR_DECLARE(void) apr_allocator_free(apr_allocator_t *allocator,
                                     apr_memnode_t *memnode);

#include "apr_pools.h"

/**
 * Set the owner of the allocator
 * @param allocator The allocator to set the owner for
 * @param pool The pool that is to own the allocator
 * @remark Typically pool is the highest level pool using the allocator
 */
/*
 * XXX: see if we can come up with something a bit better.  Currently
 * you can make a pool an owner, but if the pool doesn't use the allocator
 * the allocator will never be destroyed.
 */
APR_DECLARE(void) apr_allocator_owner_set(apr_allocator_t *allocator,
                                          apr_pool_t *pool);

/** @deprecated @see apr_allocator_owner_set */
APR_DECLARE(void) apr_allocator_set_owner(apr_allocator_t *allocator,
                                          apr_pool_t *pool);

/**
 * Get the current owner of the allocator
 * @param allocator The allocator to get the owner from
 */
APR_DECLARE(apr_pool_t *) apr_allocator_owner_get(apr_allocator_t *allocator);

/** @deprecated @see apr_allocator_owner_get */
APR_DECLARE(apr_pool_t *) apr_allocator_get_owner(
                                  apr_allocator_t *allocator);

/**
 * Set the current threshold at which the allocator should start
 * giving blocks back to the system.
 * @param allocator The allocator the set the threshold on
 * @param size The threshold.  0 == unlimited.
 */
APR_DECLARE(void) apr_allocator_max_free_set(apr_allocator_t *allocator,
                                             apr_size_t size);

/** @deprecated @see apr_allocator_max_free_set */
APR_DECLARE(void) apr_allocator_set_max_free(apr_allocator_t *allocator,
                                             apr_size_t size);

#include "apr_thread_mutex.h"

#if APR_HAS_THREADS
/**
 * Set a mutex for the allocator to use
 * @param allocator The allocator to set the mutex for
 * @param mutex The mutex
 */
APR_DECLARE(void) apr_allocator_mutex_set(apr_allocator_t *allocator,
                                          apr_thread_mutex_t *mutex);

/** @deprecated @see apr_allocator_mutex_set */
APR_DECLARE(void) apr_allocator_set_mutex(apr_allocator_t *allocator,
                                          apr_thread_mutex_t *mutex);

/**
 * Get the mutex currently set for the allocator
 * @param allocator The allocator
 */
APR_DECLARE(apr_thread_mutex_t *) apr_allocator_mutex_get(
                                      apr_allocator_t *allocator);

/** @deprecated @see apr_allocator_mutex_get */
APR_DECLARE(apr_thread_mutex_t *) apr_allocator_get_mutex(
                                      apr_allocator_t *allocator);

#endif /* APR_HAS_THREADS */

/** @} */

#ifdef __cplusplus
}
#endif

#endif /* !APR_ALLOCATOR_H */


text:
namespace OKHOSTING.Hosting.Net4.Domains.WhoIs
{
	/// <summary>
	/// String extension class
	/// </summary>
	public static class SubstringByCharExtension
	{
		/// <summary>
		/// Substrings the after char.
		/// </summary>
		/// <param name="value">The value.</param>
		/// <param name="match">The match.</param>
		/// <returns></returns>
		public static string SubstringAfterChar(this string value, string match)
		{
			var result = value;

			if (!string.IsNullOrWhiteSpace(value) && !string.IsNullOrWhiteSpace(match))
			{
				if (value.Contains(match))
				{
					result = value.Substring(value.IndexOf(match) + match.Length);
				}
			}

			return result;
		}

		/// <summary>
		/// Substrings the before char.
		/// </summary>
		/// <param name="value">The value.</param>
		/// <param name="match">The match.</param>
		/// <returns></returns>
		public static string SubstringBeforeChar(this string value, string match)
		{
			var result = value;

			if (!string.IsNullOrWhiteSpace(value) && !string.IsNullOrWhiteSpace(match))
			{
				if (value.Contains(match))
				{
					result = value.Substring(0, value.IndexOf(match));
				}
			}

			return result;
		}
	}
}


text:
System.register(["events/Events", "extend/Extend"], function (_export) {
    "use strict";

    var Events, Extend, Catamaran;

    var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

    function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

    return {
        setters: [function (_eventsEvents) {
            Events = _eventsEvents["default"];
        }, function (_extendExtend) {
            Extend = _extendExtend["default"];
        }],
        execute: function () {
            Catamaran = (function () {
                function Catamaran() {
                    _classCallCheck(this, Catamaran);
                }

                _createClass(Catamaran, [{
                    key: "extend",
                    value: function extend(ns, ns_string) {
                        var parts = ns_string.split(".");
                        parent = ns;
                        var pl;
                        var i;
                        if (parts[0] == "CATAMARAN") {
                            parts = parts.slice(1);
                        }
                        pl = parts.length;
                        for (i = 0; i < pl; i++) {
                            if (typeof parent[parts[i]] == "undefined") {
                                parent[parts[i]] = {};
                            }
                            parent = parent[parts[i]];
                        }
                        return parent;
                    }
                }], [{
                    key: "isInteger",
                    value: function isInteger(x) {
                        return (x ^ 0) === x;
                    }
                }, {
                    key: "findCenter",
                    value: function findCenter(selector) {
                        return document.querySelector(selector).offsetWidth / 2;
                    }
                }, {
                    key: "getRandomArr",
                    value: function getRandomArr(arr) {
                        return Math.floor(Math.random() * arr.length);
                    }
                }, {
                    key: "isMobile",
                    value: function isMobile() {
                        switch (true) {
                            case /Android/i.test(navigator.userAgent):
                                _catamaran.Utils._mobileOS = "android";
                                return true;
                            case /webOS/i.test(navigator.userAgent):
                                _catamaran.Utils._mobileOS = "webos";
                                return true;
                            case /iPhone/i.test(navigator.userAgent):
                                _catamaran.Utils._mobileOS = "iphone";
                                return true;
                            case /iPad/i.test(navigator.userAgent):
                                _catamaran.Utils._mobileOS = "ipad";
                                return true;
                            case /iPod/i.test(navigator.userAgent):
                                _catamaran.Utils._mobileOS = "ipod";
                                return true;
                            case /BlackBerry/i.test(navigator.userAgent):
                                _catamaran.Utils._mobileOS = "blackberry";
                                return true;
                            case /Windows Phone/i.test(navigator.userAgent):
                                _catamaran.Utils._mobileOS = "windows";
                                return true;
                            default:
                                return false;
                        }
                    }
                }]);

                return Catamaran;
            })();
        }
    };
});


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

using SampSharp.GameMode.Tools;
using SampSharp.GameMode.World;

namespace SampSharp.GameMode.Controllers
{
    /// <summary>
    ///     A controller processing all pickup actions.
    /// </summary>
    public class PickupController : Disposable, IEventListener, ITypeProvider
    {
        /// <summary>
        ///     Registers the events this TextDrawController wants to listen to.
        /// </summary>
        /// <param name="gameMode">The running GameMode.</param>
        public void RegisterEvents(BaseMode gameMode)
        {
            gameMode.PlayerPickUpPickup += (sender, args) =>
            {
                var obj = sender as Pickup;

                if (obj != null)
                    obj.OnPickUp(args);
            };
        }

        /// <summary>
        ///     Registers types this PickupController requires the system to use.
        /// </summary>
        public void RegisterTypes()
        {
            Pickup.Register<Pickup>();
        }

        /// <summary>
        ///     Performs tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        /// <param name="disposing">Whether managed resources should be disposed.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                foreach (Pickup pickup in Pickup.All)
                {
                    pickup.Dispose();
                }
            }
        }
    }
}


text:
package org.flywaydb.core.extensibility;

import org.flywaydb.core.api.configuration.Configuration;
import org.flywaydb.core.internal.util.Pair;

import java.util.List;

public interface ResourceTypeProvider extends Plugin {
    List<Pair<String, ResourceType>> getPrefixTypePairs(Configuration configuration);
}


text:
namespace visionaray
{
namespace gl
{

void buffer::destroy()
{
    glDeleteBuffers(1, &name_);
}

void framebuffer::destroy()
{
    glDeleteFramebuffers(1, &name_);
}

void renderbuffer::destroy()
{
    glDeleteRenderbuffers(1, &name_);
}

void texture::destroy()
{
    glDeleteTextures(1, &name_);
}

void vertex_array::destroy()
{
    glDeleteVertexArrays(1, &name_);
}

GLuint create_buffer()
{
    GLuint buf = 0;
    glGenBuffers(1, &buf);
    return buf;
}

GLuint create_framebuffer()
{
    GLuint buf = 0;
    glGenFramebuffers(1, &buf);
    return buf;
}

GLuint create_renderbuffer()
{
    GLuint buf = 0;
    glGenRenderbuffers(1, &buf);
    return buf;
}

GLuint create_texture()
{
    GLuint buf = 0;
    glGenTextures(1, &buf);
    return buf;
}

GLuint create_vertex_array()
{
    GLuint buf = 0;
    glGenVertexArrays(1, &buf);
    return buf;
}

} // gl
} // visionaray


text:
package com.awizen.gangehi.rest;

import java.util.Collection;

import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import com.awizen.gangehi.dtos.WorkflowSummaryDto;
import com.awizen.gangehi.service.ScheduleService;

@Path("/schedule")
@RequestScoped
public class ScheduleRESTService {

	@Inject
	private ScheduleService scheduleService;

	@GET
	@Produces(MediaType.APPLICATION_JSON)
	public Collection<WorkflowSummaryDto> listForLogedInUser() {
		String user = "userA";
		int first = 1;
		int pageSize = 5;
		return scheduleService.getTasks(first , pageSize , user);
	}

	@GET
	@Path("/{user}")
	@Produces(MediaType.APPLICATION_JSON)
	public Collection<WorkflowSummaryDto> lookupMemberById(@PathParam("user") String user) {
		int first = 1;
		int pageSize = 5;
		return scheduleService.getTasks(first, pageSize, user);
	}

}


text:
package org.apache.xbean.spring.context.v2;

import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate;
import org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader;
import org.springframework.beans.factory.xml.XmlReaderContext;
import org.springframework.util.xml.DomUtils;
import org.w3c.dom.Element;

public class XBeanBeanDefinitionDocumentReader extends DefaultBeanDefinitionDocumentReader {

    protected BeanDefinitionParserDelegate createHelper(XmlReaderContext readerContext, Element root) {
        BeanDefinitionParserDelegate delegate = XBeanV2Helper.createParser(readerContext);
        delegate.initDefaults(root);
        return delegate;
    }

    protected void parseBeanDefinitions(Element root, BeanDefinitionParserDelegate delegate) {
        String namespaceUri = root.getNamespaceURI();
        if (!DomUtils.nodeNameEquals(root, "beans") &&
            !delegate.isDefaultNamespace(namespaceUri)) {
            delegate.parseCustomElement(root, false);
        } else {
            super.parseBeanDefinitions(root, delegate);
        }
    }

}


text:
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import os

from datetime import datetime
from packaging import version

import tensorflow as tf
from tensorflow import keras

import numpy as np

print("TensorFlow version: ", tf.__version__)
assert (
    version.parse(tf.__version__).release[0] >= 2
), "This script requires TensorFlow 2.0 or above."

data_size = 1000
# 80% of the data is for training.
train_pct = 0.8
lr = 0.2
train_epochs = 100

train_size = int(data_size * train_pct)

# Create some input data between -1 and 1 and randomize it.
x = np.linspace(-1, 1, data_size)
np.random.shuffle(x)

# Generate the output data.
# y = 0.5x + 2 + noise
y = 0.5 * x + 2 + np.random.normal(0, 0.05, (data_size,))

# Split into test and train pairs.
x_train, y_train = x[:train_size], y[:train_size]
x_test, y_test = x[train_size:], y[train_size:]

logdir = os.getenv("LOGDIR") or "logs/scalars/" + datetime.now().strftime(
    "%Y%m%d-%H%M%S"
)
tensorboard_callback = keras.callbacks.TensorBoard(log_dir=logdir)

model = keras.models.Sequential(
    [keras.layers.Dense(16, input_dim=1), keras.layers.Dense(1),]
)

model.compile(
    loss='mse',  # keras.losses.mean_squared_error
    optimizer=keras.optimizers.SGD(lr=lr),
)

print("Training ... With default parameters, this takes less than 10 seconds.")
training_history = model.fit(
    x_train,  # input
    y_train,  # output
    batch_size=train_size,
    verbose=0,  # Suppress chatty output; use Tensorboard instead
    epochs=train_epochs,
    validation_data=(x_test, y_test),
    callbacks=[tensorboard_callback],
)

print("Average test loss: ", np.average(training_history.history['loss']))


text:
package org.apache.hadoop.hive.ql.exec;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Writable;

/**
 * RecordReader.
 *
 */
public interface RecordReader {

  void initialize(InputStream in, Configuration conf, Properties tbl) throws IOException;

  Writable createRow() throws IOException;

  /**
   * Returns the number of bytes that we consumed.
   * -1 means end of stream.
   */
  int next(Writable row) throws IOException;

  void close() throws IOException;
}


text:
<!DOCTYPE html>

<link href="resources/flexbox.css" rel="stylesheet">


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <!--项目声明-->
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.app</groupId>
    <artifactId>App</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>
    <name>AppExample</name>
    <description>SpringBoot 脚手架</description>

    <modules>
        <!--<module>OauthServer</module>-->
    </modules>

    <!--Maven相关配置属性-->
    <properties>
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${java.version}</maven.compiler.target>
        <spring-boot.version>1.4.2.RELEASE</spring-boot.version>
        <spring-boot-actuator.version>1.5.3.RELEASE</spring-boot-actuator.version>
        <spring-cloud.version>1.1.7.RELEASE</spring-cloud.version>
        <junit.version>4.12</junit.version>
        <hamcrest.version>1.3</hamcrest.version>
        <gson.version>2.7</gson.version>
        <dom4j.version>1.6.1</dom4j.version>
        <maven-surefire-plugin.version>2.18.1</maven-surefire-plugin.version>
        <spring-boot-maven-plugin.version>1.3.6.RELEASE</spring-boot-maven-plugin.version>
        <swagger.jersey.version>1.5.12</swagger.jersey.version>
        <swagger.version>2.6.1</swagger.version>
        <fastjson.version>1.2.22</fastjson.version>
        <javaee-api.version>7.0</javaee-api.version>
        <jest.version>2.0.1-SNAPSHOT</jest.version>
        <jolokia.version>1.3.5</jolokia.version>
        <requests.version>1.0.0</requests.version>
    </properties>

    <!--依赖管理-->
    <dependencyManagement>
        <dependencies>
            <!--SpringBoot-starter-->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter</artifactId>
                <version>${spring-boot.version}</version>
            </dependency>
            <!--web支持-->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
                <version>${spring-boot.version}</version>
            </dependency>
            <!--web容器-->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-jetty</artifactId>
                <version>${spring-boot.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-eureka</artifactId>
                <version>${spring-cloud.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-eureka-server</artifactId>
                <version>${spring-cloud.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-ribbon</artifactId>
                <version>${spring-cloud.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-zuul</artifactId>
                <version>${spring-cloud.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-hystrix</artifactId>
                <version>${spring-cloud.version}</version>
            </dependency>
            <dependency>
                <groupId>org.jolokia</groupId>
                <artifactId>jolokia-core</artifactId>
                <version>${jolokia.version}</version>
            </dependency>
            <!--JavaEE7-->
            <dependency>
                <groupId>javax</groupId>
                <artifactId>javaee-api</artifactId>
                <version>${javaee-api.version}</version>
            </dependency>
            <!--Rest实现-->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-jersey</artifactId>
                <version>${spring-boot.version}</version>
            </dependency>
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger2</artifactId>
                <version>${swagger.version}</version>
            </dependency>
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger-ui</artifactId>
                <version>${swagger.version}</version>
            </dependency>
            <dependency>
                <groupId>io.swagger</groupId>
                <artifactId>swagger-jersey2-jaxrs</artifactId>
                <version>${swagger.jersey.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>javax.ws.rs</groupId>
                        <artifactId>jsr311-api</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <!--ES Http请求client-->
            <dependency>
                <groupId>io.searchbox</groupId>
                <artifactId>jest</artifactId>
                <version>${jest.version}</version>
            </dependency>
            <!--log日志-->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-logging</artifactId>
                <version>${spring-boot.version}</version>
            </dependency>
            <!--MongoDB-->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-data-mongodb</artifactId>
                <version>${spring-boot.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-actuator</artifactId>
                <version>${spring-boot.version}</version>
            </dependency>
            <!-- Json字符串对象转换-->
            <dependency>
                <groupId>com.google.code.gson</groupId>
                <artifactId>gson</artifactId>
                <version>${gson.version}</version>
            </dependency>
            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>fastjson</artifactId>
                <version>${fastjson.version}</version>
            </dependency>
            <!--Test-->
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>${junit.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.hamcrest</groupId>
                <artifactId>hamcrest-library</artifactId>
                <version>${hamcrest.version}</version>
                <scope>test</scope>
            </dependency>
            <!--spring test-->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <version>${spring-boot.version}</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <!--项目依赖-->
    <dependencies>
        <!--web支持-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <!--web容器-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jetty</artifactId>
        </dependency>
        <!--Jersey-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jersey</artifactId>
        </dependency>
        <!--JavaEE7-->
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
        </dependency>
        <!--日志-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-logging</artifactId>
        </dependency>
        <!--HTTP Client-->
        <dependency>
            <groupId>cn.networklab</groupId>
            <artifactId>requests</artifactId>
            <version>${requests.version}</version>
        </dependency>
        <!-- Json字符串对象转换-->
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>${gson.version}</version>
        </dependency>
        <!--Test-->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-library</artifactId>
            <version>${hamcrest.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>${spring-boot-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven-surefire-plugin.version}</version>
                <configuration>
                    <skipTests>true</skipTests>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>


text:
/*依赖 util.js,requestAnimationFrame.js,observer.js */
;eval(function(d,f,a,c,b,e){b=function(a){return a.toString(f)};if(!"".replace(/^/,String)){for(;a--;)e[b(a)]=c[a]||b(a);c=[function(a){return e[a]}];b=function(){return"\\w+"};a=1}for(;a--;)c[a]&&(d=d.replace(new RegExp("\\b"+b(a)+"\\b","g"),c[a]));return d}("0.2=(1(){7 0.2||0.3||0.4||0.c||0.6||1(a,b){0.8(a,9/5)}})();",13,13,"window function requestAnimationFrame webkitRequestAnimationFrame mozRequestAnimationFrame 60 msRequestAnimationFrame return setTimeout 1e3   oRequestAnimationFrame".split(" "),0,{}));

var IR = IR || {};
(function (IR) {
    var tools = IR.Util,
        handler = IR.Observer;

    function Timer() {

        this.interval = undefined;
        this._handler = new handler(this);
        /*
         // 单例的实现
         if (tools.isUndefined(Timer.instance)) {
         return getInstance();
         }
         else {
         return Timer.instance;
         }
         function getInstance() {
         Timer.instance = that;
         return that;
         }

         */
    }
    Timer.prototype = {
        addHandler: function (func, caller) {
            if (!tools.isUndefined(caller)) {
                func = tools.bind(func, caller);
            }
            this._handler.attach("timer", func);
        },
        start: function () {
            var that = this;
            //var call2=arguments.callee;//不能使用
           ;(function () {
                that.interval = window.requestAnimationFrame(arguments.callee);
                that._handler.notifyByKey("timer");
            })();
        },
        stop: function () {
            var that = this;
            window.cancelAnimationFrame(that.interval);
        }

    };

    IR.Timer = Timer;
})(IR)


text:
module Liquid
  class Raw < Block
    def parse(tokens)
      @nodelist ||= []
      @nodelist.clear

      while token = tokens.shift
        if token =~ FullToken
          if block_delimiter == $1
            end_tag
            return
          end
        end
        @nodelist << token if not token.empty?
      end
    end
  end

  Template.register_tag('raw', Raw)
end


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
<title>ReflectionRewritePolicy xref</title>
<link type="text/css" rel="stylesheet" href="../../../../stylesheet.css" />

1
17  package org.apache.log4j.rewrite;
18
19  import java.beans.Introspector;
20  import java.beans.PropertyDescriptor;
21  import java.util.HashMap;
22  import java.util.Map;
23
24  import org.apache.log4j.Logger;
25  import org.apache.log4j.helpers.LogLog;
26  import org.apache.log4j.spi.LoggingEvent;
27
28  /**
29   * This policy rewrites events by evaluating any
30   * JavaBean properties on the message object and adding them
31   * to the event properties.  If the message object has a
32   * message property, the value of that property will be
33   * used as the message for the rewritten event and will
34   * not be added to the event properties.  Values from the
35   * JavaBean properties will replace any existing property
36   * with the same name.
37   *
38   * The combination of the RewriteAppender and this policy
39   * performs the same actions as the ReflectionFilter from log4j 1.3.
40   */
41  public class ReflectionRewritePolicy implements RewritePolicy {
42      /**
43       * {@inheritDoc}
44       */
45      public LoggingEvent rewrite(final LoggingEvent source) {
46          Object msg = source.getMessage();
47          if (!(msg instanceof String)) {
48              Object newMsg = msg;
49              Map rewriteProps = new HashMap(source.getProperties());
50
51              try {
52                  PropertyDescriptor[] props = Introspector.getBeanInfo(
53                          msg.getClass(), Object.class).getPropertyDescriptors();
54                  if (props.length > 0) {
55                      for (int i=0;i<props.length;i++) {
56                          try {
57                              Object propertyValue =
58                                  props[i].getReadMethod().invoke(msg,
59                                          (Object[]) null);
60                              if ("message".equalsIgnoreCase(props[i].getName())) {
61                                  newMsg = propertyValue;
62                              } else {
63                                  rewriteProps.put(props[i].getName(), propertyValue);
64                              }
65                          } catch (Exception e) {
66                              LogLog.warn("Unable to evaluate property " +
67                                      props[i].getName(), e);
68                          }
69                      }
70                      return new LoggingEvent(
71                              source.getFQNOfLoggerClass(),
72                              source.getLogger() != null ? source.getLogger(): Logger.getLogger(source.getLoggerName()),
73                              source.getTimeStamp(),
74                              source.getLevel(),
75                              newMsg,
76                              source.getThreadName(),
77                              source.getThrowableInformation(),
78                              source.getNDC(),
79                              source.getLocationInformation(),
80                              rewriteProps);
81                  }
82              } catch (Exception e) {
83                  LogLog.warn("Unable to get property descriptors", e);
84              }
85
86          }
87          return source;
88      }
89  }

This page was automatically generated by Maven


text:
How to Unity3d : start with javascript scripting only
======

![alt text](screenshots/160523003222084.png)

This tutorial is for those who choose to program rather than using the Unity3d IDE.

It covers multiple stages, from project creation to basic scripting.

# Step 1 : Prepare Environnement

You'll need Unity3d. Get the free version here :

[https://unity3d.com/get-unity/](https://unity3d.com/get-unity/)
https://unity3d.com/get-unity/

![alt text](screenshots/160523003222126.jpg)

# Step 2 : Create Project

So create a new project.

![alt text](screenshots/160523003222402.jpg)

Choose a name for it.

![alt text](screenshots/160523003222637.jpg)

# Step 3 : Create Main Scene and Game Object

Unity3d needs at least one scene and a game object, to attach scripts on. And because it's binary file, this can only be made only by using Unity3d SDK.

At this point, unity3d is launched with an empty scene.

![alt text](screenshots/160523003222899.jpg)

So create an empty game object.

![alt text](screenshots/160523003223208.jpg)

# Step 4 : Link Script to Scene

JavaScript file needs to be attached to a game object.

So select the new game object.

![alt text](screenshots/160523003223476.jpg)

Add a new component to it by clicking on component menu then add…

![alt text](screenshots/160523003223730.jpg)

At this point, Inspector view displays a new component form. Choose new script.

![alt text](screenshots/160523003224092.jpg)

Then type a name and choose a scripting language (Javascript here).

![alt text](screenshots/160523003224372.jpg)

Then click on create.

![alt text](screenshots/160523003224620.jpg)

Here is a new script ! When script is selected, the Inspector view display script content (source code).

![alt text](screenshots/160523003224858.jpg)

# Step 5 : Start Scripting

Right click on the script file in the Asset view. Choose Open.

![alt text](screenshots/160523003225214.jpg)

Then the MonoDevelop editor starts…

![alt text](screenshots/160523003225510.jpg)

By default, a script has two function : start() and update(). Start function starts with the object, and so with the scene.

![alt text](screenshots/160523003225724.jpg)

Add a little code to your script.

MainScript.js

```
#pragma strict

function Start () {

    // SAY HELLO
    print( "Hello, world" );

    // GET SCENE OBJECTS
    var cam = GameObject.Find("Main Camera");
    var mainObject = GameObject.Find("GameObject");

    // CENTER CAMERA ON OBJECT
    cam.transform.LookAt(mainObject.transform);

    // PAUSE
    yield WaitForSeconds (1);

    // ADD OBJECTS TO THE SCENE

    var sphere : GameObject = GameObject.CreatePrimitive(PrimitiveType.Sphere);
    sphere.transform.position = Vector3(0, 1.5, 0);

    var sphere2 : GameObject = GameObject.CreatePrimitive(PrimitiveType.Sphere);
    sphere2.transform.position = Vector3(2, 1, 0);

    var sphere3 : GameObject = GameObject.CreatePrimitive(PrimitiveType.Sphere);
    sphere3.transform.position = Vector3(0, 0, 0);

}

function Update () {

}
```

Save your Javascript file.

![alt text](screenshots/160523003225976.jpg)

Save your Script

# Demo

Open your Unity3d SDK and click on Play button.

![alt text](screenshots/160523003226210.jpg)

And wait for the demo to start…

Then wait 1 seconde.

![alt text](screenshots/160523003226497.jpg)

The demo add three new spheres to the scene.

![alt text](screenshots/160523003226755.jpg)

Then the demo print "Hello world" to the console.

![alt text](screenshots/160523003227007.jpg)

(and don't forget to save your scene for later!)

![alt text](screenshots/160523003227261.jpg)

# Conclusion

From there, you can start to script an entire project, without even open Unity3d (only for building). It's an easier way for building game were programming is a core aspect of the project. Like with procedural generation level or reusable components. Or for those who are not familiar with a 3d software like Unity3d IDE.

Tips : for a full scripting, remove default camera and light from the scene, and add them by scripting.

# Sources

[https://github.com/DamienFremont/blog/tree/master/20150624-unity3d-start_scripting](https://github.com/DamienFremont/blog/tree/master/20150624-unity3d-start_scripting)
https://github.com/DamienFremont/blog/tree/master/20150624-unity3d-start_scripting

# References

[http://docs.unity3d.com/Manual/CreatingAndUsingScripts.html](http://docs.unity3d.com/Manual/CreatingAndUsingScripts.html)
http://docs.unity3d.com/Manual/CreatingAndUsingScripts.html

[https://unity3d.com/learn/tutorials/modules/beginner/scripting/classes](https://unity3d.com/learn/tutorials/modules/beginner/scripting/classes)
https://unity3d.com/learn/tutorials/modules/beginner/scripting/classes

## Origin
[https://damienfremont.com/2015/06/24/how-to-unity3d-start-with-javascript-scripting-only/](https://damienfremont.com/2015/06/24/how-to-unity3d-start-with-javascript-scripting-only/)


text:
//
//  WWZSegementView.h
//  Pods
//
//  Created by apple on 2017/5/4.
//
//

#import <UIKit/UIKit.h>

typedef NS_ENUM(NSUInteger, WWZSegementType) {
    WWZSegementTypeDefault,
    WWZSegementTypeBottomLine,
    WWZSegementTypeCustom,
};

@class WWZSegementView;

@protocol WWZSegementViewDelegate <NSObject>

- (void)segementView:(WWZSegementView *)segementView clickButtonAtIndex:(int)index;

@end

@interface WWZSegementView : UIScrollView

@property (nonatomic, weak) id<WWZSegementViewDelegate> segementDelegate;

/**
 *  设置类型
 */
@property (nonatomic, assign) WWZSegementType segementType;

/**
 *  单个cell宽,默认平分self.width
 */
@property (nonatomic, assign) CGFloat cellWidth;

/**
 *  底部线高,default is 2
 */
@property (nonatomic, assign) CGFloat lineHeight;

/**
 *  底部线与文字的间隙,default is 5
 */
@property (nonatomic, assign) CGFloat lineYSpace;

- (instancetype)initWithFrame:(CGRect)frame titles:(NSArray *)titles;

/**
 *  选中按钮
 */
- (void)selectCellAtIndex:(int)index;

/**
 *  设置文字属性
 */
- (void)setTitleFont:(UIFont *)font nColor:(UIColor *)nColor sColor:(UIColor *)sColor;

/**
 *  设置背景图片,仅当WWZSegementTypeCustom时可用
 */
- (void)setNBImage:(UIImage *)nBImage sBImage:(UIImage *)sBImage;
@end


text:
// Effect.cs
// Copyright (c) Nikhil Kothari, 2008. All Rights Reserved.
// http://www.nikhilk.net
//
// Silverlight.FX is an application framework for building RIAs with Silverlight.
// This project is licensed under the BSD license. See the accompanying License.txt
// file for more information.
// For updated project information please visit http://projects.nikhilk.net/SilverlightFX.
//

using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Reflection;
using System.Windows;
using System.Windows.Media.Glitz;

namespace System.Windows.Media.Glitz {

    /// <summary>
    /// Represents an animation that can be associated with an element.
    /// </summary>
    public abstract class AnimationEffect : FrameworkElement, IAttachedObject, IProceduralAnimationFactory {

        private FrameworkElement _associatedObject;
        private FrameworkElement _target;
        private string _targetName;
        private TimeSpan _duration;
        private bool _autoReverse;
        private bool _reversible;
        private bool _reversed;
        private bool _useDefaultInterpolation;
        private TweenInterpolation _interpolation;

        private ProceduralAnimation _animation;
        private AnimationEffectDirection _direction;

        /// <summary>
        /// Initializes an AnimationEffect instance.
        /// </summary>
        protected AnimationEffect() {
            _duration = TimeSpan.FromMilliseconds(250);
            _reversible = true;
            _useDefaultInterpolation = true;
        }

        /// <summary>
        /// Gets the object that this Effect is associated with.
        /// </summary>
        protected FrameworkElement AssociatedObject {
            get {
                return _associatedObject;
            }
        }

        /// <summary>
        /// Whether to automatically play the reverse effect upon completing
        /// the forward effect in response to a single event.
        /// </summary>
        public bool AutoReverse {
            get {
                return _autoReverse;
            }
            set {
                _autoReverse = value;
            }
        }

        /// <summary>
        /// Gets the direction that the effect is currently playing while it is
        /// active or has just completed.
        /// </summary>
        public AnimationEffectDirection Direction {
            get {
                return _direction;
            }
        }

        /// <summary>
        /// Gets or sets the duration over which the effect is played.
        /// </summary>
        [TypeConverter(typeof(TimeSpanTypeConverter))]
        public TimeSpan Duration {
            get {
                return _duration;
            }
            set {
                _duration = value;
            }
        }

        /// <summary>
        /// Gets or sets how the animation progress is interpolated over time.
        /// The default is to smoothly interpolate from start to finish, which
        /// equates to basic easing in and easing out.
        /// </summary>
        public TweenInterpolation Interpolation {
            get {
                return _interpolation;
            }
            set {
                _interpolation = value;
                _useDefaultInterpolation = false;
            }
        }

        /// <summary>
        /// Gets whether the effect is currently active, i.e. the associated animation
        /// is currently playing.
        /// </summary>
        public bool IsActive {
            get {
                return (_animation != null) && _animation.IsPlaying;
            }
        }

        /// <summary>
        /// Gets or sets whether the effect is logically reversed, i.e. it plays the
        /// reverse effect on being triggered to play in the forward direction and vice versa.
        /// </summary>
        public bool Reversed {
            get {
                return _reversed;
            }
            set {
                _reversed = value;
            }
        }

        /// <summary>
        /// Gets or sets whether the effect is allowed to play in reverse direction.
        /// If this is set to false, the effect only plays in forward direction, and uses
        /// the same animation when triggered to play in reverse direction.
        /// </summary>
        public bool Reversible {
            get {
                return _reversible;
            }
            set {
                _reversible = value;
            }
        }

        /// <summary>
        /// The object on which the effect is applied. By default
        /// this is the object that the effect is associated with.
        /// </summary>
        public FrameworkElement Target {
            get {
                return _target;
            }
            set {
                _target = value;
            }
        }

        /// <summary>
        /// The name of the object on which the effect is applied. By default
        /// this is the object that the effect is associated with
        /// </summary>
        public string TargetName {
            get {
                return _targetName;
            }
            set {
                _targetName = value;
            }
        }

        /// <summary>
        /// Indicates that an effect has been completed. This event is only raised
        /// when the effect completes on its own, rather than implicitly completed
        /// as a result of restarting the effect.
        /// </summary>
        public event EventHandler Completed;

        /// <summary>
        /// Gets the effective interpolation to use for animations created by the
        /// effect.
        /// </summary>
        /// <returns>The effective interpolation; null if there is no specific interpolation.</returns>
        protected TweenInterpolation GetEffectiveInterpolation() {
            if (_useDefaultInterpolation) {
                return EasingInterpolation.Default;
            }

            if ((_interpolation != null) && (_interpolation.IsLinearInterpolation == false)) {
                return _interpolation;
            }

            return null;
        }

        /// <summary>
        /// Gets the target of the effect. This resolves the TargetName
        /// property value into an actual object if one has been specified.
        /// </summary>
        /// <returns>The target of the effect.</returns>
        protected FrameworkElement GetTarget() {
            if (_target != null) {
                return _target;
            }

            if (String.IsNullOrEmpty(_targetName)) {
                return AssociatedObject;
            }

            FrameworkElement element = AssociatedObject.FindName(_targetName) as FrameworkElement;
            if (element == null) {
                throw new InvalidOperationException("The specified target '" + _targetName + "' could not be found.");
            }

            return element;
        }

        /// <internalonly />
        protected virtual void OnAttach() {
        }

        /// <internalonly />
        protected virtual void OnDetach() {
        }

        /// <summary>
        /// Creates the animation representing the effect.
        /// </summary>
        /// <param name="direction">The direction of the animation.</param>
        /// <returns>The animation to be played to play the effect.</returns>
        protected internal abstract ProceduralAnimation CreateEffectAnimation(AnimationEffectDirection direction);

        private void OnAnimationStopped(object sender, EventArgs e) {
            OnCompleted();
        }

        /// <summary>
        /// Indicates that the effect has completed playing.
        /// </summary>
        protected virtual void OnCompleted() {
            if (Completed != null) {
                Completed(this, EventArgs.Empty);
            }
        }

        /// <summary>
        /// Indicates that the effect is about to be played.
        /// </summary>
        protected virtual void OnStarting() {
        }

        /// <summary>
        /// Indicates that the effect should start playing.
        /// </summary>
        /// <param name="direction">Indicates whether to play the direction in forward direction or reverse direction.</param>
        public void PlayEffect(AnimationEffectDirection direction) {
            if (_animation != null) {
                _animation.Stopped -= OnAnimationStopped;
                if (_animation.IsPlaying) {
                    _animation.Stop(ProceduralAnimationStopState.Complete);
                }
                _animation = null;
            }

            if ((direction == AnimationEffectDirection.Reverse) && (AutoReverse || (Reversible == false))) {
                direction = AnimationEffectDirection.Forward;
            }
            if (_reversed) {
                direction = (direction == AnimationEffectDirection.Forward) ? AnimationEffectDirection.Reverse :
                                                                              AnimationEffectDirection.Forward;
            }

            _animation = CreateEffectAnimation(direction);
            if (_animation != null) {
                _direction = direction;
                _animation.Stopped += OnAnimationStopped;

                OnStarting();
                _animation.Play(AssociatedObject);
            }
        }

        /// <summary>
        /// Indicates that the effect should complete itself now and stop.
        /// </summary>
        public void StopEffect() {
            if ((_animation != null) && _animation.IsPlaying) {
                _animation.Stop(ProceduralAnimationStopState.Complete);
            }
        }

        #region IAttachedObject Members
        DependencyObject IAttachedObject.AssociatedObject {
            get {
                return _associatedObject;
            }
        }

        void IAttachedObject.Attach(DependencyObject associatedObject) {
            _associatedObject = (FrameworkElement)associatedObject;
            OnAttach();
        }

        void IAttachedObject.Detach() {
            OnDetach();
            _associatedObject = null;
        }
        #endregion

        #region Implementation of IProceduralAnimationFactory
        ProceduralAnimation IProceduralAnimationFactory.CreateAnimation() {
            return CreateEffectAnimation(AnimationEffectDirection.Forward);
        }
        #endregion
    }
}


text:
using System.Collections.Generic;

namespace MyCouch.Querying
{
    public class IndexParameters : IIndexParameters
    {
        public string DesignDocument { get; set; }
        public IndexType? Type { get; set; }
        public string Name { get; set; }
        public IList<SortableField> Fields { get; set; }

        public IndexParameters()
        {
            Fields = new List<SortableField>();
        }
    }
}


text:
using System;
using HealthGraphNet.Models;
using System.Threading.Tasks;

namespace HealthGraphNet
{
    public interface IBackgroundActivitiesEndpoint
    {
        //Get Background Activities Feed
        Task<FeedModel<BackgroundActivitiesFeedItemModel>> GetFeedPage(int? pageIndex = null, int? pageSize = null, DateTime? noEarlierThan = null, DateTime? noLaterThan = null, DateTime? modifiedNoEarlierThan = null, DateTime? modifiedNoLaterThan = null);
        //Get Background Activity (Detailed)
        Task<BackgroundActivitiesPastModel> GetActivity(string uri);
        //Update Background Activity (Detailed)
        Task<BackgroundActivitiesPastModel> UpdateActivity(BackgroundActivitiesPastModel activityToUpdate);
        //Create Background Activity
        Task<string> CreateActivity(BackgroundActivitiesNewModel activityToCreate);
        //Delete Background Activity
        Task DeleteActivity(string uri);
    }
}


text:
namespace chromeos {

class MockFlimflamProfileClient : public FlimflamProfileClient {
 public:
  MockFlimflamProfileClient();
  virtual ~MockFlimflamProfileClient();

  MOCK_METHOD2(SetPropertyChangedHandler,
               void(const dbus::ObjectPath& profile_path,
                    const PropertyChangedHandler& handler));
  MOCK_METHOD1(ResetPropertyChangedHandler,
               void(const dbus::ObjectPath& profile_path));
  MOCK_METHOD2(GetProperties, void(const dbus::ObjectPath& profile_path,
                                   const DictionaryValueCallback& callback));
  MOCK_METHOD3(GetEntry, void(const dbus::ObjectPath& profile_path,
                              const std::string& entry_path,
                              const DictionaryValueCallback& callback));
  MOCK_METHOD3(DeleteEntry, void(const dbus::ObjectPath& profile_path,
                                 const std::string& entry_path,
                                 const VoidCallback& callback));
};

}  // namespace chromeos

#endif  // CHROMEOS_DBUS_MOCK_FLIMFLAM_PROFILE_CLIENT_H_


text:
define(function (require, exports, module) {
    "use strict";

    var CodeMirror = require("thirdparty/CodeMirror/lib/codemirror"),
        TokenUtils = require("utils/TokenUtils");

    // Constants
    var TAG_NAME = "tagName",
        CLOSING_TAG = "closingTag",
        ATTR_NAME = "attr.name",
        ATTR_VALUE = "attr.value";

    // Regular expression for token types with "tag" prefixed
    var tagPrefixedRegExp = /^tag/;

   /**
     * @private
     * Sometimes as attr values are getting typed, if the quotes aren't balanced yet
     * some extra 'non attribute value' text gets included in the token. This attempts
     * to assure the attribute value we grab is always good
     * @param {editor:{CodeMirror}, pos:{ch:{string}, line:{number}}, token:{object}} context
     * @return { val:{string}, offset:{number}}
     */
    function _extractAttrVal(ctx) {
        var attrValue = ctx.token.string,
            startChar = attrValue.charAt(0),
            endChar = attrValue.charAt(attrValue.length - 1),
            offset = TokenUtils.offsetInToken(ctx),
            foundEqualSign = false;

        //If this is a fully quoted value, return the whole
        //thing regardless of position
        if (attrValue.length > 1 &&
                (startChar === "'" || startChar === '"') &&
                endChar === startChar) {

            // Find an equal sign before the end quote. If found,
            // then the user may be entering an attribute value right before
            // another attribute and we're getting a false balanced string.
            // An example of this case is <link rel" href="foo"> where the
            // cursor is right after the first double quote.
            foundEqualSign = (attrValue.match(/\=\s*['"]$/) !== null);

            if (!foundEqualSign) {
                //strip the quotes and return;
                attrValue = attrValue.substring(1, attrValue.length - 1);
                offset = offset - 1 > attrValue.length ? attrValue.length : offset - 1;
                return {val: attrValue, offset: offset, quoteChar: startChar, hasEndQuote: true};
            }
        }

        if (foundEqualSign) {
            var spaceIndex = attrValue.indexOf(" "),
                bracketIndex = attrValue.indexOf(">"),
                upToIndex = (spaceIndex !== -1 && spaceIndex < bracketIndex) ? spaceIndex : bracketIndex;
            attrValue = attrValue.substring(0, (upToIndex > offset) ? upToIndex : offset);
        } else if (offset > 0 && (startChar === "'" || startChar === '"')) {
            //The att value is getting edit in progress. There is possible extra
            //stuff in this token state since the quote isn't closed, so we assume
            //the stuff from the quote to the current pos is definitely in the attribute
            //value.
            attrValue = attrValue.substring(0, offset);
        }

        //If the attrValue start with a quote, trim that now
        startChar = attrValue.charAt(0);
        if (startChar === "'" || startChar === '"') {
            attrValue = attrValue.substring(1);
            offset--;
        } else {
            startChar = "";
            // Make attr value empty and set offset to zero if it has the ">"
            // which is the closing of the tag.
            if (endChar === ">") {
                attrValue = "";
                offset = 0;
            }
        }

        return {val: attrValue, offset: offset, quoteChar: startChar, hasEndQuote: false};
    }

    /**
     * @private
     * Gets the tagname from where ever you are in the currect state
     * @param {editor:{CodeMirror}, pos:{ch:{string}, line:{number}}, token:{object}} context
     * @return {string}
     */
    function _extractTagName(ctx) {
        var mode = ctx.editor.getMode(),
            innerModeData = CodeMirror.innerMode(mode, ctx.token.state);

        if (ctx.token.type === "tag bracket") {
            return innerModeData.state.tagName;
        }

        // If the ctx is inside the tag name of an end tag, innerModeData.state.tagName is
        // undefined. So return token string as the tag name.
        return innerModeData.state.tagName || ctx.token.string;
    }

    /**
     * Compiles a list of used attributes for a given tag
     * @param {CodeMirror} editor An instance of a CodeMirror editor
     * @param {ch:{string}, line:{number}} pos A CodeMirror position
     * @return {Array.<string>} A list of the used attributes inside the current tag
     */
    function getTagAttributes(editor, pos) {
        var attrs       = [],
            backwardCtx = TokenUtils.getInitialContext(editor._codeMirror, pos),
            forwardCtx  = $.extend({}, backwardCtx);

        if (editor.getModeForSelection() === "html") {
            if (backwardCtx.token && !tagPrefixedRegExp.test(backwardCtx.token.type)) {
                while (TokenUtils.movePrevToken(backwardCtx) && !tagPrefixedRegExp.test(backwardCtx.token.type)) {
                    if (backwardCtx.token.type === "error" && backwardCtx.token.string.indexOf("<") === 0) {
                        break;
                    }
                    if (backwardCtx.token.type === "attribute") {
                        attrs.push(backwardCtx.token.string);
                    }
                }

                while (TokenUtils.moveNextToken(forwardCtx) && !tagPrefixedRegExp.test(forwardCtx.token.type)) {
                    if (forwardCtx.token.type === "attribute") {
                        // If the current tag is not closed, codemirror may return the next opening
                        // tag as an attribute. Stop the search loop in that case.
                        if (forwardCtx.token.string.indexOf("<") === 0) {
                            break;
                        }
                        attrs.push(forwardCtx.token.string);
                    } else if (forwardCtx.token.type === "error") {
                        if (forwardCtx.token.string.indexOf("<") === 0 || forwardCtx.token.string.indexOf(">") === 0) {
                            break;
                        }
                        // If we type the first letter of the next attribute, it comes as an error
                        // token. We need to double check for possible invalidated attributes.
                        if (/\S/.test(forwardCtx.token.string) &&
                                forwardCtx.token.string.indexOf("\"") === -1 &&
                                forwardCtx.token.string.indexOf("'") === -1 &&
                                forwardCtx.token.string.indexOf("=") === -1) {
                            attrs.push(forwardCtx.token.string);
                        }
                    }
                }
            }
        }

        return attrs;
    }

    /**
     * Creates a tagInfo object and assures all the values are entered or are empty strings
     * @param {string=} tokenType what is getting edited and should be hinted
     * @param {number=} offset where the cursor is for the part getting hinted
     * @param {string=} tagName The name of the tag
     * @param {string=} attrName The name of the attribute
     * @param {string=} attrValue The value of the attribute
     * @return {{tagName:string,
     *           attr:{name:string, value:string, valueAssigned:boolean, quoteChar:string, hasEndQuote:boolean},
     *           position:{tokenType:string, offset:number}
     *         }}
     *         A tagInfo object with some context about the current tag hint.
     */
    function createTagInfo(tokenType, offset, tagName, attrName, attrValue, valueAssigned, quoteChar, hasEndQuote) {
        return { tagName: tagName || "",
                 attr:
                    { name: attrName || "",
                      value: attrValue || "",
                      valueAssigned: valueAssigned || false,
                      quoteChar: quoteChar || "",
                      hasEndQuote: hasEndQuote || false },
                 position:
                    { tokenType: tokenType || "",
                      offset: offset || 0 } };
    }

    /**
     * @private
     * Gets the taginfo starting from the attribute value and moving backwards
     * @param {editor:{CodeMirror}, pos:{ch:{string}, line:{number}}, token:{object}} context
     * @return {string}
     */
    function _getTagInfoStartingFromAttrValue(ctx) {
        // Assume we in the attr value
        // and validate that by going backwards
        var attrInfo = _extractAttrVal(ctx),
            attrVal = attrInfo.val,
            offset = attrInfo.offset,
            quoteChar = attrInfo.quoteChar,
            hasEndQuote = attrInfo.hasEndQuote,
            strLength = ctx.token.string.length;

        if ((ctx.token.type === "string" || ctx.token.type === "error") &&
                ctx.pos.ch === ctx.token.end && strLength > 1) {
            var firstChar = ctx.token.string[0],
                lastChar = ctx.token.string[strLength - 1];

            // We get here only when the cursor is immediately on the right of the end quote
            // of an attribute value. So we want to return an empty tag info so that the caller
            // can dismiss the code hint popup if it is still open.
            if (firstChar === lastChar && (firstChar === "'" || firstChar === "\"")) {
                return createTagInfo();
            }
        }

        //Move to the prev token, and check if it's "="
        if (!TokenUtils.moveSkippingWhitespace(TokenUtils.movePrevToken, ctx) || ctx.token.string !== "=") {
            return createTagInfo();
        }

        //Move to the prev token, and check if it's an attribute
        if (!TokenUtils.moveSkippingWhitespace(TokenUtils.movePrevToken, ctx) || ctx.token.type !== "attribute") {
            return createTagInfo();
        }

        var attrName = ctx.token.string;
        var tagName = _extractTagName(ctx);

        //We're good.
        return createTagInfo(ATTR_VALUE, offset, tagName, attrName, attrVal, true, quoteChar, hasEndQuote);
    }

    /**
     * @private
     * Gets the taginfo starting from the attribute name and moving forwards
     * @param {editor:{CodeMirror}, pos:{ch:{string}, line:{number}}, token:{object}} context
     * @param {boolean} isPriorAttr indicates whether we're getting info for a prior attribute
     * @return {string}
     */
    function _getTagInfoStartingFromAttrName(ctx, isPriorAttr) {
        //Verify We're in the attribute name, move forward and try to extract the rest of
        //the info. If the user it typing the attr the rest might not be here
        if (isPriorAttr === false && ctx.token.type !== "attribute") {
            return createTagInfo();
        }

        var tagName = _extractTagName(ctx);
        var attrName = ctx.token.string;
        var offset = TokenUtils.offsetInToken(ctx);

        if (!TokenUtils.moveSkippingWhitespace(TokenUtils.moveNextToken, ctx) || ctx.token.string !== "=") {
            // If we're checking for a prior attribute and the next token we get is a tag or an html comment or
            // an undefined token class, then we've already scanned past our original cursor location.
            // So just return an empty tag info.
            if (isPriorAttr &&
                    (!ctx.token.type ||
                    (ctx.token.type && ctx.token.type !== "attribute" &&
                        ctx.token.type.indexOf("error") === -1 &&
                        ctx.token.string.indexOf("<") !== -1))) {
                return createTagInfo();
            }
            return createTagInfo(ATTR_NAME, offset, tagName, attrName);
        }

        if (!TokenUtils.moveSkippingWhitespace(TokenUtils.moveNextToken, ctx)) {
            return createTagInfo(ATTR_NAME, offset, tagName, attrName);
        }
        //this should be the attrvalue
        var attrInfo = _extractAttrVal(ctx),
            attrVal = attrInfo.val,
            quoteChar = attrInfo.quoteChar,
            hasEndQuote = attrInfo.hasEndQuote;

        return createTagInfo(ATTR_NAME, offset, tagName, attrName, attrVal, true, quoteChar, hasEndQuote);
    }

    /**
     * Figure out if we're in a tag, and if we are return info about it
     * An example token stream for this tag is  :
     *      className:tag       string:""
     * @param {Editor} editor An instance of a Brackets editor
     * @param {{ch: number, line: number}} constPos  A CM pos (likely from editor.getCursorPos())
     * @return {{tagName:string,
     *           attr:{name:string, value:string, valueAssigned:boolean, quoteChar:string, hasEndQuote:boolean},
     *           position:{tokenType:string, offset:number}
     *         }}
     *         A tagInfo object with some context about the current tag hint.
     */
    function getTagInfo(editor, constPos) {
        // We're going to be changing pos a lot, but we don't want to mess up
        // the pos the caller passed in so we use extend to make a safe copy of it.
        var pos = $.extend({}, constPos),
            ctx = TokenUtils.getInitialContext(editor._codeMirror, pos),
            offset = TokenUtils.offsetInToken(ctx),
            tagInfo,
            tokenType;

        // Check if this is inside a style block.
        if (editor.getModeForSelection() !== "html") {
            return createTagInfo();
        }

        // Check and see where we are in the tag
        if (ctx.token.string.length > 0 && !/\S/.test(ctx.token.string)) {

            // token at (i.e. before) pos is whitespace, so test token at next pos
            //
            // note: getTokenAt() does range checking for ch. If it detects that ch is past
            // EOL, it uses EOL, same token is returned, and the following condition fails,
            // so we don't need to worry about testPos being valid.
            var testPos = {ch: ctx.pos.ch + 1, line: ctx.pos.line},
                testToken = editor._codeMirror.getTokenAt(testPos, true);

            if (testToken.string.length > 0 && /\S/.test(testToken.string) &&
                    testToken.string.charAt(0) !== ">") {
                // pos has whitespace before it and non-whitespace after it, so use token after
                ctx.token = testToken;

                // Check whether the token type is one of the types prefixed with "tag"
                // (e.g. "tag", "tag error", "tag brackets")
                if (tagPrefixedRegExp.test(ctx.token.type)) {
                    // Check to see if the cursor is just before a "<" but not in any tag.
                    if (ctx.token.string.charAt(0) === "<") {
                        return createTagInfo();
                    }
                } else if (ctx.token.type === "attribute") {
                    // Check to see if the user is going to add a new attr before an existing one
                    return _getTagInfoStartingFromAttrName(ctx, false);
                } else if (ctx.token.string === "=") {
                    // We're between a whitespace and  "=", so return an empty tag info.
                    return createTagInfo();
                }
            } else {
                // We get here if ">" or white spaces after testPos.
                // Check if there is an equal sign after testPos by creating a new ctx
                // with the original pos. We can't use the current ctx since we need to
                // use it to scan backwards if we don't find an equal sign here.
                // Comment out this block to fix issue #1510.
//                if (testToken.string.length > 0 && testToken.string.charAt(0) !== ">") {
//                    tempCtx = TokenUtils.getInitialContext(editor._codeMirror, pos);
//                    if (TokenUtils.moveSkippingWhitespace(TokenUtils.moveNextToken, tempCtx) && tempCtx.token.string === "=") {
//                        // Return an empty tag info since we're between an atribute name and the equal sign.
//                        return createTagInfo();
//                    }
//                }

                // next, see what's before pos
                if (!TokenUtils.movePrevToken(ctx)) {
                    return createTagInfo();
                }

                if (ctx.token.type === "comment") {
                    return createTagInfo();
                } else if (!tagPrefixedRegExp.test(ctx.token.type) && ctx.token.string !== "=") {
                    // If it wasn't the tag name, assume it was an attr value
                    // Also we don't handle the "=" here.
                    tagInfo = _getTagInfoStartingFromAttrValue(ctx);

                    // Check to see if this is the closing of a tag (either the start or end)
                    // or a comment tag.
                    if (ctx.token.type === "comment" ||
                            (tagPrefixedRegExp.test(ctx.token.type) &&
                            (ctx.token.string === ">" || ctx.token.string === "/>" ||
                                ctx.token.string === "</"))) {
                        return createTagInfo();
                    }

                    // If it wasn't an attr value, assume it was an empty attr (ie. attr with no value)
                    if (!tagInfo.tagName) {
                        tagInfo = _getTagInfoStartingFromAttrName(ctx, true);
                    }

                    // We don't want to give context for the previous attr
                    // and we want it to look like the user is going to add a new attr
                    if (tagInfo.tagName) {
                        return createTagInfo(ATTR_NAME, 0, tagInfo.tagName);
                    }
                    return createTagInfo();
                }

                // We know the tag was here, so the user is adding an attr name
                tokenType = ATTR_NAME;
                offset = 0;
            }
        }

        if (tagPrefixedRegExp.test(ctx.token.type)) {
            if (ctx.token.type !== "tag bracket") {
                // Check if the user just typed a white space after "<" that made an existing tag invalid.
                if (TokenUtils.movePrevToken(ctx) && !/\S/.test(ctx.token.string)) {
                    return createTagInfo();
                }

                // Check to see if this is a closing tag
                if (ctx.token.type === "tag bracket" && ctx.token.string === "</") {
                    tokenType = CLOSING_TAG;
                }

                // Restore the original ctx by moving back to next context since we call
                // movePrevToken above to detect "<" or "</".
                TokenUtils.moveNextToken(ctx);
            }

            // Check to see if this is the closing of a start tag or a self closing tag
            if (ctx.token.string === ">" || ctx.token.string === "/>") {
                return createTagInfo();
            }

            // Make sure the cursor is not after an equal sign or a quote before we report the context as a tag.
            if (ctx.token.string !== "=" && ctx.token.string.match(/^["']/) === null) {
                if (!tokenType) {
                    tokenType = TAG_NAME;
                    if (ctx.token.type === "tag bracket") {
                        // Check to see if this is a closing tag
                        if (ctx.token.string === "</") {
                            tokenType = CLOSING_TAG;
                            offset -= 2;
                        } else {
                            offset = 0;
                        }
                        // If the cursor is right after the "<" or "</", then
                        // move context to next one so that _extractTagName
                        // call below can get the tag name if there is one.
                        if (offset === 0) {
                            TokenUtils.moveNextToken(ctx);
                        }
                    }
                }

                // We're actually in the tag, just return that as we have no relevant
                // info about what attr is selected
                return createTagInfo(tokenType, offset, _extractTagName(ctx));
            }
        }

        if (ctx.token.string === "=") {
            // We could be between the attr and the value
            // Step back and check
            if (!TokenUtils.moveSkippingWhitespace(TokenUtils.movePrevToken, ctx) || ctx.token.type !== "attribute") {
                return createTagInfo();
            }

            // The "=" is added, time to hint for values
            tokenType = ATTR_VALUE;
            offset = 0;
        }

        if (ctx.token.type === "attribute") {
            tagInfo = _getTagInfoStartingFromAttrName(ctx, false);

            // If we're in attr value, then we may need to calculate the correct offset
            // from the beginning of the attribute value. If the cursor position is to
            // the left of attr value, then the offset is negative.
            // e.g. if the cursor is just to the right of the "=" in <a rel= "rtl", then
            // the offset will be -2.
            if (tagInfo.attr.quoteChar) {
                offset = constPos.ch - ctx.pos.ch;
            } else if (tokenType === ATTR_VALUE && (constPos.ch + 1) < ctx.pos.ch) {
                // The cursor may be right before an unquoted attribute or another attribute name.
                // Since we can't distinguish between them, we will empty the value so that the
                // caller can just insert a new attribute value.
                tagInfo.attr.value = "";
            }
        } else {
            // if we're not at a tag, "=", or attribute name, assume we're in the value
            tagInfo = _getTagInfoStartingFromAttrValue(ctx);
        }

        if (tokenType && tagInfo.tagName) {
            tagInfo.position.tokenType = tokenType;
            tagInfo.position.offset = offset;
        }

        return tagInfo;
    }

    /**
     * Returns an Array of info about all blocks whose token mode name matches that passed in,
     * in the given Editor's HTML document (assumes the Editor contains HTML text).
     * @param {!Editor} editor - the editor containing the HTML text
     * @param {string} modeName - the mode name of the tokens to look for
     * @return {Array.<{start:{line:number, ch:number}, end:{line:number, ch:number}, text:string}>}
     */
    function findBlocks(editor, modeName) {
        // Start scanning from beginning of file
        var ctx = TokenUtils.getInitialContext(editor._codeMirror, {line: 0, ch: 0}),
            blocks = [],
            currentBlock = null,
            inBlock = false,
            outerMode = editor._codeMirror.getMode(),
            tokenModeName,
            previousMode;

        while (TokenUtils.moveNextToken(ctx, false)) {
            tokenModeName = CodeMirror.innerMode(outerMode, ctx.token.state).mode.name;
            if (inBlock) {
                if (!currentBlock.end) {
                    // Handle empty blocks
                    currentBlock.end = currentBlock.start;
                }
                // Check for end of this block
                if (tokenModeName === previousMode) {
                    // currentBlock.end is already set to pos of the last token by now
                    currentBlock.text = editor.document.getRange(currentBlock.start, currentBlock.end);
                    inBlock = false;
                } else {
                    currentBlock.end = { line: ctx.pos.line, ch: ctx.pos.ch };
                }
            } else {
                // Check for start of a block
                if (tokenModeName === modeName) {
                    currentBlock = {
                        start: { line: ctx.pos.line, ch: ctx.pos.ch }
                    };
                    blocks.push(currentBlock);
                    inBlock = true;
                } else {
                    previousMode = tokenModeName;
                }
                // else, random token: ignore
            }
        }

        return blocks;
    }

    /**
     * Returns an Array of info about all


text:
<resources>
    <string name="app_name">Biolock</string>

    <string name="title_activity_authentication_fullscreen">AuthenticationFullscreenActivity
    </string>
    <string name="dummy_button">Dummy Button</string>
    <string name="dummy_content">DUMMY\nCONTENT</string>
    <string name="title_activity_authentication">AuthenticationActivity</string>
    <string name="detectingHeartRate">Detecting heart rate</string>
    <string name="bpm">bpm</string>
    <string name="authenticate">Authenticate with ECG</string>
    <string name="selectECGDevice">Select ECG device</string>
    <string name="heartAnimation">Heart animation</string>
</resources>


text: Test that a different origin manifest is completely ignored.


text:
package griffon.plugins.domain.orm;

import java.util.Arrays;

/**
 * @author Andres Almiray
 */
public final class CompositeCriterion implements Criterion {
    private final Criterion[] criteria;
    private final Operator operator;

    public CompositeCriterion(Criterion... criteria) {
        this(Operator.AND, criteria);
    }

    public CompositeCriterion(Operator operator, Criterion... criteria) {
        if (criteria == null) {
            this.criteria = new Criterion[0];
        } else {
            this.criteria = new Criterion[criteria.length];
            System.arraycopy(criteria, 0, this.criteria, 0, criteria.length);
        }

        operator = operator == null ? Operator.AND : operator;
        if (operator != Operator.AND && operator != Operator.OR) {
            throw new IllegalArgumentException("Invalid operator '" + operator + "'. Allowed operators are AND, OR.");
        }
        this.operator = operator;
    }

    public Criterion[] getCriteria() {
        Criterion[] tmp = new Criterion[criteria.length];
        System.arraycopy(criteria, 0, tmp, 0, criteria.length);
        return tmp;
    }

    public Operator getOperator() {
        return this.operator;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder();
        sb.append("CompositeCriterion");
        sb.append("{criteria=").append(criteria == null ? "null" : Arrays.asList(criteria).toString());
        sb.append(", operator=").append(operator);
        sb.append('}');
        return sb.toString();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        CompositeCriterion that = (CompositeCriterion) o;

        if (!Arrays.equals(criteria, that.criteria)) return false;
        if (operator != that.operator) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = Arrays.hashCode(criteria);
        result = 31 * result + operator.hashCode();
        return result;
    }
}


text:
"""
Tests for states.py.
"""

from __init__ import DocutilsTestSupport

def suite():
    s = DocutilsTestSupport.ParserTestSuite()
    s.generateTests(totest)
    return s

totest = {}

totest['line_blocks'] = [
["""\
| This is a line block.
| Line breaks are *preserved*.

| This is a second line block.

| This is a third.
""",
"""\
<document source="test data">
    <line_block>
        <line>
            This is a line block.
        <line>
            Line breaks are \n\
            <emphasis>
                preserved
            .
    <line_block>
        <line>
            This is a second line block.
    <line_block>
        <line>
            This is a third.
"""],
["""\
| In line blocks,
|     Initial indentation is *also* preserved.
""",
"""\
<document source="test data">
    <line_block>
        <line>
            In line blocks,
        <line_block>
            <line>
                Initial indentation is \n\
                <emphasis>
                    also
                 preserved.
"""],
["""\
| Individual lines in line blocks
  *may* wrap, as indicated by the lack of a vertical bar prefix.
| These are called "continuation lines".
""",
"""\
<document source="test data">
    <line_block>
        <line>
            Individual lines in line blocks
            <emphasis>
                may
             wrap, as indicated by the lack of a vertical bar prefix.
        <line>
            These are called "continuation lines".
"""],
["""\
| Inline markup in line blocks may also wrap *to
  continuation lines*.
| But not to following lines.
""",
"""\
<document source="test data">
    <line_block>
        <line>
            Inline markup in line blocks may also wrap \n\
            <emphasis>
                to
                continuation lines
            .
        <line>
            But not to following lines.
"""],
["""\
\\| This is not a line block.
The vertical bar is simply part of a paragraph.
""",
"""\
<document source="test data">
    <paragraph>
        | This is not a line block.
        The vertical bar is simply part of a paragraph.
"""],
["""\
| This line block is incomplete.
There should be a blank line before this paragraph.
""",
"""\
<document source="test data">
    <line_block>
        <line>
            This line block is incomplete.
    <system_message level="2" line="2" source="test data" type="WARNING">
        <paragraph>
            Line block ends without a blank line.
    <paragraph>
        There should be a blank line before this paragraph.
"""],
["""\
| This line block contains
|
| blank lines.
""",
"""\
<document source="test data">
    <line_block>
        <line>
            This line block contains
        <line>
        <line>
            blank lines.
"""],
["""\
| The blank lines in this block
|   \n\
|       \n\
| have bogus spaces.
""",
"""\
<document source="test data">
    <line_block>
        <line>
            The blank lines in this block
        <line>
        <line>
        <line>
            have bogus spaces.
"""],
["""\
| Initial indentation is also significant and preserved:
|
|     Indented 4 spaces
| Not indented
|   Indented 2 spaces
|     Indented 4 spaces
|  Only one space
|
|     Continuation lines may be indented less
  than their base lines.
""",
"""\
<document source="test data">
    <line_block>
        <line>
            Initial indentation is also significant and preserved:
        <line>
        <line_block>
            <line>
                Indented 4 spaces
        <line>
            Not indented
        <line_block>
            <line_block>
                <line>
                    Indented 2 spaces
                <line_block>
                    <line>
                        Indented 4 spaces
            <line>
                Only one space
            <line>
            <line_block>
                <line>
                    Continuation lines may be indented less
                    than their base lines.
"""],
["""\
|
| This block begins and ends with blank lines.
|
""",
"""\
<document source="test data">
    <line_block>
        <line>
        <line>
            This block begins and ends with blank lines.
        <line>
"""],
["""\
This is not
| a line block.
""",
"""\
<document source="test data">
    <paragraph>
        This is not
        | a line block.
"""],
["""\
|   The first line is indented.
|     The second line is more indented.
""",
"""\
<document source="test data">
    <line_block>
        <line>
            The first line is indented.
        <line_block>
            <line>
                The second line is more indented.
"""],
["""\
|     The first line is indented.
|   The second line is less indented.
""",
"""\
<document source="test data">
    <line_block>
        <line_block>
            <line>
                The first line is indented.
        <line>
            The second line is less indented.
"""],
["""\
|This is not
|a line block

| This is an
|incomplete line block.
""",
"""\
<document source="test data">
    <paragraph>
        <problematic ids="id2" refid="id1">
            |
        This is not
        <problematic ids="id4" refid="id3">
            |
        a line block
    <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING">
        <paragraph>
            Inline substitution_reference start-string without end-string.
    <system_message backrefs="id4" ids="id3" level="2" line="1" source="test data" type="WARNING">
        <paragraph>
            Inline substitution_reference start-string without end-string.
    <line_block>
        <line>
            This is an
    <system_message level="2" line="5" source="test data" type="WARNING">
        <paragraph>
            Line block ends without a blank line.
    <paragraph>
        <problematic ids="id6" refid="id5">
            |
        incomplete line block.
    <system_message backrefs="id6" ids="id5" level="2" line="5" source="test data" type="WARNING">
        <paragraph>
            Inline substitution_reference start-string without end-string.
"""],
["""\
| Inline markup *may not
| wrap* over several lines.
""",
"""\
<document source="test data">
    <line_block>
        <line>
            Inline markup \n\
            <problematic ids="id2" refid="id1">
                *
            may not
        <line>
            wrap* over several lines.
    <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING">
        <paragraph>
            Inline emphasis start-string without end-string.
"""],
["""\
| * Block level markup
| * is not recognized.
""",
"""\
<document source="test data">
    <line_block>
        <line>
            * Block level markup
        <line>
            * is not recognized.
"""],
]

if __name__ == '__main__':
    import unittest
    unittest.main(defaultTest='suite')


text:
/*
 * Do not modify this file. This file is generated from the monitoring-2010-08-01.normal.json service model.
 */
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;

using Amazon.CloudWatch.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
namespace Amazon.CloudWatch.Model.Internal.MarshallTransformations
{
    /// <summary>
    /// GetMetricStatistics Request Marshaller
    /// </summary>
    public class GetMetricStatisticsRequestMarshaller : IMarshaller<IRequest, GetMetricStatisticsRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
    {
        public IRequest Marshall(AmazonWebServiceRequest input)
        {
            return this.Marshall((GetMetricStatisticsRequest)input);
        }

        public IRequest Marshall(GetMetricStatisticsRequest publicRequest)
        {
            IRequest request = new DefaultRequest(publicRequest, "Amazon.CloudWatch");
            request.Parameters.Add("Action", "GetMetricStatistics");
            request.Parameters.Add("Version", "2010-08-01");

            if(publicRequest != null)
            {
                if(publicRequest.IsSetDimensions())
                {
                    int publicRequestlistValueIndex = 1;
                    foreach(var publicRequestlistValue in publicRequest.Dimensions)
                    {
                        if(publicRequestlistValue.IsSetName())
                        {
                            request.Parameters.Add("Dimensions" + "." + "member" + "." + publicRequestlistValueIndex + "." + "Name", StringUtils.FromString(publicRequestlistValue.Name));
                        }
                        if(publicRequestlistValue.IsSetValue())
                        {
                            request.Parameters.Add("Dimensions" + "." + "member" + "." + publicRequestlistValueIndex + "." + "Value", StringUtils.FromString(publicRequestlistValue.Value));
                        }
                        publicRequestlistValueIndex++;
                    }
                }
                if(publicRequest.IsSetEndTime())
                {
                    request.Parameters.Add("EndTime", StringUtils.FromDateTime(publicRequest.EndTime));
                }
                if(publicRequest.IsSetMetricName())
                {
                    request.Parameters.Add("MetricName", StringUtils.FromString(publicRequest.MetricName));
                }
                if(publicRequest.IsSetNamespace())
                {
                    request.Parameters.Add("Namespace", StringUtils.FromString(publicRequest.Namespace));
                }
                if(publicRequest.IsSetPeriod())
                {
                    request.Parameters.Add("Period", StringUtils.FromInt(publicRequest.Period));
                }
                if(publicRequest.IsSetStartTime())
                {
                    request.Parameters.Add("StartTime", StringUtils.FromDateTime(publicRequest.StartTime));
                }
                if(publicRequest.IsSetStatistics())
                {
                    int publicRequestlistValueIndex = 1;
                    foreach(var publicRequestlistValue in publicRequest.Statistics)
                    {
                        request.Parameters.Add("Statistics" + "." + "member" + "." + publicRequestlistValueIndex, StringUtils.FromString(publicRequestlistValue));
                        publicRequestlistValueIndex++;
                    }
                }
                if(publicRequest.IsSetUnit())
                {
                    request.Parameters.Add("Unit", StringUtils.FromString(publicRequest.Unit));
                }
            }
            return request;
        }
    }
}