text:
title: How to use Great Expectations in Deepnote
---

import Prerequisites from './components/deployment_pattern_prerequisites.jsx'
import TechnicalTag from '@site/docs/term_tags/_tag.mdx';

_This piece of documentation was authored by [Allan Campopiano](https://www.linkedin.com/in/allan-campopiano-703394120)._

This guide will help you get started with Great Expectations on Deepnote. You will learn how to validate columns in a Pandas DataFrame,
host your data docs, and schedule a pipeline job.

All of this will be accomplished from within a single, [ready-to-use notebook](https://deepnote.com/project/Reduce-Pipeline-Debt-With-Great-Expectations-d78cwK3GRYKU7AAl9fO7lg/%2Fnotebook.ipynb/#00000-85c6538f-6aaa-427b-9eda-29fdacf56457),
with no prerequisites beyond signing up for a [free Deepnote account](https://deepnote.com/)!

### Benefits of Great Expectations in Deepnote

Deepnote provides a "click and play" notebook platform that integrates perfectly with Great Expectations.
You can read all about it in [this blog post](https://deepnote.com/blog/how-not-to-draw-an-owl-cky1yda1c784x0b30j4ktcok7)!

Here are some of the notable benefits:
- Great Expectation's features are demonstrated in a [single notebook](https://deepnote.com/project/Reduce-Pipeline-Debt-With-Great-Expectations-d78cwK3GRYKU7AAl9fO7lg/%2Fnotebook.ipynb/#00000-85c6538f-6aaa-427b-9eda-29fdacf56457) (no terminal needed)
- Data Docs can be [hosted publicly on Deepnote](https://docs.deepnote.com/environment/incoming-connections) (no need to host them yourself)
- [Deepnote scheduling](https://docs.deepnote.com/features/scheduling) allows you to experience Great Expectations as part of a pipeline

These benefits make Deepnote one of the easiest and fastest ways to get started with Great Expectations.

## Steps

### 1. Begin by importing Great Expectations

Since Great Expectations can be listed in Deepnote's `requirements.txt`, it will be installed automatically. You can read more about package installation [here](https://docs.deepnote.com/environment/python-requirements).
This lets us import the required libraries right away.

```python
import pandas as pd
import numpy as np
import great_expectations as ge
from great_expectations.data_context.types.base import (
    DataContextConfig,
    DatasourceConfig,
    FilesystemStoreBackendDefaults,
)
from great_expectations.data_context import BaseDataContext
from great_expectations.checkpoint import SimpleCheckpoint
from great_expectations.core.batch import RuntimeBatchRequest
```

### 2. Initialize Great Expectations

The following cell creates a Great Expectations folder in the filesystem
which will hold all of the forthcoming project configurations. Note that if this folder already exists, Great Expectations gracefully allows us to continue.

```bash
!great_expectations --yes --v3-api init
```

### 3. Validate a Pandas DataFrame

In practice, this is where you would bring in your own data; however, for the sake of a placeholder,
a DataFrame with random values is created. The Expectations we set later on this data may pass or fail.

:::note
Replace the randomly created DataFrame below with your own datasource.
:::

```python
import pandas as pd

products = np.random.choice(
    [
        "camera",
        "phone",
        "computer",
        "speaker",
        "TV",
        "cable",
        "movie",
        "guitar",
        "printer",
    ],
    size=5,
)

quantities = np.random.choice(list(range(10)) + [None], size=5)

dates = np.random.choice(pd.date_range(start="2020-12-30", end="2021-01-08"), size=5)

df = pd.DataFrame({"products": products, "quantities": quantities, "dates": dates})

df.show()
```

![Example DataFrame](./images/dataframe.png)

### 4. Define Expectations

Expectations can be defined directly on a Pandas DataFrame using `ge.from_pandas(df)`.
We're defining three Expectations on our DataFrame:

1. The `products` column must contain unique values
2. The `quantities` column cannot contain null values
3. The `dates` column must have dates between January 1st and January 8th

These Expectations together form an <TechnicalTag tag="expectation_suite" text="Expectation Suite"/> that will be validated against our data.

:::tip
Replace the sample Expectations below with those that relate to your data.

You can see all the Expectations available in the [gallery](https://greatexpectations.io/expectations).
:::

```python
df = ge.from_pandas(df)

# ~30% chance of passing
df.expect_column_values_to_be_unique("products") # ~30% chance of passing

# ~60% chance of passing
df.expect_column_values_to_not_be_null("quantities") # ~60% chance of passing

# ~60% chance of passing
df.expect_column_values_to_be_between(
    "dates", "2021-01-01", "2021-01-8", parse_strings_as_datetimes=True
);
```

### 5. Set project configurations

Before we can validate our expectations against our data, we need to tell Great Expectations more about our project's configuration.
Great Expectations keeps track of many configurations with a <TechnicalTag tag="data_context" text="Data Context"/>.
These configurations are used to manage aspects of your project behind the scenes.

:::info
There's a lot going on here, but for the sake of this guide we don't need to worry about the full details.

To learn more, visit the [Great Expectations docs](https://docs.greatexpectations.io/docs/).
:::

```python
data_context_config = DataContextConfig(
    datasources={
        "my_datasource": DatasourceConfig(
            class_name="Datasource",
            module_name="great_expectations.datasource",
            execution_engine={
                "class_name": "PandasExecutionEngine",
                "module_name": "great_expectations.execution_engine",
            },
            data_connectors={
                "default_runtime_data_connector_name": {
                    "class_name": "RuntimeDataConnector",
                    "batch_identifiers": ["default_identifier_name"],
                }
            },
        )
    },
    store_backend_defaults=FilesystemStoreBackendDefaults(
        root_directory="/work/great_expectations"
    ),
)

context = BaseDataContext(project_config=data_context_config)
context.save_expectation_suite(
    expectation_suite_name="my_expectation_suite",
    expectation_suite=df.get_expectation_suite(discard_failed_expectations=False),
);
```

### 6. Setting up a Batch and Checkpoint

In order to populate the documentation (<TechnicalTag tag="data_docs" text="Data Docs"/>) for our tests,
we need to set up at least one <TechnicalTag tag="batch" text="Batch"/> and a <TechnicalTag tag="checkpoint" text="Checkpoint"/>.

A Batch is a pairing of data and metadata to be validated. A Checkpoint is a bundle of at least:
- One Batch (the data to be validated)
- One Expectation Suite (our Expectations for that data)
- One <TechnicalTag tag="action" text="Action"/> (saving our validation results, rebuilding Data Docs, sending a Slack notification, etc.)

In the cell below, one Batch is constructed from our DataFrame with a <TechnicalTag tag="batch_request" text="RuntimeBatchRequest"/>.

We then create a Checkpoint, and pass in our `batch_request`.

When we execute this code, our Expectation Suite is run against our data, validating whether that data meets our
Expectations or not. The results are then persisted temporarily until we build our Data Docs.

```python
batch_request = RuntimeBatchRequest(
    datasource_name="my_datasource",
    data_connector_name="default_runtime_data_connector_name",
    data_asset_name="df",
    runtime_parameters={"batch_data": df},
    batch_identifiers={"default_identifier_name": "df"},
)

checkpoint_config = {
    "name": "my_checkpoint",
    "config_version": 1,
    "class_name": "SimpleCheckpoint",
    "expectation_suite_name": "my_expectation_suite",
}

context.add_checkpoint(**checkpoint_config)

results = context.run_checkpoint(
    checkpoint_name="my_checkpoint",
    validations=[{"batch_request": batch_request}],
    run_id="my_run_id",
)
```

### 7. Build the documentation

Our Data Docs can now be generated and served (thanks to [Deepnote Tunneling](https://docs.deepnote.com/environment/incoming-connections)!) by running the next cell.

```python
context.build_data_docs();

# Uncomment this line to serve up the documentation
#!python -m http.server 8080 --directory great_expectations/uncommitted/data_docs/local_site
```

When served, the Data Docs site provides the details of each <TechnicalTag tag="validation" text="Validation"/> we've run and Expectation Suite we've created.

For example, the following image shows a run where three Expectations were validated against our DataFrame and two of them failed.

![Data Docs](./images/datadocs.png)

Congratulations!
🎉 You've successfully deployed Great Expectations on Deepnote! 🎉

## Summary

Deepnote integrates perfectly with Great Expectations, allowing documentation to be hosted and notebooks to be scheduled. Please visit [Deepnote](https://deepnote.com/)
to learn more about how to bring tools, teams, and workflows together.


text:
<?php

namespace Documentor\Parsers;

use Documentor\AbstractParser;

/**
 * @category   Parsers
 * @package    Documentor
 * @subpackage Parsers
 * @author     Julien Ballestracci <julien@nitronet.org>
 * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
 * @link       http://github.com/neiluj/Documentor
 */
class ClassParser extends AbstractParser
{
    protected $triggerToken = \T_CLASS;

    /**
     * @return void
     */
    public function __construct($filePath = null)
    {
        parent::__construct($filePath);

        $this->addParsers(array(
            ':constants'    => new ConstantParser(),
            ':methods'      => new MethodParser(),
            ':attributes'   => new AttributeParser()
        ));
    }

    public function parse()
    {
        if (!isset($this->results)) {
            parent::parse();

            $tokens = $this->getTokens();
            $startLine = 0;
            $openClass = false;
            $abstract = false;
            $name = null;
            $impl = array();
            $inClass = 0;
            $inFunction = 0;

            foreach ($tokens as $num => $token) {
                if (!is_array($token)) {
                    $tok = $token;
                    $contents = $token;
                } else {
                    $tok = $token[0];
                    $contents = $token[1];
                    $line = $token[2];
                }

                if ($tok == $this->triggerToken) {
                    if (\is_string($openClass)) {
                        throw new \Exception(sprintf(
                            "Parser error: double CLASS (%s:%s).", $this->filePath, $line
                        ));
                    }

                    $openClass = "";
                    $startLine = $line;
                    continue;
                } elseif ($tok == \T_ABSTRACT) {
                    $abstract = true;
                    continue;
                } if (is_string($openClass) && $contents != '{') {
                    $openClass .= $contents;
                } elseif (is_string($openClass) && $contents == '{') {
                    $openClass = trim($openClass);
                    $className = "";
                    $parentClass = null;
                    $implements = array();
                    $hasImplements = false;
                    $xxx = \explode(' ', $openClass);

                    foreach ($xxx as $x => $item) {
                        if ($x === 0) {
                            $className = $item;
                        } elseif ($item == 'extends') {
                            $parentClass = $xxx[$x + 1];
                        } elseif ($item == 'implements') {
                            $hasImplements = true;
                        }
                    }

                    if ($hasImplements) {
                        $impltmp = trim(substr($openClass, strpos($openClass, ' implements ') + 11));
                        if (strpos($impltmp, ',') !== false) {
                            $x = explode(',', $impltmp);
                            foreach ($x as $implemented) {
                                $impl[] = trim($implemented);
                            }
                        } else {
                            $impl[] = $impltmp;
                        }
                    }

                    $implements = $impl;
                    $name       = $className;
                    $openClass  = false;
                }

                if ($contents == '}') {
                    if ($inClass == 1 && !empty($name)) {
                        $this->results[$name] = array(
                            'name'          => $name,
                            'abstract'      => $abstract,
                            'implements'    => $implements,
                            'parent'        => $parentClass,
                            'startLine'     => $startLine,
                            'endLine'       => $line + 1
                        );

                        $this->appendData($name, 'constants');
                        $this->appendData($name, 'attributes');
                        $this->appendData($name, 'methods');

                        $implements = array();
                        $abstract = false;
                        $parentClass = null;
                        $name = null;
                        $openClass = false;
                        $impl = array();
                    }
                    $inClass--;
                } elseif ($contents == '{') {
                    $inClass++;
                }
            }

            unset($this->results[':constants'],
                  $this->results[':methods'],
                  $this->results[':attributes']);
        }

        return $this->results;
    }

    protected function appendData($className, $type)
    {
        if(!isset($this->results[$className])) {
            throw new \RuntimeException(sprintf(
               "Inexistant class %s", $className
            ));
        }

        $infos  = $this->results[$className];
        $start  = $infos['startLine'];
        $end    = $infos['endLine'];

        $remove = array();
        if(!isset($this->results[':'. $type]) || !is_array($this->results[':'. $type])) {
            return;
        }

        foreach ($this->results[':'. $type] as $key => $data)
        {
            if ($data['startLine'] >= $end || $data['endLine'] <= $start) {
                continue;
            }

            $this->results[$className][$type][$data['name']] = $data;
            $remove[] = $key;
        }

        foreach($remove as $key) {
            unset($this->results[':'. $type][$key]);
        }
    }

    public function getTriggerToken()
    {
        return $this->triggerToken;
    }

    public function setTriggerToken($triggerToken)
    {
        $this->triggerToken = $triggerToken;
    }
}

redpajama_set_name: RedPajamaGithub


text:
package flinkcep.examples.sources;

import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.functions.source.RichParallelSourceFunction;

import flinkcep.examples.common.AlarmEvent;
import flinkcep.examples.common.Severity;

import java.util.Random;

/**
 * Source to generate events.
 * simulating events from a network elements with random
 * severity.
 *
 *
 */
public class AlarmEventSource extends RichParallelSourceFunction<AlarmEvent> {
	private static final long serialVersionUID = 3589767994783688247L;

	private boolean running = true;

	private final long pause;
	private final double temperatureStd;
	private final double temperatureMean;
	private Random random;

	public AlarmEventSource(long pause, double temperatureStd, double temperatureMean) {
		this.pause = pause;
		this.temperatureMean = temperatureMean;
		this.temperatureStd = temperatureStd;
	}

	@Override
	public void open(Configuration configuration) {
		random = new Random();
	}

	public void run(SourceContext<AlarmEvent> sourceContext) throws Exception {
		while (running) {
			AlarmEvent event = null;
			Severity alarmSeverity = null;
			double temperature = random.nextGaussian() * temperatureStd + temperatureMean;
			if (temperature > temperatureMean) {
				alarmSeverity = Severity.CRITICAL;
			}else if (temperature > (temperatureMean-10) && temperature < temperatureMean) {
				alarmSeverity = Severity.MAJOR;
			}else if (temperature > (temperatureMean-20) && temperature < temperatureMean-10) {
				alarmSeverity = Severity.MINOR;
			}else if (temperature > (temperatureMean-30) && temperature < temperatureMean-20) {
				alarmSeverity = Severity.WARNING;
			}else if (temperature < (temperatureMean-30))  {
				alarmSeverity = Severity.CLEAR;
			}
			event = new AlarmEvent(123, "NE1", alarmSeverity);
			event.setSpecificProblem("Temperature Reached : "+ temperature);
			sourceContext.collect(event);
			Thread.sleep(pause);
		}
	}

	public void cancel() {
		running = false;
	}

}


text:
using testing::ReturnRef;

namespace Envoy {
namespace Network {
namespace {
struct CallbackHandle {
  std::unique_ptr<Network::MockListenerFilterCallbacks> callback_;
  std::unique_ptr<Network::MockConnectionSocket> socket_;
  Address::InstanceConstSharedPtr address_;
};
} // namespace
class ListenerFilterMatcherTest : public testing::Test {
public:
  std::unique_ptr<CallbackHandle> createCallbackOnPort(int port) {
    auto handle = std::make_unique<CallbackHandle>();
    handle->address_ = std::make_shared<Network::Address::Ipv4Instance>("127.0.0.1", port);
    handle->socket_ = std::make_unique<MockConnectionSocket>();
    handle->callback_ = std::make_unique<MockListenerFilterCallbacks>();
    EXPECT_CALL(*(handle->socket_), localAddress()).WillRepeatedly(ReturnRef(handle->address_));
    EXPECT_CALL(*(handle->callback_), socket()).WillRepeatedly(ReturnRef(*(handle->socket_)));
    return handle;
  }
  envoy::config::listener::v3::ListenerFilterChainMatchPredicate createPortPredicate(int port_start,
                                                                                int port_end) {
    envoy::config::listener::v3::ListenerFilterChainMatchPredicate pred;
    auto ports = pred.mutable_destination_port_range();
    ports->set_start(port_start);
    ports->set_end(port_end);
    return pred;
  }
};

TEST_F(ListenerFilterMatcherTest, DstPortMatcher) {
  auto pred = createPortPredicate(80, 81);
  auto matcher = ListenerFilterMatcherBuilder::buildListenerFilterMatcher(pred);
  auto handle79 = createCallbackOnPort(79);
  auto handle80 = createCallbackOnPort(80);
  auto handle81 = createCallbackOnPort(81);
  EXPECT_FALSE(matcher->matches(*(handle79->callback_)));
  EXPECT_TRUE(matcher->matches(*(handle80->callback_)));
  EXPECT_FALSE(matcher->matches(*(handle81->callback_)));
}

TEST_F(ListenerFilterMatcherTest, AnyMatdcher) {
  envoy::config::listener::v3::ListenerFilterChainMatchPredicate pred;
  pred.set_any_match(true);
  auto matcher = ListenerFilterMatcherBuilder::buildListenerFilterMatcher(pred);
  auto handle79 = createCallbackOnPort(79);
  auto handle80 = createCallbackOnPort(80);
  auto handle81 = createCallbackOnPort(81);
  EXPECT_TRUE(matcher->matches(*(handle79->callback_)));
  EXPECT_TRUE(matcher->matches(*(handle80->callback_)));
  EXPECT_TRUE(matcher->matches(*(handle81->callback_)));
}

TEST_F(ListenerFilterMatcherTest, NotMatcher) {
  auto pred = createPortPredicate(80, 81);
  envoy::config::listener::v3::ListenerFilterChainMatchPredicate not_pred;
  not_pred.mutable_not_match()->MergeFrom(pred);
  auto matcher = ListenerFilterMatcherBuilder::buildListenerFilterMatcher(not_pred);
  auto handle79 = createCallbackOnPort(79);
  auto handle80 = createCallbackOnPort(80);
  auto handle81 = createCallbackOnPort(81);
  EXPECT_TRUE(matcher->matches(*(handle79->callback_)));
  EXPECT_FALSE(matcher->matches(*(handle80->callback_)));
  EXPECT_TRUE(matcher->matches(*(handle81->callback_)));
}

TEST_F(ListenerFilterMatcherTest, OrMatcher) {
  auto pred80 = createPortPredicate(80, 81);
  auto pred443 = createPortPredicate(443, 444);

  envoy::config::listener::v3::ListenerFilterChainMatchPredicate pred;
  pred.mutable_or_match()->mutable_rules()->Add()->MergeFrom(pred80);
  pred.mutable_or_match()->mutable_rules()->Add()->MergeFrom(pred443);

  auto matcher = ListenerFilterMatcherBuilder::buildListenerFilterMatcher(pred);
  auto handle80 = createCallbackOnPort(80);
  auto handle443 = createCallbackOnPort(443);
  auto handle3306 = createCallbackOnPort(3306);

  EXPECT_FALSE(matcher->matches(*(handle3306->callback_)));
  EXPECT_TRUE(matcher->matches(*(handle80->callback_)));
  EXPECT_TRUE(matcher->matches(*(handle443->callback_)));
}

TEST_F(ListenerFilterMatcherTest, AndMatcher) {
  auto pred80_3306 = createPortPredicate(80, 3306);
  auto pred443_3306 = createPortPredicate(443, 3306);

  envoy::config::listener::v3::ListenerFilterChainMatchPredicate pred;
  pred.mutable_and_match()->mutable_rules()->Add()->MergeFrom(pred80_3306);
  pred.mutable_and_match()->mutable_rules()->Add()->MergeFrom(pred443_3306);

  auto matcher = ListenerFilterMatcherBuilder::buildListenerFilterMatcher(pred);
  auto handle80 = createCallbackOnPort(80);
  auto handle443 = createCallbackOnPort(443);
  auto handle3306 = createCallbackOnPort(3306);

  EXPECT_FALSE(matcher->matches(*(handle3306->callback_)));
  EXPECT_FALSE(matcher->matches(*(handle80->callback_)));
  EXPECT_TRUE(matcher->matches(*(handle443->callback_)));
}
} // namespace Network
} // namespace Envoy


text:
// Authors:
// 		Thomas Wiest (twiest@novell.com)
//		Rusty Howell  (rhowell@novell.com)
//
// (C)  Novell Inc.

using System;
using System.Collections.Generic;
using System.Text;

namespace System.Management.Internal
{
    /// <summary>
    /// Abstract parent class of a CimProperty or a CimMethod, and include the common attributes of both sub classes
    /// </summary>
    internal abstract class CimClassMember
    {
        /* <!ELEMENT PROPERTY (QUALIFIER*,VALUE?)>
         * <!ATTLIST PROPERTY
         *      %CIMName;
         *      %CIMType; #REQUIRED
         *      %ClassOrigin;
         *      %Propagated;
         *      xml:lang NMTOKEN #IMPLIED>
         * */

        /* <!ELEMENT METHOD
         * (QUALIFIER*,(PARAMETER|PARAMETER.REFERENCE|PARAMETER.ARRAY|PARAMETER.REFARRAY)*)>
         * <!ATTLIST METHOD
         *      %CIMName;
         *      %CIMType; #IMPLIED
         *      %ClassOrigin;
         *      %Propagated;>
         * */
        private CimQualifierList _qualifiers = null;
        private CimName _name = null;
        private NullableCimType _type = null;
        private CimName _classOrigin = null;
        private NullableBool _isPropagated = null;

        #region Constructors
        #endregion

        #region Properties
        /// <summary>
        /// Gets or set the name of the property
        /// </summary>
        public CimName Name
        {
            get
            {
                if (_name == null)
                    _name = new CimName(null);
                return _name;
            }
            set { _name = value; }
        }

        /// <summary>
        /// Gets or sets the name of the class that the CimMember object belongs to.
        /// </summary>
        public CimName ClassOrigin
        {
            get
            {
                if (_classOrigin == null)
                    _classOrigin = new CimName(null);
                return _classOrigin;
            }
            set { _classOrigin = value; }
        }

        /// <summary>
        /// Gets or sets the NullableCimType of the CimMember object
        /// </summary>
        public NullableCimType Type
        {
            get
            {
                if (_type == null)
                    _type = new NullableCimType();
                return _type;
            }
            set { _type = value; }
        }

        /// <summary>
        /// Gets or sets the CimQualifiers of the CimProperty object
        /// </summary>
        public CimQualifierList Qualifiers
        {
            // Guaranteed not to be null
            get
            {
                // Guaranteed not to be null
                if (_qualifiers == null)
                    _qualifiers = new CimQualifierList();   // Alloc on demand

                return _qualifiers;
            }
            private set { _qualifiers = value; }
        }

        /// <summary>
        /// Gets or sets the flag indicating whether or not this property is propagated
        /// </summary>
        public NullableBool IsPropagated
        {
            get
            {
                if (_isPropagated == null)
                    _isPropagated = new NullableBool(false);
                return _isPropagated;
            }
            set { _isPropagated = value; }
        }

        //public bool IsSet
        //{
        //    get { return (Name.IsSet && Type.IsSet); }
        //}
        #endregion

        #region Methods
        #endregion
    }
}


text:
'use strict'

const path = require('path')
const shell = require('shelljs')

shell.set('-e')
shell.set('-v')

const rootPath = path.join(__dirname, '..')
const packagesPath = path.join(rootPath, 'packages')
const packageScriptsPath = path.join(packagesPath, 'package-scripts')
const createPackagePath = path.join(
	packagesPath,
	'create-package',
	'create-package.js'
)

shell.cd(rootPath)
shell.exec('node_modules/.bin/lerna bootstrap')

shell.cd(packageScriptsPath)
shell.cp('package.json', 'package.json.orig')

shell.cd(__dirname)
shell.exec('node replace-local-dependencies')

const npmPackOutput = shell.exec('npm pack ' + packageScriptsPath, {
	cwd: packageScriptsPath,
})
const bundlePath = path.join(packageScriptsPath, npmPackOutput.stdout.trim())

shell.exec('yarn cache clean')

shell.exec(
	`node ${createPackagePath} create-package-test --package-scripts ${bundlePath} --debug`,
	{ cwd: rootPath }
)

shell.cd(packageScriptsPath)
shell.rm('package.json')
shell.mv('package.json.orig', 'package.json')

shell.rm(bundlePath)


text:
echo "Building blog"
bundle exec jekyll build
echo "Deploying blog to s3"
s3_website push


text:
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5" />
    <title>DefaultSelenium.AddLocationStrategy Method</title>
    <xml>
    </xml>
    <link rel="stylesheet" type="text/css" href="MSDN.css" />

            An NDoc Documented Class Library

DefaultSelenium.AddLocationStrategy Method

Defines a new function for Selenium to locate elements on the page. For example, if you define the strategy "foo", and someone runs click("foo=blah"), we'll run your function, passing you the string "blah", and click on the element that your function returns, or throw an "Element not found" error if your function returns null. We'll pass three arguments to your function:

locator: the string the user passed in

inWindow: the currently selected window

inDocument: the currently selected document

 The function must return null if the element can't be found.

public void AddLocationStrategy(
   string strategyName,
   string functionDefinition
);

Parameters

          strategyName

the name of the strategy to define; this should use only letters [a-zA-Z] with no spaces or other punctuation.

          functionDefinition

a string defining the body of a function in JavaScript. For example:
return inDocument.getElementById(locator);

Implements

        ISelenium.AddLocationStrategy

See Also

        DefaultSelenium Class | Selenium Namespace


text:
package com.fpliu.newton.framework.security;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.security.KeyFactory;
import java.security.KeyStore;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.Signature;
import java.security.cert.Certificate;
import java.security.cert.CertificateFactory;
import java.security.spec.DSAPrivateKeySpec;
import java.security.spec.DSAPublicKeySpec;
import java.security.spec.RSAPrivateKeySpec;
import java.security.spec.RSAPublicKeySpec;

import javax.crypto.Cipher;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;

import com.fpliu.newton.base.DebugLog;

/**
 * RSA非对称加密和解密
 *
 * @author 792793182@qq.com 2014-09-28
 *
 */
public final class RSA {

	private static final String TAG = RSA.class.getSimpleName();

	private RSA() { }

	/**
	 * 加载KeyStore文件
	 * @param keyStoreFile       密钥库文件
	 * @param keyStorePassword   KeyStore文件的密码
	 */
	public static KeyStore loadKeySotre(File keyStoreFile, char[] keyStorePassword) {
		InputStream is = null;
		try {
			is = new FileInputStream(keyStoreFile);
			KeyStore keyStore = KeyStore.getInstance("JKS");
			keyStore.load(is, keyStorePassword);
			return keyStore;
		} catch (Exception e) {
			DebugLog.e(TAG, "loadKeySotre()", e);
		} finally {
			if (is != null) {
				try {
					is.close();
				} catch (IOException e) {
					DebugLog.e(TAG, "loadKeySotre()", e);
				}
			}
		}
		return null;
	}

	/**
	 * 从KeyStore文件中获取证书
	 * @param keyStoreFile       密钥库文件
	 * @param keyStorePassword   密钥库文件的密码
	 * @param alias              证书条目的别名
	 */
	public static Certificate getCertificatey(File keyStoreFile, char[] keyStorePassword, String alias) {
		KeyStore keyStore = loadKeySotre(keyStoreFile, keyStorePassword);
		if (keyStore != null) {
			try {
				return keyStore.getCertificate(alias);
			} catch (Exception e) {
				DebugLog.e(TAG, "getCertificatey()", e);
			}
		}
		return null;
	}

	/**
	 * 从证书中获取公钥
	 * @param certificate  证书
	 */
	public static PublicKey getPublicKey(Certificate certificate) {
		return certificate.getPublicKey();
	}

	/**
	 * 从X.509证书文件(*.cer)中获取公钥
	 * @param certificateFile  证书文件
	 */
	public static PublicKey getPublicKey(File certificateFile) {
		try {
			CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509");
			FileInputStream fileInputStream = new FileInputStream(certificateFile);
			Certificate certificate = certificateFactory.generateCertificate(fileInputStream);
			return certificate.getPublicKey();
		} catch (Exception e) {
			DebugLog.e(TAG, "getPublicKey()", e);
			return null;
		}
	}

	/**
	 * 从KeyStore文件中获取指定条目的私钥
	 * @param keyStoreFile       密钥库文件
	 * @param keyStorePassword   密钥库文件的密码
	 * @param alias              证书条目的别名
	 * @param aliasPassword      证书条目的密码
	 */
	public static PrivateKey getPrivateKey(File keyStoreFile, char[] keyStorePassword, String alias, char[] aliasPassword) {
		KeyStore keyStore = loadKeySotre(keyStoreFile, keyStorePassword);
		try {
			return (PrivateKey) keyStore.getKey(alias, aliasPassword);
		} catch (Exception e) {
			DebugLog.e(TAG, "getPrivateKey()", e);
			return null;
		}
	}

	/**
	 * 获取公钥的长度
	 * @param publicKey 公钥
	 * @return          公钥的长度
	 */
	public static int getLength(PublicKey publicKey) {
		try {
			// 获取算法
			String algorithm = publicKey.getAlgorithm();
			KeyFactory keyFactory = KeyFactory.getInstance(algorithm);
			BigInteger modulus = null;

			// 如果是RSA加密
			if ("RSA".equals(algorithm)) {
				RSAPublicKeySpec keySpec = (RSAPublicKeySpec) keyFactory
						.getKeySpec(publicKey, RSAPublicKeySpec.class);
				modulus = keySpec.getModulus();
			}
			// 如果是DSA加密
			else if ("DSA".equals(algorithm)) {
				DSAPublicKeySpec keySpec = (DSAPublicKeySpec) keyFactory
						.getKeySpec(publicKey, DSAPublicKeySpec.class);
				modulus = keySpec.getP();
			}
			// 转换为二进制,获取公钥长度
			return modulus.toString(2).length();
		} catch (Exception e) {
			DebugLog.e(TAG, "getLength()", e);
			return 0;
		}
	}

	/**
	 * 获取私钥的长度
	 * @param privateKey 私钥
	 * @return           私钥的长度
	 */
	public static int getLength(PrivateKey privateKey) {
		try {
			// 获取算法
			String algorithm = privateKey.getAlgorithm();
			KeyFactory keyFactory = KeyFactory.getInstance(algorithm);
			BigInteger modulus = null;

			// 如果是RSA加密
			if ("RSA".equals(algorithm)) {
				RSAPrivateKeySpec keySpec = (RSAPrivateKeySpec) keyFactory
						.getKeySpec(privateKey, RSAPrivateKeySpec.class);
				modulus = keySpec.getModulus();
			}
			// 如果是DSA加密
			else if ("DSA".equals(algorithm)) {
				DSAPrivateKeySpec keySpec = (DSAPrivateKeySpec) keyFactory
						.getKeySpec(privateKey, DSAPrivateKeySpec.class);
				modulus = keySpec.getP();
			}
			// 转换为二进制,获取公钥长度
			return modulus.toString(2).length();
		} catch (Exception e) {
			e.printStackTrace();
			return 0;
		}
	}

	/**
	 * 用公钥进行加密
	 * @param src       明文
	 * @param publicKey 公钥
	 * @return          加密后的数据
	 */
	public static byte[] encrypt(byte[] src, PublicKey publicKey) {
		if (src == null|| publicKey == null) {
			return null;
		}

		try {
			Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
			cipher.init(Cipher.ENCRYPT_MODE, publicKey);

			int totalLength = src.length;
			ByteArrayOutputStream out = new ByteArrayOutputStream();
			int offSet = 0;
			byte[] cache;
			int i = 0;
			// 对数据分段解密
			while (totalLength - offSet > 0) {
				if (totalLength - offSet > 117) {
					cache = cipher.doFinal(src, offSet, 117);
				} else {
					cache = cipher.doFinal(src, offSet, totalLength - offSet);
				}
				out.write(cache, 0, cache.length);
				i++;
				offSet = i * 117;
			}

			return out.toByteArray();
		} catch (Exception e) {
			DebugLog.e(TAG, "decrypt()", e);
			return null;
		}
	}

	/**
	 * 用私钥进行解密
	 * @param src        密文
	 * @param privateKey 私钥
	 * @return           解密后的数据
	 */
	public static byte[] decrypt(byte[] src, PrivateKey privateKey) {
		if (src == null|| privateKey == null) {
			return null;
		}

		try {
			Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
			cipher.init(Cipher.DECRYPT_MODE, privateKey);

			int totalLength = src.length;
			ByteArrayOutputStream out = new ByteArrayOutputStream();
			int offSet = 0;
			byte[] cache;
			int i = 0;
			// 对数据分段解密
			while (totalLength - offSet > 0) {
				if (totalLength - offSet > 128) {
					cache = cipher.doFinal(src, offSet, 128);
				} else {
					cache = cipher.doFinal(src, offSet, totalLength - offSet);
				}
				out.write(cache, 0, cache.length);
				i++;
				offSet = i * 128;
			}

			return out.toByteArray();
		} catch (Exception e) {
			DebugLog.e(TAG, "decrypt()", e);
			return null;
		}
	}

	/**
	 * 用证书文件中的公钥加密文件
	 * @param srcFile           要加密的文件
	 * @param desFile           加密后的文件
	 * @param certificateFile   证书文件
	 * @return                  是否成功
	 */
	public static boolean encrypt(File srcFile, File desFile, File certificateFile) {
		if (srcFile == null || desFile == null || certificateFile == null) {
			return false;
		}

		PublicKey publicKey = getPublicKey(certificateFile);
		if (publicKey == null) {
			return false;
		}

		//Key的长度单位是bit
		int keyLength = getLength(publicKey);
		//能够加密的最大字节数
		int bufferLength = keyLength / 8 - 11;

		FileInputStream fis = null;
		FileOutputStream fos = null;
		try {
			fis = new FileInputStream(srcFile);
			fos = new FileOutputStream(desFile);

			Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
			cipher.init(Cipher.ENCRYPT_MODE, publicKey);

			byte[] cache = null;
			byte[] buffer = new byte[bufferLength];
			while (true) {
				int readCount = fis.read(buffer);
				DebugLog.d(TAG, "readCount = " + readCount);
				if (readCount == -1) {
					break;
				} else {
					cache = cipher.doFinal(buffer, 0, readCount);
					fos.write(cache);
				}
			}
			return true;
		} catch (Exception e) {
			DebugLog.e(TAG, "encrypt()", e);
			return false;
		} finally {
			if (fis != null) {
				try {
					fis.close();
				} catch (IOException e) {
					DebugLog.e(TAG, "encrypt()", e);
				}
			}
			if (fos != null) {
				try {
					fos.close();
				} catch (IOException e) {
					DebugLog.e(TAG, "encrypt()", e);
				}
			}
		}
	}

	/**
	 * 用KeyStore文件中的私钥解密文件
	 * @param srcFile            要解密的文件
	 * @param desFile            解密后的文件
	 * @param keyStoreFile       密钥库文件
	 * @param keyStorePassword   密钥库文件的密码
	 * @param alias              证书条目的别名
	 * @param aliasPassword      证书条目的密码
	 * @return                   是否成功
	 */
	public static boolean decrypt(File srcFile, File desFile, File keyStoreFile, char[] keyStorePassword, String alias, char[] aliasPassword) {
		if (srcFile == null || desFile == null || keyStoreFile == null) {
			return false;
		}

		PrivateKey privateKey = getPrivateKey(keyStoreFile, keyStorePassword, alias, aliasPassword);
		if (privateKey == null) {
			return false;
		}

		//Key的长度单位是bit
		int keyLength = getLength(privateKey);
		//能够加密的最大字节数
		int bufferLength = keyLength / 8;

		FileInputStream fis = null;
		FileOutputStream fos = null;
		try {
			fis = new FileInputStream(srcFile);
			fos = new FileOutputStream(desFile);

			Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
			cipher.init(Cipher.DECRYPT_MODE, privateKey);

			byte[] cache = null;
			byte[] buffer = new byte[bufferLength];
			while (true) {
				int readCount = fis.read(buffer);
				DebugLog.d(TAG, "readCount = " + readCount);
				if (readCount == -1) {
					break;
				} else {
					cache = cipher.doFinal(buffer, 0, readCount);
					fos.write(cache);
				}
			}
			return true;
		} catch (Exception e) {
			DebugLog.e(TAG, "encrypt()", e);
			return false;
		} finally {
			if (fis != null) {
				try {
					fis.close();
				} catch (IOException e) {
					DebugLog.e(TAG, "encrypt()", e);
				}
			}
			if (fos != null) {
				try {
					fos.close();
				} catch (IOException e) {
					DebugLog.e(TAG, "encrypt()", e);
				}
			}
		}
	}

	/**
	 * 使用私钥对数据进行签名
	 * @param data        要签名的数据
	 * @param privateKey  私钥
	 * @return            签名后,并Base64编码的数据
	 */
	public static String sign(byte[] data, PrivateKey privateKey) {
		try {
			Signature signature = Signature.getInstance("MD5withRSA");
			signature.initSign(privateKey);
			signature.update(data);
			return Base64.encode(signature.sign());
		} catch (Exception e) {
			DebugLog.e(TAG, "sign()", e);
			return "";
		}
	}

	/**
	 * 使用公钥对数据的签名进行验证
	 * @param data      签名的数据
	 * @param publicKey 公钥
	 * @param sign      签名,Base64编码
	 * @return          是否验证通过
	 */
	public static boolean verify(byte[] data, PublicKey publicKey, String sign) {
		try {
			Signature signature = Signature.getInstance("MD5withRSA");
			signature.initVerify(publicKey);
			signature.update(data);
			return signature.verify(Base64.decode(sign.getBytes()));
		} catch (Exception e) {
			DebugLog.e(TAG, "verify()", e);
			return false;
		}
	}

	/**
	 * Android特有的
	 * @param context
	 * @return
	 */
	public static android.content.pm.Signature getAPKSignature(Context context) {
		PackageManager pm = context.getPackageManager();
		try {
			PackageInfo packageInfo = pm.getPackageInfo(context.getPackageName(), PackageManager.GET_SIGNATURES);
			android.content.pm.Signature[] signatures = packageInfo.signatures;
			return signatures[0];
		} catch (Exception e) {
			DebugLog.e(TAG, "verify()", e);
			return null;
		}
	}
}


text:
"""Sunstone

Begins the DHCP server process
"""
import SocketServer

from DHCPHandler import DHCPHandler

def main():
    """Begins a socketserver listening on port 67"""
#    s = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM)
#    s.bind(('', 67))
#    m = s.recvfrom(1024)
#    print(m)
    host, port = "", 67
    server = SocketServer.UDPServer((host, port), DHCPHandler)
    server.serve_forever()

if __name__ == "__main__":
    main()


text:
<?php

/**
 * @author:  Gabriel BONDAZ <gabriel.bondaz@idci-consulting.fr>
 * @license: MIT
 */

namespace IDCI\Bundle\SimpleMetadataBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type as Types;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class MetadataType extends AbstractType
{
    /**
     * {@inheritdoc}
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        if (!isset($options['namespace'])) {
            $builder->add('namespace');
        } else {
            $builder->add('namespace', Types\HiddenType::class, array('data' => $options['namespace']));
        }

        $builder
            ->add('key')
        ;

        if (!$options['hide_value_field']) {
            $builder->add('value');
        } else {
            $builder->add('value', Types\HiddenType::class, array(
                'data' => $options['hidden_value_default_data'],
            ));
        }
    }

    /**
     * {@inheritdoc}
     */
    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver
            ->setDefaults(array(
                'data_class' => 'IDCI\Bundle\SimpleMetadataBundle\Entity\Metadata',
                'hide_value_field' => false,
                'hidden_value_default_data' => true,
            ))
            ->setDefined('namespace')
            ->setAllowedTypes('hide_value_field', array('bool'))
        ;
    }

    /**
     * {@inheritdoc}
     *
     * @deprecated
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $this->configureOptions($resolver);
    }

    /**
     * {@inheritdoc}
     */
    public function getBlockPrefix()
    {
        return 'idci_bundle_simplemetadatabundle_metadatatype';
    }

    /**
     * {@inheritdoc}
     *
     * @deprecated
     */
    public function getName()
    {
        return $this->getBlockPrefix();
    }
}


text:
<?xml version="1.0"?>
<!--
PHPUnit configuration file to run Chippyash\Matrix tests
-->

<!--
Additional items for phpunit section
printerFile="/path/to/ResultPrinter.php"
testSuiteLoaderFile="/path/to/StandardTestSuiteLoader.php"
-->
<phpunit
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/3.7/phpunit.xsd"
         backupGlobals="true"
         backupStaticAttributes="false"
         bootstrap="./vendor/autoload.php"
         cacheTokens="false"
         colors="false"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         forceCoversAnnotation="false"
         mapTestClassNameToCoveredClassName="false"
         printerClass="PHPUnit_TextUI_ResultPrinter"
         processIsolation="false"
         stopOnError="false"
         stopOnFailure="false"
         stopOnIncomplete="false"
         stopOnSkipped="false"
         timeoutForSmallTests="1"
         timeoutForMediumTests="10"
         timeoutForLargeTests="60"
         verbose="false">

    <testsuites>
        <testsuite name="Chippyash/Matrix Test Suite">
            <directory phpVersion="5.4.0" phpVersionOperator=">=">./test/src/</directory>
        </testsuite>
    </testsuites>
    <!--
     ! The <filter> element and its children can be used to configure the
     ! blacklist and whitelist for the code coverage reporting.
     !-->
    <filter>
        <whitelist processUncoveredFilesFromWhitelist="true">
            <directory suffix=".php">./src</directory>
            <exclude>
            </exclude>
        </whitelist>
        <blacklist>
            <directory>./vendor</directory>
            <!-- don't cover interfaces- nothing to test! -->
            <file>./src/Chippyash/BuilderPattern/*Interface.php</file>
            <!-- don't cover exceptions - banal! -->
            <directory>./src/Chippyash/BuilderPattern/Exceptions</directory>
        </blacklist>
    </filter>

    <logging>
        <log type="coverage-clover" target="./build/logs/clover.xml"/>
    </logging>
</phpunit>


text:
(function ($, window, document) {
	'use strict';

	/**
	 * Double Tap To Go [http://osvaldas.info/drop-down-navigation-responsive-and-touch-friendly]
	 * By: Osvaldas Valutis [http://www.osvaldas.info]
	 * License: MIT
	 */
	$.fn.doubleTapToGo = function () {
		if ('ontouchstart' in window) {
			this.each(function () {
				var curItem = false;

				$(this).on('click', function (event) {
					var item = $(this);

					if (item[0] !== curItem[0]) {
						event.preventDefault();
						curItem = item;
					}
				});

				$(document).on('click', function (event) {
					var resetItem = true,
						parents = $(event.target).parents();

					for (var i = 0; i < parents.length; i++) {
						if (parents[i] === curItem[0]) {
							resetItem = false;
						}
					}
					if (resetItem) {
						curItem = false;
					}
				});
			});
		}

		return this;
	};

	/**
	 * This function works if the element, or its parent, have been hidden via JavaScript, and can either
	 * retrieve inner or outer dimensions as well as returning the offset values. The function is called
	 * directly on the object and will insert a clone just after the original element making it possible
	 * for the clone to maintain inherited dimensions.
	 *
	 * @param outer
	 * @returns {*}
	 *
	 * element width: $(ELEMENT).getRealDimensions().width;
	 * element outerWidth: $(ELEMENT).getRealDimensions(true).width;
	 * element height: $(ELEMENT).getRealDimensions().height;
	 * element outerHeight: $(ELEMENT).getRealDimensions(true).height;
	 * element offsetTop: $(ELEMENT).getRealDimensions().offsetTop;
	 * element offsetLeft: $(ELEMENT).getRealDimensions().offsetLeft;
	 */
	$.fn.getRealDimensions = function (outer) {
		var $this = $(this);

		if ($this.length === 0) {
			return false;
		}

		var $clone = $this.clone().css(
			{
				'display': 'block',
				'visibility': 'hidden'
			}
		).insertAfter($this);

		var result = {
			width: (outer) ? $clone.outerWidth() : $clone.innerWidth(),
			height: (outer) ? $clone.outerHeight() : $clone.innerHeight(),
			offsetTop: $clone.offset().top,
			offsetLeft: $clone.offset().left
		};

		$clone.remove();
		return result;
	};

	/**
	 * This function will check if navigation elements will be rendered outside
	 * of the visible area. If they will be, a class is added to the parent
	 * element which will change the render direction. You can pass a jQuery
	 * object as the `container` parameter to have the visible area set to
	 * something other than the documentElement.
	 *
	 * @param container
	 */
	$.fn.setOffsetDirection = function (container) {
		var triggerElement = $(this);

		triggerElement.on('mouseenter', function (e) {
			var parentElement = $(this),
				childElement = parentElement.find('ul').first(),
				grandchildElement = childElement.find('ul').first(),
				childOffsetWidth = childElement.offset().left + childElement.width(),
				documentWidth = container ? container.outerWidth() : document.documentElement.clientWidth;

			if (grandchildElement) {
				childOffsetWidth = childOffsetWidth + grandchildElement.getRealDimensions().width;
			}

			var isEntirelyVisible = (childOffsetWidth <= documentWidth);

			if (!isEntirelyVisible) {
				//console.log('NOT In the viewport!');
				parentElement.addClass('is-off-screen');
			}
			else {
				//console.log('In the viewport!');
				parentElement.removeClass('is-off-screen');
			}
		});
		return this;
	};

	/**
	 * This function is the compiled call for all the functions contained in this extension. You can pass a jQuery
	 * object as the `container` parameter to have the visible area set to something other than the documentElement.
	 *
	 * Example: $(ELEMENT).dropDownNavigation();
	 *          $(ELEMENT).dropDownNavigation($(CONTAINER_ELEMENT));
	 *
	 * @param container
	 */
	$.fn.dropDownNavigation = function (container) {
		return this.doubleTapToGo().setOffsetDirection(container);
	};
})(jQuery, window, document);


text:
package org.thinkhub.gateway.oauth.util;

import org.junit.Assert;
import org.junit.Test;
import org.thinkinghub.gateway.util.RegexUtil;

public class RegexUtilTest {
	@Test
	public void isProperUrl_TestWithHttp(){
		String url = "http://abc.com.hk/abc/a.json";
		Assert.assertTrue(RegexUtil.isProperUrl(url));
	}

	@Test
	public void isProperUrl_TestWithHttps(){
		String url = "https://abc.com.hkhkaaaaaaaaaa";
		Assert.assertTrue(RegexUtil.isProperUrl(url));
	}

	@Test
	public void isProperUrl_TestWithSpace(){
		String url = "https://abc.com.hk/ab. cd/b";
		Assert.assertTrue(RegexUtil.isProperUrl(url));
	}

	@Test
	public void isProperUrl_TestWithNonUrl(){
		String url = "https://abc.com.hk/+/b";
		Assert.assertFalse(RegexUtil.isProperUrl(url));
	}
}


text:
require "spec_helper"

describe OpenXml::DrawingML::Properties::UnderlineText do
  include ValuePropertyTestMacros

  it_should_use tag: :uLnTx, name: "underline_text", value: true

  with_value(true) do
    it_should_work
    it_should_output "<a:uLnTx/>"
  end

  with_value(false) do
    it_should_work
    it_should_output ""
  end
end


text:
.class public Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$CollectionItemInfoCompat;
.super Ljava/lang/Object;
.source "AccessibilityNodeInfoCompat.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x9
    name = "CollectionItemInfoCompat"
.end annotation

# instance fields
.field private final mInfo:Ljava/lang/Object;

# direct methods
.method private constructor <init>(Ljava/lang/Object;)V
    .registers 2
    .param p1, "info"    # Ljava/lang/Object;

    .prologue
    .line 427
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 428
    iput-object p1, p0, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$CollectionItemInfoCompat;->mInfo:Ljava/lang/Object;

    .line 429
    return-void
.end method

.method synthetic constructor <init>(Ljava/lang/Object;Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$1;)V
    .registers 3
    .param p1, "x0"    # Ljava/lang/Object;
    .param p2, "x1"    # Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$1;

    .prologue
    .line 412
    invoke-direct {p0, p1}, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$CollectionItemInfoCompat;-><init>(Ljava/lang/Object;)V

    return-void
.end method

.method static synthetic access$300(Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$CollectionItemInfoCompat;)Ljava/lang/Object;
    .registers 2
    .param p0, "x0"    # Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$CollectionItemInfoCompat;

    .prologue
    .line 412
    iget-object v0, p0, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$CollectionItemInfoCompat;->mInfo:Ljava/lang/Object;

    return-object v0
.end method

.method public static obtain(IIIIZZ)Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$CollectionItemInfoCompat;
    .registers 14
    .param p0, "rowIndex"    # I
    .param p1, "rowSpan"    # I
    .param p2, "columnIndex"    # I
    .param p3, "columnSpan"    # I
    .param p4, "heading"    # Z
    .param p5, "selected"    # Z

    .prologue
    .line 423
    new-instance v7, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$CollectionItemInfoCompat;

    # getter for: Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat;->IMPL:Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$AccessibilityNodeInfoImpl;
    invoke-static {}, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat;->access$000()Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$AccessibilityNodeInfoImpl;

    move-result-object v0

    move v1, p0

    move v2, p1

    move v3, p2

    move v4, p3

    move v5, p4

    move v6, p5

    invoke-interface/range {v0 .. v6}, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$AccessibilityNodeInfoImpl;->obtainCollectionItemInfo(IIIIZZ)Ljava/lang/Object;

    move-result-object v0

    invoke-direct {v7, v0}, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$CollectionItemInfoCompat;-><init>(Ljava/lang/Object;)V

    return-object v7
.end method

# virtual methods
.method public getColumnIndex()I
    .registers 3

    .prologue
    .line 432
    # getter for: Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat;->IMPL:Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$AccessibilityNodeInfoImpl;
    invoke-static {}, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat;->access$000()Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$AccessibilityNodeInfoImpl;

    move-result-object v0

    iget-object v1, p0, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$CollectionItemInfoCompat;->mInfo:Ljava/lang/Object;

    invoke-interface {v0, v1}, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$AccessibilityNodeInfoImpl;->getCollectionItemColumnIndex(Ljava/lang/Object;)I

    move-result v0

    return v0
.end method

.method public getColumnSpan()I
    .registers 3

    .prologue
    .line 436
    # getter for: Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat;->IMPL:Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$AccessibilityNodeInfoImpl;
    invoke-static {}, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat;->access$000()Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$AccessibilityNodeInfoImpl;

    move-result-object v0

    iget-object v1, p0, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$CollectionItemInfoCompat;->mInfo:Ljava/lang/Object;

    invoke-interface {v0, v1}, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$AccessibilityNodeInfoImpl;->getCollectionItemColumnSpan(Ljava/lang/Object;)I

    move-result v0

    return v0
.end method

.method public getRowIndex()I
    .registers 3

    .prologue
    .line 440
    # getter for: Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat;->IMPL:Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$AccessibilityNodeInfoImpl;
    invoke-static {}, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat;->access$000()Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$AccessibilityNodeInfoImpl;

    move-result-object v0

    iget-object v1, p0, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$CollectionItemInfoCompat;->mInfo:Ljava/lang/Object;

    invoke-interface {v0, v1}, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$AccessibilityNodeInfoImpl;->getCollectionItemRowIndex(Ljava/lang/Object;)I

    move-result v0

    return v0
.end method

.method public getRowSpan()I
    .registers 3

    .prologue
    .line 444
    # getter for: Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat;->IMPL:Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$AccessibilityNodeInfoImpl;
    invoke-static {}, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat;->access$000()Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$AccessibilityNodeInfoImpl;

    move-result-object v0

    iget-object v1, p0, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$CollectionItemInfoCompat;->mInfo:Ljava/lang/Object;

    invoke-interface {v0, v1}, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$AccessibilityNodeInfoImpl;->getCollectionItemRowSpan(Ljava/lang/Object;)I

    move-result v0

    return v0
.end method

.method public isHeading()Z
    .registers 3

    .prologue
    .line 448
    # getter for: Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat;->IMPL:Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$AccessibilityNodeInfoImpl;
    invoke-static {}, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat;->access$000()Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$AccessibilityNodeInfoImpl;

    move-result-object v0

    iget-object v1, p0, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$CollectionItemInfoCompat;->mInfo:Ljava/lang/Object;

    invoke-interface {v0, v1}, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$AccessibilityNodeInfoImpl;->isCollectionItemHeading(Ljava/lang/Object;)Z

    move-result v0

    return v0
.end method

.method public isSelected()Z
    .registers 3

    .prologue
    .line 452
    # getter for: Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat;->IMPL:Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$AccessibilityNodeInfoImpl;
    invoke-static {}, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat;->access$000()Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$AccessibilityNodeInfoImpl;

    move-result-object v0

    iget-object v1, p0, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$CollectionItemInfoCompat;->mInfo:Ljava/lang/Object;

    invoke-interface {v0, v1}, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$AccessibilityNodeInfoImpl;->isCollectionItemSelected(Ljava/lang/Object;)Z

    move-result v0

    return v0
.end method


text: export LOCALE_ARCHIVE="@out@/lib/locale/locale-archive"


text:
@interface KKView () <UITextFieldDelegate> {
@private
    BOOL isInitialState;
    BOOL isValidState;
}
@end

@implementation KKView

@synthesize innerView, opaqueOverGradientView, cardNumberField,
    cardBLZField, placeholderView, delegate;

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setup];
    }
    return self;
}

-(void)dealloc {
    lut_cleanup();
}

- (void)setup
{
    int retval;
    NSString * resourcePath = [[NSBundle mainBundle] resourcePath];
    NSString * lutPath = [resourcePath stringByAppendingPathComponent:@"blz.lut2"];

    if ((retval = lut_init([lutPath UTF8String], 5, 0)) != OK)
    {
        NSLog(@"lut_init: %@", [[NSString alloc] initWithUTF8String:kto_check_retval2txt(retval)]);
    }

    //retval = kto_check_blz("12070024", "3193422");
    retval = kto_check_blz("12070024", "");
    NSLog(@"kto_check_blz: %@", [[NSString alloc] initWithUTF8String:kto_check_retval2txt(retval)]);

    isInitialState = YES;
    isValidState   = NO;

    self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, 290, 46);
    self.backgroundColor = [UIColor clearColor];

    UIImageView *backgroundImageView = [[UIImageView alloc] initWithFrame:self.bounds];
    backgroundImageView.image = [[UIImage imageNamed:@"textfield"]
                                 resizableImageWithCapInsets:UIEdgeInsetsMake(0, 8, 0, 8)];
    [self addSubview:backgroundImageView];

    self.innerView = [[UIView alloc] initWithFrame:CGRectMake(40, 12, self.frame.size.width - 40, 20)];
    self.innerView.clipsToBounds = YES;

    [self setupPlaceholderView];
    [self setupCardBLZField];
    [self setupCardNumberField];

    [self.innerView addSubview:cardBLZField];

    UIImageView *gradientImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 12, 34)];
    gradientImageView.image = [UIImage imageNamed:@"gradient"];
    [self.innerView addSubview:gradientImageView];

    opaqueOverGradientView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 9, 34)];
    opaqueOverGradientView.backgroundColor = [UIColor colorWithRed:0.9686 green:0.9686
                                                              blue:0.9686 alpha:1.0000];
    opaqueOverGradientView.alpha = 0.0;
    [self.innerView addSubview:opaqueOverGradientView];

    [self addSubview:self.innerView];
    [self addSubview:placeholderView];

    [self stateCardBLZ];
}

