text:
package uuid

/****************
 * Date: 16/02/14
 * Time: 11:29 AM
 ***************/

import (
	"github.com/stretchr/testify/assert"
	"net/url"
	"testing"
)

const (
	generate = 10000
)

var (
	goLang     Name = "https://google.com/golang.org?q=golang"
	namespaces      = make(map[UUID]string)
)

func init() {
	namespaces[NamespaceX500] = "6ba7b814-9dad-11d1-80b4-00c04fd430c8"
	namespaces[NamespaceOID] = "6ba7b812-9dad-11d1-80b4-00c04fd430c8"
	namespaces[NamespaceURL] = "6ba7b811-9dad-11d1-80b4-00c04fd430c8"
	namespaces[NamespaceDNS] = "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
}

func TestNewV1(t *testing.T) {
	u := NewV1()

	assert.Equal(t, 1, u.Version(), "Expected correct version")
	assert.Equal(t, ReservedRFC4122, u.Variant(), "Expected correct variant")
	assert.True(t, parseUUIDRegex.MatchString(u.String()), "Expected string representation to be valid")
}

func TestNewV2(t *testing.T) {

}

func TestNewV3(t *testing.T) {
	u := NewV3(NamespaceURL, goLang)

	assert.Equal(t, 3, u.Version(), "Expected correct version")
	assert.Equal(t, ReservedRFC4122, u.Variant(), "Expected correct variant")
	assert.True(t, parseUUIDRegex.MatchString(u.String()), "Expected string representation to be valid")

	ur, _ := url.Parse(string(goLang))

	// Same NS same name MUST be equal
	u2 := NewV3(NamespaceURL, ur)
	assert.Equal(t, u, u2, "Expected UUIDs generated with same namespace and name to equal")

	// Different NS same name MUST NOT be equal
	u3 := NewV3(NamespaceDNS, ur)
	assert.NotEqual(t, u, u3, "Expected UUIDs generated with different namespace and same name to be different")

	// Same NS different name MUST NOT be equal
	u4 := NewV3(NamespaceURL, u)
	assert.NotEqual(t, u, u4, "Expected UUIDs generated with the same namespace and different names to be different")

	ids := []UUID{
		u, u2, u3, u4,
	}

	for j, id := range ids {
		i := NewV3(NamespaceURL, NewName(string(j), id))
		assert.NotEqual(t, id, i, "Expected UUIDs generated with the same namespace and different names to be different")
	}
}

func TestNewV4(t *testing.T) {
	u := NewV4()

	assert.Equal(t, 4, u.Version(), "Expected correct version")
	assert.Equal(t, ReservedRFC4122, u.Variant(), "Expected correct variant")
	assert.True(t, parseUUIDRegex.MatchString(u.String()), "Expected string representation to be valid")

}

func TestNewV5(t *testing.T) {
	u := NewV5(NamespaceURL, goLang)

	assert.Equal(t, 5, u.Version(), "Expected correct version")
	assert.Equal(t, ReservedRFC4122, u.Variant(), "Expected correct variant")
	assert.True(t, parseUUIDRegex.MatchString(u.String()), "Expected string representation to be valid")

	ur, _ := url.Parse(string(goLang))

	// Same NS same name MUST be equal
	u2 := NewV5(NamespaceURL, ur)
	assert.Equal(t, u, u2, "Expected UUIDs generated with same namespace and name to equal")

	// Different NS same name MUST NOT be equal
	u3 := NewV5(NamespaceDNS, ur)
	assert.NotEqual(t, u, u3, "Expected UUIDs generated with different namespace and same name to be different")

	// Same NS different name MUST NOT be equal
	u4 := NewV5(NamespaceURL, u)
	assert.NotEqual(t, u, u4, "Expected UUIDs generated with the same namespace and different names to be different")

	ids := []UUID{
		u, u2, u3, u4,
	}

	for j, id := range ids {
		i := NewV5(NamespaceURL, NewName(string(j), id))
		assert.NotEqual(t, i, id, "Expected UUIDs generated with the same namespace and different names to be different")

	}
}

func TestUUID_NewV1Bulk(t *testing.T) {
	for i := 0; i < generate; i++ {
		NewV1()
	}
}

func TestUUID_NewV3Bulk(t *testing.T) {
	for i := 0; i < generate; i++ {
		NewV3(NamespaceDNS, goLang)
	}
}

func TestUUID_NewV4Bulk(t *testing.T) {
	for i := 0; i < generate; i++ {
		NewV4()
	}
}

func TestUUID_NewV5Bulk(t *testing.T) {
	for i := 0; i < generate; i++ {
		NewV5(NamespaceDNS, goLang)
	}
}

func Test_EachIsUnique(t *testing.T) {
	s := 1024
	ids := make([]UUID, s)
	for i := 0; i < s; i++ {
		u := NewV1()
		ids[i] = u
		for j := 0; j < i; j++ {
			assert.NotEqual(t, u.Bytes(), ids[j].Bytes(), "Should not create the same V1 UUID")
		}
	}
	ids = make([]UUID, s)
	for i := 0; i < s; i++ {
		u := NewV3(NamespaceDNS, NewName(string(i), Name(goLang)))
		ids[i] = u
		for j := 0; j < i; j++ {
			assert.NotEqual(t, u.Bytes(), ids[j].Bytes(), "Should not create the same V3 UUID")

		}
	}
	ids = make([]UUID, s)
	for i := 0; i < s; i++ {
		u := NewV4()
		ids[i] = u
		for j := 0; j < i; j++ {
			assert.NotEqual(t, u.Bytes(), ids[j].Bytes(), "Should not create the same V4 UUID")
		}
	}
	ids = make([]UUID, s)
	for i := 0; i < s; i++ {
		u := NewV5(NamespaceDNS, NewName(string(i), Name(goLang)))
		ids[i] = u
		for j := 0; j < i; j++ {
			assert.NotEqual(t, u.Bytes(), ids[j].Bytes(), "Should not create the same V5 UUID")
		}
	}
}

func Test_NameSpaceUUIDs(t *testing.T) {
	for k, v := range namespaces {

		arrayId, _ := Parse(v)

		uuidId := new(uuid)
		uuidId.UnmarshalBinary(arrayId.Bytes())
		assert.Equal(t, v, arrayId.String())
		assert.Equal(t, v, k.String())
	}
}


text:
FROM biocontainers/biocontainers:vdebian-buster-backports_cv1
MAINTAINER biocontainers <biodocker@gmail.com>
LABEL    software="hl7" \
    base_image="biocontainers/biocontainers:vdebian-buster-backports_cv1" \
    container="hl7" \
    about.summary="Python library for parsing HL7 messages" \
    about.home="https://github.com/johnpaulett/python-hl7/" \
    software.version="0.3.4-3-deb-py2" \
    upstream.version="0.3.4" \
    version="1" \
    about.copyright="2009-2014 John Paulett <john@paulett.org>" \
    about.license="BSD-3-clause" \
    about.license_file="/usr/share/doc/hl7/copyright" \
    about.tags=""

