text:
var mongoose  = require('mongoose');
var Schema    = mongoose.Schema;
var ObjectId  = Schema.ObjectId;
var BaseModel = require("./base_model");

var GropuSchema = new Schema({
    name: {type: String},
    create_at: {type: Date, default: Date.now},
    user_count: {type: Number}
});

GropuSchema.plugin(BaseModel);
mongoose.model('Group', GropuSchema);

redpajama_set_name: RedPajamaGithub


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

using System;
using System.Linq;
using System.Threading;
using System.Collections.Generic;
using System.Collections.Concurrent;

using NUnit.Framework;

namespace MonoTests.System.Collections.Concurrent
{

	[TestFixture()]
	public class ConcurrentQueueTests
	{
		ConcurrentQueue<int> queue;

		[SetUpAttribute]
		public void Setup()
		{
			queue = new ConcurrentQueue<int>();
			for (int i = 0; i < 10; i++) {
				queue.Enqueue(i);
			}
		}

		[Test]
		public void StressEnqueueTestCase ()
		{
			/*ParallelTestHelper.Repeat (delegate {
				queue = new ConcurrentQueue<int> ();
				int amount = -1;
				const int count = 10;
				const int threads = 5;

				ParallelTestHelper.ParallelStressTest (queue, (q) => {
					int t = Interlocked.Increment (ref amount);
					for (int i = 0; i < count; i++)
						queue.Enqueue (t);
				}, threads);

				Assert.AreEqual (threads * count, queue.Count, "#-1");
				int[] values = new int[threads];
				int temp;
				while (queue.TryDequeue (out temp)) {
					values[temp]++;
				}

				for (int i = 0; i < threads; i++)
					Assert.AreEqual (count, values[i], "#" + i);
			});*/

			CollectionStressTestHelper.AddStressTest (new ConcurrentQueue<int> ());
		}

		[Test]
		public void StressDequeueTestCase ()
		{
			/*ParallelTestHelper.Repeat (delegate {
				queue = new ConcurrentQueue<int> ();
				const int count = 10;
				const int threads = 5;
				const int delta = 5;

				for (int i = 0; i < (count + delta) * threads; i++)
					queue.Enqueue (i);

				bool state = true;

				ParallelTestHelper.ParallelStressTest (queue, (q) => {
					int t;
					for (int i = 0; i < count; i++)
						state &= queue.TryDequeue (out t);
				}, threads);

				Assert.IsTrue (state, "#1");
				Assert.AreEqual (delta * threads, queue.Count, "#2");

				string actual = string.Empty;
				int temp;
				while (queue.TryDequeue (out temp)) {
					actual += temp;
				}
				string expected = Enumerable.Range (count * threads, delta * threads)
					.Aggregate (string.Empty, (acc, v) => acc + v);

				Assert.AreEqual (expected, actual, "#3");
			});*/

			CollectionStressTestHelper.RemoveStressTest (new ConcurrentQueue<int> (), CheckOrderingType.InOrder);
		}

		[Test]
		public void CountTestCase()
		{
			Assert.AreEqual(10, queue.Count, "#1");
			int value;
			queue.TryPeek(out value);
			queue.TryDequeue(out value);
			queue.TryDequeue(out value);
			Assert.AreEqual(8, queue.Count, "#2");
		}

		//[Ignore]
		[Test]
		public void EnumerateTestCase()
		{
			string s = string.Empty;
			foreach (int i in queue) {
				s += i;
			}
			Assert.AreEqual("0123456789", s, "#1 : " + s);
		}

		[Test()]
		public void TryPeekTestCase()
		{
			int value;
			queue.TryPeek(out value);
			Assert.AreEqual(0, value, "#1 : " + value);
			queue.TryDequeue(out value);
			Assert.AreEqual(0, value, "#2 : " + value);
			queue.TryDequeue(out value);
			Assert.AreEqual(1, value, "#3 : " + value);
			queue.TryPeek(out value);
			Assert.AreEqual(2, value, "#4 : " + value);
			queue.TryPeek(out value);
			Assert.AreEqual(2, value, "#5 : " + value);
		}

		[Test()]
		public void TryDequeueTestCase()
		{
			int value;
			queue.TryPeek(out value);
			Assert.AreEqual(0, value, "#1");
			Assert.IsTrue(queue.TryDequeue(out value), "#2");
			Assert.IsTrue(queue.TryDequeue(out value), "#3");
			Assert.AreEqual(1, value, "#4");
		}

		[Test()]
		public void TryDequeueEmptyTestCase()
		{
			int value;
			queue = new ConcurrentQueue<int> ();
			queue.Enqueue(1);
			Assert.IsTrue(queue.TryDequeue(out value), "#1");
			Assert.IsFalse(queue.TryDequeue(out value), "#2");
			Assert.IsTrue(queue.IsEmpty, "#3");
		}

		[Test]
		public void ToArrayTest()
		{
			int[] array = queue.ToArray();
			string s = string.Empty;
			foreach (int i in array) {
				s += i;
			}
			Assert.AreEqual("0123456789", s, "#1 : " + s);
			queue.CopyTo(array, 0);
			s = string.Empty;
			foreach (int i in array) {
				s += i;
			}
			Assert.AreEqual("0123456789", s, "#2 : " + s);
		}

		[Test, ExpectedException (typeof (ArgumentNullException))]
		public void ToExistingArray_Null ()
		{
			queue.CopyTo (null, 0);
		}

		[Test, ExpectedException (typeof (ArgumentOutOfRangeException))]
		public void ToExistingArray_OutOfRange ()
		{
			queue.CopyTo (new int[3], -1);
		}

		[Test, ExpectedException (typeof (ArgumentException))]
		public void ToExistingArray_IndexOverflow ()
		{
			queue.CopyTo (new int[3], 4);
		}

		[Test, ExpectedException (typeof (ArgumentException))]
		public void ToExistingArray_Overflow ()
		{
			queue.CopyTo (new int[3], 0);
		}
	}
}


text:
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<!DOCTYPE cxxClass PUBLIC "-//NOKIA//DTD DITA C++ API Class Reference Type v0.5.0//EN" "dtd/cxxClass.dtd" >
<cxxClass id="class_t_ptr_c8">
	<apiName>TPtrC8</apiName>
	<cxxClassDetail>
		<cxxClassDefinition>
			<cxxClassAccessSpecifier value="public"/>
			<cxxClassDerivations>
				<cxxClassDerivation>
					<cxxClassDerivationAccessSpecifier value="public"/>
					<cxxClassBaseClass href="class_t_des_c8.xml#class_t_des_c8">TDesC8</cxxClassBaseClass>
				</cxxClassDerivation>
			</cxxClassDerivations>
			<cxxClassAPIItemLocation>
				<cxxClassDeclarationFile name="filePath" value="K:/epoc32/include/e32des8.h"/>
				<cxxClassDeclarationFileLine name="lineNumber" value="131"/>
				<cxxClassDefinitionFile name="filePath" value="K:/epoc32/include/e32des8.h"/>
				<cxxClassDefinitionFileLineStart name="lineNumber" value="110"/>
				<cxxClassDefinitionFileLineEnd name="lineNumber" value="146"/>
			</cxxClassAPIItemLocation>
		</cxxClassDefinition>
		<apiDesc>

8-bit non-modifiable pointer descriptor.

This is a descriptor class intended for instantiation and encapsulates a pointer to the 8-bit data that it represents. The data can live in ROM or RAM and this location is separate from the descriptor object itself.