- (void)setupPlaceholderView
{
    placeholderView = [[UIImageView alloc] initWithFrame:CGRectMake(12, 13, 32, 20)];
    placeholderView.backgroundColor = [UIColor clearColor];
    placeholderView.image = [UIImage imageNamed:@"placeholder"];

    CALayer *clip = [CALayer layer];
    clip.frame = CGRectMake(32, 0, 4, 20);
    clip.backgroundColor = [UIColor clearColor].CGColor;
    [placeholderView.layer addSublayer:clip];
}

- (void)setupCardBLZField
{
    cardBLZField = [[KKTextField alloc] initWithFrame:CGRectMake(12,0,170,20)];

    cardBLZField.delegate = self;

    cardBLZField.placeholder = @"Bankleitzahl";
    cardBLZField.keyboardType = UIKeyboardTypeNumberPad;
    cardBLZField.textColor = DarkGreyColor;
    cardBLZField.font = DefaultBoldFont;

    [cardBLZField.layer setMasksToBounds:YES];
}

- (void)setupCardNumberField
{
    cardNumberField = [[KKTextField alloc] initWithFrame:CGRectMake(12,0,170,20)];

    cardNumberField.delegate = self;

    cardNumberField.placeholder = @"Konto-Nr.";
    cardNumberField.keyboardType = UIKeyboardTypeNumberPad;
    cardNumberField.textColor = DarkGreyColor;
    cardNumberField.font = DefaultBoldFont;

    [cardNumberField.layer setMasksToBounds:YES];
}