USER root
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && (apt-get install -t buster-backports -y python-hl7 || apt-get install -y python-hl7) && apt-get clean && apt-get purge && rm -rf /var/lib/apt/lists/* /tmp/*
USER biodocker

redpajama_set_name: RedPajamaGithub


text:
// ****************************************************************
// Copyright 2008, Charlie Poole
// This is free software licensed under the NUnit license. You may
// obtain a copy of the license at http://nunit.org.
// ****************************************************************

using System;
using System.Collections;
#if NET_2_0
using System.Collections.Generic;
#endif
using System.Reflection;
using System.Text;
using NUnit.Core.Extensibility;

namespace NUnit.Core.Builders
{
	public class PairwiseStrategy : CombiningStrategy
	{
		internal class FleaRand
		{
			private const int FleaRandSize = 256;

			private uint b;
			private uint c;
			private uint d;
			private uint z;

			private uint[] m = new uint[FleaRandSize];
			private uint[] r = new uint[FleaRandSize];

			private uint q;

			public FleaRand(uint seed)
			{
				this.b = seed;
				this.c = seed;
				this.d = seed;
				this.z = seed;

				for (int i = 0; i < this.m.Length; i++)
				{
					this.m[i] = seed;
				}

				for (int i = 0; i < 10; i++)
				{
					this.Batch();
				}

				this.q = 0;
			}

			public uint Next()
			{
				if (this.q == 0)
				{
					this.Batch();
					this.q = (uint)this.r.Length - 1;
				}
				else
				{
					this.q--;
				}

				return this.r[this.q];
			}

			private void Batch()
			{
				uint a;
				uint b = this.b;
				uint c = this.c + (++this.z);
				uint d = this.d;

				for (int i = 0; i < this.r.Length; i++)
				{
					a = this.m[b % this.m.Length];
					this.m[b % this.m.Length] = d;
					d = (c << 19) + (c >> 13) + b;
					c = b ^ this.m[i];
					b = a + d;
					this.r[i] = c;
				}

				this.b = b;
				this.c = c;
				this.d = d;
			}
		}

		internal class FeatureInfo
		{
			public const string Names = "abcdefghijklmnopqrstuvwxyz";

			public readonly int Dimension;
			public readonly int Feature;

			public FeatureInfo(int dimension, int feature)
			{
				this.Dimension = dimension;
				this.Feature = feature;
			}

#if DEBUG
			public override string ToString()
			{
				return (this.Dimension + 1).ToString() + FeatureInfo.Names[this.Feature];
			}
#endif
		}

		internal class Tuple
		{
			private readonly ArrayList features = new ArrayList();

			public int Count
			{
				get
				{
					return this.features.Count;
				}
			}

			public FeatureInfo this[int index]
			{
				get
				{
					return (FeatureInfo)this.features[index];
				}
			}

			public void Add(FeatureInfo feature)
			{
				this.features.Add(feature);
			}

#if DEBUG
			public override string ToString()
			{
				StringBuilder sb = new StringBuilder();

				sb.Append('(');

				for (int i = 0; i < this.features.Count; i++)
				{
					if (i > 0)
					{
						sb.Append(' ');
					}

					sb.Append(this.features[i].ToString());
				}

				sb.Append(')');

				return sb.ToString();
			}
#endif
		}

		internal class TupleCollection
		{
			private readonly ArrayList tuples = new ArrayList();

			public int Count
			{
				get
				{
					return this.tuples.Count;
				}
			}

			public Tuple this[int index]
			{
				get
				{
					return (Tuple)this.tuples[index];
				}
			}

			public void Add(Tuple tuple)
			{
				this.tuples.Add(tuple);
			}

			public void RemoveAt(int index)
			{
				this.tuples.RemoveAt(index);
			}
		}

		internal class TestCase
		{
			public readonly int[] Features;

			public TestCase(int numberOfDimensions)
			{
				this.Features = new int[numberOfDimensions];
			}

			public bool IsTupleCovered(Tuple tuple)
			{
				for (int i = 0; i < tuple.Count; i++)
				{
					if (this.Features[tuple[i].Dimension] != tuple[i].Feature)
					{
						return false;
					}
				}

				return true;
			}

#if DEBUG
			public override string ToString()
			{
				StringBuilder sb = new StringBuilder();

				for (int i = 0; i < this.Features.Length; i++)
				{
					if (i > 0)
					{
						sb.Append(' ');
					}

					sb.Append(i + 1);
					sb.Append(FeatureInfo.Names[this.Features[i]]);
				}

				return sb.ToString();
			}
#endif
		}

		internal class TestCaseCollection : IEnumerable
		{
			private readonly ArrayList testCases = new ArrayList();

			public void Add(TestCase testCase)
			{
				this.testCases.Add(testCase);
			}

			public IEnumerator GetEnumerator()
			{
				return this.testCases.GetEnumerator();
			}

			public bool IsTupleCovered(Tuple tuple)
			{
				foreach (TestCase testCase in this.testCases)
				{
					if (testCase.IsTupleCovered(tuple))
					{
						return true;
					}
				}

				return false;
			}
		}

		internal class PairwiseTestCaseGenerator
		{
			private const int MaxTupleLength = 2;

			private readonly FleaRand random = new FleaRand(0);

			private readonly int[] dimensions;

			private readonly TupleCollection[][] uncoveredTuples;

			private readonly int[][] currentTupleLength;

			private readonly TestCaseCollection testCases = new TestCaseCollection();

			public PairwiseTestCaseGenerator(int[] dimensions)
			{
				this.dimensions = dimensions;

				this.uncoveredTuples = new TupleCollection[this.dimensions.Length][];

				for (int d = 0; d < this.uncoveredTuples.Length; d++)
				{
					this.uncoveredTuples[d] = new TupleCollection[this.dimensions[d]];

					for (int f = 0; f < this.dimensions[d]; f++)
					{
						this.uncoveredTuples[d][f] = new TupleCollection();
					}
				}

				this.currentTupleLength = new int[this.dimensions.Length][];

				for (int d = 0; d < this.dimensions.Length; d++)
				{
					this.currentTupleLength[d] = new int[this.dimensions[d]];
				}
			}

			public IEnumerable GetTestCases()
			{
				this.CreateTestCases();

				this.SelfTest();

				return this.testCases;
			}

			private void CreateTestCases()
			{
				while (true)
				{
					this.ExtendTupleSet();

					Tuple tuple = this.FindTupleToCover();

					if (tuple == null)
					{
						return;
					}

					TestCase testCase = this.FindGoodTestCase(tuple);

					this.RemoveTuplesCoveredBy(testCase);

					this.testCases.Add(testCase);
				}
			}

			private void ExtendTupleSet()
			{
				for (int d = 0; d < this.dimensions.Length; d++)
				{
					for (int f = 0; f < this.dimensions[d]; f++)
					{
						this.ExtendTupleSet(d, f);
					}
				}
			}

			private void ExtendTupleSet(int dimension, int feature)
			{
				// If tuples for [dimension][feature] already exists, it's no needs to add more tuples.
				if (this.uncoveredTuples[dimension][feature].Count > 0)
				{
					return;
				}

				// If maximum tuple length for [dimension][feature] is reached, it's no needs to add more tuples.
				if (this.currentTupleLength[dimension][feature] == MaxTupleLength)
				{
					return;
				}

				this.currentTupleLength[dimension][feature]++;

				int tupleLength = this.currentTupleLength[dimension][feature];

				if (tupleLength == 1)
				{
					Tuple tuple = new Tuple();

					tuple.Add(new FeatureInfo(dimension, feature));

					if (this.testCases.IsTupleCovered(tuple))
					{
						return;
					}

					this.uncoveredTuples[dimension][feature].Add(tuple);
				}
				else
				{
					for (int d = 0; d < this.dimensions.Length; d++)
					{
						for (int f = 0; f < this.dimensions[d]; f++)
						{
							Tuple tuple = new Tuple();
							tuple.Add(new FeatureInfo(d, f));

							if (tuple[0].Dimension == dimension)
							{
								continue;
							}

							tuple.Add(new FeatureInfo(dimension, feature));

							if (this.testCases.IsTupleCovered(tuple))
							{
								continue;
							}

							this.uncoveredTuples[dimension][feature].Add(tuple);
						}
					}
				}
			}

			private Tuple FindTupleToCover()
			{
				int tupleLength = MaxTupleLength;
				int tupleCount = 0;
				Tuple tuple = null;

				for (int d = 0; d < this.dimensions.Length; d++)
				{
					for (int f = 0; f < this.dimensions[d]; f++)
					{
						if (this.currentTupleLength[d][f] < tupleLength)
						{
							tupleLength = this.currentTupleLength[d][f];
							tupleCount = this.uncoveredTuples[d][f].Count;
							tuple = this.uncoveredTuples[d][f][0];
						}
						else
						{
							if (this.currentTupleLength[d][f] == tupleLength && this.uncoveredTuples[d][f].Count > tupleCount)
							{
								tupleCount = this.uncoveredTuples[d][f].Count;
								tuple = this.uncoveredTuples[d][f][0];
							}
						}
					}
				}

				return tuple;
			}

			private TestCase FindGoodTestCase(Tuple tuple)
			{
				TestCase bestTest = null;
				int bestCoverage = -1;

				for (int i = 0; i < 5; i++)
				{
					TestCase test = new TestCase(this.dimensions.Length);

					int coverage = this.CreateTestCase(tuple, test);

					if (coverage > bestCoverage)
					{
						bestTest = test;
						bestCoverage = coverage;
					}
				}

				return bestTest;
			}

			private int CreateTestCase(Tuple tuple, TestCase test)
			{
				// Create a random test case...
				for (int i = 0; i < test.Features.Length; i++)
				{
					test.Features[i] = (int)(this.random.Next() % this.dimensions[i]);
				}

				// ...and inject the tuple into it!
				for (int i = 0; i < tuple.Count; i++)
				{
					test.Features[tuple[i].Dimension] = tuple[i].Feature;
				}

				return this.MaximizeCoverage(test, tuple);
			}

			private int MaximizeCoverage(TestCase test, Tuple tuple)
			{
				int[] dimensionOrder = this.GetMutableDimensions(tuple);

				while (true)
				{
					bool progress = false;
					int totalCoverage = 1;

					// Scramble dimensions.
					for (int i = dimensionOrder.Length; i > 1; i--)
					{
						int j = (int)(this.random.Next() % i);
						int t = dimensionOrder[i - 1];
						dimensionOrder[i - 1] = dimensionOrder[j];
						dimensionOrder[j] = t;
					}

					// For each dimension that can be modified...
					for (int i = 0; i < dimensionOrder.Length; i++)
					{
						int d = dimensionOrder[i];

						ArrayList bestFeatures = new ArrayList();

						int bestCoverage = this.CountTuplesCovered(test, d, test.Features[d]);

						int bestTupleLength = this.currentTupleLength[d][test.Features[d]];

						// For each feature that can be modified, check if it can extend coverage.
						for (int f = 0; f < this.dimensions[d]; f++)
						{
							test.Features[d] = f;

							int coverage = this.CountTuplesCovered(test, d, f);

							if (this.currentTupleLength[d][f] < bestTupleLength)
							{
								progress = true;
								bestTupleLength = this.currentTupleLength[d][f];
								bestCoverage = coverage;
								bestFeatures.Clear();
								bestFeatures.Add(f);
							}
							else
							{
								if (this.currentTupleLength[d][f] == bestTupleLength && coverage >= bestCoverage)
								{
									if (coverage > bestCoverage)
									{
										progress = true;
										bestCoverage = coverage;
										bestFeatures.Clear();
									}

									bestFeatures.Add(f);
								}
							}
						}

						if (bestFeatures.Count == 1)
						{
							test.Features[d] = (int)bestFeatures[0];
						}
						else
						{
							test.Features[d] = (int)bestFeatures[(int)(this.random.Next() % bestFeatures.Count)];
						}

						totalCoverage += bestCoverage;
					}

					if (!progress)
					{
						return totalCoverage;
					}
				}
			}

			private int[] GetMutableDimensions(Tuple tuple)
			{
				bool[] immutableDimensions = new bool[this.dimensions.Length];

				for (int i = 0; i < tuple.Count; i++)
				{
					immutableDimensions[tuple[i].Dimension] = true;
				}

				ArrayList mutableDimensions = new ArrayList();

				for (int i = 0; i < this.dimensions.Length; i++)
				{
					if (!immutableDimensions[i])
					{
						mutableDimensions.Add(i);
					}
				}

				return (int[])mutableDimensions.ToArray(typeof(int));
			}

			private int CountTuplesCovered(TestCase test, int dimension, int feature)
			{
				int tuplesCovered = 0;

				TupleCollection tuples = this.uncoveredTuples[dimension][feature];

				for (int i = 0; i < tuples.Count; i++)
				{
					if (test.IsTupleCovered(tuples[i]))
					{
						tuplesCovered++;
					}
				}

				return tuplesCovered;
			}

			private void RemoveTuplesCoveredBy(TestCase testCase)
			{
				for (int d = 0; d < this.uncoveredTuples.Length; d++)
				{
					for (int f = 0; f < this.uncoveredTuples[d].Length; f++)
					{
						TupleCollection tuples = this.uncoveredTuples[d][f];

						for (int i = tuples.Count - 1; i >= 0; i--)
						{
							if (testCase.IsTupleCovered(tuples[i]))
							{
								tuples.RemoveAt(i);
							}
						}
					}
				}
			}

			private void SelfTest()
			{
				for (int d1 = 0; d1 < this.dimensions.Length - 1; d1++)
				{
					for (int d2 = d1 + 1; d2 < this.dimensions.Length; d2++)
					{
						for (int f1 = 0; f1 < this.dimensions[d1]; f1++)
						{
							for (int f2 = 0; f2 < this.dimensions[d2]; f2++)
							{
								Tuple tuple = new Tuple();
								tuple.Add(new FeatureInfo(d1, f1));
								tuple.Add(new FeatureInfo(d2, f2));

								if (!this.testCases.IsTupleCovered(tuple))
								{
									throw new ApplicationException("PairwiseStrategy self-test failed : Not all pairs are covered!");
								}
							}
						}
					}
				}
			}
		}

		public PairwiseStrategy(IEnumerable[] sources) : base(sources) { }

		public override IEnumerable GetTestCases()
		{
			ArrayList[] valueSet = CreateValueSet();
			int[] dimensions = CreateDimensions(valueSet);

			IEnumerable pairwiseTestCases = new PairwiseTestCaseGenerator(dimensions).GetTestCases();

#if NET_2_0
            List<ParameterSet> testCases = new List<ParameterSet>();
#else
            ArrayList testCases = new ArrayList();
#endif

			foreach (TestCase pairwiseTestCase in pairwiseTestCases)
			{
				object[] testData = new object[pairwiseTestCase.Features.Length];

				for (int i = 0; i < pairwiseTestCase.Features.Length; i++)
				{
					testData[i] = valueSet[i][pairwiseTestCase.Features[i]];
				}

                ParameterSet testCase = new ParameterSet();
                testCase.Arguments = testData;

				testCases.Add(testCase);
			}

			return testCases;
		}

		private ArrayList[] CreateValueSet()
		{
			ArrayList[] valueSet = new ArrayList[Sources.Length];

			for (int i = 0; i < valueSet.Length; i++)
			{
				ArrayList values = new ArrayList();

				foreach (object value in Sources[i])
				{
					values.Add(value);
				}

				valueSet[i] = values;
			}

			return valueSet;
		}

		private int[] CreateDimensions(ArrayList[] valueSet)
		{
			int[] dimensions = new int[valueSet.Length];

			for (int i = 0; i < valueSet.Length; i++)
			{
				dimensions[i] = valueSet[i].Count;
			}

			return dimensions;
		}
	}
}


text:
/*************************************************************************/
/*  audio_stream_player.cpp                                              */
/*************************************************************************/
/*                       This file is part of:                           */
/*                           GODOT ENGINE                                */
/*                      https://godotengine.org                          */
/*************************************************************************/
/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur.                 */
/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md)    */
/*                                                                       */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the       */
/* "Software"), to deal in the Software without restriction, including   */
/* without limitation the rights to use, copy, modify, merge, publish,   */
/* distribute, sublicense, and/or sell copies of the Software, and to    */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions:                                             */
/*                                                                       */
/* The above copyright notice and this permission notice shall be        */
/* included in all copies or substantial portions of the Software.       */
/*                                                                       */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
/*************************************************************************/

#include "audio_stream_player.h"

#include "core/engine.h"

void AudioStreamPlayer::_mix_to_bus(const AudioFrame *p_frames, int p_amount) {

	int bus_index = AudioServer::get_singleton()->thread_find_bus_index(bus);

	AudioFrame *targets[4] = { NULL, NULL, NULL, NULL };

	if (AudioServer::get_singleton()->get_speaker_mode() == AudioServer::SPEAKER_MODE_STEREO) {
		targets[0] = AudioServer::get_singleton()->thread_get_channel_mix_buffer(bus_index, 0);
	} else {
		switch (mix_target) {
			case MIX_TARGET_STEREO: {
				targets[0] = AudioServer::get_singleton()->thread_get_channel_mix_buffer(bus_index, 0);
			} break;
			case MIX_TARGET_SURROUND: {
				for (int i = 0; i < AudioServer::get_singleton()->get_channel_count(); i++) {
					targets[i] = AudioServer::get_singleton()->thread_get_channel_mix_buffer(bus_index, i);
				}
			} break;
			case MIX_TARGET_CENTER: {
				targets[0] = AudioServer::get_singleton()->thread_get_channel_mix_buffer(bus_index, 1);
			} break;
		}
	}

	for (int c = 0; c < 4; c++) {
		if (!targets[c])
			break;
		for (int i = 0; i < p_amount; i++) {
			targets[c][i] += p_frames[i];
		}
	}
}

void AudioStreamPlayer::_mix_internal(bool p_fadeout) {

	//get data
	AudioFrame *buffer = mix_buffer.ptrw();
	int buffer_size = mix_buffer.size();

	if (p_fadeout) {
		// Short fadeout ramp
		buffer_size = MIN(buffer_size, 128);
	}

	stream_playback->mix(buffer, pitch_scale, buffer_size);

	//multiply volume interpolating to avoid clicks if this changes
	float target_volume = p_fadeout ? -80.0 : volume_db;
	float vol = Math::db2linear(mix_volume_db);
	float vol_inc = (Math::db2linear(target_volume) - vol) / float(buffer_size);

	for (int i = 0; i < buffer_size; i++) {
		buffer[i] *= vol;
		vol += vol_inc;
	}

	//set volume for next mix
	mix_volume_db = target_volume;

	_mix_to_bus(buffer, buffer_size);
}