The data is intended to be accessed, but not changed, through this descriptor. The base class provides the functions through which data is accessed.

				<xref href="class_t_ptr8.xml#class_t_ptr8">TPtr8</xref>

				<xref href="class_t_des_c8.xml#class_t_des_c8">TDesC8</xref>

				<xref href="class_t_des8.xml#class_t_des8">TDes8</xref>

				<xref href="class_t_buf_c8.xml#class_t_buf_c8">TBufC8</xref>

				<xref href="class_t_buf8.xml#class_t_buf8">TBuf8</xref>

				<xref href="class_h_buf_c8.xml#class_h_buf_c8">HBufC8</xref>

		</apiDesc>
	</cxxClassDetail>
	<cxxFunction id="class_t_ptr_c8_1a45abb591313c76441c2f7faedf637a51">
		<apiName>TPtrC8</apiName>
		<cxxFunctionDetail>
			<cxxFunctionDefinition>
				<cxxFunctionAccessSpecifier value="public"/>
				<cxxFunctionConstructor/>
				<cxxFunctionDeclaredType>IMPORT_C</cxxFunctionDeclaredType>
				<cxxFunctionScopedName>TPtrC8</cxxFunctionScopedName>
				<cxxFunctionPrototype>IMPORT_C TPtrC8()</cxxFunctionPrototype>
				<cxxFunctionNameLookup>TPtrC8::TPtrC8()</cxxFunctionNameLookup>
				<cxxFunctionParameters/>
				<cxxFunctionAPIItemLocation>
					<cxxFunctionDeclarationFile name="filePath" value="K:/epoc32/include/e32des8.h"/>
					<cxxFunctionDeclarationFileLine name="lineNumber" value="133"/>
				</cxxFunctionAPIItemLocation>
			</cxxFunctionDefinition>
			<apiDesc/>
		</cxxFunctionDetail>
	</cxxFunction>
	<cxxFunction id="class_t_ptr_c8_1a793ce9615cc4fedad853d0d98029bc67">
		<apiName>TPtrC8</apiName>
		<cxxFunctionDetail>
			<cxxFunctionDefinition>
				<cxxFunctionAccessSpecifier value="public"/>
				<cxxFunctionConstructor/>
				<cxxFunctionDeclaredType>IMPORT_C</cxxFunctionDeclaredType>
				<cxxFunctionScopedName>TPtrC8</cxxFunctionScopedName>
				<cxxFunctionPrototype>IMPORT_C TPtrC8(const TDesC8 &aDes)</cxxFunctionPrototype>
				<cxxFunctionNameLookup>TPtrC8::TPtrC8(const TDesC8 &)</cxxFunctionNameLookup>
				<cxxFunctionParameters>
					<cxxFunctionParameter>
						<cxxFunctionParameterDeclaredType>const <apiRelation href="class_t_des_c8.xml#class_t_des_c8">TDesC8</apiRelation> &</cxxFunctionParameterDeclaredType>
						<cxxFunctionParameterDeclarationName>aDes</cxxFunctionParameterDeclarationName>
						<apiDefNote/>
					</cxxFunctionParameter>
				</cxxFunctionParameters>
				<cxxFunctionAPIItemLocation>
					<cxxFunctionDeclarationFile name="filePath" value="K:/epoc32/include/e32des8.h"/>
					<cxxFunctionDeclarationFileLine name="lineNumber" value="134"/>
				</cxxFunctionAPIItemLocation>
			</cxxFunctionDefinition>
			<apiDesc/>
		</cxxFunctionDetail>
	</cxxFunction>
	<cxxFunction id="class_t_ptr_c8_1a42c49768b70519dc9a4bef2f45d5b32b">
		<apiName>TPtrC8</apiName>
		<cxxFunctionDetail>
			<cxxFunctionDefinition>
				<cxxFunctionAccessSpecifier value="public"/>
				<cxxFunctionConstructor/>
				<cxxFunctionDeclaredType>IMPORT_C</cxxFunctionDeclaredType>
				<cxxFunctionScopedName>TPtrC8</cxxFunctionScopedName>
				<cxxFunctionPrototype>IMPORT_C TPtrC8(const TUint8 *aString)</cxxFunctionPrototype>
				<cxxFunctionNameLookup>TPtrC8::TPtrC8(const TUint8 *)</cxxFunctionNameLookup>
				<cxxFunctionParameters>
					<cxxFunctionParameter>
						<cxxFunctionParameterDeclaredType>const <apiRelation href="e32def_8h.xml#_1aae4399ce3f10d6c2b5ec96a13bbb5881">TUint8</apiRelation> *</cxxFunctionParameterDeclaredType>
						<cxxFunctionParameterDeclarationName>aString</cxxFunctionParameterDeclarationName>
						<apiDefNote/>
					</cxxFunctionParameter>
				</cxxFunctionParameters>
				<cxxFunctionAPIItemLocation>
					<cxxFunctionDeclarationFile name="filePath" value="K:/epoc32/include/e32des8.h"/>
					<cxxFunctionDeclarationFileLine name="lineNumber" value="135"/>
				</cxxFunctionAPIItemLocation>
			</cxxFunctionDefinition>
			<apiDesc/>
		</cxxFunctionDetail>
	</cxxFunction>
	<cxxFunction id="class_t_ptr_c8_1ab864b092372f46963c5f2297e583d999">
		<apiName>TPtrC8</apiName>
		<cxxFunctionDetail>
			<cxxFunctionDefinition>
				<cxxFunctionAccessSpecifier value="public"/>
				<cxxFunctionConstructor/>
				<cxxFunctionDeclaredType>IMPORT_C</cxxFunctionDeclaredType>
				<cxxFunctionScopedName>TPtrC8</cxxFunctionScopedName>
				<cxxFunctionPrototype>IMPORT_C TPtrC8(const TUint8 *aBuf, TInt aLength)</cxxFunctionPrototype>
				<cxxFunctionNameLookup>TPtrC8::TPtrC8(const TUint8 *,TInt)</cxxFunctionNameLookup>
				<cxxFunctionParameters>
					<cxxFunctionParameter>
						<cxxFunctionParameterDeclaredType>const <apiRelation href="e32def_8h.xml#_1aae4399ce3f10d6c2b5ec96a13bbb5881">TUint8</apiRelation> *</cxxFunctionParameterDeclaredType>
						<cxxFunctionParameterDeclarationName>aBuf</cxxFunctionParameterDeclarationName>
						<apiDefNote/>
					</cxxFunctionParameter>
					<cxxFunctionParameter>
						<cxxFunctionParameterDeclaredType>
							<apiRelation href="e32def_8h.xml#_1abb88f5378e8305d934297176fe5fa298">TInt</apiRelation>
						</cxxFunctionParameterDeclaredType>
						<cxxFunctionParameterDeclarationName>aLength</cxxFunctionParameterDeclarationName>
						<apiDefNote/>
					</cxxFunctionParameter>
				</cxxFunctionParameters>
				<cxxFunctionAPIItemLocation>
					<cxxFunctionDeclarationFile name="filePath" value="K:/epoc32/include/e32des8.h"/>
					<cxxFunctionDeclarationFileLine name="lineNumber" value="136"/>
				</cxxFunctionAPIItemLocation>
			</cxxFunctionDefinition>
			<apiDesc/>
		</cxxFunctionDetail>
	</cxxFunction>
	<cxxFunction id="class_t_ptr_c8_1a6b764ee986eeaa57007c2615e25fd29b">
		<apiName>Set</apiName>
		<cxxFunctionDetail>
			<cxxFunctionDefinition>
				<cxxFunctionAccessSpecifier value="public"/>
				<cxxFunctionInline/>
				<cxxFunctionDeclaredType>void</cxxFunctionDeclaredType>
				<cxxFunctionScopedName>TPtrC8</cxxFunctionScopedName>
				<cxxFunctionPrototype>inline void Set(const TUint8 *aBuf, TInt aLength)</cxxFunctionPrototype>
				<cxxFunctionNameLookup>TPtrC8::Set(const TUint8 *,TInt)</cxxFunctionNameLookup>
				<cxxFunctionParameters>
					<cxxFunctionParameter>
						<cxxFunctionParameterDeclaredType>const <apiRelation href="e32def_8h.xml#_1aae4399ce3f10d6c2b5ec96a13bbb5881">TUint8</apiRelation> *</cxxFunctionParameterDeclaredType>
						<cxxFunctionParameterDeclarationName>aBuf</cxxFunctionParameterDeclarationName>
						<apiDefNote>A pointer to the location that the descriptor is to represent. </apiDefNote>
					</cxxFunctionParameter>
					<cxxFunctionParameter>
						<cxxFunctionParameterDeclaredType>
							<apiRelation href="e32def_8h.xml#_1abb88f5378e8305d934297176fe5fa298">TInt</apiRelation>
						</cxxFunctionParameterDeclaredType>
						<cxxFunctionParameterDeclarationName>aLength</cxxFunctionParameterDeclarationName>
						<apiDefNote>The length of the descriptor. This value must be non-negative.</apiDefNote>
					</cxxFunctionParameter>
				</cxxFunctionParameters>
				<cxxFunctionAPIItemLocation>
					<cxxFunctionDeclarationFile name="filePath" value="K:/epoc32/include/e32des8.h"/>
					<cxxFunctionDeclarationFileLine name="lineNumber" value="137"/>
					<cxxFunctionDefinitionFile name="filePath" value="K:/sf/os/commsfw/datacommsserver/esockserver/csock/CS_CLI.CPP"/>
					<cxxFunctionDefinitionFileLineStart name="lineNumber" value="499"/>
					<cxxFunctionDefinitionFileLineEnd name="lineNumber" value="511"/>
				</cxxFunctionAPIItemLocation>
			</cxxFunctionDefinition>
			<apiDesc>

Sets the 8-bit non-modifiable pointer descriptor to point to the specified location in memory, whether in RAM or ROM.

The length of the descriptor is set to the specified length.

					panic

USER 29, if aLength is negative.

			</apiDesc>
		</cxxFunctionDetail>
	</cxxFunction>
	<cxxFunction id="class_t_ptr_c8_1aace74341c16b88bd423b19ccc5bd630e">
		<apiName>Set</apiName>
		<cxxFunctionDetail>
			<cxxFunctionDefinition>
				<cxxFunctionAccessSpecifier value="public"/>
				<cxxFunctionInline/>
				<cxxFunctionDeclaredType>void</cxxFunctionDeclaredType>
				<cxxFunctionScopedName>TPtrC8</cxxFunctionScopedName>
				<cxxFunctionPrototype>inline void Set(const TDesC8 &aDes)</cxxFunctionPrototype>
				<cxxFunctionNameLookup>TPtrC8::Set(const TDesC8 &)</cxxFunctionNameLookup>
				<cxxFunctionParameters>
					<cxxFunctionParameter>
						<cxxFunctionParameterDeclaredType>const <apiRelation href="class_t_des_c8.xml#class_t_des_c8">TDesC8</apiRelation> &</cxxFunctionParameterDeclaredType>
						<cxxFunctionParameterDeclarationName>aDes</cxxFunctionParameterDeclarationName>
						<apiDefNote>A reference to an 8-bit non-modifiable descriptor. </apiDefNote>
					</cxxFunctionParameter>
				</cxxFunctionParameters>
				<cxxFunctionAPIItemLocation>
					<cxxFunctionDeclarationFile name="filePath" value="K:/epoc32/include/e32des8.h"/>
					<cxxFunctionDeclarationFileLine name="lineNumber" value="138"/>
					<cxxFunctionDefinitionFile name="filePath" value="K:/sf/os/commsfw/datacommsserver/esockserver/csock/CS_CLI.CPP"/>
					<cxxFunctionDefinitionFileLineStart name="lineNumber" value="516"/>
					<cxxFunctionDefinitionFileLineEnd name="lineNumber" value="524"/>
				</cxxFunctionAPIItemLocation>
			</cxxFunctionDefinition>
			<apiDesc>

Sets the 8-bit non-modifiable pointer descriptor from the specified descriptor.

It is set to point to the same data and is given the same length.

			</apiDesc>
		</cxxFunctionDetail>
	</cxxFunction>
	<cxxFunction id="class_t_ptr_c8_1a546ac6d359c6d9117219c2a31d5a1290">
		<apiName>Set</apiName>
		<cxxFunctionDetail>
			<cxxFunctionDefinition>
				<cxxFunctionAccessSpecifier value="public"/>
				<cxxFunctionInline/>
				<cxxFunctionDeclaredType>void</cxxFunctionDeclaredType>
				<cxxFunctionScopedName>TPtrC8</cxxFunctionScopedName>
				<cxxFunctionPrototype>inline void Set(const TPtrC8 &aPtr)</cxxFunctionPrototype>
				<cxxFunctionNameLookup>TPtrC8::Set(const TPtrC8 &)</cxxFunctionNameLookup>
				<cxxFunctionParameters>
					<cxxFunctionParameter>
						<cxxFunctionParameterDeclaredType>const <apiRelation href="class_t_ptr_c8.xml#class_t_ptr_c8">TPtrC8</apiRelation> &</cxxFunctionParameterDeclaredType>
						<cxxFunctionParameterDeclarationName>aPtr</cxxFunctionParameterDeclarationName>
						<apiDefNote>A reference to an 8-bit non-modifiable pointer descriptor. </apiDefNote>
					</cxxFunctionParameter>
				</cxxFunctionParameters>
				<cxxFunctionAPIItemLocation>
					<cxxFunctionDeclarationFile name="filePath" value="K:/epoc32/include/e32des8.h"/>
					<cxxFunctionDeclarationFileLine name="lineNumber" value="139"/>
					<cxxFunctionDefinitionFile name="filePath" value="K:/sf/os/commsfw/datacommsserver/esockserver/csock/CS_CLI.CPP"/>
					<cxxFunctionDefinitionFileLineStart name="lineNumber" value="529"/>
					<cxxFunctionDefinitionFileLineEnd name="lineNumber" value="538"/>
				</cxxFunctionAPIItemLocation>
			</cxxFunctionDefinition>
			<apiDesc>