- (void)stateCardBLZ
{
    if (!isInitialState) {
        // Animate left
        isInitialState = YES;

        [UIView animateWithDuration:0.05 delay:0.0 options:UIViewAnimationOptionCurveEaseInOut
                         animations:^{
                             opaqueOverGradientView.alpha = 0.0;
                         } completion:^(BOOL finished) {}];
        [UIView animateWithDuration:0.400
                              delay:0
                            options:(UIViewAnimationOptionCurveEaseInOut|UIViewAnimationOptionAllowUserInteraction)
                         animations:^{
                             cardNumberField.frame = CGRectMake(kKKViewCardNumberFieldStartX,
                                                             cardNumberField.frame.origin.y,
                                                             cardNumberField.frame.size.width,
                                                             cardNumberField.frame.size.height);
                             cardBLZField.frame = CGRectMake(12,
                                                                cardBLZField.frame.origin.y,
                                                                cardBLZField.frame.size.width,
                                                                cardBLZField.frame.size.height);
                         }
                         completion:^(BOOL completed) {
                             [cardNumberField removeFromSuperview];
                         }];
    }

    [self.cardBLZField becomeFirstResponder];
}

- (void)stateCardNumber
{
    [cardNumberField becomeFirstResponder];
}

- (void)stateMeta
{
    isInitialState = NO;

    CGSize cardBLZSize = [self.cardBLZ.formattedString sizeWithFont:DefaultBoldFont];
    CGSize lastGroupSize = [self.cardBLZ.lastGroup sizeWithFont:DefaultBoldFont];
    CGFloat frameX = self.cardBLZField.frame.origin.x - (cardBLZSize.width - lastGroupSize.width);

    [UIView animateWithDuration:0.05 delay:0.35 options:UIViewAnimationOptionCurveEaseInOut
                     animations:^{
                         opaqueOverGradientView.alpha = 1.0;
                     } completion:^(BOOL finished) {}];
    [UIView animateWithDuration:0.400 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
        cardNumberField.frame = CGRectMake(kKKViewCardNumberFieldEndX,
                                        cardNumberField.frame.origin.y,
                                        cardNumberField.frame.size.width,
                                        cardNumberField.frame.size.height);
        cardBLZField.frame = CGRectMake(frameX,
                                           cardBLZField.frame.origin.y,
                                           cardBLZField.frame.size.width,
                                           cardBLZField.frame.size.height);
    } completion:nil];

    [self addSubview:placeholderView];
    [self.innerView addSubview:cardNumberField];
    [cardNumberField becomeFirstResponder];
}