void AudioStreamPlayer::_mix_audio() {

	if (use_fadeout) {
		_mix_to_bus(fadeout_buffer.ptr(), fadeout_buffer.size());
		use_fadeout = false;
	}

	if (!stream_playback.is_valid() || !active ||
			(stream_paused && !stream_paused_fade)) {
		return;
	}

	if (stream_paused) {
		if (stream_paused_fade) {
			_mix_internal(true);
			stream_paused_fade = false;
		}
		return;
	}

	if (setstop) {
		_mix_internal(true);
		stream_playback->stop();
		setstop = false;
	}

	if (setseek >= 0.0 && !stop_has_priority) {
		if (stream_playback->is_playing()) {

			//fade out to avoid pops
			_mix_internal(true);
		}

		stream_playback->start(setseek);
		setseek = -1.0; //reset seek
		mix_volume_db = volume_db; //reset ramp
	}

	stop_has_priority = false;

	_mix_internal(false);
}

void AudioStreamPlayer::_notification(int p_what) {

	if (p_what == NOTIFICATION_ENTER_TREE) {

		AudioServer::get_singleton()->add_callback(_mix_audios, this);
		if (autoplay && !Engine::get_singleton()->is_editor_hint()) {
			play();
		}
	}

	if (p_what == NOTIFICATION_INTERNAL_PROCESS) {

		if (!active || (setseek < 0 && !stream_playback->is_playing())) {
			active = false;
			set_process_internal(false);
			emit_signal("finished");
		}
	}

	if (p_what == NOTIFICATION_EXIT_TREE) {

		AudioServer::get_singleton()->remove_callback(_mix_audios, this);
	}

	if (p_what == NOTIFICATION_PAUSED) {
		if (!can_process()) {
			// Node can't process so we start fading out to silence
			set_stream_paused(true);
		}
	}

	if (p_what == NOTIFICATION_UNPAUSED) {
		set_stream_paused(false);
	}
}

void AudioStreamPlayer::set_stream(Ref<AudioStream> p_stream) {

	AudioServer::get_singleton()->lock();

	if (active && stream_playback.is_valid() && !stream_paused) {
		//changing streams out of the blue is not a great idea, but at least
		//lets try to somehow avoid a click

		AudioFrame *buffer = fadeout_buffer.ptrw();
		int buffer_size = fadeout_buffer.size();

		stream_playback->mix(buffer, pitch_scale, buffer_size);

		//multiply volume interpolating to avoid clicks if this changes
		float target_volume = -80.0;
		float vol = Math::db2linear(mix_volume_db);
		float vol_inc = (Math::db2linear(target_volume) - vol) / float(buffer_size);

		for (int i = 0; i < buffer_size; i++) {
			buffer[i] *= vol;
			vol += vol_inc;
		}

		use_fadeout = true;
	}

	mix_buffer.resize(AudioServer::get_singleton()->thread_get_mix_buffer_size());

	if (stream_playback.is_valid()) {
		stream_playback.unref();
		stream.unref();
		active = false;
		setseek = -1;
		setstop = false;
	}

	if (p_stream.is_valid()) {
		stream = p_stream;
		stream_playback = p_stream->instance_playback();
	}

	AudioServer::get_singleton()->unlock();

	if (p_stream.is_valid() && stream_playback.is_null()) {
		stream.unref();
	}
}

Ref<AudioStream> AudioStreamPlayer::get_stream() const {

	return stream;
}

void AudioStreamPlayer::set_volume_db(float p_volume) {

	volume_db = p_volume;
}
float AudioStreamPlayer::get_volume_db() const {

	return volume_db;
}

void AudioStreamPlayer::set_pitch_scale(float p_pitch_scale) {
	ERR_FAIL_COND(p_pitch_scale <= 0.0);
	pitch_scale = p_pitch_scale;
}
float AudioStreamPlayer::get_pitch_scale() const {
	return pitch_scale;
}

void AudioStreamPlayer::play(float p_from_pos) {

	if (stream_playback.is_valid()) {
		//mix_volume_db = volume_db; do not reset volume ramp here, can cause clicks
		setseek = p_from_pos;
		stop_has_priority = false;
		active = true;
		set_process_internal(true);
	}
}

void AudioStreamPlayer::seek(float p_seconds) {

	if (stream_playback.is_valid()) {
		setseek = p_seconds;
	}
}

void AudioStreamPlayer::stop() {

	if (stream_playback.is_valid() && active) {
		setstop = true;
		stop_has_priority = true;
	}
}

bool AudioStreamPlayer::is_playing() const {

	if (stream_playback.is_valid()) {
		return active && !setstop; //&& stream_playback->is_playing();
	}

	return false;
}

float AudioStreamPlayer::get_playback_position() {

	if (stream_playback.is_valid()) {
		return stream_playback->get_playback_position();
	}

	return 0;
}

void AudioStreamPlayer::set_bus(const StringName &p_bus) {

	//if audio is active, must lock this
	AudioServer::get_singleton()->lock();
	bus = p_bus;
	AudioServer::get_singleton()->unlock();
}
StringName AudioStreamPlayer::get_bus() const {

	for (int i = 0; i < AudioServer::get_singleton()->get_bus_count(); i++) {
		if (AudioServer::get_singleton()->get_bus_name(i) == bus) {
			return bus;
		}
	}
	return "Master";
}

void AudioStreamPlayer::set_autoplay(bool p_enable) {

	autoplay = p_enable;
}
bool AudioStreamPlayer::is_autoplay_enabled() {

	return autoplay;
}

void AudioStreamPlayer::set_mix_target(MixTarget p_target) {

	mix_target = p_target;
}

AudioStreamPlayer::MixTarget AudioStreamPlayer::get_mix_target() const {

	return mix_target;
}

void AudioStreamPlayer::_set_playing(bool p_enable) {

	if (p_enable)
		play();
	else
		stop();
}
bool AudioStreamPlayer::_is_active() const {

	return active;
}

void AudioStreamPlayer::set_stream_paused(bool p_pause) {

	if (p_pause != stream_paused) {
		stream_paused = p_pause;
		stream_paused_fade = p_pause;
	}
}

bool AudioStreamPlayer::get_stream_paused() const {

	return stream_paused;
}

void AudioStreamPlayer::_validate_property(PropertyInfo &property) const {

	if (property.name == "bus") {

		String options;
		for (int i = 0; i < AudioServer::get_singleton()->get_bus_count(); i++) {
			if (i > 0)
				options += ",";
			String name = AudioServer::get_singleton()->get_bus_name(i);
			options += name;
		}

		property.hint_string = options;
	}
}

void AudioStreamPlayer::_bus_layout_changed() {

	_change_notify();
}

Ref<AudioStreamPlayback> AudioStreamPlayer::get_stream_playback() {
	return stream_playback;
}

void AudioStreamPlayer::_bind_methods() {

	ClassDB::bind_method(D_METHOD("set_stream", "stream"), &AudioStreamPlayer::set_stream);
	ClassDB::bind_method(D_METHOD("get_stream"), &AudioStreamPlayer::get_stream);

	ClassDB::bind_method(D_METHOD("set_volume_db", "volume_db"), &AudioStreamPlayer::set_volume_db);
	ClassDB::bind_method(D_METHOD("get_volume_db"), &AudioStreamPlayer::get_volume_db);

	ClassDB::bind_method(D_METHOD("set_pitch_scale", "pitch_scale"), &AudioStreamPlayer::set_pitch_scale);
	ClassDB::bind_method(D_METHOD("get_pitch_scale"), &AudioStreamPlayer::get_pitch_scale);

	ClassDB::bind_method(D_METHOD("play", "from_position"), &AudioStreamPlayer::play, DEFVAL(0.0));
	ClassDB::bind_method(D_METHOD("seek", "to_position"), &AudioStreamPlayer::seek);
	ClassDB::bind_method(D_METHOD("stop"), &AudioStreamPlayer::stop);

	ClassDB::bind_method(D_METHOD("is_playing"), &AudioStreamPlayer::is_playing);
	ClassDB::bind_method(D_METHOD("get_playback_position"), &AudioStreamPlayer::get_playback_position);

	ClassDB::bind_method(D_METHOD("set_bus", "bus"), &AudioStreamPlayer::set_bus);
	ClassDB::bind_method(D_METHOD("get_bus"), &AudioStreamPlayer::get_bus);

	ClassDB::bind_method(D_METHOD("set_autoplay", "enable"), &AudioStreamPlayer::set_autoplay);
	ClassDB::bind_method(D_METHOD("is_autoplay_enabled"), &AudioStreamPlayer::is_autoplay_enabled);

	ClassDB::bind_method(D_METHOD("set_mix_target", "mix_target"), &AudioStreamPlayer::set_mix_target);
	ClassDB::bind_method(D_METHOD("get_mix_target"), &AudioStreamPlayer::get_mix_target);

	ClassDB::bind_method(D_METHOD("_set_playing", "enable"), &AudioStreamPlayer::_set_playing);
	ClassDB::bind_method(D_METHOD("_is_active"), &AudioStreamPlayer::_is_active);

	ClassDB::bind_method(D_METHOD("_bus_layout_changed"), &AudioStreamPlayer::_bus_layout_changed);

	ClassDB::bind_method(D_METHOD("set_stream_paused", "pause"), &AudioStreamPlayer::set_stream_paused);
	ClassDB::bind_method(D_METHOD("get_stream_paused"), &AudioStreamPlayer::get_stream_paused);

	ClassDB::bind_method(D_METHOD("get_stream_playback"), &AudioStreamPlayer::get_stream_playback);

	ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "stream", PROPERTY_HINT_RESOURCE_TYPE, "AudioStream"), "set_stream", "get_stream");
	ADD_PROPERTY(PropertyInfo(Variant::REAL, "volume_db", PROPERTY_HINT_RANGE, "-80,24"), "set_volume_db", "get_volume_db");
	ADD_PROPERTY(PropertyInfo(Variant::REAL, "pitch_scale", PROPERTY_HINT_RANGE, "0.01,32,0.01"), "set_pitch_scale", "get_pitch_scale");
	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "playing", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "_set_playing", "is_playing");
	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "autoplay"), "set_autoplay", "is_autoplay_enabled");
	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "stream_paused", PROPERTY_HINT_NONE, ""), "set_stream_paused", "get_stream_paused");
	ADD_PROPERTY(PropertyInfo(Variant::INT, "mix_target", PROPERTY_HINT_ENUM, "Stereo,Surround,Center"), "set_mix_target", "get_mix_target");
	ADD_PROPERTY(PropertyInfo(Variant::STRING, "bus", PROPERTY_HINT_ENUM, ""), "set_bus", "get_bus");

	ADD_SIGNAL(MethodInfo("finished"));

	BIND_ENUM_CONSTANT(MIX_TARGET_STEREO);
	BIND_ENUM_CONSTANT(MIX_TARGET_SURROUND);
	BIND_ENUM_CONSTANT(MIX_TARGET_CENTER);
}

AudioStreamPlayer::AudioStreamPlayer() {

	mix_volume_db = 0;
	pitch_scale = 1.0;
	volume_db = 0;
	autoplay = false;
	setseek = -1;
	active = false;
	stream_paused = false;
	stream_paused_fade = false;
	mix_target = MIX_TARGET_STEREO;
	fadeout_buffer.resize(512);
	setstop = false;
	use_fadeout = false;

	AudioServer::get_singleton()->connect("bus_layout_changed", this, "_bus_layout_changed");
}

AudioStreamPlayer::~AudioStreamPlayer() {
}


text:
'use strict';

import {IEventEmitter} from 'vs/base/common/eventEmitter';
import {IDisposable} from 'vs/base/common/lifecycle';
import {createDecorator} from 'vs/platform/instantiation/common/instantiation';

export const IEventService = createDecorator<IEventService>('eventService');

export interface IEventService {
	_serviceBrand: any;

	/**
	 * Allows to add a listener to the platform event bus for all emitters that are known to the platform.
	 */
	addListener2(eventType: string, listener: (event: any) => void): IDisposable;

	/**
	 * Allows to add an event emitter to the platform bus such as Events from the emitter
	 * can be received from all listeners on the bus.
	 */
	addEmitter2(eventEmitter: IEventEmitter, emitterType?: string): IDisposable;

	/**
	 * Emits an event of the given type into the platform event bus.
	 * Note: Instead of emitting directly to the platform bus, it is also possible to register
	 * as event emitter to the bus using addEmitter() with a emitterType specified. This
	 * makes it possible to scope Events on the bus to a specific namespace, depending on the
	 * emitter and avoids polluting the global namespace in the bus with Events.
	 */
	emit(eventType: string, e?: any): void;
}


text:
using System.Collections.Generic;
using System.Text.RegularExpressions;

using Microsoft.Recognizers.Definitions.Portuguese;

namespace Microsoft.Recognizers.Text.DateTime.Portuguese
{
    public class PortugueseDateTimePeriodExtractorConfiguration : BaseOptionsConfiguration, IDateTimePeriodExtractorConfiguration
    {
        public string TokenBeforeDate { get; }

        public static readonly Regex NumberCombinedWithUnit = new Regex(DateTimeDefinitions.DateTimePeriodNumberCombinedWithUnit, RegexOptions.IgnoreCase | RegexOptions.Singleline);

        private static readonly Regex FromRegex = new Regex(DateTimeDefinitions.FromRegex, RegexOptions.IgnoreCase | RegexOptions.Singleline);
        private static readonly Regex ConnectorAndRegex = new Regex(DateTimeDefinitions.ConnectorAndRegex, RegexOptions.IgnoreCase | RegexOptions.Singleline);
        private static readonly Regex BetweenRegex = new Regex(DateTimeDefinitions.BetweenRegex, RegexOptions.IgnoreCase | RegexOptions.Singleline);