Sets the 8-bit non-modifiable pointer descriptor from the specified non-modifiable pointer descriptor.

It is set to point to the same data and is given the same length.

			</apiDesc>
		</cxxFunctionDetail>
	</cxxFunction>
	<cxxFunction id="class_t_ptr_c8_1a7f04d9cf8490f0d7bebc8363ac6b5b8e">
		<apiName>operator=</apiName>
		<cxxFunctionDetail>
			<cxxFunctionDefinition>
				<cxxFunctionAccessSpecifier value="private"/>
				<cxxFunctionDeclaredType>
					<apiRelation href="class_t_ptr_c8.xml#class_t_ptr_c8">TPtrC8</apiRelation> &</cxxFunctionDeclaredType>
				<cxxFunctionScopedName>TPtrC8</cxxFunctionScopedName>
				<cxxFunctionPrototype>TPtrC8 & operator=(const TPtrC8 &aDes)</cxxFunctionPrototype>
				<cxxFunctionNameLookup>TPtrC8::operator=(const TPtrC8 &)</cxxFunctionNameLookup>
				<cxxFunctionParameters>
					<cxxFunctionParameter>
						<cxxFunctionParameterDeclaredType>const <apiRelation href="class_t_ptr_c8.xml#class_t_ptr_c8">TPtrC8</apiRelation> &</cxxFunctionParameterDeclaredType>
						<cxxFunctionParameterDeclarationName>aDes</cxxFunctionParameterDeclarationName>
						<apiDefNote/>
					</cxxFunctionParameter>
				</cxxFunctionParameters>
				<cxxFunctionAPIItemLocation>
					<cxxFunctionDeclarationFile name="filePath" value="K:/epoc32/include/e32des8.h"/>
					<cxxFunctionDeclarationFileLine name="lineNumber" value="141"/>
				</cxxFunctionAPIItemLocation>
			</cxxFunctionDefinition>
			<apiDesc/>
		</cxxFunctionDetail>
	</cxxFunction>
	<cxxVariable id="class_t_ptr_c8_1a831cd3390e342108335ac97436ede2ca">
		<apiName>iPtr</apiName>
		<cxxVariableDetail>
			<cxxVariableDefinition>
				<cxxVariableAccessSpecifier value="protected"/>
				<cxxVariableDeclaredType>const <apiRelation href="e32def_8h.xml#_1aae4399ce3f10d6c2b5ec96a13bbb5881">TUint8</apiRelation> *</cxxVariableDeclaredType>
				<cxxVariableScopedName>TPtrC8</cxxVariableScopedName>
				<cxxVariablePrototype>const TUint8 * iPtr</cxxVariablePrototype>
				<cxxVariableNameLookup>TPtrC8::iPtr</cxxVariableNameLookup>
				<cxxVariableAPIItemLocation>
					<cxxVariableDeclarationFile name="filePath" value="K:/epoc32/include/e32des8.h"/>
					<cxxVariableDeclarationFileLine name="lineNumber" value="143"/>
				</cxxVariableAPIItemLocation>
			</cxxVariableDefinition>
			<apiDesc/>
		</cxxVariableDetail>
	</cxxVariable>
	<cxxVariable id="class_t_ptr_c8_1a3e8e0d2bafafc76788c3c8f834134b48">
		<apiName>__DECLARE_TEST</apiName>
		<cxxVariableDetail>
			<cxxVariableDefinition>
				<cxxVariableAccessSpecifier value="private"/>
				<cxxVariableDeclaredType/>
				<cxxVariableScopedName>TPtrC8</cxxVariableScopedName>
				<cxxVariablePrototype>__DECLARE_TEST</cxxVariablePrototype>
				<cxxVariableNameLookup>TPtrC8::__DECLARE_TEST</cxxVariableNameLookup>
				<cxxVariableReimplemented href="class_t_des_c8.xml#class_t_des_c8_1a013229cafab8b6bb75e7f382ed348623">TDesC8::__DECLARE_TEST</cxxVariableReimplemented>
				<cxxVariableAPIItemLocation>
					<cxxVariableDeclarationFile name="filePath" value="K:/epoc32/include/e32des8.h"/>
					<cxxVariableDeclarationFileLine name="lineNumber" value="145"/>
				</cxxVariableAPIItemLocation>
			</cxxVariableDefinition>
			<apiDesc/>
		</cxxVariableDetail>
	</cxxVariable>
	<cxxClassInherits>
		<cxxClassInheritsDetail>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1ae12913a18e1f53ffe32008e363040bb7">TDesC8::Alloc()const</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1acb9377a3daa8007540a971c45226b07d">TDesC8::AllocL()const</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1a30b7f032063db3b4542d46c3841afa78">TDesC8::AllocLC()const</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1acc5086e9e39151f226053c6b2333865a">TDesC8::AtC(TInt)const</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1aa11013768a16980f98da4868fff4b027">TDesC8::Compare(const TDesC8 &)const</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1acdb8a024b2e0d38aa7edd513a2061fdd">TDesC8::CompareC(const TDesC8 &)const</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1a17a6d8c18c87623e927513db81fbb8e4">TDesC8::CompareF(const TDesC8 &)const</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1ab865b94b246b8937af396edb0f11b315">TDesC8::DoSetLength(TInt)</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1a4e45eae201e3631a2717540dfc08e0d4">TDesC8::Find(const TDesC8 &)const</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1a86474526c8fa3ae05df159d69a478d70">TDesC8::Find(const TUint8 *,TInt)const</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1aaba87de7a4cd86d300c1d16eac26092a">TDesC8::FindC(const TDesC8 &)const</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1ae6c7758bc62eede7e077eb4f888a9d84">TDesC8::FindC(const TUint8 *,TInt)const</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1a2fdef2be0f7f3d5deddfebd38ad57de9">TDesC8::FindF(const TDesC8 &)const</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1a8882caf3bcea2faa87ff444fd3258e25">TDesC8::FindF(const TUint8 *,TInt)const</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1a5d6a54a323fcd3530ea507bd1382bf34">TDesC8::Left(TInt)const</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1a9790499cbe5ab4425c744530ef139d0c">TDesC8::Length()const</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1aef3e8cccdb3320822b33c783645302c1">TDesC8::Locate(TChar)const</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1a5d83bc70f8d942f9469a0c548acb4f7d">TDesC8::LocateF(TChar)const</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1a2cda493bafd84cc21d8e57e8df6f529d">TDesC8::LocateReverse(TChar)const</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1a74bbbfbda06aea8aa657e7d54c90a2af">TDesC8::LocateReverseF(TChar)const</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1a4eaea8ec34e303e2d26ea58ac55ef446">TDesC8::Match(const TDesC8 &)const</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1adbfe3236b60a49aafee78f335bd37784">TDesC8::MatchC(const TDesC8 &)const</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1a7c062d7f65e25939a84092ee1ac85938">TDesC8::MatchF(const TDesC8 &)const</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1a20192ee422ae4dd2e219e181cdbb7d04">TDesC8::Mid(TInt)const</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1a04f74ea7ca876212965a6a13b1871ae0">TDesC8::Mid(TInt,TInt)const</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1a58f6fdadc505cc3cc47234d269256ac5">TDesC8::Ptr()const</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1a4762d15e4bda1fb58eb6204f5fbe06a1">TDesC8::Right(TInt)const</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1a5ac9b8da8957c53f5e2c6367d846fb91">TDesC8::Size()const</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1af3c13c6c2540d1f6ef322b72a9b90588">TDesC8::TDesC8()</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1ab545269513682dd7202c3dbfe699c186">TDesC8::TDesC8(TInt,TInt)</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1a9f3e1ab20d4fb8656c01004da3952006">TDesC8::Type()const</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1a79f00085c845f9859d08287f7ee46817">TDesC8::operator!=(const TDesC8 &)const</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1a627d1d8aea5e180c8572e766ae428137">TDesC8::operator<(const TDesC8 &)const</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1a9cc68dbf549e0f6363872eaf4f44d60d">TDesC8::operator<=(const TDesC8 &)const</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1a330f3b1519445df03b5a47536730056a">TDesC8::operator==(const TDesC8 &)const</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1a8adcb79832fab99c383d395377b71e11">TDesC8::operator>(const TDesC8 &)const</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1a33883a685b25ec649fe4d3c3270b23df">TDesC8::operator>=(const TDesC8 &)const</cxxClassFunctionInherited>
			<cxxClassFunctionInherited href="class_t_ptr_c8.xml#class_t_des_c8_1a1680866065b25aa3e33a765aeb973305">TDesC8::operator[](TInt)const</cxxClassFunctionInherited>
		</cxxClassInheritsDetail>
	</cxxClassInherits>
</cxxClass>


text: public class A_2 extends C { }


text:
<?php
require_once 'tests/HTTP/TaintedInputs.php';

require_once 'PHPUnit/Framework/TestCase.php';

/**
 * TaintedInputs test case.
 */
class TaintedInputsTest extends PHPUnit_Framework_TestCase
{

    /**
     *
     * @var TaintedInputs
     */
    private $TaintedInputs;

    /**
     * Prepares the environment before running a test.
     */
    protected function setUp()
    {
        parent::setUp();

        // TODO Auto-generated TaintedInputsTest::setUp()

        $this->TaintedInputs = new TaintedInputs(/* parameters */);
    }

    /**
     * Cleans up the environment after running a test.
     */
    protected function tearDown()
    {
        // TODO Auto-generated TaintedInputsTest::tearDown()
        $this->TaintedInputs = null;

        parent::tearDown();
    }

    /**
     * Constructs the test case.
     */
    public function __construct()
    {
        // TODO Auto-generated constructor
    }

    /**
     * Tests TaintedInputs->is_submit()
     */
    public function testIs_submit()
    {
        // TODO Auto-generated TaintedInputsTest->testIs_submit()
        $this->markTestIncomplete("is_submit test not implemented");

        $this->TaintedInputs->is_submit(/* parameters */);
    }

    /**
     * Tests TaintedInputs->is_empty()
     */
    public function testIs_empty()
    {
        // TODO Auto-generated TaintedInputsTest->testIs_empty()
        $this->markTestIncomplete("is_empty test not implemented");

        $this->TaintedInputs->is_empty(/* parameters */);
    }