- (void)setPlaceholderViewImage:(UIImage *)image
{
    if(![placeholderView.image isEqual:image]) {
        __block __weak UIView *previousPlaceholderView = placeholderView;
        [UIView animateWithDuration:kKKViewPlaceholderViewAnimationDuration delay:0
                            options:UIViewAnimationOptionCurveEaseInOut
                         animations:^
         {
             placeholderView.layer.opacity = 0.0;
             placeholderView.layer.transform = CATransform3DMakeScale(1.2, 1.2, 1.2);
         } completion:^(BOOL finished) {
             [previousPlaceholderView removeFromSuperview];
         }];
        placeholderView = nil;

        [self setupPlaceholderView];
        placeholderView.image = image;
        placeholderView.layer.opacity = 0.0;
        placeholderView.layer.transform = CATransform3DMakeScale(0.8, 0.8, 0.8);
        [self insertSubview:placeholderView belowSubview:previousPlaceholderView];
        [UIView animateWithDuration:kKKViewPlaceholderViewAnimationDuration delay:0
                            options:UIViewAnimationOptionCurveEaseInOut
                         animations:^
         {
             placeholderView.layer.opacity = 1.0;
             placeholderView.layer.transform = CATransform3DIdentity;
         } completion:^(BOOL finished) {}];
    }
}