        public PortugueseDateTimePeriodExtractorConfiguration(IOptionsConfiguration config) : base(config)
        {
            TokenBeforeDate = DateTimeDefinitions.TokenBeforeDate;

            CardinalExtractor = Number.Portuguese.CardinalExtractor.GetInstance();

            SingleDateExtractor = new BaseDateExtractor(new PortugueseDateExtractorConfiguration(this));
            SingleTimeExtractor = new BaseTimeExtractor(new PortugueseTimeExtractorConfiguration(this));
            SingleDateTimeExtractor = new BaseDateTimeExtractor(new PortugueseDateTimeExtractorConfiguration(this));
            DurationExtractor = new BaseDurationExtractor(new PortugueseDurationExtractorConfiguration(this));
            TimePeriodExtractor = new BaseTimePeriodExtractor(new PortugueseTimePeriodExtractorConfiguration(this));
        }

        public IExtractor CardinalExtractor { get; }

        public IDateTimeExtractor SingleDateExtractor { get; }

        public IDateTimeExtractor SingleTimeExtractor { get; }

        public IDateTimeExtractor SingleDateTimeExtractor { get; }

        public IDateTimeExtractor DurationExtractor { get; }

        public IDateTimeExtractor TimePeriodExtractor { get; }

        public IEnumerable<Regex> SimpleCasesRegex => new[]
        {
            PortugueseTimePeriodExtractorConfiguration.PureNumFromTo,
            PortugueseTimePeriodExtractorConfiguration.PureNumBetweenAnd
        };

        public Regex PrepositionRegex => PortugueseDateTimeExtractorConfiguration.PrepositionRegex;

        public Regex TillRegex => PortugueseDatePeriodExtractorConfiguration.TillRegex;

        public Regex SpecificTimeOfDayRegex => PortugueseDateTimeExtractorConfiguration.SpecificTimeOfDayRegex;

        public Regex TimeOfDayRegex => PortugueseDateTimeExtractorConfiguration.TimeOfDayRegex;

        public Regex FollowedUnit => PortugueseTimePeriodExtractorConfiguration.FollowedUnit;

        public Regex TimeUnitRegex => PortugueseTimePeriodExtractorConfiguration.UnitRegex;

        public Regex PastPrefixRegex => PortugueseDatePeriodExtractorConfiguration.PastRegex;

        public Regex NextPrefixRegex => PortugueseDatePeriodExtractorConfiguration.FutureRegex;

        public Regex FutureSuffixRegex => PortugueseDatePeriodExtractorConfiguration.FutureSuffixRegex;

        public static readonly Regex WeekDayRegex = new Regex(DateTimeDefinitions.WeekDayRegex, RegexOptions.IgnoreCase | RegexOptions.Singleline);

        public static readonly Regex RestOfDateTimeRegex = new Regex(DateTimeDefinitions.RestOfDateTimeRegex, RegexOptions.IgnoreCase | RegexOptions.Singleline);

        public static readonly Regex PeriodTimeOfDayWithDateRegex = new Regex(DateTimeDefinitions.PeriodTimeOfDayWithDateRegex, RegexOptions.IgnoreCase | RegexOptions.Singleline);

        public static readonly Regex RelativeTimeUnitRegex = new Regex(DateTimeDefinitions.RelativeTimeUnitRegex, RegexOptions.IgnoreCase | RegexOptions.Singleline);

        public static readonly Regex GeneralEndingRegex =
            new Regex(DateTimeDefinitions.GeneralEndingRegex, RegexOptions.IgnoreCase | RegexOptions.Singleline);

        public static readonly Regex MiddlePauseRegex =
            new Regex(DateTimeDefinitions.MiddlePauseRegex, RegexOptions.IgnoreCase | RegexOptions.Singleline);

        public static readonly Regex AmDescRegex =
            new Regex(DateTimeDefinitions.AmDescRegex, RegexOptions.IgnoreCase | RegexOptions.Singleline);

        public static readonly Regex PmDescRegex =
            new Regex(DateTimeDefinitions.PmDescRegex, RegexOptions.IgnoreCase | RegexOptions.Singleline);

        public static readonly Regex WithinNextPrefixRegex =
            new Regex(DateTimeDefinitions.WithinNextPrefixRegex, RegexOptions.IgnoreCase | RegexOptions.Singleline);

        public static readonly Regex DateUnitRegex =
            new Regex(DateTimeDefinitions.DateUnitRegex, RegexOptions.IgnoreCase | RegexOptions.Singleline);

        public static readonly Regex PrefixDayRegex =
            new Regex(DateTimeDefinitions.PrefixDayRegex,
                RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.RightToLeft);

        public static readonly Regex SuffixRegex =
            new Regex(DateTimeDefinitions.SuffixRegex, RegexOptions.IgnoreCase | RegexOptions.Singleline);

        public static readonly Regex BeforeRegex =
            new Regex(DateTimeDefinitions.BeforeRegex, RegexOptions.IgnoreCase | RegexOptions.Singleline);

        public static readonly Regex AfterRegex =
            new Regex(DateTimeDefinitions.AfterRegex, RegexOptions.IgnoreCase | RegexOptions.Singleline);

        Regex IDateTimePeriodExtractorConfiguration.PrefixDayRegex => PrefixDayRegex;

        Regex IDateTimePeriodExtractorConfiguration.DateUnitRegex => DateUnitRegex;

        Regex IDateTimePeriodExtractorConfiguration.NumberCombinedWithUnit => NumberCombinedWithUnit;

        Regex IDateTimePeriodExtractorConfiguration.WeekDayRegex => WeekDayRegex;

        Regex IDateTimePeriodExtractorConfiguration.PeriodTimeOfDayWithDateRegex => PeriodTimeOfDayWithDateRegex;

        Regex IDateTimePeriodExtractorConfiguration.RelativeTimeUnitRegex => RelativeTimeUnitRegex;

        Regex IDateTimePeriodExtractorConfiguration.RestOfDateTimeRegex => RestOfDateTimeRegex;

        Regex IDateTimePeriodExtractorConfiguration.GeneralEndingRegex => GeneralEndingRegex;

        Regex IDateTimePeriodExtractorConfiguration.MiddlePauseRegex => MiddlePauseRegex;

        Regex IDateTimePeriodExtractorConfiguration.AmDescRegex => AmDescRegex;

        Regex IDateTimePeriodExtractorConfiguration.PmDescRegex => PmDescRegex;

        Regex IDateTimePeriodExtractorConfiguration.WithinNextPrefixRegex => WithinNextPrefixRegex;

        Regex IDateTimePeriodExtractorConfiguration.SuffixRegex => SuffixRegex;

        Regex IDateTimePeriodExtractorConfiguration.BeforeRegex => BeforeRegex;

        Regex IDateTimePeriodExtractorConfiguration.AfterRegex => AfterRegex;

        public bool GetFromTokenIndex(string text, out int index)
        {
            index = -1;
            var fromMatch = FromRegex.Match(text);
            if (fromMatch.Success)
            {
                index = fromMatch.Index;
            }
            return fromMatch.Success;
        }

        public bool GetBetweenTokenIndex(string text, out int index)
        {
            index = -1;

            var match = BetweenRegex.Match(text);
            if (match.Success)
            {
                index = match.Index;
            }

            return match.Success;
        }

        public bool HasConnectorToken(string text)
        {
            return ConnectorAndRegex.IsMatch(text);
        }
    }
}


text:
name: Bug report
about: Create a report to help us improve
labels: bug

---

<!--
Note: bpftrace is under active development and not all distros ship the most
recent version yet. Please make sure the bug reproduces on the latest release
or master.
-->

### What reproduces the bug?
<!--
Enter details about your bug, preferably with a small code snippet.

Also describe what you expect to happen.
-->

### bpftrace --info
<!--
Place output here.
-->


text:
/*
  aura-ydb interface for node-webkit and node server.
  bridge node context and DOM context only in aura-extensions
  do not call node function directly in widgets js
*/
define(function() {
  return {

 initialize: function(app) {
    var makeinf=function(name) {
      return function(opts,callback) {
              var data=app.sandbox.services["yase"][name](opts);
              //this line is not really needed.
              setTimeout( function() { callback(0,data) }, 0);
             //callback(0,data);
      }
   }
     if (typeof process !='undefined' &&process.versions['node-webkit']) {
        /* compatible async interface for browser side js code*/
        var api_yase=require('yase').api ;
        if (!app.sandbox.services) app.sandbox.services={};
        api_yase(app.sandbox.services); //install api into services
        app.sandbox.yase={ //turn into async, for compatible with node_server
            phraseSearch: makeinf('phraseSearch'),
            boolSearch: makeinf('boolSearch'),
            search: makeinf('search'),
            getTermVariants: makeinf('getTermVariants'),
            getText: makeinf('getText'),
            getTextByTag: makeinf('getTextByTag'),
            getTextRange:makeinf('getTextRange'),
            getTagInRange: makeinf('getTagInRange'),
            closestTag: makeinf('closestTag'),
            buildToc: makeinf('buildToc'),
            getTagAttr: makeinf('getTagAttr'),
            fillText: makeinf('fillText'),
            getRange: makeinf('getRange'),
            getRaw: makeinf('getRaw'),
            getBlob: makeinf('getBlob'),
            findTag: makeinf('findTag'),
            expandToken: makeinf('expandToken'),

            findTagBySelectors: makeinf('findTagBySelectors'),
            exist: makeinf('exist'),
            keyExists: makeinf('keyExists'),
            customfunc: makeinf('customfunc'),
            version: app.sandbox.services["yase"].version(),

            enumLocalYdb:makeinf('enumLocalYdb'),
            sameId:makeinf('sameId'),
        };
     } else {
        //for node_server , use socket.io to talk to server-side yase_api.js
        requirejs(['../node_server/cli-js/rpc_yase'],function(yase){
          app.sandbox.yase=yase;
        });
     }

      app.sandbox.$yase=function(api,opts) {
        if (typeof app.sandbox.yase[api]!=='function') {
          throw api+' not found';
          return;
        }
        var deferred = new $.Deferred();
        var promise=deferred.promise();
        var that=this;

        app.sandbox.yase[api](opts,function(err,data){
          if (err) deferred.fail(err);
          else deferred.resolveWith(that,[data]);
          deferred.always(err);
        });

        return promise;
      }
  },
  afterAppStart: function() {
  }
}});


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>Midio Reader</title>

      <input type="file" id="file" name="file" />
      Open File


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Preface</title>
    <link rel="stylesheet" href="apiReference.css" type="text/css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
    <link rel="start" href="index.html" title="Berkeley DB C API Reference" />
    <link rel="up" href="index.html" title="Berkeley DB C API Reference" />
    <link rel="prev" href="index.html" title="Berkeley DB C API Reference" />
    <link rel="next" href="moreinfo.html" title="For More Information" />

Library Version 11.2.5.3

          Preface

          Prev

           Next

Preface

        Welcome to Berkeley DB 11g Release 2 (DB).
        This document describes the
        C

        API for DB library version 11.2.5.3.

            It is intended to describe the DB API, including all
            classes, methods, and functions.  As such, this document is
            intended for
            C developers who are actively writing or maintaining
            applications that make use of DB databases.

Conventions Used in this Book

        The following typographical conventions are used within in this manual:

            Structure names are represented in monospaced font, as are
            method names. For example:
            "DB->open() is a method
		    on a DB handle."

            Variable or non-literal text is presented in italics. For example:
            "Go to your DB_INSTALL directory."

        Program examples are displayed in a monospaced font on a shaded background.
        For example:

/* File: gettingstarted_common.h */
typedef struct stock_dbs {
    DB *inventory_dbp; /* Database containing inventory information */
    DB *vendor_dbp;    /* Database containing vendor information */

    char *db_home_dir;       /* Directory containing the database files */
    char *inventory_db_name; /* Name of the inventory database */
    char *vendor_db_name;    /* Name of the vendor database */
} STOCK_DBS;

Note

            Finally, notes of interest are represented using a note block such
            as this.

          Prev

           Next

          Berkeley DB C API Reference

            Home

           For More Information


text:
package ca.ualberta.cs.team1travelexpenseapp;

public class Tag {
	private String name;

	public Tag(String name){
		this.name=name;
	}

	public String getName(){
		return name;
	}

	@Override
	public String toString() {
		return this.getName();
	}

	public void setName(String newName){
		this.name=newName;
	}
}


text:
<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">

  <title>couchdbkit.external.External</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />

         Home

         Trees

         Indices

         Help

        Package couchdbkit ::
        Module external ::
        Class External

[hide private]

[frames] | no frames]

Class External

source code

object --+
         |
        External

Known Subclasses:

wsgi.handler.WSGIHandler

simple class to handle an external
ans send the response.