    /**
     * Tests TaintedInputs->sanitizeWithCheck()
     */
    public function testSanitizeWithCheck()
    {
        // TODO Auto-generated TaintedInputsTest->testSanitizeWithCheck()
        $this->markTestIncomplete("sanitizeWithCheck test not implemented");

        $this->TaintedInputs->sanitizeWithCheck(/* parameters */);
    }

    /**
     * Tests TaintedInputs->sanitizeAsObjectProperty()
     */
    public function testSanitizeAsObjectProperty()
    {
        // TODO Auto-generated TaintedInputsTest->testSanitizeAsObjectProperty()
        $this->markTestIncomplete("sanitizeAsObjectProperty test not implemented");

        $this->TaintedInputs->sanitizeAsObjectProperty(/* parameters */);
    }

    /**
     * Tests TaintedInputs->__construct()
     */
    public function test__construct()
    {
        // TODO Auto-generated TaintedInputsTest->test__construct()
        $this->markTestIncomplete("__construct test not implemented");

        $this->TaintedInputs->__construct(/* parameters */);
    }

    /**
     * Tests TaintedInputs->__call()
     */
    public function test__call()
    {
        // TODO Auto-generated TaintedInputsTest->test__call()
        $this->markTestIncomplete("__call test not implemented");

        $this->TaintedInputs->__call(/* parameters */);
    }
}


text:
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using NBitcoin;
using Stratis.Bitcoin.Base;
using Stratis.Bitcoin.Utilities;

namespace Stratis.Bitcoin.Features.BlockStore.Pruning
{
    /// <inheritdoc/>
    public sealed class PruneBlockStoreService : IPruneBlockStoreService
    {
        private IAsyncLoop asyncLoop;
        private readonly IAsyncLoopFactory asyncLoopFactory;
        private readonly IBlockRepository blockRepository;
        private readonly IChainState chainState;
        private readonly ILogger logger;
        private readonly INodeLifetime nodeLifetime;
        private readonly IPrunedBlockRepository prunedBlockRepository;
        private readonly StoreSettings storeSettings;

        /// <inheritdoc/>
        public ChainedHeader PrunedUpToHeaderTip { get; private set; }

        public PruneBlockStoreService(
            IAsyncLoopFactory asyncLoopFactory,
            IBlockRepository blockRepository,
            IPrunedBlockRepository prunedBlockRepository,
            IChainState chainState,
            ILoggerFactory loggerFactory,
            INodeLifetime nodeLifetime,
            StoreSettings storeSettings)
        {
            this.asyncLoopFactory = asyncLoopFactory;
            this.blockRepository = blockRepository;
            this.prunedBlockRepository = prunedBlockRepository;
            this.chainState = chainState;
            this.logger = loggerFactory.CreateLogger(this.GetType().FullName);
            this.nodeLifetime = nodeLifetime;
            this.storeSettings = storeSettings;
        }

        /// <inheritdoc/>
        public void Initialize()
        {
            this.PrunedUpToHeaderTip = this.chainState.BlockStoreTip.GetAncestor(this.prunedBlockRepository.PrunedTip.Height);

            this.asyncLoop = this.asyncLoopFactory.Run($"{this.GetType().Name}.{nameof(this.PruneBlocksAsync)}", async token =>
            {
                await this.PruneBlocksAsync().ConfigureAwait(false);
            },
            this.nodeLifetime.ApplicationStopping,
            repeatEvery: TimeSpans.TenSeconds);
        }

        /// <inheritdoc/>
        public async Task PruneBlocksAsync()
        {
            if (this.PrunedUpToHeaderTip == null)
                throw new BlockStoreException($"{nameof(this.PrunedUpToHeaderTip)} has not been set, please call initialize first.");

            if (this.blockRepository.TipHashAndHeight.Height < this.storeSettings.AmountOfBlocksToKeep)
            {
                this.logger.LogTrace("(-)[PRUNE_ABORTED_BLOCKSTORE_TIP_BELOW_AMOUNTOFBLOCKSTOKEEP]");
                return;
            }

            if (this.blockRepository.TipHashAndHeight.Height == this.PrunedUpToHeaderTip.Height)
            {
                this.logger.LogTrace("(-)[PRUNE_ABORTED_BLOCKSTORE_TIP_EQUALS_PRUNEDTIP]");
                return;
            }

            if (this.blockRepository.TipHashAndHeight.Height <= (this.PrunedUpToHeaderTip.Height + this.storeSettings.AmountOfBlocksToKeep))
            {
                this.logger.LogTrace("(-)[PRUNE_ABORTED_BLOCKSTORE_TIP_BELOW_OR_EQUAL_THRESHOLD]");
                return;
            }

            int heightToPruneFrom = this.blockRepository.TipHashAndHeight.Height - this.storeSettings.AmountOfBlocksToKeep;
            ChainedHeader startFrom = this.chainState.BlockStoreTip.GetAncestor(heightToPruneFrom);
            if (startFrom == null)
            {
                this.logger.LogInformation("(-)[PRUNE_ABORTED_START_BLOCK_NOT_FOUND]{0}:{1}", nameof(heightToPruneFrom), heightToPruneFrom);
                return;
            }

            this.logger.LogInformation("Pruning triggered, delete from {0} to {1}.", heightToPruneFrom, this.PrunedUpToHeaderTip.Height);

            var chainedHeadersToDelete = new List<ChainedHeader>();
            while (startFrom.Previous != null && this.PrunedUpToHeaderTip != startFrom)
            {
                chainedHeadersToDelete.Add(startFrom);
                startFrom = startFrom.Previous;
            }

            this.logger.LogDebug($"{chainedHeadersToDelete.Count} blocks will be pruned.");

            ChainedHeader prunedTip = chainedHeadersToDelete.First();

            this.blockRepository.DeleteBlocks(chainedHeadersToDelete.Select(c => c.HashBlock).ToList());
            this.prunedBlockRepository.UpdatePrunedTip(prunedTip);

            this.PrunedUpToHeaderTip = prunedTip;

            this.logger.LogInformation($"Store has been pruned up to {this.PrunedUpToHeaderTip.Height}.");
        }

        /// <inheritdoc/>
        public void Dispose()
        {
            this.asyncLoop?.Dispose();
        }
    }
}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using Azure.Core.TestFramework;

namespace Azure.AI.AnomalyDetector.Tests
{
    ///
    /// A helper class used to retrieve information to be used for tests.
    ///
    public class AnomalyDetectorTestEnvironment: TestEnvironment
    {
        /// The name of the environment variable from which the Anomaly Detector resource's endpoint will be extracted for the live tests.
        internal const string EndpointEnvironmentVariableName = "ANOMALY_DETECTOR_ENDPOINT";

        /// The name of the environment variable from which the Anomaly Detector resource's API key will be extracted for the live tests.
        internal const string ApiKeyEnvironmentVariableName = "ANOMALY_DETECTOR_API_KEY";
        /// The name of the environment variable from which the Anomaly Detector resource's data source will be extracted for the live tests.
        internal const string DataSourceEnvironmentVariableName = "ANOMALY_DETECTOR_DATASOURCE";

        public string ApiKey => GetRecordedVariable(ApiKeyEnvironmentVariableName);
        public string Endpoint => GetRecordedVariable(EndpointEnvironmentVariableName);
        public string DataSource => GetRecordedVariable(DataSourceEnvironmentVariableName);
    }
}


text:
namespace csocks
{

class Portal;

class Buffer
{
    friend class Portal;
private:
    static Pool pool;

public:
    std::size_t capacity;
    char* data;

    explicit Buffer(std::size_t _size):
        capacity(_size), data(pool.malloc(capacity))
    {}
};

}


text:
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE OverloadedStrings #-}
module Lazyfoo.Lesson14 (main) where

import Control.Applicative
import Control.Monad
import Data.Foldable
import Data.Monoid
import Foreign.C.Types
import Linear
import Linear.Affine
import SDL (($=))
import qualified SDL

import Paths_sdl2 (getDataFileName)

screenWidth, screenHeight :: CInt
(screenWidth, screenHeight) = (640, 480)

data Texture = Texture SDL.Texture (V2 CInt)

loadTexture :: SDL.Renderer -> FilePath -> IO Texture
loadTexture r filePath = do
  surface <- getDataFileName filePath >>= SDL.loadBMP
  size <- SDL.surfaceDimensions surface
  format <- SDL.surfaceFormat surface
  key <- SDL.mapRGB format (V3 0 maxBound maxBound)
  SDL.colorKey surface $= Just key
  t <- SDL.createTextureFromSurface r surface
  SDL.freeSurface surface
  return (Texture t size)

renderTexture :: SDL.Renderer -> Texture -> Point V2 CInt -> Maybe (SDL.Rectangle CInt) -> IO ()
renderTexture r (Texture t size) xy clip =
  let dstSize = maybe size (\(SDL.Rectangle _ size') -> size') clip
  in SDL.renderCopy r t clip (Just (SDL.Rectangle xy dstSize))

main :: IO ()
main = do
  SDL.initialize [SDL.InitVideo]

  SDL.HintRenderScaleQuality $= SDL.ScaleLinear
  do renderQuality <- SDL.get SDL.HintRenderScaleQuality
     when (renderQuality /= SDL.ScaleLinear) $
       putStrLn "Warning: Linear texture filtering not enabled!"

  window <-
    SDL.createWindow
      "SDL Tutorial"
      SDL.defaultWindow {SDL.windowInitialSize = V2 screenWidth screenHeight}
  SDL.showWindow window

  renderer <-
    SDL.createRenderer
      window
      (-1)
      (SDL.RendererConfig
         { SDL.rendererAccelerated = True
         , SDL.rendererSoftware = False
         , SDL.rendererTargetTexture = False
         , SDL.rendererPresentVSync = True
         })

  SDL.renderDrawColor renderer $= V4 maxBound maxBound maxBound maxBound

  spriteSheetTexture <- loadTexture renderer "examples/lazyfoo/animation.bmp"
  let spriteSize = V2 64 205
      clip1 = SDL.Rectangle (P (V2 0 0)) spriteSize
      clip2 = SDL.Rectangle (P (V2 64 0)) spriteSize
      clip3 = SDL.Rectangle (P (V2 128 0)) spriteSize
      clip4 = SDL.Rectangle (P (V2 196 0)) spriteSize

  let loop (frame:frames) = do
        let collectEvents = do
              e <- SDL.pollEvent
              case e of
                Nothing -> return []
                Just e' -> (e' :) <$> collectEvents
        events <- collectEvents

        let (Any quit) =
              foldMap (\case
                         SDL.QuitEvent -> (Any True)
                         _ -> mempty) $
              map SDL.eventPayload events

        SDL.renderDrawColor renderer $= V4 maxBound maxBound maxBound maxBound
        SDL.renderClear renderer

        renderTexture renderer spriteSheetTexture (P (fmap (`div` 2) (V2 screenWidth screenHeight) - fmap (`div` 2) spriteSize)) (Just frame)

        SDL.renderPresent renderer

        unless quit (loop frames)

  loop (cycle ([clip1, clip2, clip3, clip4] >>= replicate 4))

  SDL.destroyRenderer renderer
  SDL.destroyWindow window
  SDL.quit