- (void)setPlaceholderToCardType
{
    KKCardBLZ *cardBLZ = [KKCardBLZ cardBLZWithString:cardBLZField.text];
    KKCardType cardType = [cardBLZ cardType];
    NSString* cardTypeName   = @"placeholder";

    switch (cardType) {
        case KKCardTypeDeutscheBank:
            cardTypeName = @"deutschebank";
            break;
        default:
            break;
    }

    [self setPlaceholderViewImage:[UIImage imageNamed:cardTypeName]];
}

- (void)textFieldDidBeginEditing:(UITextField *)textField
{
    [self setPlaceholderToCardType];

    if ([textField isEqual:cardBLZField] && !isInitialState) {
        [self stateCardNumber];
    }
}

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)replacementString
{
    if ([textField isEqual:cardBLZField]) {
        return [self cardBLZShouldChangeCharactersInRange:range replacementString:replacementString];
    }

    if ([textField isEqual:cardNumberField]) {
        return [self cardNumberFieldShouldChangeCharactersInRange:range replacementString:replacementString];
    }

    return YES;
}

- (BOOL)cardBLZShouldChangeCharactersInRange: (NSRange)range replacementString:(NSString *)replacementString
{
    NSString *resultString = [cardBLZField.text stringByReplacingCharactersInRange:range withString:replacementString];
    resultString = [KKTextField textByRemovingUselessSpacesFromString:resultString];
    KKCardBLZ *cardBLZ = [KKCardBLZ cardBLZWithString:resultString];

    if (replacementString.length > 0) {
        cardBLZField.text = [cardBLZ formattedStringWithTrail];
    } else {
        cardBLZField.text = [cardBLZ formattedString];
    }

    [self setPlaceholderToCardType];

    if ([cardBLZ isValid]) {
        [self textFieldIsValid:cardBLZField];
        [self stateMeta];

    //} else if ([cardNumber isValidLength] && ![cardBLZ isValidLuhn]) {
    //    [self textFieldIsInvalid:cardNumberField withErrors:YES];

    //} else if (![cardBLZ isValidLength]) {
    //    [self textFieldIsInvalid:cardNumberField withErrors:NO];
    }

    return NO;
}