example:

    from couchdbkit.external import External
    from couchdbkit.utils import json

    class Test(External):

        def handle_line(self, line):
            self.send_response(200,
                "got message external object %s" % json.dumps(line),
                {"Content-type": "text/plain"})

    if __name__ == "__main__":
        Test().run()

        Instance Methods
        [hide private]

          __init__(self,
        stdin=sys.stdout,
        stdout=sys.stdout)

      x.__init__(...) initializes x; see help(type(x)) for signature

            source code

          handle_line(self,
        line)

            source code

          write(self,
        line)

            source code

          lines(self)

            source code

          run(self)

            source code

          send_response(self,
        code=200,
        body='',
        headers={})

            source code

Inherited from object:
      __delattr__,
      __format__,
      __getattribute__,
      __hash__,
      __new__,
      __reduce__,
      __reduce_ex__,
      __repr__,
      __setattr__,
      __sizeof__,
      __str__,
      __subclasshook__

        Properties
        [hide private]

Inherited from object:
      __class__

        Method Details
        [hide private]

__init__(self,
        stdin=sys.stdout,
        stdout=sys.stdout)

(Constructor)

  	source code

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides:
        object.__init__

(inherited documentation)

         Home

         Trees

         Indices

         Help

    Generated by Epydoc 3.0.1 on Fri Feb 18 10:31:28 2011

      http://epydoc.sourceforge.net


text:
$:.unshift File.join(File.dirname(__FILE__),"..","lib")

require 'test/unit'
require 'rgen/environment'
require 'rgen/serializer/json_serializer'
require 'rgen/instantiator/json_instantiator'
require 'concrete/metamodel/concrete_mmm'
require 'concrete/metamodel/ecore_to_concrete'

class MetamodelTest < Test::Unit::TestCase
  include Concrete::Metamodel

  TestDir = File.dirname(__FILE__)+"/metamodel_test"
  def test_ecore_to_concrete
    env = RGen::Environment.new
    outfile = TestDir + "/concrete_mmm_generated.js"
    ECoreToConcrete.new(nil, env).trans(ConcreteMMM.ecore.eClasses)
    File.open(outfile, "w") do |f|
      ser = RGen::Serializer::JsonSerializer.new(f)
      ser.serialize(env.find(:class => ConcreteMMM::Classifier).sort{|a,b| a.name <=> b.name})
    end
    assert_equal File.read(TestDir+"/concrete_mmm_expected.json").strip, File.read(outfile).strip
  end

  def test_json_roundtrip
    env = RGen::Environment.new
    inst = RGen::Instantiator::JsonInstantiator.new(env, ConcreteMMM)
    infile = TestDir + "/concrete_mmm_expected.json"
    inst.instantiate(File.read(infile))
    outfile = TestDir + "/concrete_mmm_regenerated.js"
    File.open(outfile, "w") do |f|
      # mark unresolved references, there should be no unresolved references
      ser = RGen::Serializer::JsonSerializer.new(f, :identifierProvider => proc{|e| e.is_a?(RGen::MetamodelBuilder::MMProxy) && "xxx"})
      ser.serialize(env.find(:class => ConcreteMMM::Classifier).sort{|a,b| a.name <=> b.name})
    end
    assert_equal File.read(infile).strip, File.read(outfile).strip
  end

end


text:
<?php

namespace DvsaEntities\Factory\Repository;

use Doctrine\ORM\EntityManager;
use DvsaEntities\Entity\TesterRiskScore;
use Interop\Container\ContainerInterface;
use Zend\ServiceManager\Factory\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use DvsaEntities\Repository\TesterRiskScoreRepository;

class TesterRiskScoreRepositoryFactory implements FactoryInterface
{
    public function createService(ServiceLocatorInterface $serviceLocator)
    {
        return $this($serviceLocator, TesterRiskScoreRepository::class);
    }

    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
    {
        $entityManager = $container->get(EntityManager::class);

        return $entityManager->getRepository(TesterRiskScore::class);
    }
}


text:
<?php

require_once dirname(__FILE__) . '/../../../../tools/helpers/bookstore/BookstoreEmptyTestBase.php';

/**
 * Tests the generated Object classes.
 *
 * This test uses generated Bookstore classes to test the behavior of various
 * object operations.  The _idea_ here is to test every possible generated method
 * from Object.tpl; if necessary, bookstore will be expanded to accommodate this.
 *
 * The database is relaoded before every test and flushed after every test.  This
 * means that you can always rely on the contents of the databases being the same
 * for each test method in this class.  See the BookstoreDataPopulator::populate()
 * method for the exact contents of the database.
 *
 * @see        BookstoreDataPopulator
 * @author     Hans Lellelid <hans@xmpl.org>
 * @package    generator.builder.om
 */
class GeneratedObjectTest extends BookstoreEmptyTestBase
{
	protected function setUp()
	{
		parent::setUp();
		require_once dirname(__FILE__) . '/../../../../tools/helpers/bookstore/behavior/TestAuthor.php';
	}

	/**
	 * Test saving an object after setting default values for it.
	 */
	public function testSaveWithDefaultValues()
	{
		// From the schema.xml, I am relying on the following:
		//  - that 'Penguin' is the default Name for a Publisher
		//  - that 2001-01-01 is the default ReviewDate for a Review

		// 1) check regular values (VARCHAR)
		$pub = new Publisher();
		$pub->setName('Penguin');
		$pub->save();
		$this->assertTrue($pub->getId() !== null, "Expect Publisher to have been saved when default value set.");

		// 2) check date/time values
		$review = new Review();
		// note that this is different from how it's represented in schema, but should resolve to same unix timestamp
		$review->setReviewDate('2001-01-01');
		$this->assertTrue($review->isModified(), "Expect Review to have been marked 'modified' after default date/time value set.");

	}

	/**
	 * Test isModified() to be false after setting default value second time
	 */
	public function testDefaultValueSetTwice()
	{
    $pub = new Publisher();
    $pub->setName('Penguin');
    $pub->save();

    $pubId = $pub->getId();

    PublisherPeer::clearInstancePool();

    $pub2 = PublisherPeer::retrieveByPK($pubId);
    $pub2->setName('Penguin');
    $this->assertFalse($pub2->isModified(), "Expect Publisher to be not modified after setting default value second time.");
	}

  public function testHasApplyDefaultValues()
  {
    $this->assertTrue(method_exists('Publisher', 'applyDefaultValues'), 'Tables with default values should have an applyDefaultValues() method');
    $this->assertFalse(method_exists('Book', 'applyDefaultValues'), 'Tables with no default values should not have an applyDefaultValues() method');
  }

	/**
	 * Test default return values.
	 */
	public function testDefaultValues()
	{
		$r = new Review();
		$this->assertEquals('2001-01-01', $r->getReviewDate('Y-m-d'));

		$this->assertFalse($r->isModified(), "expected isModified() to be false");

		$acct = new BookstoreEmployeeAccount();
		$this->assertEquals(true, $acct->getEnabled());
		$this->assertFalse($acct->isModified());

		$acct->setLogin("testuser");
		$acct->setPassword("testpass");
		$this->assertTrue($acct->isModified());
	}

	/**
	 * Tests the use of default expressions and the reloadOnInsert and reloadOnUpdate attributes.
	 *
	 * @link       http://propel.phpdb.org/trac/ticket/378
	 * @link       http://propel.phpdb.org/trac/ticket/555
	 */
	public function testDefaultExpresions()
	{
		if (Propel::getDb(BookstoreEmployeePeer::DATABASE_NAME) instanceof DBSqlite) {
			$this->markTestSkipped("Cannot test default expressions with SQLite");
		}

		$b = new Bookstore();
		$b->setStoreName("Foo!");
		$b->save();

		$employee = new BookstoreEmployee();
		$employee->setName("Johnny Walker");

		$acct = new BookstoreEmployeeAccount();
		$acct->setBookstoreEmployee($employee);
		$acct->setLogin("test-login");

		$this->assertNull($acct->getCreated(), "Expected created column to be NULL.");
		$this->assertNull($acct->getAuthenticator(), "Expected authenticator column to be NULL.");

		$acct->save();

		$acct = BookstoreEmployeeAccountPeer::retrieveByPK($acct->getEmployeeId());

		$this->assertNotNull($acct->getAuthenticator(), "Expected a valid (non-NULL) authenticator column after save.");
		$this->assertEquals('Password', $acct->getAuthenticator(), "Expected authenticator='Password' after save.");
		$this->assertNotNull($acct->getCreated(), "Expected a valid date after retrieving saved object.");

		$now = new DateTime("now");
		$this->assertEquals($now->format("Y-m-d"), $acct->getCreated("Y-m-d"));

		$acct->setCreated($now);
		$this->assertEquals($now->format("Y-m-d"), $acct->getCreated("Y-m-d"));

		// Unfortunately we can't really test the conjunction of reloadOnInsert and reloadOnUpdate when using just
		// default values. (At least not in a cross-db way.)
	}

	/**
	 * Tests the use of default expressions and the reloadOnInsert attribute.
	 *
	 * @link       http://propel.phpdb.org/trac/ticket/378
	 * @link       http://propel.phpdb.org/trac/ticket/555
	 */
	public function testDefaultExpresions_ReloadOnInsert()
	{
		if (Propel::getDb(BookstoreEmployeePeer::DATABASE_NAME) instanceof DBSqlite) {
			$this->markTestSkipped("Cannot test default date expressions with SQLite");
		}

		// Create a new bookstore, contest, bookstore_contest, and bookstore_contest_entry

		$b = new Bookstore();
		$b->setStoreName("Barnes & Noble");
		$b->save();

		$c = new Contest();
		$c->setName("Bookathon Contest");
		$c->save();

		$bc = new BookstoreContest();
		$bc->setBookstore($b);
		$bc->setContest($c);
		$bc->save();

		$c = new Customer();
		$c->setName("Happy Customer");
		$c->save();

		$bce = new BookstoreContestEntry();
		$bce->setBookstore($b);
		$bce->setBookstoreContest($bc);
		$bce->setCustomer($c);
		$bce->save();

		$this->assertNotNull($bce->getEntryDate(), "Expected a non-null entry_date after save.");
	}

	/**
	 * Tests the overriding reloadOnInsert at runtime.
	 *
	 * @link       http://propel.phpdb.org/trac/ticket/378
	 * @link       http://propel.phpdb.org/trac/ticket/555
	 */
	public function testDefaultExpresions_ReloadOnInsert_Override()
	{
		if (Propel::getDb(BookstoreEmployeePeer::DATABASE_NAME) instanceof DBSqlite) {
			$this->markTestSkipped("Cannot test default date expressions with SQLite");
		}

		// Create a new bookstore, contest, bookstore_contest, and bookstore_contest_entry
		$b = new Bookstore();
		$b->setStoreName("Barnes & Noble");
		$b->save();

		$c = new Contest();
		$c->setName("Bookathon Contest");
		$c->save();

		$bc = new BookstoreContest();
		$bc->setBookstore($b);
		$bc->setContest($c);
		$bc->save();

		$c = new Customer();
		$c->setName("Happy Customer");
		$c->save();

		$bce = new BookstoreContestEntry();
		$bce->setBookstore($b);
		$bce->setBookstoreContest($bc);
		$bce->setCustomer($c);
		$bce->save(null, $skipReload=true);

		$this->assertNull($bce->getEntryDate(), "Expected a NULL entry_date after save.");
	}

	/**
	 * Tests the use of default expressions and the reloadOnUpdate attribute.
	 *
	 * @link       http://propel.phpdb.org/trac/ticket/555
	 */
	public function testDefaultExpresions_ReloadOnUpdate()
	{
		$b = new Bookstore();
		$b->setStoreName("Foo!");
		$b->save();

		$sale = new BookstoreSale();
		$sale->setBookstore(BookstorePeer::doSelectOne(new Criteria()));
		$sale->setSaleName("Spring Sale");
		$sale->save();

		// Expect that default values are set, but not default expressions
		$this->assertNull($sale->getDiscount(), "Expected discount to be NULL.");

		$sale->setSaleName("Winter Clearance");
		$sale->save();
		// Since reloadOnUpdate = true, we expect the discount to be set now.

		$this->assertNotNull($sale->getDiscount(), "Expected discount to be non-NULL after save.");
	}

	/**
	 * Tests the overriding reloadOnUpdate at runtime.
	 *
	 * @link       http://propel.phpdb.org/trac/ticket/378
	 * @link       http://propel.phpdb.org/trac/ticket/555
	 */
	public function testDefaultExpresions_ReloadOnUpdate_Override()
	{
		$b = new Bookstore();
		$b->setStoreName("Foo!");
		$b->save();

		$sale = new BookstoreSale();
		$sale->setBookstore(BookstorePeer::doSelectOne(new Criteria()));
		$sale->setSaleName("Spring Sale");
		$sale->save();

		// Expect that default values are set, but not default expressions
		$this->assertNull($sale->getDiscount(), "Expected discount to be NULL.");

		$sale->setSaleName("Winter Clearance");
		$sale->save(null, $skipReload=true);

		// Since reloadOnUpdate = true, we expect the discount to be set now.

		$this->assertNull($sale->getDiscount(), "Expected NULL value for discount after save.");
	}