text:
#ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_BATCH_MATMUL_H_
#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_BATCH_MATMUL_H_

#include "tensorflow/lite/c/common.h"
#include "tensorflow/lite/kernels/cpu_backend_gemm.h"
#include "tensorflow/lite/kernels/cpu_backend_gemm_params.h"
#include "tensorflow/lite/kernels/internal/common.h"
#include "tensorflow/lite/kernels/internal/types.h"

namespace tflite {
namespace optimized_ops {

inline void BatchMatMul(const RuntimeShape& lhs_shape, const float* lhs_data,
                        const RuntimeShape& rhs_shape, const float* rhs_data,
                        const RuntimeShape& output_shape, float* output_data,
                        CpuBackendContext* context) {
  using ::tflite::cpu_backend_gemm::Gemm;
  using ::tflite::cpu_backend_gemm::GemmParams;
  using ::tflite::cpu_backend_gemm::MatrixParams;
  const RuntimeShape extended_lhs_shape =
      RuntimeShape::ExtendedShape(5, lhs_shape);
  const RuntimeShape extended_rhs_shape =
      RuntimeShape::ExtendedShape(5, rhs_shape);

  // Determine which dimension is the broadcast dimension.
  auto broadcast_dim = [](int lhs_dim, int rhs_dim) {
    if (lhs_dim == rhs_dim) return lhs_dim;
    if (lhs_dim == 1) return rhs_dim;
    TFLITE_DCHECK_EQ(rhs_dim, 1);
    return lhs_dim;
  };

  // Compute the "extent" for iterating on this dimension.
  // If we are broadcasting, then don't advance (i.e return 0).
  auto extent = [](const RuntimeShape& shape, int x) {
    if (shape.Dims(x) == 1) {
      return 0;
    }
    int prod = 1;
    for (int i = x + 1; i < shape.DimensionsCount(); ++i) {
      prod *= shape.Dims(i);
    }
    return prod;
  };

  const int batch_dim0 =
      broadcast_dim(extended_lhs_shape.Dims(0), extended_rhs_shape.Dims(0));
  const int batch_dim1 =
      broadcast_dim(extended_lhs_shape.Dims(1), extended_rhs_shape.Dims(1));
  const int batch_dim2 =
      broadcast_dim(extended_lhs_shape.Dims(2), extended_rhs_shape.Dims(2));

  const int lhs_ext0 = extent(extended_lhs_shape, 0);
  const int lhs_ext1 = extent(extended_lhs_shape, 1);
  const int lhs_ext2 = extent(extended_lhs_shape, 2);
  const int rhs_ext0 = extent(extended_rhs_shape, 0);
  const int rhs_ext1 = extent(extended_rhs_shape, 1);
  const int rhs_ext2 = extent(extended_rhs_shape, 2);

  // Set params for each matrix multiply.
  const int lhs_rows = extended_lhs_shape.Dims(3);
  const int rhs_cols = extended_rhs_shape.Dims(4);
  const int accum_depth = extended_lhs_shape.Dims(4);

  MatrixParams<float> lhs_params;
  lhs_params.order = cpu_backend_gemm::Order::kRowMajor;
  lhs_params.rows = lhs_rows;
  lhs_params.cols = accum_depth;

  MatrixParams<float> rhs_params;
  rhs_params.order = cpu_backend_gemm::Order::kColMajor;
  rhs_params.rows = accum_depth;
  rhs_params.cols = rhs_cols;

  MatrixParams<float> dst_params;
  dst_params.order = cpu_backend_gemm::Order::kColMajor;
  dst_params.rows = lhs_rows;
  dst_params.cols = rhs_cols;

  for (int b0 = 0; b0 < batch_dim0; ++b0) {
    const float* lhs_ptr0 = lhs_data + (b0 * lhs_ext0);
    const float* rhs_ptr0 = rhs_data + (b0 * rhs_ext0);
    for (int b1 = 0; b1 < batch_dim1; ++b1) {
      const float* lhs_ptr1 = lhs_ptr0 + b1 * lhs_ext1;
      const float* rhs_ptr1 = rhs_ptr0 + b1 * rhs_ext1;
      for (int b2 = 0; b2 < batch_dim2; ++b2) {
        const float* lhs_ptr2 = lhs_ptr1 + b2 * lhs_ext2;
        const float* rhs_ptr2 = rhs_ptr1 + b2 * rhs_ext2;
        float* out_ptr = output_data + ((b0 * batch_dim1 * batch_dim2) +
                                        b1 * batch_dim2 + b2) *
                                           lhs_rows * rhs_cols;
        GemmParams<float, float> gemm_params;
        cpu_backend_gemm::Gemm(lhs_params, lhs_ptr2, rhs_params, rhs_ptr2,
                               dst_params, out_ptr, gemm_params, context);
      }
    }
  }
}

}  // namespace optimized_ops
}  // namespace tflite

#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_BATCH_MATMUL_H_


text:
#include <nan.h>

#include <sys/ioctl.h>
#include <linux/parport.h>
#include <linux/ppdev.h>

#include "port-status.h"

Nan::Persistent<v8::Function> PortStatus::constructor;

PortStatus::PortStatus(int handle) : handle_(handle) {}
PortStatus::~PortStatus() {}

int PortStatus::GetStatus() {
  int val;

  ioctl(handle_, PPRSTATUS, &val);
  val ^= PARPORT_STATUS_BUSY; /* /BUSY needs to get inverted */

  return val;
}

NAN_MODULE_INIT(PortStatus::Init) {
  v8::Local<v8::FunctionTemplate> tpl = Nan::New<v8::FunctionTemplate>(New);
  auto tplInst = tpl->InstanceTemplate();
  tpl->SetClassName(Nan::New("PortStatus").ToLocalChecked());
  tpl->InstanceTemplate()->SetInternalFieldCount(1);

  Nan::SetAccessor(tplInst, Nan::New("ack").ToLocalChecked(), GetAck, SetStatus);
  Nan::SetAccessor(tplInst, Nan::New("busy").ToLocalChecked(), GetBusy, SetStatus);
  Nan::SetAccessor(tplInst, Nan::New("error").ToLocalChecked(), GetError, SetStatus);
  Nan::SetAccessor(tplInst, Nan::New("select").ToLocalChecked(), GetSelect, SetStatus);
  Nan::SetAccessor(tplInst, Nan::New("paperOut").ToLocalChecked(), GetPaperOut, SetStatus);

  constructor.Reset(Nan::GetFunction(tpl).ToLocalChecked());
  Nan::Set(target, Nan::New("PortStatus").ToLocalChecked(), Nan::GetFunction(tpl).ToLocalChecked());
}

NAN_METHOD(PortStatus::New) {
  if (!info.IsConstructCall()) {
    Nan::ThrowError("Use the new operator to create instances of this object.");
    return;
  }

  int num = info[0]->IsUndefined() ? 0 : info[0]->IntegerValue();
  PortStatus* obj = new PortStatus(num);
  obj->Wrap(info.This());
  info.GetReturnValue().Set(info.This());
}

void PortStatus::NewInstance(const Nan::PropertyCallbackInfo<v8::Value>& args, int handle) {
  const unsigned argc = 1;
  v8::Local<v8::Value> argv[argc] = { Nan::New(handle) };
  v8::Local<v8::Function> cons = Nan::New(constructor);
  //v8::Local<v8::Object> instance = cons->NewInstance(argc, argv);

  Nan::MaybeLocal<v8::Object> maybeInstance = Nan::NewInstance(cons, argc, argv);
  v8::Local<v8::Object> instance;

  if (maybeInstance.IsEmpty()) {
    Nan::ThrowError("Could not create new PortStatus instance");
  } else {
    instance = maybeInstance.ToLocalChecked();
  }

  args.GetReturnValue().Set(instance);
}

NAN_GETTER(PortStatus::GetAck) {
  PortStatus* obj = ObjectWrap::Unwrap<PortStatus>(info.Holder());
  info.GetReturnValue().Set((obj->GetStatus() & PARPORT_STATUS_ACK) == PARPORT_STATUS_ACK);
}

NAN_GETTER(PortStatus::GetBusy) {
  PortStatus* obj = ObjectWrap::Unwrap<PortStatus>(info.Holder());
  info.GetReturnValue().Set((obj->GetStatus() & PARPORT_STATUS_BUSY) == PARPORT_STATUS_BUSY);
}

NAN_GETTER(PortStatus::GetError) {
  PortStatus* obj = ObjectWrap::Unwrap<PortStatus>(info.Holder());
  info.GetReturnValue().Set((obj->GetStatus() & PARPORT_STATUS_ERROR) == PARPORT_STATUS_ERROR);
}

NAN_GETTER(PortStatus::GetSelect) {
  PortStatus* obj = ObjectWrap::Unwrap<PortStatus>(info.Holder());
  info.GetReturnValue().Set((obj->GetStatus() & PARPORT_STATUS_SELECT) == PARPORT_STATUS_SELECT);
}

NAN_GETTER(PortStatus::GetPaperOut) {
  PortStatus* obj = ObjectWrap::Unwrap<PortStatus>(info.Holder());
  info.GetReturnValue().Set((obj->GetStatus() & PARPORT_STATUS_PAPEROUT) == PARPORT_STATUS_PAPEROUT);
}