- (void)checkValid
{
    if ([self isValid] && !isValidState) {
        isValidState = YES;

        if ([self.delegate respondsToSelector:@selector(paymentView:withCard:isValid:)]) {
            [self.delegate paymentView:self withCard:self.card isValid:YES];
        }

    } else if (![self isValid] && isValidState) {
        isValidState = NO;

        if ([self.delegate respondsToSelector:@selector(paymentView:withCard:isValid:)]) {
            [self.delegate paymentView:self withCard:self.card isValid:NO];
        }
    }
}

- (void)textFieldIsValid:(UITextField *)textField {
    textField.textColor = DarkGreyColor;
    [self checkValid];
}

- (BOOL)cardNumberFieldShouldChangeCharactersInRange: (NSRange)range replacementString:(NSString *)replacementString
{
    NSString *resultString = [cardNumberField.text stringByReplacingCharactersInRange:range withString:replacementString];
    resultString = [KKTextField textByRemovingUselessSpacesFromString:resultString];
    KKCardNumber *cardNumber = [KKCardNumber cardNumberWithString:resultString];
    KKCardType cardType = [[KKCardNumber cardNumberWithString:cardBLZField.text] cardType];

    //if ( ![cardNumber isPartiallyValidWithType:cardType] ) return NO;

    // Strip non-digits
    cardNumberField.text = [cardNumber string];

    //if ([cardNumber isValidWithType:cardType]) {
    //    [self textFieldIsValid:cardNumberField];
    //} else {
    //    [self textFieldIsInvalid:cardNumberField withErrors:NO];
    //}

    return NO;
}

- (void)kkTextFieldDidBackSpaceWhileTextIsEmpty:(KKTextField *)textField
{
    if (textField == self.cardBLZField)
        [self.cardNumberField becomeFirstResponder];
}

- (BOOL)isValid
{
    return [self.cardBLZ isValid] && [self.cardNumber isValid];
}

@end


text:
using System.Windows.Controls;

namespace SRNicoNico.Views {
    public partial class SearchResultEntry : UserControl {
        public SearchResultEntry() {
            InitializeComponent();
        }
    }
}


text:
<?php

namespace Collections;

interface Enumerator extends Collection, \Iterator {

}


text:
<?php

namespace AppBundle\Entity\Traits;

use AppBundle\Entity\User;

/**
 * ModifyAudit Trait, usable with PHP >= 5.4
 *
 */
trait ModifyAudit
{
    /**
     * Last modified by
     *
     * @JMS\Groups({"last-modified"})
     * @JMS\Type("AppBundle\Entity\User")
     * @var \AppBundle\Entity\User
     *
     */
    protected $lastModifiedBy;

    /**
     * Last modified on
     *
     * @JMS\Groups({"last-modified"})
     * @JMS\Type("DateTime")
     * @var \DateTime
     *
     */
    protected $lastModifiedOn;

    /**
     * @return \AppBundle\Entity\User
     */
    public function getLastModifiedBy()
    {
        return $this->lastModifiedBy;
    }

    /**
     * @param \AppBundle\Entity\User $lastModifiedBy
     *
     * @return $this
     */
    public function setLastModifiedBy(User $lastModifiedBy)
    {
        $this->lastModifiedBy = $lastModifiedBy;
        return $this;
    }

    /**
     * @return \DateTime
     */
    public function getLastModifiedOn()
    {
        return $this->lastModifiedOn;
    }

    /**
     * @param \DateTime $lastModifiedOn
     *
     * @return $this
     */
    public function setLastModifiedOn(\DateTime $lastModifiedOn)
    {
        $this->lastModifiedOn = $lastModifiedOn;
        return $this;
    }
}