	/**
	 * Testing creating & saving new object & instance pool.
	 */
	public function testObjectInstances_New()
	{
		$emp = new BookstoreEmployee();
		$emp->setName(md5(microtime()));
		$emp->save();
		$id = $emp->getId();

		$retrieved = BookstoreEmployeePeer::retrieveByPK($id);
		$this->assertSame($emp, $retrieved, "Expected same object (from instance pool)");
	}

	/**
	 *
	 */
	public function testObjectInstances_Fkeys()
	{
		// Establish a relationship between one employee and account
		// and then change the employee_id and ensure that the account
		// is not pulling the old employee.

		$pub1 = new Publisher();
		$pub1->setName('Publisher 1');
		$pub1->save();

		$pub2 = new Publisher();
		$pub2->setName('Publisher 2');
		$pub2->save();

		$book = new Book();
		$book->setTitle("Book Title");
		$book->setISBN("1234");
		$book->setPublisher($pub1);
		$book->save();

		$this->assertSame($pub1, $book->getPublisher());

		// now change values behind the scenes
		$con = Propel::getConnection(BookstoreEmployeeAccountPeer::DATABASE_NAME);
		$con->exec("UPDATE " . BookPeer::TABLE_NAME . " SET "
		. " publisher_id = " . $pub2->getId()
		. " WHERE id = " . $book->getId());

		$book2 = BookPeer::retrieveByPK($book->getId());
		$this->assertSame($book, $book2, "Expected same book object instance");

		$this->assertEquals($pub1->getId(), $book->getPublisherId(), "Expected book to have OLD publisher id before reload()");

		$book->reload();

		$this->assertEquals($pub2->getId(), $book->getPublisherId(), "Expected book to have new publisher id");
		$this->assertSame($pub2, $book->getPublisher(), "Expected book to have new publisher object associated.");

		// Now let's set it back, just to be double sure ...

		$con->exec("UPDATE " . BookPeer::TABLE_NAME . " SET "
		. " publisher_id = " . $pub1->getId()
		. " WHERE id = " . $book->getId());

		$book->reload();

		$this->assertEquals($pub1->getId(), $book->getPublisherId(), "Expected book to have old publisher id (again).");
		$this->assertSame($pub1, $book->getPublisher(), "Expected book to have old publisher object associated (again).");

	}

	/**
	 * Test the effect of typecast on primary key values and instance pool retrieval.
	 */
	public function testObjectInstancePoolTypecasting()
	{
		$reader = new BookReader();
		$reader->setName("Tester");
		$reader->save();
		$readerId = $reader->getId();

		$book = new Book();
		$book->setTitle("BookTest");
		$book->setISBN("TEST");
		$book->save();
		$bookId = $book->getId();

		$opinion = new BookOpinion();
		$opinion->setBookId((string)$bookId);
		$opinion->setReaderId((string)$readerId);
		$opinion->setRating(5);
		$opinion->setRecommendToFriend(false);
		$opinion->save();

		$opinion2 = BookOpinionPeer::retrieveByPK($bookId, $readerId);

		$this->assertSame($opinion, $opinion2, "Expected same object to be retrieved from differently type-casted primary key values.");

	}

	/**
	 * Test the reload() method.
	 */
	public function testReload()
	{
		BookstoreDataPopulator::populate();
		$a = AuthorPeer::doSelectOne(new Criteria());

		$origName = $a->getFirstName();

		$a->setFirstName(md5(time()));

		$this->assertNotEquals($origName, $a->getFirstName());
		$this->assertTrue($a->isModified());

		$a->reload();

		$this->assertEquals($origName, $a->getFirstName());
		$this->assertFalse($a->isModified());

	}

	/**
	 * Test reload(deep=true) method.
	 */
	public function testReloadDeep()
	{
		BookstoreDataPopulator::populate();

		// arbitrary book
		$b = BookPeer::doSelectOne(new Criteria());

		// arbitrary, different author
		$c = new Criteria();
		$c->add(AuthorPeer::ID, $b->getAuthorId(), Criteria::NOT_EQUAL);
		$a = AuthorPeer::doSelectOne($c);

		$origAuthor = $b->getAuthor();

		$b->setAuthor($a);

		$this->assertNotEquals($origAuthor, $b->getAuthor(), "Expected just-set object to be different from obj from DB");
		$this->assertTrue($b->isModified());

		$b->reload($deep=true);

		$this->assertEquals($origAuthor, $b->getAuthor(), "Expected object in DB to be restored");
		$this->assertFalse($a->isModified());
	}

	/**
	 * Test saving an object and getting correct number of affected rows from save().
	 * This includes tests of cascading saves to fk-related objects.
	 */
	public function testSaveReturnValues()
	{

		$author = new Author();
		$author->setFirstName("Mark");
		$author->setLastName("Kurlansky");
		// do not save

		$pub = new Publisher();
		$pub->setName("Penguin Books");
		// do not save

		$book = new Book();
		$book->setTitle("Salt: A World History");
		$book->setISBN("0142001619");
		$book->setAuthor($author);
		$book->setPublisher($pub);

		$affected = $book->save();
		$this->assertEquals(3, $affected, "Expected 3 affected rows when saving book + publisher + author.");

		// change nothing ...
		$affected = $book->save();
		$this->assertEquals(0, $affected, "Expected 0 affected rows when saving already-saved book.");

		// modify the book (UPDATE)
		$book->setTitle("Salt A World History");
		$affected = $book->save();
		$this->assertEquals(1, $affected, "Expected 1 affected row when saving modified book.");

		// modify the related author
		$author->setLastName("Kurlanski");
		$affected = $book->save();
		$this->assertEquals(1, $affected, "Expected 1 affected row when saving book with updated author.");

		// modify both the related author and the book
		$author->setLastName("Kurlansky");
		$book->setTitle("Salt: A World History");
		$affected = $book->save();
		$this->assertEquals(2, $affected, "Expected 2 affected rows when saving updated book with updated author.");

	}

	/**
	 * Test deleting an object using the delete() method.
	 */
	public function testDelete()
	{
		BookstoreDataPopulator::populate();

		// 1) grab an arbitrary object
		$book = BookPeer::doSelectOne(new Criteria());
		$bookId = $book->getId();

		// 2) delete it
		$book->delete();

		// 3) make sure it can't be save()d now that it's deleted
		try {
			$book->setTitle("Will Fail");
			$book->save();
			$this->fail("Expect an exception to be thrown when attempting to save() a deleted object.");
		} catch (PropelException $e) {}

		// 4) make sure that it doesn't exist in db
		$book = BookPeer::retrieveByPK($bookId);
		$this->assertNull($book, "Expect NULL from retrieveByPK on deleted Book.");

	}

	/**
	 *
	 */
	public function testNoColsModified()
	{
		$e1 = new BookstoreEmployee();
		$e1->setName('Employee 1');

		$e2 = new BookstoreEmployee();
		$e2->setName('Employee 2');

		$super = new BookstoreEmployee();
		// we don't know who the supervisor is yet
		$super->addSubordinate($e1);
		$super->addSubordinate($e2);

		$affected = $super->save();

	}

	/**
	 * Tests new one-to-one functionality.
	 */
	public function testOneToOne()
	{
		BookstoreDataPopulator::populate();

		$emp = BookstoreEmployeePeer::doSelectOne(new Criteria());

		$acct = new BookstoreEmployeeAccount();
		$acct->setBookstoreEmployee($emp);
		$acct->setLogin("testuser");
		$acct->setPassword("testpass");

		$this->assertSame($emp->getBookstoreEmployeeAccount(), $acct, "Expected same object instance.");
	}

	/**
	 * Test the type sensitivity of the resturning columns.
	 *
	 */
	public function testTypeSensitive()
	{
		BookstoreDataPopulator::populate();

		$book = BookPeer::doSelectOne(new Criteria());

		$r = new Review();
		$r->setReviewedBy("testTypeSensitive Tester");
		$r->setReviewDate(time());
		$r->setBook($book);
		$r->setRecommended(true);
		$r->save();

		$id = $r->getId();
		unset($r);

		// clear the instance cache to force reload from database.
		ReviewPeer::clearInstancePool();
		BookPeer::clearInstancePool();

		// reload and verify that the types are the same
		$r2 = ReviewPeer::retrieveByPK($id);

		$this->assertInternalType('integer', $r2->getId(), "Expected getId() to return an integer.");
		$this->assertInternalType('string', $r2->getReviewedBy(), "Expected getReviewedBy() to return a string.");
		$this->assertInternalType('boolean', $r2->getRecommended(), "Expected getRecommended() to return a boolean.");
		$this->assertInstanceOf('Book', $r2->getBook(), "Expected getBook() to return a Book.");
		$this->assertInternalType('float', $r2->getBook()->getPrice(), "Expected Book->getPrice() to return a float.");
		$this->assertInstanceOf('DateTime', $r2->getReviewDate(null), "Expected Book->getReviewDate() to return a DateTime.");

	}

	/**
	 * This is a test for expected exceptions when saving UNIQUE.
	 * See http://propel.phpdb.org/trac/ticket/2
	 */
	public function testSaveUnique()
	{
	  // The whole test is in a transaction, but this test needs real transactions
	  $this->con->commit();

		$emp = new BookstoreEmployee();
		$emp->setName(md5(microtime()));

		$acct = new BookstoreEmployeeAccount();
		$acct->setBookstoreEmployee($emp);
		$acct->setLogin("foo");
		$acct->setPassword("bar");
		$acct->save();

		// now attempt to create a new acct
		$acct2 = $acct->copy();

		try {
			$acct2->save();
			$this->fail("Expected PropelException in first attempt to save object with duplicate value for UNIQUE constraint.");
		} catch (Exception $x) {
			try {
				// attempt to save it again
				$acct3 = $acct->copy();
				$acct3->save();
				$this->fail("Expected PropelException in second attempt to save object with duplicate value for UNIQUE constraint.");
			} catch (Exception $x) {
				// this is expected.
			}
			// now let's double check that it can succeed if we're not violating the constraint.
			$acct3->setLogin("foo2");
			$acct3->save();
		}

		$this->con->beginTransaction();
	}

	/**
	 * Test for correct reporting of isModified().
	 */
	public function testIsModified()
	{
		// 1) Basic test

		$a = new Author();
		$a->setFirstName("John");
		$a->setLastName("Doe");
		$a->setAge(25);

		$this->assertTrue($a->isModified(), "Expected Author to be modified after setting values.");

		$a->save();

		$this->assertFalse($a->isModified(), "Expected Author to be unmodified after saving set values.");

		// 2) Test behavior with setting vars of different types

		// checking setting int col to string val
		$a->setAge('25');
		$this->assertFalse($a->isModified(), "Expected Author to be unmodified after setting int column to string-cast of same value.");

		$a->setFirstName("John2");
		$this->assertTrue($a->isModified(), "Expected Author to be modified after changing string column value.");

		// checking setting string col to int val
		$a->setFirstName("1");
		$a->save();
		$this->assertFalse($a->isModified(), "Expected Author to be unmodified after saving set values.");

		$a->setFirstName(1);
		$this->assertFalse($a->isModified(), "Expected Author to be unmodified after setting string column to int-cast of same value.");

		// 3) Test for appropriate behavior of NULL

		// checking "" -> NULL
		$a->setFirstName("");
		$a->save();
		$this->assertFalse($a->isModified(), "Expected Author to be unmodified after saving set values.");

		$a->setFirstName(null);
		$this->assertTrue($a->isModified(), "Expected Author to be modified after changing empty string column value to NULL.");

		$a->setFirstName("John");
		$a->setAge(0);
		$a->save();
		$this->assertFalse($a->isModified(), "Expected Author to be unmodified after saving set values.");

		$a->setAge(null);
		$this->assertTrue($a->isModified(), "Expected Author to be modified after changing 0-value int column to NULL.");

		$a->save();
		$this->assertFalse($a->isModified(), "Expected Author to be unmodified after saving set values.");

		$a->setAge(0);
		$this->assertTrue($a->isModified(), "Expected Author to be modified after changing NULL-value int column to 0.");

	}

	/**
	 * Test the BaseObject#equals().
	 */
	public function testEquals()
	{
		BookstoreDataPopulator::populate();

		$b = BookPeer::doSelectOne(new Criteria());
		$c = new Book();
		$c->setId($b->getId());
		$this->assertTrue($b->equals($c), "Expected Book objects to be equal()");

		$a = new Author();
		$a->setId($b->getId());
		$this->assertFalse($b->equals($a), "Expected Book and Author with same primary key NOT to match.");
	}