NAN_SETTER(PortStatus::SetStatus) {
  Nan::ThrowError("You can't modify status fields");
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//JP">

<TITLE>Asynchronous Input/Output</TITLE>
<META NAME="description" CONTENT="Asynchronous Input/Output">
<META NAME="keywords" CONTENT="manual">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">

<META NAME="Generator" CONTENT="LaTeX2HTML v2008">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">

<LINK REL="STYLESHEET" HREF="manual.css">

<LINK REL="next" HREF="manual-node69.html">
<LINK REL="previous" HREF="manual-node64.html">
<LINK REL="up" HREF="manual-node60.html">
<LINK REL="next" HREF="manual-node69.html">

 Next: Pathnames
 Up: Streams and Input/Output
 Previous: Sockets
     Contents
     Index

Asynchronous Input/Output

select-stream stream-list timeout [function]

finds a list of streams which are ready for input operation, in
stream-list.
NIL is returned if timeout seconds have expired before any
streams become ready.
Select-stream is useful when you choose active streams
out of a list of input-streams on which input operation becomes
possible asynchronously.
Timeout specifies the time when the select operation is aborted.
It can be a float number.
If no timeout is specified, select-stream blocks
until input arrives at least one stream.
If timeout is specified and no input appears on any streams,
select-stream aborts and returns NIL.

def-async stream function [macro]

defines function to be called when data arrives at stream.
stream is either a file-stream or a socket-port.
When data comes to the file-stream or a connection request appears on
the socket-port, function is invoked with the stream as its argument.
This macro installs a SIGIO handler that dispatches to user supplied
function which is expected to perform actual input operation,
and uses unix:fcntl on stream to issue SIGIO
asynchronously when stream becomes ready to be read.

 Next: Pathnames
 Up: Streams and Input/Output
 Previous: Sockets
     Contents
     Index

<ADDRESS>

2015-08-10
</ADDRESS>


text:
<?xml version="1.0" encoding="ISO-8859-1"?>

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

    <meta content="text/html; charset=iso-8859-1" http-equiv="content-type"/>
    <title>
      WSO2 EI - Extending
    </title>
    <link href="css/EI-docs.css" rel="stylesheet"/>
    <link href="styles/dist-docs.css" rel="stylesheet" type="text/css" media="all"/>

      [  Documentation Index  ]

      Extending WSO2 Enterprise Integrator (EI)

      This document explains how to write custom mediator implementations and
      custom configuration implementations for mediators by extending Apache
      Synapse through WSO2 EI. It also provides guidelines on how to configure
      these mediators.

Contents

          Writing Custom Mediator Implementations

              MessageContext Interface

              Mediator Interface

              Leaf and Node Mediators, List Mediators and
              Filter Mediators

                  The ListMediator Interface

                  FilterMediator Interface

          Writing Custom Configuration Implementations
          for Mediators

              The MediatorFactory Interface

              The MediatorSerializer Interface

          Configuring Mediators

              Loading of Extensions by the Synapse Runtime

          Xpath Extension Framework

 Implementing HELLO_WORLD custom xpath variable

 Implementing hello-world() custom xpath function

Registering Extensions

      Writing Custom Mediator Implementations

      The primary interface of the Synapse API is the MessageContext interface
      defined below. This essentially defines the per-message context passed
      through the chain of mediators, for each and every message received and
      processed by Synapse. Each message instance is wrapped within a
      MessageContext instance, and the message context is set with the
      references to the SynapseConfiguration and SynapseEnvironments. The
      SynapseConfiguration holds the global configuration model that defines
      mediation rules, local registry entries and other configuration, while
      the environment gives access to the underlying SOAP implementation used -
      Apache Axis2. A typical mediator would need to manipulate the
      MessageContext by referring to the SynapseConfiguration. However, it is
      strongly recommended that the SynapseConfiguration is not updated by
      mediator instances as it is shared by all messages, and may be updated by
      Synapse administration or configuration modules. Mediator instances may
      store local message properties into the MessageContext for later retrieval
      by successive mediators. Extending the AbstractMediator class is the
      easiest way to write a new mediator, than implementing the Mediator
      interface.

      MessageContext
      Interface

package org.apache.synapse;

import ...

public interface MessageContext {

    /**
     * Get a reference to the current SynapseConfiguration
     *
     * @return the current synapse configuration
     */
    public SynapseConfiguration getConfiguration();

    /**
     * Set or replace the Synapse Configuration instance to be used. May be used to
     * programmatically change the configuration at runtime etc.
     *
     * @param cfg The new synapse configuration instance
     */
    public void setConfiguration(SynapseConfiguration cfg);

    /**
     * Returns a reference to the host Synapse Environment
     * @return the Synapse Environment
     */
    public SynapseEnvironment getEnvironment();

    /**
     * Sets the SynapseEnvironment reference to this context
     * @param se the reference to the Synapse Environment
     */
    public void setEnvironment(SynapseEnvironment se);

    /**
     * Get the value of a custom (local) property set on the message instance
     * @param key key to look up property
     * @return value for the given key
     */
    public Object getProperty(String key);

    /**
     * Set a custom (local) property with the given name on the message instance
     * @param key key to be used
     * @param value value to be saved
     */
    public void setProperty(String key, Object value);

    /**
     * Returns the Set of keys over the properties on this message context
     * @return a Set of keys over message properties
     */
    public Set getPropertyKeySet();

    /**
     * Get the SOAP envelope of this message
     * @return the SOAP envelope of the message
     */
    public SOAPEnvelope getEnvelope();

    /**
     * Sets the given envelope as the current SOAPEnvelope for this message
     * @param envelope the envelope to be set
     * @throws org.apache.axis2.AxisFault on exception
     */
    public void setEnvelope(SOAPEnvelope envelope) throws AxisFault;

    /**
     * SOAP message related getters and setters
     */
    public ....get/set()...

}

      The MessageContext interface is based on the Axis2 MessageContext
      interface, and it uses the Axis2 EndpointReference and
      SOAPEnvelope classes/interfaces. The purpose of this interface is to
      capture a message as it flows through the system. As you will see the
      message payload is represented using the SOAP infoset. Binary messages can
      be embedded in the Envelope using MTOM (SOAP Message Transmission
      Optimization Mechanism) or SwA (SOAP with Attachments) using the AXIOM
      (AXis Object Model) object model.

      Mediator
      Interface

      The second key interface for mediator writers is the Mediator interface:

package org.apache.synapse;

import org.apache.synapse.MessageContext;

/**
 * All Synapse mediators must implement this Mediator interface. As a message passes
 * through the synapse system, each mediator's mediate() method is invoked in the
 * sequence/order defined in the SynapseConfiguration.
 */
public interface Mediator {

    /**
     * Invokes the mediator passing the current message for mediation. Each
     * mediator performs its mediation action, and returns true if mediation
     * should continue, or false if further mediation should be aborted.
     *
     * @param synCtx the current message for mediation
     * @return true if further mediation should continue
     */
    public boolean mediate(MessageContext synCtx);

    /**
     * This is used for debugging purposes and exposes the type of the current
     * mediator for logging and debugging purposes
     * @return a String representation of the mediator type
     */
    public String getType();

    /**
     * This is used to check whether the tracing should be enabled on the current mediator or not
     * @return value that indicate whether tracing is on, off or unset
     */
    public int getTraceState();

    /**
     * This is used to set the value of tracing enable variable
     * @param traceState Set whether the tracing is enabled or not
     */
    public void setTraceState(int traceState);
}

      A mediator can read and/or modify the SynapseMessage in
      any suitable manner - adjusting the routing headers or changing the
      message body. If the mediate() method returns false, it signals to the
      Synapse processing model to stop further processing of the message. For
      example, if the mediator is a security agent it may decide that this
      message is dangerous and should not be processed further. This is
      generally the exception as mediators are usually designed to co-operate to
      process the message onwards.

      Leaf and Node Mediators, List Mediators and Filter Mediators

      Mediators may be Node mediators (i.e. these that can contain child
      mediators) or Leaf mediators (mediators that does not hold any other child
      mediators). A Node mediator must implement the
      org.apache.synapse.api.ListMediator interface listed below, or extend from
      the org.apache.synapse.mediators.AbstractListMediator.

      The
      ListMediator Interface

package org.apache.synapse.mediators;

import java.util.List;

/**
* The List mediator executes a given sequence/list of child mediators
*/
public interface ListMediator extends Mediator {
    /**
    * Appends the specified mediator to the end of this mediator's (children) list
    * @param m the mediator to be added
    * @return true (as per the general contract of the Collection.add method)
    */
    public boolean addChild(Mediator m);

    /**
    * Appends all of the mediators in the specified collection to the end of this mediator's (children)
    * list, in the order that they are returned by the specified collection's iterator
    * @param c the list of mediators to be added
    * @return true if this list changed as a result of the call
    */
    public boolean addAll(List c);

    /**
    * Returns the mediator at the specified position
    * @param pos index of mediator to return
    * @return the mediator at the specified position in this list
    */
    public Mediator getChild(int pos);

    /**
    * Removes the first occurrence in this list of the specified mediator
    * @param m mediator to be removed from this list, if present
    * @return true if this list contained the specified mediator
    */
    public boolean removeChild(Mediator m);

    /**
    * Removes the mediator at the specified position in this list
    * @param pos the index of the mediator to remove
    * @return the mediator previously at the specified position
    */
    public Mediator removeChild(int pos);

    /**
    * Return the list of mediators of this List mediator instance
    * @return the child/sub mediator list
    */
    public List getList();
}

      A ListMediator implementation should call super.mediate(synCtx) to process
      its sub mediator sequence. A FilterMediator is a ListMediator which
      executes its sequence of sub mediators on successful outcome of a test
      condition. The Mediator instance which performs filtering should implement
      the FilterMediator interface.

      FilterMediator
      Interface

package org.apache.synapse.mediators;

import org.apache.synapse.MessageContext;

/**
 * The filter mediator is a list mediator, which executes the given (sub) list of mediators
 * if the specified condition is satisfied
 *
 * @see FilterMediator#test(org.apache.synapse.MessageContext)
 */
public interface FilterMediator extends ListMediator {

    /**
     * Should return true if the sub/child mediators should execute. i.e. if the filter
     * condition is satisfied
     * @param synCtx
     * @return true if the configured filter condition evaluates to true
     */
    public boolean test(MessageContext synCtx);
}

      Writing Custom Configuration Implementations for Mediators

      You may write your own custom configurator for the Mediator implementation
      you write without relying on the Class mediator or Spring extension for
      its initialization. You could thus write a MediatorFactory implementation
      which defines how to digest a custom XML configuration element to be used
      to create and configure the custom mediator instance. A MediatorSerializer
      implementation defines how a configuration should be serialized back into
      an XML configuration. The custom MediatorFactory and MediatorSerializer
      implementations and the mediator class/es must be bundled as a "Synapse-Core" fragment bundle,
      which exporting these classes (See the description for Extensions below for more
      details and examples) and placed into the EI_HOME/repository/components/dropins
      folder, so that the Synapse runtime could find and load the definition.

	For eg: Your MANIFEST.MF file will look like;

	Bundle-Name: surcharge-stock-quote-mediator
	Created-By: Apache Maven Bundle Plugin
	DynamicImport-Package: *
	Fragment-Host: synapse-core
	Build-Jdk: 1.6.0_20
	Bundle-Version: 1.0.0
	Bnd-LastModified: 1322212580393
	Bundle-ManifestVersion: 2
	Bundle-Description: Tutorial
	Bundle-SymbolicName: surcharge-stock-quote-mediator
	Import-Package: javax.xml.namespace;version="0.0.0",org.apache.axiom.o
	m;resolution:=optional,org.apache.axiom.om.xpath;resolution:=optional
	,org.apache.axiom.soap;resolution:=optional,org.apache.commons.loggin
	g;resolution:=optional,org.apache.synapse;resolution:=optional,org.ap
	ache.synapse.config.xml;resolution:=optional,org.apache.synapse.media
	tors;resolution:=optional,org.jaxen;resolution:=optional,org.wso2.EI
	.tutorial.mediators;resolution:=optional

      Essentially this means that a custom JAR file must bundle your classes
      implementing the Mediator interface, MediatorSerializer and the MediatorFactory
      interfaces. It should also contain two text files named
      "org.apache.synapse.config.xml.MediatorFactory" and
      "org.apache.synapse.config.xml.MediatorSerializer" which will contain the
      fully qualified name(s) of your MediatorFactory and MediatorSerializer
      implementation classes. Any dependencies should be made available through OSGi
      bundles in the same plugins directory.

Note:
	However there is a limitation with this custom mediators. Currently EI supports them as
	fragments of synapse-core, since that custom mediators can not own their Activator classes.
	So,they can not override the information present in the host bundle, which is the synapse-core.

      The MediatorFactory interface listing is given below, which you should
      implement, and its getTagQName() method must define the fully qualified
      element of interest for custom configuration. The Synapse initialization
      will call back to this MediatorFactory instance through the
      createMediator(OMElement elem) method passing in this XML element, so that
      an instance of the mediator could be created utilizing the custom XML
      specification and returned. See the ValidateMediator and the
      ValidateMediatorFactory classes under modules/extensions in the Synapse
      source distribution for examples.

      The
      MediatorFactory Interface

package org.apache.synapse.config.xml;

import ...

/**
 * A mediator factory capable of creating an instance of a mediator through a given
 * XML should implement this interface
 */
public interface MediatorFactory {
    /**
     * Creates an instance of the mediator using the OMElement
     * @param elem
     * @return the created mediator
     */
    public Mediator createMediator(OMElement elem);

    /**
     * The QName of this mediator element in the XML config
     * @return QName of the mediator element
     */
    public QName getTagQName();
}

      The
      MediatorSerializer Interface

package org.apache.synapse.config.xml;

import ...

/**
 * Interface which should be implemented by mediator serializers. Does the
 * reverse of the MediatorFactory
 */
public interface MediatorSerializer {

    /**
     * Return the XML representation of this mediator
     * @param m mediator to be serialized
     * @param parent the OMElement to which the serialization should be attached
     * @return the serialized mediator XML
     */
    public OMElement serializeMediator(OMElement parent, Mediator m);

    /**
     * Return the class name of the mediator which can be serialized
     * @return the class name
     */
    public String getMediatorClassName();
}

      Configuring Mediators

      Mediators could access the Synapse registry to load resources and
      configure the local behaviour. Refer to the Spring mediator and Script
      mediator implementations for examples on how this could be achieved.

      Loading of Extensions by the Synapse Runtime

      Synapse loads available extensions from the runtime classpath using the J2SE
      Service Provider model. This essentially iterates over the
      available JAR files, for a META-INF/services directory within each file,
      and looks for text files with the name
      org.apache.synapse.config.xml.MediatorFactory and org.apache.synapse.config.xml.MediatorSerializer
      which contains a list of fully qualified class name that implement the above interface, listing each
      class in a separate line. For example, the built-in synapse-extensions.jar
      contains the following structure:

synapse-extensions.jar
    /META-INF/services
        org.apache.synapse.config.xml.MediatorFactory
        org.apache.synapse.config.xml.MediatorSerializer
    /... the implementation classes as usual...

Scheduled Tasks

Task is a one of method to automatically driving the mediation in the EI.
This is an implementation of EI Startup which allowed adding tasks should run
at EI startup. Task is a Startup and it is based on Quartz, an open source job
scheduling system. Task can be used to create simple or complex schedules. A
simple schedule may be a schedule to run a task periodically. A complex
schedule may be a schedule to run at specific time in future. A complex
schedule can be specified using cron expressions.

<task class="string" name="string" [group="string"] [pinnedServers="(serverName)+"]>
       <property name="string" value="String"/>
       <property name="string"><somexml>config</somexml></property>
       <trigger ([[count="int"]? interval="int"] | [cron="string"] | [once=(true | false)])/>
</task>

A task is created and scheduled to run at specified time intervals or as
specified by the cron expression. The Task class specifies the actual task
implementation class

 (which must implement
org.apache.synapse.task.Taskinterface) to be
executed at the specified interval/s, and name specifies an identifier for the
scheduled task.

 In the current EI , there is only one implementation -
org.apache.synapse.startup.tasks.MessageInjector.This can be
used to inject messages at EI startup.

Fields in the task class can be set using properties provided as string
literals or as XML fragments. (For example; if the task implementation class
has a field named "version" with a corresponding setter method, the
configuration value which will be assigned to this field before running the
task can be specified using a property with the name 'version')

There are three different trigger mechanisms to schedule tasks. A simple
trigger is specified specifying a 'count' and an 'interval', implying that the
task will run a 'count' number of times at specified intervals. A trigger may
also be specified as a cron trigger using a cron expression. A one-time trigger
is specified using the 'once' attribute as true in the definition and could be
specified as true in which case this task will be executed only once just after
the initialization of EI. You can give a list of Synapse server names where
this task should be started using pinnedServers attribute. Refer to the
explanation of this attribute under proxy services for more information.

Extending Task

A custom Task can be developed by writing a custom Java class that
implements the org.apache.synapse.task.Task interface. Task
interface is shown bellow.

package org.apache.synapse.task;

/*** Represents an executable Task*/

public interface Task {

   /*** Execute method will be invoked by the QuartzJOb.
   */
   public void execute();

}

            Xpath Extension Framework

            WSO2 EI configuration language is a powerful and flexible tool to perform
            authentication, validation, transformation, logging, routing based on the content etc.
            It could be easily extended, with configuration extensions , mediation extensions and
            even expression level extension. An expression is a lowest level particle in the
            synapase configuration. To be precise , unlike static values ,expressions can be used to
            define dynamically extracted values (using xpath) in a  configuration.
            Mediators extensively uses expressions to extract properties from message context.
            Expression is defined under attribute "expression" of a particular configuration. (see
            property/header/iterator mediator ) .Although expressions can be purely xpath , synapse
            allows extensions to define extended expressions as well. These special xpath expressions
            can be two fold , that is ,

            1.xpath variable expressions
            2.xpath function expressions

            this allows us to access xpath variables with "$" . Currently there are several
            predefined synapse xpath variables avaiable.

            Ie:- $body - message SOAP body
            $header ? message SOAP header
            $ctxt:SOME_PROPERTY ? a property belonging to synapse meessage context scope
            $axis2:SOME_PROPERTY ? a property belonging to axis2 meessage context scope
            $trp:SOME_TRANSPORT_HEADER ? a transport header

            Synapse get-property() is an example xpath function expressions. The get-property()
            function allows any XPath expression used in a configuration to lookup information from
            the current message context. Similar to above , It is possible to retrieve properties
            previously set with the property mediator, and/or information from the Synapse or Axis2
            message contexts or transport header using get-property().

            see synapse documentation for more details on usage of these expressions.
            Xpath extension framework allows users to further extend xpath expressions to
            suite user requirement. More specifically it allows users to define custom xpath
            expressions and custom xpath functions that is required in a specific usecase
            configuration scenario. Let's see how we can do this. We start by writng our HELLO_WORLD
            custom xpath variable and hello-world() custom xpath function.

            Implementing HELLO_WORLD custom xpath variable

            Before going into implementation details , let me first define our final objective here.
            What we need to do is to expose an HELLO_WORLD message in xml format to outside , so
            that users would be able to access it using a xpath expression="$HELLOWORLD/...".
            Following is the HELLO_WORLD mesasge we have.

            <HELLO_WORLD>
            <name>WSO2-EI</name>
            <version>4.0.0</version>
            <release_date>20/12/2010</release_date>
            </HELLO_WORLD>

Every custom xpath extension should implement
            org.apache.synapse.util.xpath.ext.SynapseXpathVariableResolver interface to expose a
            custom xpath variable. This interface consists of two methods , #getResolvingQName ,
            #resolve . First interface method is used to indicate the fully qualified
            variable name that this extesion support (in our case it is HELLO_WORLD). Later method
            should contain what ever resolving logic required to give the desired output.(in our
            case it should return HELLO_WORLD element) . Following is the implementation of our
            custom xpath variable HELLO_WORLD,

            package org.sample;

            import org.apache.axiom.om.OMAbstractFactory;
            import org.apache.axiom.om.OMElement;
            import org.apache.axiom.om.OMFactory;
            import org.apache.synapse.MessageContext;
            import org.apache.synapse.util.xpath.ext.SynapseXpathVariableResolver;

            import javax.xml.namespace.QName;

            public class HelloWorldXpathVariableResolver implements SynapseXpathVariableResolver {

            public static final QName HELLO_WORLD = new QName("HELLO_WORLD");

            public Object resolve(MessageContext messageContext) {
                //create Hello world message
                OMFactory factory = OMAbstractFactory.getOMFactory();
                OMElement helloWorldElement = factory.createOMElement(HELLO_WORLD);

                OMElement nameElement = factory.createOMElement(new QName("name"));
                nameElement.setText("synapse");
                OMElement versionElem = factory.createOMElement(new QName("version"));
                versionElem.setText("3.1.0");
                OMElement releaseDateElem = factory.createOMElement(new QName("release_date"));
                releaseDateElem.setText("12/12/2010");

                helloWorldElement.addChild(nameElement);
                helloWorldElement.addChild(versionElem);
                helloWorldElement.addChild(releaseDateElem);

                return helloWorldElement;
            }

            public QName getResolvingQName() {
                //to support xpath expression="$HELLO_WORLD"
                return HELLO_WORLD;
            }

            }

            with implementation in place mediators can refer version , name , release date on
            HELLO_WORLD message using expression="$HELLO_WORLD/version" , etc

            Implementing hello-world() custom xpath function

            Having an xpath function extension is easy as implementing an xpath variable extension.
            In this case Extension class should implement
            org.apache.synapse.util.xpath.ext.SynapseXpathFunctionContextProvider . This interface
            also do have methods , #getResolvingQName and #getInitializedExtFunction . First method
            serves the same purpose as in the previous example. However later method should be
            implementated in such a way that this extension should return a custom jaxen function to
            synapse , initialized with synapse message context. It is extension developers
            responsibility to provide a properly initialized xpath function so that it can be
            resolved at runtime. Our sample implementation is shown below

            package org.sample;

            import org.apache.synapse.MessageContext;
            import org.apache.synapse.util.xpath.ext.SynapseXpathFunctionContextProvider;
            import org.jaxen.Function;
            import javax.xml.namespace.QName;

            public class HelloWorldXpathFunctionProvider implements SynapseXpathFunctionContextProvider {

            public Function getInitializedExtFunction(MessageContext messageContext) {
                CustomHelloWorldFunction helloWorldFunction = new CustomHelloWorldFunction(messageContext);
                return helloWorldFunction;
            }

            public QName getResolvingQName() {
                //letting know synapse new hello-world extension function
                return new QName("hello-world");
            }
            }

            Shown bellow is the custom xpath function returned by our xpath function extension. Note
            that this should implement org.jaxen.Function to resolve xpath .

            package org.sample;

            import org.apache.axiom.om.OMAbstractFactory;
            import org.apache.axiom.om.OMElement;
            import org.apache.axiom.om.OMFactory;
            import org.apache.commons.logging.Log;
            import org.apache.commons.logging.LogFactory;
            import org.apache.synapse.MessageContext;
            import org.apache.synapse.SynapseConstants;
            import org.jaxen.Context;
            import org.jaxen.Function;
            import org.jaxen.FunctionCallException;
            import org.jaxen.function.StringFunction;

            import javax.xml.namespace.QName;
            import java.util.List;

            public class CustomHelloWorldFunction implements Function {
            private MessageContext synCtx;

            private Log log = LogFactory.getLog(CustomHelloWorldFunction.class);
            private static final Log trace = LogFactory.getLog(SynapseConstants.TRACE_LOGGER);

            private String NULL_STRING = "";
            public static final QName HELLO_WORLD = new QName("HELLO_WORLD");
            private OMElement helloWorld;

            public CustomHelloWorldFunction(MessageContext ctxt) {
                this.synCtx = ctxt;
                //create hello world message
                OMFactory factory = OMAbstractFactory.getOMFactory();
                OMElement helloWorldElement = factory.createOMElement(HELLO_WORLD);

                OMElement nameElement = factory.createOMElement(new QName("name"));
                nameElement.setText("synapse");
                OMElement versionElem = factory.createOMElement(new QName("version"));
                versionElem.setText("3.1.0");
                OMElement releaseDateElem = factory.createOMElement(new QName("release_date"));
                releaseDateElem.setText("12/12/2010");

                helloWorldElement.addChild(nameElement);
                helloWorldElement.addChild(versionElem);
                helloWorldElement.addChild(releaseDateElem);
                this.helloWorld = helloWorldElement;
            }

            /**
            * Returns the string value of the hello world message for the corresponding child
            proeprty
            * arguments are hello-world(name | version | release_date)
            *
            * @param context the context at the point in the expression when the function is called
            * @param args arguments of the functions
            * @return The string value of the property
            * @throws org.jaxen.FunctionCallException
            *
            */
            public Object call(Context context, List args) throws FunctionCallException {

                if (synCtx == null) {
                    if (log.isDebugEnabled()) {
                    log.debug("Synapse message context has not been set for the " +
                    "XPath extension function 'synapse:hello-world(arg_name)'");
                    }
                    return null;
                }

                boolean traceOn = synCtx.getTracingState() == SynapseConstants.TRACING_ON;
                boolean traceOrDebugOn = traceOn || log.isDebugEnabled();

                if (args == null || args.size() == 0) {
                    if (traceOrDebugOn) {
                        traceOrDebug(traceOn, "argument key value for lookup is not specified");
                    }
                    return NULL_STRING;
                } else
                {
                    int size = args.size();
                    if (size == 1) {
                        String argument = StringFunction.evaluate(args.get(0), context.getNavigator());
                    if ("name".equals(argument) || "version".equals(argument) ||
                        "release_date".equals(argument)) {
                         return helloWorld.getFirstChildWithName(new QName(argument));
                    }else{
                        return helloWorld;
                    }
                }
                }
                return NULL_STRING;
            }

            private void traceOrDebug(boolean traceOn, String msg) {
                if (traceOn) {
                    trace.info(msg);
                }
                if (log.isDebugEnabled()) {
                    log.debug(msg);
                }
            }

            }

            Here we basically select an child element or the whole Hello World message based on the
            aguments. Please refer to org.jaxen.Function for further details on the implementation.
            With this extension in place synapse configuration can refer to a particular element of
            our Hello World message with expression = "hello-world('name')" ,expression =
            "hello-world('version')" , etc

            Registering Extensions

            We need one additional step to make all these extensions integrate into Synapse configuration language.
            Registering extensions is done by declaring them in synapse.properties file.
            synapse.properties can be found $SYNAPSE_HOME/repository/conf . Functions should be
            declared under property synapse.xpath.func.extensions while Variables should be under
            synapse.xpath.var.extensions .

            synapse.xpath.var.extensions=org.sample.HelloWorldXpathVariableResolver
            synapse.xpath.func.extensions=org.sample. HelloWorldXpathFunctionProvider

            If multiple function / variable extesnions are needed comma delimited list can be
            declared. WSO2 EI at startup will register all these declared extensions (defined under
            its CLASSPATH) and our HELLO-WORLD xpath extensions will be ready to roll.


text:
module TagcloudHelper
end


text:
import * as request from 'request';

/** Convenience wrapper for asynchronously request an URL. */
export const requestAsync = (options: string | request.Options): Promise<any> => {
    return new Promise((resolve, reject) => {
        // `as any` because typescript complains about the type of options.
        request(options as any, (error: any, res: any, body: any) => {
            if (error) {
                return reject(error);
            }

            return resolve(body);
        });
    });
};


text:
namespace cobalt {
namespace browser {

// SplashScreen uses a WebModule to present a splash screen.
//
class SplashScreen : public LifecycleObserver {
 public:
  SplashScreen(web::UserAgentPlatformInfo* platform_info,
               base::ApplicationState initial_application_state,
               const WebModule::OnRenderTreeProducedCallback&
                   render_tree_produced_callback,
               network::NetworkModule* network_module,
               const cssom::ViewportSize& window_dimensions,
               render_tree::ResourceProvider* resource_provider,
               float layout_refresh_rate,
               const base::Optional<GURL>& fallback_splash_screen_url,
               cobalt::browser::SplashScreenCache* splash_screen_cache,
               const base::Callback<void(base::TimeDelta)>&
                   on_splash_screen_shutdown_complete,
               const base::Closure& maybe_freeze_callback);
  ~SplashScreen();

  void SetSize(const cssom::ViewportSize& viewport_size) {
    web_module_->SetSize(viewport_size);
  }

  // LifecycleObserver implementation.
  // LifecycleObserver implementation.
  void Blur(SbTimeMonotonic timestamp) override { web_module_->Blur(0); }
  void Conceal(render_tree::ResourceProvider* resource_provider,
               SbTimeMonotonic timestamp) override {
    web_module_->Conceal(resource_provider, 0);
  }
  void Freeze(SbTimeMonotonic timestamp) override { web_module_->Freeze(0); }
  void Unfreeze(render_tree::ResourceProvider* resource_provider,
                SbTimeMonotonic timestamp) override {
    web_module_->Unfreeze(resource_provider, 0);
  }
  void Reveal(render_tree::ResourceProvider* resource_provider,
              SbTimeMonotonic timestamp) override {
    web_module_->Reveal(resource_provider, 0);
  }
  void Focus(SbTimeMonotonic timestamp) override { web_module_->Focus(0); }

  void ReduceMemory() { web_module_->ReduceMemory(); }

  // This dispatches event beforeunload in the WebModule. If
  // beforeunload has any handlers or listeners, Shutdown waits for
  // window.close to be called or a maximum of kSplashShutdownSeconds
  // before running |on_splash_screen_shutdown_complete_|. If beforeunload has
  // no handlers, |on_splash_screen_shutdown_complete_| is run immediately.
  void Shutdown();

  // Returns whether Shutdown() has been called before or not.
  bool ShutdownSignaled() const { return shutdown_signaled_; }

  WebModule& web_module() { return *web_module_; }

  bool IsReadyToFreeze() { return web_module_->IsReadyToFreeze(); }

 private:
  // Run when window.close() is called by the WebModule.
  void OnWindowClosed();
  void OnWindowClosedInternal();

  WebModule::OnRenderTreeProducedCallback render_tree_produced_callback_;

  std::unique_ptr<WebModule> web_module_;

  // The splash screen runs on this message loop.
  base::MessageLoop* const self_message_loop_;

  // This is called by Shutdown (via window.close) or after
  // the time limit has been exceeded.
  base::CancelableCallback<void(base::TimeDelta)>
      on_splash_screen_shutdown_complete_;

  // True if SplashScreen::Shutdown() has been called.
  bool shutdown_signaled_;
};

}  // namespace browser
}  // namespace cobalt

#endif  // COBALT_BROWSER_SPLASH_SCREEN_H_


text:
namespace doris {

// Utility method to URL-encode a string (that is, replace special
// characters with %<hex value in ascii>).
// The optional parameter hive_compat controls whether we mimic Hive's
// behaviour when encoding a string, which is only to encode certain
// characters (excluding, e.g., ' ')
void url_encode(const std::string& in, std::string* out);
void url_encode(const std::vector<uint8_t>& in, std::string* out);

// Utility method to decode a string that was URL-encoded. Returns
// true unless the string could not be correctly decoded.
// The optional parameter hive_compat controls whether or not we treat
// the strings as encoded by Hive, which means selectively ignoring
// certain characters like ' '.
bool url_decode(const std::string& in, std::string* out);

void base64url_encode(const std::string& in, std::string *out);
void base64_encode(const std::string& in, std::string *out);

// Utility method to decode base64 encoded strings.  Also not extremely
// performant.
// Returns true unless the string could not be correctly decoded.
bool base64_decode(const std::string& in, std::string* out);

// Replaces &, < and > with &, < and > respectively. This is
// not the full set of required encodings, but one that should be
// added to on a case-by-case basis. Slow, since it necessarily
// inspects each character in turn, and copies them all to *out; use
// judiciously.
void escape_for_html(const std::string& in, std::stringstream* out);

}

#endif