text:
<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.tistory.bcuts</groupId>
	<artifactId>maven-spring3-webmvc-xml-helloworld</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>war</packaging>
	<name>maven-spring3-webmvc-xml-helloworld</name>
	<description>Maven – Spring 3 MVC Hello World Example (XML Configuration)</description>
	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
	</properties>
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.3</version>
				<configuration>
					<source>1.7</source>
					<target>1.7</target>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.eclipse.jetty</groupId>
				<artifactId>jetty-maven-plugin</artifactId>
				<version>9.2.11.v20150529</version>
				<configuration>
					<scanIntervalSeconds>450</scanIntervalSeconds>
					<webApp>
						<contextPath>/bcuts</contextPath>
					</webApp>
					<httpConnector>
						<port>18308</port>
					</httpConnector>
					<stopPort>19308</stopPort>
				    <stopKey>bcuts</stopKey>
				    <stopWait>150</stopWait>
				</configuration>
			</plugin>
		</plugins>
	</build>
	<dependencies>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-log4j12</artifactId>
			<version>1.7.21</version>
		</dependency>
		<dependency>
		    <groupId>log4j</groupId>
		    <artifactId>apache-log4j-extras</artifactId>
		    <version>1.2.17</version>
		</dependency>
		<dependency>
		    <groupId>org.slf4j</groupId>
		    <artifactId>jcl-over-slf4j</artifactId>
		    <version>1.7.21</version>
		</dependency>
		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
			<version>1.16.12</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
		    <groupId>org.springframework</groupId>
		    <artifactId>spring-test</artifactId>
		    <version>3.2.8.RELEASE</version>
		    <exclusions>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>javax.servlet-api</artifactId>
			<version>3.0.1</version>
			<scope>provided</scope>
		</dependency>
		<!--
		<dependency>
		    <groupId>javax.servlet.jsp.jstl</groupId>
		    <artifactId>javax.servlet.jsp.jstl-api</artifactId>
		    <version>1.2.1</version>
		    <scope>provided</scope>
		</dependency>
		<dependency>
		    <groupId>javax.servlet.jsp.jstl</groupId>
		    <artifactId>jstl</artifactId>
		    <version>1.2</version>
		</dependency>
		-->
		<!--
		<dependency>
		    <groupId>javax.servlet</groupId>
		    <artifactId>jstl</artifactId>
		    <version>1.2</version>
		</dependency>
		-->
		<dependency>
		    <groupId>jstl</groupId>
		    <artifactId>jstl</artifactId>
		    <version>1.2</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<version>3.2.8.RELEASE</version>
			<exclusions>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
		    <groupId>org.apache.commons</groupId>
		    <artifactId>commons-configuration2</artifactId>
		    <version>2.1</version>
		    <exclusions>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<!--
		<dependency>
		    <groupId>org.jasypt</groupId>
		    <artifactId>jasypt-spring31</artifactId>
		    <version>1.9.2</version>
		</dependency>
		 -->
		<dependency>
		    <groupId>org.jasypt</groupId>
		    <artifactId>jasypt-spring3</artifactId>
		    <version>1.9.2</version>
		</dependency>
		<dependency>
		    <groupId>org.jasypt</groupId>
		    <artifactId>jasypt-hibernate3</artifactId>
		    <version>1.9.2</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-webmvc</artifactId>
			<version>3.2.8.RELEASE</version>
		</dependency>
		<dependency>
		    <groupId>com.fasterxml.jackson.core</groupId>
		    <artifactId>jackson-databind</artifactId>
		    <version>2.8.5</version>
		</dependency>
		<dependency>
		    <groupId>com.fasterxml.jackson.core</groupId>
		    <artifactId>jackson-annotations</artifactId>
		    <version>2.8.5</version>
		</dependency>
		<dependency>
		    <groupId>org.springframework.data</groupId>
		    <artifactId>spring-data-jpa</artifactId>
		    <version>1.5.1.RELEASE</version>
		</dependency>
		<dependency>
		    <groupId>org.hibernate</groupId>
		    <artifactId>hibernate-entitymanager</artifactId>
		    <version>3.6.10.Final</version>
		</dependency>
		<dependency>
		    <groupId>org.apache.commons</groupId>
		    <artifactId>commons-dbcp2</artifactId>
		    <version>2.1.1</version>
		    <exclusions>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
		    <groupId>org.hsqldb</groupId>
		    <artifactId>hsqldb</artifactId>
		    <version>2.3.4</version>
		</dependency>
		<dependency>
		    <groupId>com.h2database</groupId>
		    <artifactId>h2</artifactId>
		    <version>1.4.193</version>
		</dependency>
		<dependency>
		    <groupId>org.apache.derby</groupId>
		    <artifactId>derby</artifactId>
		    <version>10.13.1.1</version>
		</dependency>
		<dependency>
		    <groupId>org.springframework.security</groupId>
		    <artifactId>spring-security-web</artifactId>
		    <version>3.2.5.RELEASE</version>
		</dependency>
		<dependency>
		    <groupId>org.springframework.security</groupId>
		    <artifactId>spring-security-config</artifactId>
		    <version>3.2.5.RELEASE</version>
		</dependency>
		<dependency>
		    <groupId>org.springframework.security</groupId>
		    <artifactId>spring-security-crypto</artifactId>
		    <version>3.2.5.RELEASE</version>
		</dependency>
		<dependency>
		    <groupId>org.springframework.security</groupId>
		    <artifactId>spring-security-acl</artifactId>
		    <version>3.2.5.RELEASE</version>
		</dependency>
		<dependency>
		    <groupId>commons-io</groupId>
		    <artifactId>commons-io</artifactId>
		    <version>2.5</version>
		</dependency>
		<dependency>
		    <groupId>org.webjars</groupId>
		    <artifactId>bootstrap</artifactId>
		    <version>3.3.6</version>
		</dependency>
	</dependencies>
</project>


text:
package schedule.cist;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectReader;
import schedule.models.ClassroomType;

import java.io.IOException;
import java.util.Collection;
import java.util.HashSet;

/**
 * Maps json responses to domain models.
 * @see UniversityObjectApi
 *
 * @author Vladyslav Dovhopol
 */
final class UniversityObjectJson {

    public Collection<ClassroomType> mapClassroomTypesToModels(String cistResponse) throws IOException {
        JsonNode jsonNode = new ObjectMapper().reader().readTree(cistResponse);
        JsonNode classroomTypesNode = jsonNode.get("auditory_types");
        ObjectReader typeReader = new ObjectMapper().readerFor(ClassroomType.class);

        Collection<ClassroomType> result = new HashSet<>();
        for (JsonNode typeNode : classroomTypesNode) {
            ClassroomType type = typeReader.readValue(typeNode);
            result.add(type);
        }
        return result;
    }
}


text:
[![][Build Status img]][Build Status]
[![][Coveralls img]][Coveralls]
[![][License img]][License]
[![][Maven Central img]][Maven Central]

[Build Status]:https://travis-ci.org/spals/appbuilder
[Build Status img]:https://travis-ci.org/spals/appbuilder.svg?branch=master

[Coveralls]:https://coveralls.io/github/spals/appbuilder?branch=master
[Coveralls img]:https://coveralls.io/repos/github/spals/appbuilder/badge.svg?branch=master

[License]:LICENSE
[License img]:https://img.shields.io/badge/license-BSD3-blue.svg

[Maven Central]:https://maven-badges.herokuapp.com/maven-central/net.spals.appbuilder/spals-appbuilder-bom
[Maven Central img]:https://maven-badges.herokuapp.com/maven-central/net.spals.appbuilder/spals-appbuilder-bom/badge.svg

# AppBuilder

A framework for building Java and Scala applications with micro-services

# Introduction

The Spals AppBuilder is a framework for constructing applications in Java or Scala using micro-services. Here are some important definitions which will help with understanding this concept:

- _micro-service_: A modular unit of functionality contained within a single Java or Scala class. In practice, micro-services are usually defined by an interface contract and implemented by a class.
- _module_: A group of related micro-services that are tested together and can be shared together within a build system.
- _application_: A container for a set of micro-services which together form a complete solution to a business problem.
- _web application_: An application which requires a web server. Usually, this is to support an HTTP-based API, such as [REST](https://en.wikipedia.org/wiki/Representational_state_transfer) or [GraphQL](https://en.wikipedia.org/wiki/GraphQL).
- _worker application_: An application which does not require a web server.

Note that a full business solution need not be limited to a single application. In some cases, multiple applications may be created and state shared among them via a syncronizing data store or an asynchronous API (such as one implemented over a pub-sub message queue).

The Spals AppBuilder framework attempts to achieve 3 basic goals (in no particular order):

1. Define and implement a set of micro-services that are common among many applications.
2. Make it easy to define and implement custom micro-services.
3. Make it easy to inject runtime configuration into both pre-defined and custom micro-services.

# Quickstart

This quickstart imagines that we would like to create a calculator application. A natural part of such an application would be a micro-service which performs basic arithmetic functions.

So we are going to define a `ArithmeticCalculator` micro-service to handle this piece of the application. We will then implement the `ArithmeticCalculator` micro-service.

_NOTE_: These are not complete examples. Some parts of the quickstart are left as an exercise for the reader. However, the Spals AppBuilder test suite contains the following complete examples:

- A minimally viable [Java application](https://github.com/spals/appbuilder/blob/master/app-examples/src/main/java/net/spals/appbuilder/app/examples/dropwizard/minimal/MinimalDropwizardWebApp.java)
- A sample [Java application](https://github.com/spals/appbuilder/blob/master/app-examples/src/main/java/net/spals/appbuilder/app/examples/dropwizard/sample/SampleDropwizardWebApp.java) which uses pre-defined micro-services, configures their default implementations, and defines custom micro-services
- A sample [Java application](https://github.com/spals/appbuilder/blob/master/app-examples/src/main/java/net/spals/appbuilder/app/examples/dropwizard/plugins/PluginsDropwizardWebApp.java) which uses pre-defined micro-services and configures their alternate implementations (plugins)
- A minimally viable [Scala application](https://github.com/spals/appbuilder/blob/master/app-examples/src/main/scala/net/spals/appbuilder/app/examples/finatra/minimal/MinimalFinatraWebApp.scala)
- A sample [Scala application](https://github.com/spals/appbuilder/blob/master/app-examples/src/main/scala/net/spals/appbuilder/app/examples/finatra/sample/SampleFinatraWebApp.scala)  which uses pre-defined micro-services, configures their default implementations, and defines custom micro-services
- A sample [Scala application](https://github.com/spals/appbuilder/blob/master/app-examples/src/main/scala/net/spals/appbuilder/app/examples/finatra/plugins/PluginsFinatraWebApp.scala) which uses pre-defined micro-services and configures their alternate implementations (plugins)

## Installation

All installation examples within this README show how to add Spals AppBuilder to a [Maven](http://maven.apache.org/) build. However, this is not a pre-requisite for using the AppBuilder framework. All Spals AppBuilder artifacts are published to Maven Central and should be able to be used with any build system which integrates with it.

Whether we're using Java or Scala, we'll want to include the Spals AppBuilder BOM which defines core pieces of the framework as well as all pre-defined micro-services:
```xml
<dependencyManagement>
    <dependencies>
        ...
        <dependency>
            <groupId>net.spals.appbuilder</groupId>
            <artifactId>spals-appbuilder-bom</artifactId>
            <version>${appbuilder.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
        ...
    </dependencies>
</dependencyManagement>
```

## Java

Spals AppBuilder integrates with [Dropwizard](http://www.dropwizard.io/1.1.0/docs/) to create Java web applications.

### Installation

In addition to the Spals AppBuilder BOM, we'll add the plugins specifically for Dropwizard:
```xml
<dependencies>
    <dependency>
        <groupId>net.spals.appbuilder.plugins</groupId>
        <artifactId>spals-appbuilder-app-dropwizard</artifactId>
        <version>${appbuilder.version}</version>
    </dependency>
</dependencies>
```

### Define a Micro-Service

Micro-service definitions are made via Java interface contracts.
```java
package com.example.calculator.arithmetic;

/**
* A mciro-service definition for an arthimetic calculator.
*/
public interface ArithmeticCalculator {
    double add(double a, double b);

    double divide(double a, double b);

    double multiply(double a, double b);

    double subtract(double a, double b);
}
```

### Implement a Micro-Service

Micro-services are implemented via Java classes.
```java
package com.example.calculator.arithmetic;

import net.spals.appbuilder.annotations.service.AutoBindSingleton;

/**
* A default implementation of the ArithmeticCalculator micro-service.
*/
@AutoBindSingleton(baseClass = ArithmeticCalculator.class)
class DefaultArithmeticCalculator implements ArithmeticCalculator {

    @Override
    public double add(final double a, final double b) {
        return a + b;
    }

    @Override
    public double divide(final double a, final double b) {
        return a / b;
    }

    ...
}
```

### Use Micro-Service

Let's expose our `ArithmeticCalculator` micro-service in a RESTful API endpoint.
```java
package com.example.calculator.api;

import com.google.inject.Inject;
import net.spals.appbuilder.annotations.service.AutoBindSingleton;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

@AutoBindSingleton
@Path("calculator")
@Produces(MediaType.TEXT_PLAIN)
public class CalculatorResource {

    private final ArithmeticCalculator arithmeticCalculator;

    @Inject
    DefaultPaymentService(final ArithmeticCalculator arithmeticCalculator) {
        this.arithmeticCalculator = arithmeticCalculator;
    }

    @GET
    @Path("add/{a}/{b}")
    public Response add(final double a, final double b) {
        final double result = arithmeticCalculator.add(a, b);
        return Response.ok(result).build();
    }

    @GET
    @Path("divide/{a}/{b}")
    public Response divide(final double a, final double b) {
        final double result = arithmeticCalculator.divide(a, b);
        return Response.ok(result).build();
    }

    ...
}
```

### Define Application

Finally, let's tie all of our micro-services together into a Dropwizard application.
```java
package com.example.calculator.app;

public class CalculatorWebApp extends Application<Configuration> {
    private static final Logger LOGGER = LoggerFactory.getLogger(CalculatorWebApp.class);

    private static final String APP_CONFIG_FILE_NAME = "config/calculator-app.yml";

    public static void main(final String[] args) throws Throwable {
        new CalculatorWebApp().run("server", APP_CONFIG_FILE_NAME);
    }

    private DropwizardWebApp.Builder webAppDelegateBuilder;
    private DropwizardWebApp webAppDelegate;

    @Override
    public void initialize(final Bootstrap<Configuration> bootstrap) {
        this.webAppDelegateBuilder = new DropwizardWebApp.Builder(bootstrap, LOGGER)
            .setServiceScan(new ServiceScan.Builder()
                // Have the Appbuilder framework scan the com.example.calculator
                // package for micro-services
                .addServicePackages("com.example.calculator")
                .build());
    }

    @Override
    public void run(final Configuration configuration, final Environment env) throws Exception {
        this.webAppDelegate = webAppDelegateBuilder.setEnvironment(env).build();
    }
}
```

## Scala

It is possible to translate the Dropwizard application code above into Scala, however the framework also integrates with [Finatra](https://twitter.github.io/finatra/) for more native Scala support.

### Installation

In addition to the Spals AppBuilder BOM, we'll add the plugins specifically for Finatra:
```xml
<dependencies>
    <dependency>
        <groupId>net.spals.appbuilder.plugins</groupId>
        <artifactId>spals-appbuilder-app-finatra</artifactId>
        <version>${appbuilder.version}</version>
    </dependency>
</dependencies>
```

### Define a Micro-Service

Micro-service definitions are made via Scala traits.
```scala
package com.example.calculator.arithmetic

/**
* A mciro-service definition for an arthimetic calculator.
*/
trait ArithmeticCalculator {
    def add(a: Double, b: Double): Double

    def divide(a: Double, b: Double): Double

    def multiply(a: Double, b: Double): Double

    def subtract(a: Double, b: Double): Double
}
```

### Implement a Micro-Service

Micro-services are implemented via Scala classes.
```scala
package com.example.calculator.arithmetic

import net.spals.appbuilder.annotations.service.AutoBindSingleton

/**
* A default implementation of the ArithmeticCalculator micro-service.
*/
@AutoBindSingleton(baseClass = classOf[ArithmeticCalculator])
private[arithmetic] class DefaultArithmeticCalculator extends ArithmeticCalculator {

    override def add(a: Double, b: Double): Double = a + b

    override def divide(a: Double, b: Double): Double = a / b

    ...
}
```

### Use Micro-Service

Let's expose our `ArithmeticCalculator` micro-service in a RESTful API endpoint.
```scala
package com.example.calculator.api

import com.google.inject.Inject
import com.twitter.finagle.http.Request
import com.twitter.finatra.http.Controller
import net.spals.appbuilder.annotations.service.AutoBindSingleton

@AutoBindSingleton
private[finatra] class CalculatorController @Inject() (
  arithmeticCalculator: ArithmeticCalculator
) extends Controller {

  get("/add/:a/:b") { request: Request =>
    val result = arithmeticCalculator.add(
      request.params("a").toDouble, request.params("b").toDouble)
    response.ok.body(result)
  }

  get("/divide/:a/:b") { request: Request =>
    val result = arithmeticCalculator.divide(
      request.params("a").toDouble, request.params("b").toDouble)
    response.ok.body(result)
  }

  ...
}

```

### Define Application

Finally, let's tie all of our micro-services together into a Finatra application.
```scala
package com.example.calculator.app

import net.spals.appbuilder.app.finatra.FinatraWebApp

object CalculatorWebAppMain extends CalculatorWebApp

class CalculatorWebApp extends FinatraWebApp {

  setServiceScan(new ServiceScan.Builder()
    // Have the Appbuilder framework scan the com.example.calculator
    // package for micro-services
    .addServicePackages("com.example.calculator")
    .build())
  build()
}

```

## Testing

AppBuilder includes a `MockApp` which allows you to mix real micro-services with mocked micro-services for testing purposes. Consider that we want to write a test for our calculator application which uses the full micro-service graph except that we wish to replace the `ArithmeticCalculator` service with a mocked implementation created in our test. Here's how that can be done using Mockito:

```java
import static org.mockito.Mockito.mock;

public class CalculatorAppTest {

    @Test
    public void testArithmeticCalculator() {
        // Build the full micro-service graph for the calculator application,
        // but substitute in a mocked ArithmeticCalculator service
        final MockApp app = new MockApp.Builder(MockAppTest.class)
            .addMockSingleton(mock(ArithmeticCalculator.class), ArithmeticCalculator.class)
            .setServiceScan(new ServiceScan.Builder()
                .addServicePackages("com.example.calculator")
                .build())
            .build();

        final Injector serviceInjector = app.getServiceInjector();
        final ArithmeticCalculator mockedCalculator = serviceInjector.getInstance(ArithmeticCalculator.class);

        ...
    }
```

AppBuilder also includes an inteface called `MockSingleton` which emulates the `@AutoBindSingleton` annotation. This allows testers to hand craft mock services:

```java
import net.spals.appbuilder.app.mock.MockSingleton;

public class MockArithmeticCalculator implements ArithmeticCalculator, MockSingleton<ArithmeticCalculator> {

    @Override
    public Class<ArithmeticCalculator> baseClass() {
        return ArithmeticCalculator.class;
    }

    ...
}
```

These hand crafted mock services can also be included in a `MockApp` instance:

```java
final MockApp app = new MockApp.Builder(MockAppTest.class)
    .addMockSingleton(new MockArithmeticCalculator())
    .setServiceScan(new ServiceScan.Builder()
        .addServicePackages("com.example.calculator")
        .build())
    .build();
```

## Notes

- It is important to keep package names organized because the `ServiceScan` works by scanning for package prefixes. It is recommended that all package names at least start with [com|org|net].[organizationName].[applicationName]
- Support for custom micro-services is complete, however certain predefined services are still in Beta. In particular, the asynchronous message producer and consumer services have not been fully tested.
- This README does not discuss all aspects of the Appbuilder framework. There is a TODO for a wiki which will go into greater detail about individual pieces of the framework


text:
package fr.intech.s5.candiesforall.android.service;

/**
 * Created by hugoz on 02/10/2017.
 */

public enum RequestID {
    Login,
    GetAll,
    GetByID,
    Submit
}


text:
Euler.register_language('ruby', Class.new do

  # Run the ruby solution
  def run solution
    `ruby #{file_path(solution)}`
  end

  # Copy the template into the solution's directory
  def init solution
    FileUtils.cp(template_path, file_path(solution))
  end

  private

    # Returns the path to the solution
    def file_path solution
      "#{solution.dir}/#{solution.problem.id}.rb"
    end

    # Returns the path to the ruby template
    def template_path
      "#{File.dirname(__FILE__)}/../templates/ruby.rb"
    end

end)


text:
#include <cstdlib>
#include <iostream>
#include <map>
#include <string>
#include <algorithm>

#define NORMAL 1
#define BONUS 2

using namespace std;

struct rulebook {
    const map<char, string> rules {
        {'a', "bc"},
        {'b', "a"},
        {'c', "aaa"}
    };
    const vector<char> abc {'0','1'};
    const vector<string> productions { "010","000", "1111" };
    const int n = 2;
};

bool rulesExist(string s, rulebook const &rules, int mode) {
    if (mode == NORMAL) {
            for (char c : s) {
                if ( rules.rules.find(c) == rules.rules.end() )
                    return false;
            }
        } else if (mode == BONUS) {
            for (char c : s) {
                if ( find(rules.abc.begin(), rules.abc.end(), c) == rules.abc.end())
                    return false;
        }
    }
    return true;
}

void process(string input, rulebook const &rules, int mode, int &nextProduction) {
    if (mode == NORMAL) {
        if (input.length() < 2) {
            cout << input << endl;
            return;
        }
        cout << input << endl;
        char currentChar = input.at(0);
        string result = input.substr(rules.n, string::npos );
        result = result.append( rules.rules.find(currentChar)->second );
        process(result, rules, mode, nextProduction);
    } else if (mode == BONUS) {
        if ( input == "" ) {
            return;
        }
        cout << input << endl;
        char currentChar = input.at(0);
        string result ="";
        if (input.length() > 1) {
           result = input.substr(1, string::npos);
        }
        if ( (currentChar - '0') ) {
            result.append( rules.productions.at(nextProduction) );
        }
        nextProduction++;
        if ( nextProduction >= rules.productions.size() )
            nextProduction = 0;
        process(result, rules, mode, nextProduction);
    }
}

int main(int argc, char** argv) {
    const rulebook rules;
    int mode = 0;
    int nextProduction = 0;
    string input = "";
    cin >> input;
    while ( mode == 0 ) {
        if( rulesExist(input, rules, NORMAL) ) {
            mode = NORMAL;
            break;
        } else if ( rulesExist(input, rules, BONUS) ) {
            mode = BONUS;
            break;
        }
        cout << "Invalid string." << endl;
        cin >> input;
    }
    process(input, rules, mode, nextProduction);
    return 0;
}


text:
static NSString * const PUSH_PARAMS_PUSH_ID = @"pushId";

//实现
@implementation PushPubAckRequestModel

#pragma mark -- 初始化
-(instancetype)init{
    return [super initWithMessageType:PushSocketMessageTypePuback];
}

#pragma mark -- 签名
-(NSDictionary *)toSign{
    _params = @{ PUSH_PARAMS_ACCOUNT : (self.account ? self.account : @""),
                 PUSH_PARAMS_DEVICE_ID : (self.deviceId ? self.deviceId : @""),
                 PUSH_PARAMS_PUSH_ID : (_pushId ? _pushId : @"")};
    return [super toSign];
}

@end


text:
project = u'PHP-FFMpeg'

# Tex info conf
texinfo_documents = [
  ('index', 'PHP-FFMpeg', u'PHP-FFMpeg Documentation',
   u'Romain Neutron - Alchemy', 'PHP-FFMpeg', 'One line description of project.',
   'Miscellaneous'),
]

# Man page conf
man_pages = [
    ('index', 'phpffmpeg', u'PHP-FFMpeg name Documentation',
     [u'Romain Neutron - Alchemy'], 1)
]

# Latex doc conf
latex_documents = [
  ('index', 'PHPFFMpeg.tex', u'PHP-FFMpeg Documentation',
   u'Romain Neutron - Alchemy', 'manual'),
]

# html help basename
htmlhelp_basename = 'PHPFFMpegdoc'

# version
version = '0.1'

# release
release = '0.1'

# Copyright Value  ex : copyright = u'2012, Alchemy'
copyright = u'2012, Romain Neutron - Alchemy'


text:
=============
Lovely PyRest
=============

Lovely Pyrest is an extension for
`Pyramid <http://www.pylonsproject.org/projects/pyramid/about>`_ to easily create
REST-Services. It provides functionallity to define service endpoints with the
following features:

Features
========

    - Sphinx extension to automatically generate documentation
    - Schema-validation based on `jsonschema <http://json-schema.org/>`_

Documentation
=============

Take a look at the `documentation <http://lovelysystems.github.io/lovely.pyrest/>`_
for usage information.

Installation
============

Installing via pip
------------------

To install lovely.pyrest via `pip <https://pypi.python.org/pypi/pip>`_ use
the following command::

    $ pip install lovely.pyrest

To update use::

    $ pip install -U lovely.pyrest

Installing via easy_install
---------------------------

If you prefer easy_install which is provided by
`setuptools <https://pypi.python.org/pypi/setuptools/1.1>`_
use the following command::

    $ easy_install lovely.pyrest

To update use::

    $ easy_install -U lovely.pyrest

Development Setup
=================

For development setup instructions see:

    DEVELOPER.rst