	/**
	 * Test checking for non-default values.
	 * @see        http://propel.phpdb.org/trac/ticket/331
	 */
	public function testHasOnlyDefaultValues()
	{
		$emp = new BookstoreEmployee();
		$emp->setName(md5(microtime()));

		$acct2 = new BookstoreEmployeeAccount();

		$acct = new BookstoreEmployeeAccount();
		$acct->setBookstoreEmployee($emp);
		$acct->setLogin("foo");
		$acct->setPassword("bar");
		$acct->save();

		$this->assertFalse($acct->isModified(), "Expected BookstoreEmployeeAccount NOT to be modified after save().");

		$acct->setEnabled(true);
		$acct->setPassword($acct2->getPassword());

		$this->assertTrue($acct->isModified(), "Expected BookstoreEmployeeAccount to be modified after setting default values.");

		$this->assertTrue($acct->hasOnlyDefaultValues(), "Expected BookstoreEmployeeAccount to not have only default values.");

		$acct->setPassword("bar");
		$this->assertFalse($acct->hasOnlyDefaultValues(), "Expected BookstoreEmployeeAccount to have at one non-default value after setting one value to non-default.");

		// Test a default date/time value
		$r = new Review();
		$r->setReviewDate(new DateTime("now"));
		$this->assertFalse($r->hasOnlyDefaultValues());
	}

	public function testDefaultFkColVal()
	{
		BookstoreDataPopulator::populate();

		$sale = new BookstoreSale();
		$this->assertEquals(1, $sale->getBookstoreId(), "Expected BookstoreSale object to have a default bookstore_id of 1.");

		$bookstore = BookstorePeer::doSelectOne(new Criteria());

		$sale->setBookstore($bookstore);
		$this->assertEquals($bookstore->getId(), $sale->getBookstoreId(), "Expected FK id to have changed when assigned a valid FK.");

		$sale->setBookstore(null);
		$this->assertEquals(1, $sale->getBookstoreId(), "Expected BookstoreSale object to have reset to default ID.");

		$sale->setPublisher(null);
		$this->assertEquals(null, $sale->getPublisherId(), "Expected BookstoreSale object to have reset to NULL publisher ID.");
	}

	public function testCountRefFk()
	{
		$book = new Book();
		$book->setTitle("Test Book");
		$book->setISBN("TT-EE-SS-TT");

		$num = 5;

		for ($i=2; $i < $num + 2; $i++) {
			$r = new Review();
			$r->setReviewedBy('Hans ' . $num);
			$dt = new DateTime("now");
			$dt->modify("-".$i." weeks");
			$r->setReviewDate($dt);
			$r->setRecommended(($i % 2) == 0);
			$book->addReview($r);
		}

		$this->assertEquals($num, $book->countReviews(), "Expected countReviews to return $num");
		$this->assertEquals($num, count($book->getReviews()), "Expected getReviews to return $num reviews");

		$book->save();

		BookPeer::clearInstancePool();
		ReviewPeer::clearInstancePool();

		$book = BookPeer::retrieveByPK($book->getId());
		$this->assertEquals($num, $book->countReviews(), "Expected countReviews() to return $num (after save)");
		$this->assertEquals($num, count($book->getReviews()), "Expected getReviews() to return $num (after save)");

		// Now set different criteria and expect different results
		$c = new Criteria();
		$c->add(ReviewPeer::RECOMMENDED, false);
		$this->assertEquals(floor($num/2), $book->countReviews($c), "Expected " . floor($num/2) . " results from countReviews(recomm=false)");

		// Change Criteria, run again -- expect different.
		$c = new Criteria();
		$c->add(ReviewPeer::RECOMMENDED, true);
		$this->assertEquals(ceil($num/2), count($book->getReviews($c)), "Expected " . ceil($num/2) . " results from getReviews(recomm=true)");

		$this->assertEquals($num, $book->countReviews(), "Expected countReviews to return $num with new empty Criteria");
	}

	/**
	 * Test copyInto method.
	 */
	public function testCopyInto_Deep()
	{
		BookstoreDataPopulator::populate();

		// Test a "normal" object
		$c = new Criteria();
		$c->add(BookPeer::TITLE, 'Harry%', Criteria::LIKE);

		$book = BookPeer::doSelectOne($c);
		$reviews = $book->getReviews();

		$b2 = $book->copy(true);
		$this->assertInstanceOf('Book', $b2);
		$this->assertNull($b2->getId());

		$r2 = $b2->getReviews();

		$this->assertEquals(count($reviews), count($r2));

		// Test a one-to-one object
		$emp = BookstoreEmployeePeer::doSelectOne(new Criteria());
		$e2 = $emp->copy(true);

		$this->assertInstanceOf('BookstoreEmployee', $e2);
		$this->assertNull($e2->getId());

		$this->assertEquals($emp->getBookstoreEmployeeAccount()->getLogin(), $e2->getBookstoreEmployeeAccount()->getLogin());
	}

	/**
	 * Test copying when an object has composite primary key.
	 * @link http://propel.phpdb.org/trac/ticket/618
	 */
	public function testCopy_CompositePK()
	{
		$br = new BookReader();
		$br->setName("TestReader");
		$br->save();
		$br->copy();

		$b = new Book();
		$b->setTitle("TestBook");
		$b->setISBN("XX-XX-XX-XX");
		$b->save();

		$op = new BookOpinion();
		$op->setBookReader($br);
		$op->setBook($b);
		$op->setRating(10);
		$op->setRecommendToFriend(true);
		$op->save();

		$br2 = $br->copy(true);

		$this->assertNull($br2->getId());

		$opinions = $br2->getBookOpinions();
		$this->assertEquals(1, count($opinions), "Expected to have a related BookOpinion after copy()");

		// We DO expect the reader_id to be null
		$this->assertNull($opinions[0]->getReaderId());
		// but we DO NOT expect the book_id to be null
		$this->assertEquals($op->getBookId(), $opinions[0]->getBookId());
	}

	public function testToArray()
	{
		$b = new Book();
		$b->setTitle('Don Juan');

		$arr1 = $b->toArray();
		$expectedKeys = array(
			'Id',
			'Title',
			'ISBN',
			'Price',
			'PublisherId',
			'AuthorId'
		);
		$this->assertEquals($expectedKeys, array_keys($arr1), 'toArray() returns an associative array with BasePeer::TYPE_PHPNAME keys by default');
		$this->assertEquals('Don Juan', $arr1['Title'], 'toArray() returns an associative array representation of the object');
	}

	public function testToArrayKeyType()
	{
		$b = new Book();
		$b->setTitle('Don Juan');

		$arr1 = $b->toArray(BasePeer::TYPE_COLNAME);
		$expectedKeys = array(
			BookPeer::ID,
			BookPeer::TITLE,
			BookPeer::ISBN,
			BookPeer::PRICE,
			BookPeer::PUBLISHER_ID,
			BookPeer::AUTHOR_ID
		);
		$this->assertEquals($expectedKeys, array_keys($arr1), 'toArray() accepts a $keyType parameter to change the result keys');
		$this->assertEquals('Don Juan', $arr1[BookPeer::TITLE], 'toArray() returns an associative array representation of the object');
	}

	/**
	 * Test the toArray() method with new lazyLoad param.
	 * @link       http://propel.phpdb.org/trac/ticket/527
	 */
	public function testToArrayLazyLoad()
	{
		BookstoreDataPopulator::populate();

		$c = new Criteria();
		$c->add(MediaPeer::COVER_IMAGE, null, Criteria::NOT_EQUAL);
		$c->add(MediaPeer::EXCERPT, null, Criteria::NOT_EQUAL);

		$m = MediaPeer::doSelectOne($c);
		if ($m === null) {
			$this->fail("Test requires at least one media row w/ cover_image and excerpt NOT NULL");
		}

		$arr1 = $m->toArray(BasePeer::TYPE_COLNAME);
		$this->assertNotNull($arr1[MediaPeer::COVER_IMAGE]);
		$this->assertInternalType('resource', $arr1[MediaPeer::COVER_IMAGE]);

		$arr2 = $m->toArray(BasePeer::TYPE_COLNAME, false);
		$this->assertNull($arr2[MediaPeer::COVER_IMAGE]);
		$this->assertNull($arr2[MediaPeer::EXCERPT]);

		$diffKeys = array_keys(array_diff($arr1, $arr2));

		$expectedDiff = array(MediaPeer::COVER_IMAGE, MediaPeer::EXCERPT);

		$this->assertEquals($expectedDiff, $diffKeys);
	}

	public function testToArrayIncludesForeignObjects()
	{
		BookstoreDataPopulator::populate();
		BookPeer::clearInstancePool();
		AuthorPeer::clearInstancePool();
		PublisherPeer::clearInstancePool();

		$c = new Criteria();
		$c->add(BookPeer::TITLE, 'Don Juan');
		$books = BookPeer::doSelectJoinAuthor($c);
		$book = $books[0];

		$arr1 = $book->toArray(BasePeer::TYPE_PHPNAME, null, array(), true);
		$expectedKeys = array(
			'Id',
			'Title',
			'ISBN',
			'Price',
			'PublisherId',
			'AuthorId',
			'Author'
		);
		$this->assertEquals($expectedKeys, array_keys($arr1), 'toArray() can return sub arrays for hydrated related objects');
		$this->assertEquals('George', $arr1['Author']['FirstName'], 'toArray() can return sub arrays for hydrated related objects');

		$c = new Criteria();
		$c->add(BookPeer::TITLE, 'Don Juan');
		$books = BookPeer::doSelectJoinAll($c);
		$book = $books[0];

		$arr2 = $book->toArray(BasePeer::TYPE_PHPNAME, null, array(), true);
		$expectedKeys = array(
			'Id',
			'Title',
			'ISBN',
			'Price',
			'PublisherId',
			'AuthorId',
			'Publisher',
			'Author'
		);
		$this->assertEquals($expectedKeys, array_keys($arr2), 'toArray() can return sub arrays for hydrated related objects');
	}

	public function testToArrayIncludesForeignReferrers()
	{
		$a1 = new Author();
		$a1->setFirstName('Leo');
		$a1->setLastName('Tolstoi');
		$arr = $a1->toArray(BasePeer::TYPE_PHPNAME, null, array(), true);
		$this->assertFalse(array_key_exists('Books', $arr));
		$b1 = new Book();
		$b1->setTitle('War and Peace');
		$b2 = new Book();
		$b2->setTitle('Anna Karenina');
		$a1->addBook($b1);
		$a1->addBook($b2);
		$arr = $a1->toArray(BasePeer::TYPE_PHPNAME, null, array(), true);
		$this->assertTrue(array_key_exists('Books', $arr));
		$this->assertEquals(2, count($arr['Books']));
		$this->assertEquals('War and Peace', $arr['Books']['Book_0']['Title']);
		$this->assertEquals('Anna Karenina', $arr['Books']['Book_1']['Title']);
		$this->assertEquals('*RECURSION*', $arr['Books']['Book_0']['Author']);
	}

	/**
	 * Test regexp validator for ticket:542
	 * @link       http://propel.phpdb.org/trac/ticket/542
	 */
	public function testRegexValidator()
	{
		$b = new Bookstore();
		$b->setWebsite("http://this.is.valid.com/foo.bar");
		$res = $b->validate();
		$this->assertTrue($res, "Expected URL to validate");
	}

	/**
	 * Test that setting the auto-increment primary key will result in exception.
	 */
	public function testSettingAutoIncrementPK()
	{
	  // The whole test is in a transaction, but this test needs real transactions
	  $this->con->commit();

		$b = new Bookstore();
		$b->setId(1);
		$b->setStoreName("Test");
		try {
			$b->save();
			$this->fail("Expected setting auto-increment primary key to result in Exception");
		} catch (Exception $x) {
			$this->assertInstanceOf('PropelException', $x);
		}

		// ... but we should silently ignore NULL values, since these are really
		// the same as "not set" in PHP world.
		$b = new Bookstore();
		$b->setId(null);
		$b->setStoreName("Test2");
		try {
			$b->save();
		} catch (Exception $x) {
			$this->fail("Expected no exception when setting auto-increment primary key to NULL");
		}
		// success ...

		$this->con->beginTransaction();
	}

	/**
	 * Checks wether we are allowed to specify the primary key on a
	 * table with allowPkInsert=true set
	 *
	 * saves the object, gets it from data-source again and then compares
	 * them for equality (thus the instance pool is also checked)
	 */
	public function testAllowPkInsertOnIdMethodNativeTable()
	{
		$cu = new Customer;
		$cu->setPrimaryKey(100000);
		$cu->save();

		$this->assertEquals(100000, $cu->getPrimaryKey());

		$cu2 = CustomerPeer::retrieveByPk(100000);

		$this->assertSame($cu, $cu2);
	}
	/**
	 * Checks if it is allowed to save new, empty objects with a auto increment column
	 */
	public function testAllowEmptyWithAutoIncrement()
	{
		$bookreader = new BookReader();
		$bookreader->save();

		$this->assertFalse($bookreader->isNew() );
	}

	/**
	 * Test foreign key relationships based on references to unique cols but not PK.
	 * @link       http://propel.phpdb.org/trac/ticket/691
	 */
	public function testUniqueFkRel()
	{
		$employee = new BookstoreEmployee();
		$employee->setName("Johnny Walker");

		$acct = new BookstoreEmployeeAccount();
		$acct->setBookstoreEmployee($employee);
		$acct->setLogin("test-login");
		$acct->save();
		$acctId = $acct->getEmployeeId();

		$al = new AcctAuditLog();
		$al->setBookstoreEmployeeAccount($acct);
		$al->save();
		$alId = $al->getId();

		BookstoreEmployeePeer::clearInstancePool();
		BookstoreEmployeeAccountPeer::clearInstancePool();
		AcctAuditLogPeer::clearInstancePool();

		$al2 = AcctAuditLogPeer::retrieveByPK($alId);
		/* @var $al2 AcctAuditLog */
		$mapacct = $al2->getBookstoreEmployeeAccount();
		$lookupacct = BookstoreEmployeeAccountPeer::retrieveByPK($acctId);

		$logs = $lookupacct->getAcctAuditLogs();

		$this->assertTrue(count($logs) == 1, "Expected 1 audit log result.");
		$this->assertEquals($logs[0]->getId(), $al->getId(), "Expected returned audit log to match created audit log.");
	}

	public function testIsPrimaryKeyNull()
	{
		$b = new Book();
		$this->assertTrue($b->isPrimaryKeyNull());
		$b->setPrimaryKey(123);
		$this->assertFalse($b->isPrimaryKeyNull());
		$b->setPrimaryKey(null);
		$this->assertTrue($b->isPrimaryKeyNull());
	}

	public function testIsPrimaryKeyNullCompmosite()
	{
		$b = new BookOpinion();
		$this->assertTrue($b->isPrimaryKeyNull());
		$b->setPrimaryKey(array(123, 456));
		$this->assertFalse($b->isPrimaryKeyNull());
		$b->setPrimaryKey(array(123, null));
		$this->assertFalse($b->isPrimaryKeyNull());
		$b->setPrimaryKey(array(null, 456));
		$this->assertFalse($b->isPrimaryKeyNull());
		$b->setPrimaryKey(array(null, null));
		$this->assertTrue($b->isPrimaryKeyNull());
	}

	public function testAddToStringDefault()
	{
	  $this->assertTrue(method_exists('Author', '__toString'), 'addPrimaryString() adds a __toString() method even if no column has the primaryString attribute');
	  $author = new Author();
	  $author->setFirstName('Leo');
	  $author->setLastName('Tolstoi');
	  $expected = <<<EOF
Id: null
FirstName: Leo
LastName: Tolstoi
Email: null
Age: null

EOF;
		$this->assertEquals($expected, (string) $author, 'addPrimaryString() adds a __toString() method returning the YAML representation of the object where no column is defined as primaryString');
	}

	public function testAddToStringPrimaryString()
	{
	  $this->assertTrue(method_exists('Book', '__toString'), 'addPrimaryString() adds a __toString() method if a column has the primaryString attribute');
	  $book = new Book();
	  $book->setTitle('foo');
	  $this->assertEquals('foo', (string) $book, 'addPrimaryString() adds a __toString() method returning the value of the the first column where primaryString is true');
	}

	public function testPreInsert()
	{
		$author = new TestAuthor();
		$author->setFirstName("bogus");
		$author->setLastName("Lastname");
		$author->save();
		$this->assertEquals('PreInsertedFirstname', $author->getFirstName());
	}

	public function testPreUpdate()
	{
		$author = new TestAuthor();
		$author->setFirstName("bogus");
		$author->setLastName("Lastname");
		$author->save();
		$author->setNew(false);
		$author->save();
		$this->assertEquals('PreUpdatedFirstname', $author->getFirstName());
	}

	public function testPostInsert()
	{
		$author = new TestAuthor();
		$author->setFirstName("bogus");
		$author->setLastName("Lastname");
		$author->save();
		$this->assertEquals('PostInsertedLastName', $author->getLastName());
	}

	public function testPostUpdate()
	{
		$author = new TestAuthor();
		$author->setFirstName("bogus");
		$author->setLastName("Lastname");
		$author->save();
		$author->setNew(false);
		$author->save();
		$this->assertEquals('PostUpdatedLastName', $author->getLastName());
	}

	public function testPreSave()
	{
		$author = new TestAuthor();
		$author->setFirstName("bogus");
		$author->setLastName("Lastname");
		$author->save();
		$this->assertEquals('pre@save.com', $author->getEmail());
	}

	public function testPreSaveFalse()
	{
		$con = Propel::getConnection(AuthorPeer::DATABASE_NAME);
		$author = new TestAuthorSaveFalse();
		$author->setFirstName("bogus");
		$author->setLastName("Lastname");
		$res = $author->save($con);
		$this->assertEquals(0, $res);
		$this->assertEquals('pre@save.com', $author->getEmail());
		$this->assertNotEquals(115, $author->getAge());
		$this->assertTrue($author->isNew());
		$this->assertEquals(1, $con->getNestedTransactionCount());
	}

	public function testPostSave()
	{
		$author = new TestAuthor();
		$author->setFirstName("bogus");
		$author->setLastName("Lastname");
		$author->save();
		$this->assertEquals(115, $author->getAge());
	}

	public function testPreDelete()
	{
		$author = new TestAuthor();
		$author->setFirstName("bogus");
		$author->setLastName("Lastname");
		$author->save();
		$author->delete();
		$this->assertEquals("Pre-Deleted", $author->getFirstName());
	}

	public function testPreDeleteFalse()
	{
		$con = Propel::getConnection(AuthorPeer::DATABASE_NAME);
		$author = new TestAuthorDeleteFalse();
		$author->setFirstName("bogus");
		$author->setLastName("Lastname");
		$author->save($con);
		$author->delete($con);
		$this->assertEquals("Pre-Deleted", $author->getFirstName());
		$this->assertNotEquals("Post-Deleted", $author->getLastName());
		$this->assertFalse($author->isDeleted());
		$this->assertEquals(1, $con->getNestedTransactionCount());
	}

	public function testPostDelete()
	{
		$author = new TestAuthor();
		$author->setFirstName("bogus");
		$author->setLastName("Lastname");
		$author->save();
		$author->delete();
		$this->assertEquals("Post-Deleted", $author->getLastName());
	}

	public function testMagicVirtualColumnGetter()
	{
		$book = new Book();
		$book->setVirtualColumn('Foo', 'bar');
		$this->assertEquals('bar', $book->getFoo(), 'generated __call() catches getters for virtual columns');
		$book = new Book();
		$book->setVirtualColumn('foo', 'bar');
		$this->assertEquals('bar', $book->getFoo(), 'generated __call() catches getters for virtual columns starting with a lowercase character');
	}

	/**
	 * @expectedException PropelException
	 */
	public function testMagicCallUndefined()
	{
		$book = new Book();
		$book->fooMethodName();
	}

	public static function conditionsForTestReadOnly()
	{
		return array(
			array('reload'),
			array('delete'),
			array('save'),
			array('doSave'),
		);
	}

	/**
	 * @dataProvider conditionsForTestReadOnly
	 */
	public function testReadOnly($method)
	{
		$cv = new ContestView();
		$this->assertFalse(method_exists($cv, $method), 'readOnly tables end up with no ' . $method . ' method in the generated object class');
	}
}


text:
package net.ion.oadr2.service.bean;

public class VenStatus {

	private String _id;
	private String venId;
	private String eventId;
	private String requestId;
	private String status;
	private String programId;
	private long created;

	public VenStatus(){

	}

	public String get_id() {
		return this._id;
	}

	public void set_id(String _id) {
		this._id = _id;
	}

	public String getVenId() {
		return this.venId;
	}

	public void setVenId(String venId) {
		this.venId = venId;
	}

	public String getEventId() {
		return this.eventId;
	}

	public void setEventId(String eventId) {
		this.eventId = eventId;
	}

	public String getRequestId() {
		return this.requestId;
	}

	public void setRequestId(String requestId) {
		this.requestId = requestId;
	}

	public String getStatus() {
		return this.status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getProgramId() {
		return this.programId;
	}

	public void setProgramId(String programId) {
		this.programId = programId;
	}

	public long getCreated() {
		return this.created;
	}

	public void setCreated(long created) {
		this.created = created;
	}

}


text:
#ifndef __STDAFX_H__
#define __STDAFX_H__

#include <iostream>
#include <string>
#include <vector>
#include <limits>
#include <fstream>
#include <strstream>
#include <iterator>
#include <memory>

#pragma warning(push)
#pragma warning(disable:4100)
#pragma warning(disable:4512)
#pragma warning(disable:4510)
#pragma warning(disable:4610)
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp>
#include <boost/tokenizer.hpp>
#include <boost/graph/breadth_first_search.hpp>
#pragma warning(pop)

#include <Windows.h>
#include <tchar.h>

#ifdef max
#undef max
#endif

#ifdef min
#undef min
#endif

#include <cstdio>
#include <cstring>
#include <cassert>
#include <cmath>
#include <cctype>

//#ifndef EXE_BUILD
//#define EXE_BUILD
//#endif

#endif//__STDAFX_H__


text:
{% extends 'developers/base_impala.html' %}
{% from 'developers/includes/macros.html' import required %}

{% set title = _('In-App Products') %}
{% block title %}{{ hub_page_title(title, addon) }}{% endblock %}

{% set can_edit = check_addon_ownership(request, addon) %}
{% block bodyclass %}
  {{ super() }}{% if not can_edit %} no-edit{% endif %}
{% endblock %}

{% block css_extra %}
    {{ css('mkt/in-app-products') }}
{% endblock %}

{% block js %}
    {{ js('mkt/in-app-products') }}
{% endblock %}

{% block content %}

    {{ hub_breadcrumbs(addon, items=[(None, title)]) }}

{{ title }}

            {{ _('Icon') }}
            {{ _('Name') }}
            {{ _('Price Point') }}
            {{ _('Buy URL') }}

          {% for product in products %}
            {% include "developers/payments/in-app-product-row.html" %}
          {% endfor %}

      <button id="add-in-app-product">{{ _('+ Add a product') }}</button>

  {% include "developers/includes/addons_edit_nav.html" %}
{% endblock %}


text:
<?php
namespace Resource\Bundle\ListenerBundle\Listener\Controller;

use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Resource\Bundle\ListenerBundle\Services\ResponseFormaterService;

class RequestListener
{

    protected $formater;

    public function __construct(ResponseFormaterService $formater){
        $this->formater = $formater;
    }
    public function onKernelController(FilterControllerEvent $event)
    {
        $controller = $event->getController();

        if (!is_array($controller)) {
            return;
        }

        $request = $event->getRequest();
        if (0 === strpos($request->headers->get('Content-Type'), 'application/json')) {
            $data = json_decode($request->getContent(), true);
            $data = is_array($data)?$data:array();
            //todo might be usefull to set every key as a post data
            foreach($data as $key=>$value){
                if(is_array($value)) $value = json_encode($value);
                $event->getRequest()->attributes->set($key,$value);
            }
        }
    }

    public function onKernelResponse(FilterResponseEvent $event){
            $event->setResponse(
                $this->formater->formatResponse(
                    $event->getResponse(),
                    $event->getRequest()
                )
            );
    }
}


text:
<?php

namespace DTS\eBaySDK\MerchantData\Types;

/**
 *
 * @property boolean $Delete
 * @property \DTS\eBaySDK\MerchantData\Types\NameValueListType[] $NameValueList
 * @property string $CompatibilityNotes
 */
class ItemCompatibilityType extends \DTS\eBaySDK\Types\BaseType
{
    /**
     * @var array Properties belonging to objects of this class.
     */
    private static $propertyTypes = array(
        'Delete' => array(
            'type' => 'boolean',
            'unbound' => false,
            'attribute' => false,
            'elementName' => 'Delete'
        ),
        'NameValueList' => array(
            'type' => 'DTS\eBaySDK\MerchantData\Types\NameValueListType',
            'unbound' => true,
            'attribute' => false,
            'elementName' => 'NameValueList'
        ),
        'CompatibilityNotes' => array(
            'type' => 'string',
            'unbound' => false,
            'attribute' => false,
            'elementName' => 'CompatibilityNotes'
        )
    );

    /**
     * @param array $values Optional properties and values to assign to the object.
     */
    public function __construct(array $values = array())
    {
        list($parentValues, $childValues) = self::getParentValues(self::$propertyTypes, $values);

        parent::__construct($parentValues);

        if (!array_key_exists(__CLASS__, self::$properties)) {
            self::$properties[__CLASS__] = array_merge(self::$properties[get_parent_class()], self::$propertyTypes);
        }

        if (!array_key_exists(__CLASS__, self::$xmlNamespaces)) {
            self::$xmlNamespaces[__CLASS__] = 'urn:ebay:apis:eBLBaseComponents';
        }

        $this->setValues(__CLASS__, $childValues);
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <ListView
        android:id="@+id/list"
        android:layout_width="fill_parent"
        android:layout_height="0dip"
        android:layout_weight="1"
        android:cacheColorHint="#00000000"
        android:listSelector="@android:color/transparent"
        android:transcriptMode="alwaysScroll" />

    <LinearLayout
        android:id="@+id/footer"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="bottom"
        android:orientation="horizontal" >

        <EditText
            android:id="@+id/editText"
            android:layout_width="0dp"
            android:layout_height="40dp"
            android:layout_weight="1"
            android:inputType="textMultiLine|textNoSuggestions" />

        <Button
            android:id="@+id/send_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:text="@string/send" />
    </LinearLayout>

</LinearLayout>