text:
using System;
using UnityEngine;

public static class WorldIO
{
    public static void SaveWorldState(World world)
    {
        // Get world state object.
        WorldSaveState sd = new WorldSaveState(world);
        string path = OutputUtils.RealitySaveDirectory + world.RealityName + OutputUtils.WorldStateSaveFile;

        OutputUtils.ObjectToFile(sd, path);
        Debug.Log("Saved world state to '" + path + "'");
    }

    public static void LoadWorldState(World world)
    {
        // Tryo to load from file.
        string path = OutputUtils.RealitySaveDirectory + world.RealityName + OutputUtils.WorldStateSaveFile;
        WorldSaveState sd = InputUtils.FileToObject<WorldSaveState>(path);

        if(sd != null)
        {
            sd.Apply(world);
            Debug.Log("Applied loaded world state...");
        }
        else
        {
            Debug.LogError("Null world state save file, no world state data applied.");
        }
    }

    public static WorldSaveState GetSaveState(string reality)
    {
        string path = OutputUtils.RealitySaveDirectory + reality + OutputUtils.WorldStateSaveFile;
        WorldSaveState sd = InputUtils.FileToObject<WorldSaveState>(path);

        return sd;
    }
}

public class WorldSaveState
{
    // Stuff like time, difficulty, etc.
    public float Time;
    public DateTime LastPlayed;
    public Vector2 SpawnPoint;
    public float SpawnRadius;

    public WorldSaveState()
    {

    }

    public WorldSaveState(World w)
    {
        Time = w.GameTime.GetTimeRaw();
        LastPlayed = DateTime.Now;
        SpawnPoint = w.SpawnPoint;
        SpawnRadius = w.SpawnRadius;
    }

    public void Apply(World world)
    {
        world.GameTime.SetTime(Time);
        world.SpawnPoint = SpawnPoint;
        world.SpawnRadius = SpawnRadius;
    }
}


text:
--TEST--
Test mcrypt_encrypt() function : AES functionality
--SKIPIF--
<?php
if (!extension_loaded("mcrypt")) {
	print "skip - mcrypt extension not loaded";
}
?>
--FILE--
<?php
/* Prototype  : string mcrypt_encrypt(string cipher, string key, string data, string mode, string iv)
 * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv
 * Source code: ext/mcrypt/mcrypt.c
 * Alias to functions:
 */
 /* Prototype  : string mcrypt_decrypt(string cipher, string key, string data, string mode, string iv)
 * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv
 * Source code: ext/mcrypt/mcrypt.c
 * Alias to functions:
 */
 /* Prototype  : string mcrypt_cbc(int cipher, string key, string data, int mode, string iv)
 * Description: CBC crypt/decrypt data using key key with cipher cipher starting with iv
 * Source code: ext/mcrypt/mcrypt.c
 * Alias to functions:
 */
 /* Prototype  : string mcrypt_ecb(int cipher, string key, string data, int mode, string iv)
 * Description: ECB crypt/decrypt data using key key with cipher cipher starting with iv
 * Source code: ext/mcrypt/mcrypt.c
 * Alias to functions:
 */

echo "*** Testing mcrypt : Rijndael128 functionality ***\n";

$cipher = MCRYPT_RIJNDAEL_128;
$mode = MCRYPT_MODE_CBC;
$data = b'This is the secret message which must be encrypted';

// keys : 20 bytes, 24 bytes, 30 Bytes, 32 Bytes, 40 Bytes
$keys = array(
              b'12345678901234567890',
              b'123456789012345678901234',
              b'123456789012345678901234567890',
              b'12345678901234567890123456789012',
              b'1234567890123456789012345678901234567890'
 );
// rijndael128 is a block cipher of 128 bits (16 bytes)
$iv = b'1234567890123456';

echo "\n--- testing different key lengths\n";
foreach ($keys as $key) {
   echo "\nkey length=".strlen($key)."\n";
   $res = mcrypt_encrypt($cipher, $key, $data, MCRYPT_MODE_CBC, $iv);
   var_dump(bin2hex($res));
   $res = mcrypt_decrypt($cipher, $key, $res, MCRYPT_MODE_CBC, $iv);
   var_dump(bin2hex($res));
}
?>
===DONE===
--EXPECTF--
*** Testing mcrypt : Rijndael128 functionality ***

--- testing different key lengths

key length=20

Warning: mcrypt_encrypt(): Key of size 20 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
string(0) ""

Warning: mcrypt_decrypt(): Key of size 20 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
string(0) ""

key length=24
string(128) "8ecdf1ed5742aff16ef34c819c8d22c707c54f4d9ffc18e5f6ab79fe68c25705351e2c001a0b9f29e5def67570ca9da644efb69a8bb97940cb4bec094dae8bb5"
string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000"

key length=30

Warning: mcrypt_encrypt(): Key of size 30 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
string(0) ""

Warning: mcrypt_decrypt(): Key of size 30 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
string(0) ""

key length=32
string(128) "f23bc103bfd0859a8318acee6d96e5f43dff68f3cdeae817a1e77c33492e32bdb82c5f660fcd1a2bfda70d9de4d5d8028ce179a9e2f7f9ee7dd61c7b4b409e95"
string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000"

key length=40

Warning: mcrypt_encrypt(): Key of size 40 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
string(0) ""

Warning: mcrypt_decrypt(): Key of size 40 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
string(0) ""
===DONE===

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DotVVM.Framework.Compilation.ControlTree;
using DotVVM.Framework.Compilation.ControlTree.Resolved;
using DotVVM.Framework.Compilation.Parser;
using DotVVM.Framework.Compilation.Parser.Dothtml.Parser;
using DotVVM.Framework.Compilation.Parser.Dothtml.Tokenizer;
using DotVVM.Framework.Configuration;
using DotVVM.Framework.Controls;
using DotVVM.Framework.Controls.Infrastructure;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using DotVVM.Framework.Binding;
using DotVVM.Framework.Utils;
using System.Linq.Expressions;

namespace DotVVM.Framework.Tests.Runtime.ControlTree
{
    [TestClass]
    public class DefaultControlTreeResolverTests
    {
        private DotvvmConfiguration configuration;
        private IControlTreeResolver controlTreeResolver;

        [TestInitialize()]
        public void TestInit()
        {
            configuration = DotvvmConfiguration.CreateDefault();
            configuration.Markup.AddCodeControl("cc", typeof(ClassWithInnerElementProperty));
            controlTreeResolver = configuration.ServiceLocator.GetService<IControlTreeResolver>();
        }

        [TestMethod]
        public void ResolvedTree_MissingViewModelDirective()
        {
            var root = ParseSource(@"");

            Assert.IsTrue(root.DothtmlNode.HasNodeErrors);
            Assert.IsTrue(root.DothtmlNode.NodeErrors.First().Contains("missing"));
        }

        [TestMethod]
        public void ResolvedTree_UnknownViewModelType()
        {
            var root = ParseSource(@"@viewModel invalid
");

            var directiveNode = ((DothtmlRootNode)root.DothtmlNode).Directives.First();
            Assert.IsTrue(directiveNode.HasNodeErrors);
            Assert.IsTrue(directiveNode.NodeErrors.First().Contains("Could not resolve type"));
        }

        [TestMethod]
        public void ResolvedTree_WhiteSpaceLiteral()
        {
            var root = ParseSource(@"     ");

            var control = root.Content.First();
            Assert.AreEqual(typeof(RawLiteral), control.Metadata.Type);

            Assert.AreEqual(root, control.Parent);
        }

        [TestMethod]
        public void ResolvedTree_SingleControl()
        {
            var root = ParseSource(@"<dot:Button />");

            var control = root.Content.First();
            Assert.AreEqual(typeof(Button), control.Metadata.Type);

            Assert.AreEqual(root, control.Parent);
        }

        [TestMethod]
        public void ResolvedTree_SingleControlWithBinding_BindingError_MissingViewModelDirective()
        {
            var root = ParseSource(@"<dot:Button Text='{value: Test}' />");

            var control = root.Content.First();
            var textBinding = (ResolvedPropertyBinding)control.Properties[ButtonBase.TextProperty];
            Assert.IsNotNull(textBinding.Binding.ParsingError);
            Assert.IsTrue(textBinding.Binding.ParsingError.Message.Contains("Could not resolve identifier"));

            Assert.AreEqual(root, control.Parent);
            Assert.AreEqual(control, textBinding.Parent);
            Assert.AreEqual(textBinding, textBinding.Binding.Parent);
        }

        [TestMethod]
        public void ResolvedTree_SingleControlWithBinding_BindingError_MissingViewModelDirectiveThisId()
        {
            var root = ParseSource(@"<dot:Button Text='{value: _this.Test}' />");

            var control = root.Content.First();
            var textBinding = (ResolvedPropertyBinding)control.Properties[ButtonBase.TextProperty];
            Assert.IsNotNull(textBinding.Binding.ParsingError);
            Assert.IsTrue(textBinding.Binding.ParsingError.Message.Contains("Type of '_this' could not be resolved."));

            Assert.AreEqual(root, control.Parent);
            Assert.AreEqual(control, textBinding.Parent);
            Assert.AreEqual(textBinding, textBinding.Binding.Parent);
        }

        [TestMethod]
        public void ResolvedTree_SingleControlWithBinding_ValidBinding_UnknownViewModel()
        {
            var root = ParseSource(@"@viewModel invalid
<dot:Button Text='{value: Test}' />");

            var control = root.Content.First();
            var textBinding = (ResolvedPropertyBinding)control.Properties[ButtonBase.TextProperty];
            Assert.IsNotNull(textBinding.Binding.ParsingError);
            Assert.IsTrue(textBinding.Binding.ParsingError.Message.Contains("Could not resolve identifier"));

            Assert.AreEqual(root, control.Parent);
            Assert.AreEqual(control, textBinding.Parent);
            Assert.AreEqual(textBinding, textBinding.Binding.Parent);
        }

        [TestMethod]
        public void ResolvedTree_SingleControlWithBinding_ValidBinding_UnknownViewModelInKnownOne()
        {
            var root = ParseSource(@"@viewModel System.String
<dot:Repeater DataSource='{value: inkaalid}'><dot:Button Text='{value: _parent.Substring(0, 3)}' /></dot:Repeater>");

            var control = root.Content.First().Properties.Values.OfType<ResolvedPropertyTemplate>().First().Content.First();
            var textBinding = (ResolvedPropertyBinding)control.Properties[ButtonBase.TextProperty];
            Assert.IsNull(textBinding.Binding.ParsingError);
        }

        [TestMethod]
        public void ResolvedTree_SingleControlWithBinding_ValidBinding()
        {
            var root = ParseSource(@"@viewModel System.String, mscorlib
<dot:Button Text='{value: Length}' />");

            var control = root.Content.First();
            var textBinding = (ResolvedPropertyBinding)control.Properties[ButtonBase.TextProperty];
            Assert.IsNull(textBinding.Binding.ParsingError);
            Assert.AreEqual(typeof(int), ResolvedTypeDescriptor.ToSystemType(textBinding.Binding.ResultType));

            Assert.AreEqual(root, control.Parent);
            Assert.AreEqual(control, textBinding.Parent);
            Assert.AreEqual(textBinding, textBinding.Binding.Parent);
        }

        [TestMethod]
        public void ResolvedTree_SingleControl_HtmlAttribute()
        {
            var root = ParseSource(@"@viewModel System.String, mscorlib
<dot:Button class=active />");

            var control = root.Content.First();
            var attribute = control.GetHtmlAttribute("class") as IAbstractPropertyValue;
            Assert.AreEqual("active", attribute.Value);

            Assert.AreEqual(root, control.Parent);
        }

        [TestMethod]
        public void ResolvedTree_SingleControl_HtmlAttributeWithBinding()
        {
            var root = ParseSource(@"@viewModel System.String, mscorlib
<dot:Button class='{value: Length}' />");

            var control = root.Content.First();
            var attribute = ((ResolvedPropertyBinding) control.GetHtmlAttribute("class"));
            Assert.IsNull(attribute.Binding.ParsingError);
            Assert.AreEqual(typeof(int), ResolvedTypeDescriptor.ToSystemType(attribute.Binding.ResultType));

            Assert.AreEqual(root, control.Parent);
            Assert.AreEqual(attribute, attribute.Binding.Parent);
            Assert.AreEqual(control, attribute.Parent);
        }

        [TestMethod]
        public void ResolvedTree_SingleControlWithStaticValue_String()
        {
            var root = ParseSource(@"@viewModel System.String, mscorlib
<dot:Button Text='text' />");

            var control = root.Content.First();
            var textValue = (ResolvedPropertyValue)control.Properties[ButtonBase.TextProperty];
            Assert.AreEqual("text", textValue.Value);

            Assert.AreEqual(root, control.Parent);
            Assert.AreEqual(control, textValue.Parent);
        }

        [TestMethod]
        public void ResolvedTree_SingleControlWithStaticValue_Enum()
        {
            var root = ParseSource(@"@viewModel System.String, mscorlib
<dot:Button ButtonTagName='Input' />");

            var control = root.Content.First();
            var textValue = (ResolvedPropertyValue)control.Properties[Button.ButtonTagNameProperty];
            Assert.AreEqual(ButtonTagName.input, textValue.Value);

            Assert.AreEqual(root, control.Parent);
            Assert.AreEqual(control, textValue.Parent);
        }

        [TestMethod]
        public void ResolvedTree_UnknownElement()
        {
            var root = ParseSource(@"@viewModel System.String, mscorlib
<dot:xxxButton />");

            var control = root.Content.First();
            Assert.AreEqual(typeof(HtmlGenericControl), control.Metadata.Type);
            Assert.AreEqual(1, control.ConstructorParameters.Length);
            Assert.AreEqual("dot:xxxButton", control.ConstructorParameters[0]);
            Assert.IsTrue(control.DothtmlNode.HasNodeErrors);
            Assert.IsTrue(control.DothtmlNode.NodeErrors.First().Contains("could not be resolved"));

            Assert.AreEqual(root, control.Parent);
        }

        [TestMethod]
        public void ResolvedTree_ElementProperty()
        {
            var root = ParseSource(@"@viewModel " + typeof(DefaultControlResolverTestViewModel).AssemblyQualifiedName + @"
<dot:Repeater DataSource='{value: Items}'>
    <ItemTemplate>
        <dot:Button Text='{value: _this}' />
    </ItemTemplate>
</dot:Repeater>");

            var control = root.Content.First();
            Assert.AreEqual(typeof(Repeater), control.Metadata.Type);

            var dataSource = (ResolvedPropertyBinding)control.Properties[ItemsControl.DataSourceProperty];
            Assert.IsNull(dataSource.Binding.ParsingError);

            var itemTemplate = (ResolvedPropertyTemplate)control.Properties[Repeater.ItemTemplateProperty];
            var button = itemTemplate.Content.FirstOrDefault(c => c.Metadata.Type == typeof(Button));

            var text = (ResolvedPropertyBinding)button.Properties[ButtonBase.TextProperty];
            Assert.IsNull(text.Binding.ParsingError);

            Assert.AreEqual(root, control.Parent);
            Assert.AreEqual(control, dataSource.Parent);
            Assert.AreEqual(dataSource, dataSource.Binding.Parent);
            Assert.AreEqual(control, itemTemplate.Parent);
            Assert.AreEqual(itemTemplate, button.Parent);
            Assert.AreEqual(button, text.Parent);
            Assert.AreEqual(text, text.Binding.Parent);
        }

        [TestMethod]
        public void ResolvedTree_DefaultElementProperty()
        {
            var root = ParseSource(@"@viewModel " + typeof(DefaultControlResolverTestViewModel).AssemblyQualifiedName + @"
<dot:Repeater DataSource='{value: Items}'>
    <dot:Button Text='{value: _this}' />
</dot:Repeater>");

            var control = root.Content.First();
            Assert.AreEqual(typeof(Repeater), control.Metadata.Type);

            var dataSource = (ResolvedPropertyBinding)control.Properties[ItemsControl.DataSourceProperty];
            Assert.IsNull(dataSource.Binding.ParsingError);

            var itemTemplate = (ResolvedPropertyTemplate)control.Properties[Repeater.ItemTemplateProperty];
            var button = itemTemplate.Content.FirstOrDefault(c => c.Metadata.Type == typeof(Button));

            var text = (ResolvedPropertyBinding)button.Properties[ButtonBase.TextProperty];
            Assert.IsNull(text.Binding.ParsingError);

            Assert.AreEqual(root, control.Parent);
            Assert.AreEqual(control, dataSource.Parent);
            Assert.AreEqual(dataSource, dataSource.Binding.Parent);
            Assert.AreEqual(control, itemTemplate.Parent);
            Assert.AreEqual(itemTemplate, button.Parent);
            Assert.AreEqual(button, text.Parent);
            Assert.AreEqual(text, text.Binding.Parent);
        }

        [TestMethod]
        public void ResolvedTree_Binding_DataContextChange_InvalidType()
        {
            var root = ParseSource(@"@viewModel " + typeof(DefaultControlResolverTestViewModel).AssemblyQualifiedName + @"
<dot:Repeater DataSource='{value: Items2}'>
    <dot:Button Text='{value: _this}' />
</dot:Repeater>");

            var control = root.Content.First();
            Assert.AreEqual(typeof(Repeater), control.Metadata.Type);

            var dataSource = (ResolvedPropertyBinding)control.Properties[ItemsControl.DataSourceProperty];
            Assert.IsNotNull(dataSource.Binding.ParsingError);

            var itemTemplate = (ResolvedPropertyTemplate)control.Properties[Repeater.ItemTemplateProperty];
            var button = itemTemplate.Content.FirstOrDefault(c => c.Metadata.Type == typeof(Button));

            var text = (ResolvedPropertyBinding)button.Properties[ButtonBase.TextProperty];
            Assert.IsNotNull(text.Binding.ParsingError);

            Assert.AreEqual(root, control.Parent);
            Assert.AreEqual(control, dataSource.Parent);
            Assert.AreEqual(dataSource, dataSource.Binding.Parent);
            Assert.AreEqual(control, itemTemplate.Parent);
            Assert.AreEqual(itemTemplate, button.Parent);
            Assert.AreEqual(button, text.Parent);
            Assert.AreEqual(text, text.Binding.Parent);
        }

        [TestMethod]
        public void ResolvedTree_AttachedProperty()
        {
            var root = ParseSource(@"
@viewModel System.Object

");
            var control = root.Content.First(c => c.Metadata.Name == nameof(HtmlGenericControl));
            ResolvedPropertySetter clickProp;
            Assert.IsTrue(control.Properties.TryGetValue(Events.ClickProperty, out clickProp));
            Assert.IsInstanceOfType(clickProp, typeof(ResolvedPropertyBinding));
        }

        [TestMethod]
        public void ResolvedTree_GridViewColumns_InvalidItem()
        {
            var root = ParseSource(@"
@viewModel System.Collections.IEnumerable

<dot:GridView DataSource='{value: _this}'>
    <Columns>

    </Columns>
</dot:GridView>
");
            var gridView = root.Content.First(r => r.Metadata.Name == "GridView");
            IAbstractPropertySetter colsProp;
            Assert.IsTrue(gridView.TryGetProperty(GridView.ColumnsProperty, out colsProp));
            var cols = ((ResolvedPropertyControlCollection)colsProp).Controls;
            Assert.AreEqual(0, cols.Count); // span should not be added
            Assert.IsTrue(gridView.DothtmlNode.EnumerateNodes().Any(n => n.HasNodeErrors));
        }

        [TestMethod]
        public void ResolvedTree_ControlContent_Invalid()
        {
            var root = ParseSource(@"
@viewModel System.Collections.IEnumerable

<dot:ValidationSummary>

</dot:ValidationSummary>
");
            var control = root.Content.First(r => r.Metadata.Name == nameof(ValidationSummary));
            Assert.AreEqual(0, control.Content.Count);
            Assert.IsTrue(control.DothtmlNode.EnumerateNodes().Any(n => n.HasNodeErrors));
        }

        [TestMethod]
        public void ResolvedTree_HtmlAttributes_Invalid()
        {
            var root = ParseSource(@"
@viewModel System.Collections.IEnumerable

<dot:RequiredResource Name='ggg11' html:class='jshfsjhfkj'>
");
            var control = root.Content.First(r => r.Metadata.Name == nameof(RequiredResource));
            Assert.AreEqual(0, control.Properties.OfType<GroupedDotvvmProperty>().Where(a => a.PropertyGroup.Prefixes.Contains("")).Count());
            Assert.IsTrue(((DothtmlElementNode)control.DothtmlNode).Attributes.Any(a => a.HasNodeErrors));
        }

        [TestMethod]
        public void ResolvedTree_BindingHierarchy_Invalid()
        {
            var root = ParseSource(@"
@viewModel System.Object

    {{value: AnotherProperty}}

");
            var div = root.Content.First(r => r.Metadata.Name == nameof(HtmlGenericControl));
            Assert.IsTrue((div.Properties[DotvvmBindableObject.DataContextProperty] as ResolvedPropertyBinding).Binding.ParsingError != null);

        }

        [TestMethod]
        public void ResolvedTree_BaseType_Invalid()
        {
            var root = ParseSource(@"
@baseType someBullshitttt

");
            Assert.IsTrue(((DothtmlRootNode)root.DothtmlNode).Directives.First().HasNodeErrors);
        }

        [TestMethod]
        public void ResolvedTree_DefaultContentProperty_BindingInside()
        {
            var root = ParseSource(@"
@viewModel System.Object
<dot:GridViewTemplateColumn HeaderText='Amount'>
    <dot:Literal Text='Text123' FormatString = 'n0' /> {{value: _this}}
</dot:GridViewTemplateColumn>
 ");
            var column = root.Content.First(t => t.Metadata.Name == nameof(GridViewTemplateColumn));
            Assert.IsFalse(column.DothtmlNode.HasNodeErrors, column.DothtmlNode.NodeErrors.FirstOrDefault());
            var template = (column.Properties.FirstOrDefault(p => p.Key.Name == nameof(GridViewTemplateColumn.ContentTemplate)).Value as ResolvedPropertyTemplate)?.Content;
            Assert.IsTrue(template.Any(n => n.DothtmlNode is DothtmlBindingNode));
            Assert.IsTrue(template.Any(n => n.DothtmlNode is DothtmlElementNode && n.Metadata.Name == "Literal"));
        }

        [TestMethod]
        public void ResolvedTree_UnescapedAttributeValue()
        {
            var root = ParseSource(@"

 ");
            var column = root.Content.First(t => t.Metadata.Name == nameof(HtmlGenericControl));
            var attribute = (column.GetHtmlAttribute("onclick") as ResolvedPropertyValue);
            Assert.AreEqual(attribute.Value, "ahoj > lao");
        }

        [TestMethod]
        public void ResolvedTree_ImplicitBooleanValue()
        {
            var root = ParseSource(@"
@viewModel System.Object
<dot:CheckBox Checked />
 ");
            var checkBox = root.Content.First(t => t.Metadata.Name == nameof(CheckBox));
            Assert.IsFalse(checkBox.DothtmlNode.HasNodeErrors, checkBox.DothtmlNode.NodeErrors.FirstOrDefault());
            Assert.AreEqual(true, (checkBox.Properties.FirstOrDefault(p => p.Key.Name == nameof(CheckBox.Checked)).Value as ResolvedPropertyValue)?.Value);
        }

        [TestMethod]
        public void ResolvedTree_MergedAttributeValues()
        {
            var root = ParseSource(@"
@viewModel System.Object

");
            var value = root.Content.First(n => n.Metadata.Type == typeof(HtmlGenericControl)).GetHtmlAttribute("class");
            Assert.AreEqual("a b", value.CastTo<ResolvedPropertyValue>().Value);
        }

        [TestMethod]
        public void ResolvedTree_MergedAttributeValueAndBinding()
        {
            var root = ParseSource(@"
@viewModel System.String

");
            var value = root.Content.First(n => n.Metadata.Type == typeof(HtmlGenericControl)).GetHtmlAttribute("class");
            Assert.IsInstanceOfType(value, typeof(ResolvedPropertyBinding));
            var expression = value.CastTo<ResolvedPropertyBinding>().Binding.GetExpression().CastTo<MethodCallExpression>();
            Assert.AreEqual(expression.Method.Name, "Concat");
            Assert.AreEqual(3, expression.Arguments.Count);
            Assert.AreEqual("a", expression.Arguments[0].CastTo<ConstantExpression>().Value);
            Assert.AreEqual(" ", expression.Arguments[1].CastTo<ConstantExpression>().Value);
            Assert.AreEqual("_this", expression.Arguments[2].CastTo<ParameterExpression>().Name);
        }

        [TestMethod]
        public void ResolvedTree_MergedAttributeValueAndResourceBinding()
        {
            var root = ParseSource(@"
@viewModel System.String

");
            var value = root.Content.First(n => n.Metadata.Type == typeof(HtmlGenericControl)).GetHtmlAttribute("class");
            Assert.IsInstanceOfType(value, typeof(ResolvedPropertyBinding));
            var expression = value.CastTo<ResolvedPropertyBinding>().Binding.GetExpression().CastTo<MethodCallExpression>();
            Assert.AreEqual(expression.Method.Name, "Concat");
            Assert.AreEqual(3, expression.Arguments.Count);
            Assert.AreEqual("a", expression.Arguments[0].CastTo<ConstantExpression>().Value);
            Assert.AreEqual(" ", expression.Arguments[1].CastTo<ConstantExpression>().Value);
            Assert.AreEqual("_this", expression.Arguments[2].CastTo<ParameterExpression>().Name);
        }

        [TestMethod]
        public void ResolvedTree_MergedAttributeBindings()
        {
            var root = ParseSource(@"
@viewModel System.String

");
            var value = root.Content.First(n => n.Metadata.Type == typeof(HtmlGenericControl)).GetHtmlAttribute("class");
            Assert.IsInstanceOfType(value, typeof(ResolvedPropertyBinding));
            var expression = value.CastTo<ResolvedPropertyBinding>().Binding.GetExpression().CastTo<MethodCallExpression>();
            Assert.AreEqual(expression.Method.Name, "Concat");
            Assert.AreEqual(3, expression.Arguments.Count);
            Assert.AreEqual("_this", expression.Arguments[0].CastTo<ParameterExpression>().Name);
            Assert.AreEqual(" ", expression.Arguments[1].CastTo<ConstantExpression>().Value);
            Assert.AreEqual("_this", expression.Arguments[2].CastTo<ParameterExpression>().Name);
        }

        [TestMethod]
        public void ResolvedTree_HtmlPrefixedAttributes()
        {
            var root = ParseSource(@"

");
            var attr = root.Content.First(n => n.Metadata.Type == typeof(HtmlGenericControl)).GetHtmlAttribute("id");
            Assert.AreEqual("val", attr.CastTo<ResolvedPropertyValue>().Value);
        }

        [TestMethod]
        public void ResolvedTree_RoleView_MultipleRoles()
        {
            var root = ParseSource(@"
<dot:RoleView Roles='a, b, c, d, e, f'");
            var roles = root.Content.First(n => n.Metadata.Type == typeof(RoleView)).Properties[RoleView.RolesProperty].CastTo<ResolvedPropertyValue>().Value;
            Assert.IsInstanceOfType(roles, typeof(string[]));
            Assert.IsTrue(roles.CastTo<string[]>().SequenceEqual(new[] { "a", "b", "c", "d", "e", "f" }));
        }

        [TestMethod]
        public void ResolvedTree_InnerElementProperty_String()
        {
            var root = ParseSource(@"
<dot:Button>
    <PostBack.Handlers>
        <cc:ClassWithInnerElementProperty> AHOJ </cc:ClassWithInnerElementProperty>
    </PostBack.Handlers>
</dot:Button>");
            var control = root.Content.First(n => n.Metadata.Type == typeof(Button))
                .Properties[PostBack.HandlersProperty].CastTo<ResolvedPropertyControlCollection>().Controls
                .First(c => c.Metadata.Type == typeof(ClassWithInnerElementProperty));
            Assert.AreEqual(0, control.Content.Count);
            Assert.AreEqual(" AHOJ ", control.Properties[ClassWithInnerElementProperty.PropertyProperty].CastTo<ResolvedPropertyValue>().Value);
        }

        [TestMethod]
        public void ResolvedTree_Invalid_Content()
        {
            var root = ParseSource(@"
<dot:Button>
    <PostBack.Handlers>
        <cc:ClassWithoutInnerElementProperty> AHOJ </cc:ClassWithoutInnerElementProperty>
    </PostBack.Handlers>
</dot:Button>");
            var control = root.Content.First(n => n.Metadata.Type == typeof(Button))
                .Properties[PostBack.HandlersProperty].CastTo<ResolvedPropertyControlCollection>().Controls
                .First(c => c.Metadata.Type == typeof(ClassWithoutInnerElementProperty));
            Assert.AreEqual(0, control.Content.Count);
        }

        [TestMethod]
        public void ResolvedTree_ViewModel_GenericType()
        {
            var root = ParseSource(@"@viewModel System.Collections.Generic.List<System.Collections.Generic.Dictionary<System.String, System.Int32>>");
            Assert.AreEqual(typeof(List<Dictionary<string, int>>), root.DataContextTypeStack.DataContextType);
        }

        [TestMethod]
        public void ResolvedTree_ViewModel_InvalidAssemblyQualified()
        {
            var root = ParseSource(@"@viewModel System.String, whatever");
            Assert.IsTrue(root.Directives.Any(d => d.Value.Any(dd => dd.DothtmlNode.HasNodeErrors)));
            Assert.AreEqual(null, root.DataContextTypeStack.DataContextType);
        }

        private ResolvedTreeRoot ParseSource(string markup, string fileName = "default.dothtml")
        {
            var tokenizer = new DothtmlTokenizer();
            tokenizer.Tokenize(markup);

            var parser = new DothtmlParser();
            var tree = parser.Parse(tokenizer.Tokens);

            return (ResolvedTreeRoot)controlTreeResolver.ResolveTree(tree, fileName);
        }

    }

    public class DefaultControlResolverTestViewModel
    {
        public List<string> Items { get; set; }
    }
    [ControlMarkupOptions(DefaultContentProperty = nameof(Property))]
    public class ClassWithInnerElementProperty : PostBackHandler
    {
        [MarkupOptions(MappingMode = MappingMode.InnerElement)]
        public string Property
        {
            get { return (string)GetValue(PropertyProperty); }
            set { SetValue(PropertyProperty, value); }
        }
        public static readonly DotvvmProperty PropertyProperty
            = DotvvmProperty.Register<string, ClassWithInnerElementProperty>(c => c.Property, null);

        protected internal override string ClientHandlerName => null;

        protected internal override Dictionary<string, string> GetHandlerOptionClientExpressions()
        {
            throw new NotImplementedException();
        }
    }

    public class ClassWithoutInnerElementProperty : PostBackHandler
    {
        [MarkupOptions(MappingMode = MappingMode.Attribute)]
        public string Property
        {
            get { return (string)GetValue(PropertyProperty); }
            set { SetValue(PropertyProperty, value); }
        }
        public static readonly DotvvmProperty PropertyProperty
            = DotvvmProperty.Register<string, ClassWithoutInnerElementProperty>(c => c.Property, null);

        protected internal override string ClientHandlerName => null;

        protected internal override Dictionary<string, string> GetHandlerOptionClientExpressions()
        {
            throw new NotImplementedException();
        }
    }
}


text:
@interface DetailViewController ()

@property (nonatomic, strong) SBBClient *sbbClient;
@property (weak, nonatomic) IBOutlet MKMapView *mapView;
@property (nonatomic, weak) IBOutlet UITableView *tableView;
@property (nonatomic, strong) NSMutableArray *servicesArray;

- (void)configureView;

@end

@implementation DetailViewController

#pragma mark - Managing the detail item

- (void)setStation:(Station *)newStation
{
    if (_station != newStation) {
        _station = newStation;

        // Update the view.
        [self configureView];
    }
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.

    self.servicesArray = [[NSMutableArray alloc] init];

    [self configureSbbClient];
    [self configureView];

}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark -
#pragma mark Setup methods

- (void)configureView
{
    // Update the user interface for the detail item.
    self.title = self.station.name;

    if (self.station) {

        [self.mapView setCenterCoordinate:self.station.locationCoordinate];

        MKCoordinateRegion viewRegion = MKCoordinateRegionMakeWithDistance(self.station.locationCoordinate, 750, 750);
        MKCoordinateRegion adjustedRegion = [self.mapView regionThatFits:viewRegion];
        [self.mapView setRegion:adjustedRegion animated:YES];
    }
}

-(void)configureSbbClient {

    self.sbbClient = [SBBClient sharedSBBClient];
    [self.sbbClient setDelegate:self];

    if (self.station) {

        NSNumber *stationId = self.station.stationId;
        [self.sbbClient getDeparturesFromStation:stationId];

    }

}

#pragma mark -
#pragma mark - SBBClientDelegate methods

-(void)sbbClient:(SBBClient *)client didUpdateDepartures:(id)departures {

    NSLog(@"departures = %@", departures);

    [self parseDataFromDictionary:departures];

    [self.tableView reloadData];

}

-(void)parseDataFromDictionary:(NSDictionary *)dictionary {

    NSArray *localServicesArray = [dictionary objectForKey:@"stationboard"];

    for (NSDictionary *servicenDict in localServicesArray) {

        NSError *error = nil;
        Service *service = [MTLJSONAdapter modelOfClass:[Service class] fromJSONDictionary:servicenDict error:&error];

        [self.servicesArray addObject:service];

    }
}

#pragma mark -
#pragma mark - UITableView methods

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return [self.servicesArray count];
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"kTableCell" forIndexPath:indexPath];

    Service *theService = [self.servicesArray objectAtIndex:indexPath.row];

    NSRange range = NSMakeRange(11, 5);
    NSString *timeString = [[theService.stop objectForKey:@"departure"] substringWithRange:range];

    NSString *textLabelString = [NSString stringWithFormat:@"%@ - %@", timeString, theService.name];

    [cell.textLabel setText:textLabelString];
    [cell.detailTextLabel setText:theService.to];

    return cell;

}

@end


text:
extern "Java"
{
  namespace org
  {
    namespace omg
    {
      namespace CORBA
      {
          class Any;
          class TypeCode;
        namespace portable
        {
            class InputStream;
            class OutputStream;
        }
      }
      namespace PortableServer
      {
          class ForwardRequest;
          class ForwardRequestHelper;
      }
    }
  }
}

class org::omg::PortableServer::ForwardRequestHelper : public ::java::lang::Object
{

public:
  ForwardRequestHelper();
  static ::org::omg::PortableServer::ForwardRequest * extract(::org::omg::CORBA::Any *);
  static ::java::lang::String * id();
  static void insert(::org::omg::CORBA::Any *, ::org::omg::PortableServer::ForwardRequest *);
  static ::org::omg::PortableServer::ForwardRequest * read(::org::omg::CORBA::portable::InputStream *);
  static ::org::omg::CORBA::TypeCode * type();
  static void write(::org::omg::CORBA::portable::OutputStream *, ::org::omg::PortableServer::ForwardRequest *);
  static ::java::lang::Class class$;
};

#endif // __org_omg_PortableServer_ForwardRequestHelper__


text:
/* globals require module*/
const fs = require('fs');

function readJsonFromFile(fileName) {
  const content = fs.readFileSync(`json/${fileName}`, 'utf8');
  const object = JSON.parse(content);
  return object;
}

module.exports = readJsonFromFile;


text:
<!--
  The Ohio State University Research Foundation, Emory University,
  the University of Minnesota Supercomputing Institute

  Distributed under the OSI-approved BSD 3-Clause License.
  See http://ncip.github.com/cagrid-grid-incubation/LICENSE.txt for details.
-->
<!--
-->
<gov:CQLQuery xmlns:gov="http://CQL.caBIG/1/gov.nih.nci.cagrid.CQLQuery">
	<gov:Target name="org.cagrid.redcap.Projects">
                  <gov:Group logicRelation="OR">
                     <gov:Association roleName="eventArmsCollection" name="org.cagrid.redcap.EventArms">
                        <gov:Attribute name="armName" value="redcap" predicate="LIKE"/>
                     </gov:Association>
                     <gov:Association roleName="formsRefCollection" name="org.cagrid.redcap.Forms">
                        <gov:Attribute name="formName" value="redcap%" predicate="LIKE"/>
                     </gov:Association>
                     <gov:Attribute name="projectName" value="redcap_test%" predicate="LIKE"/>
                  </gov:Group>
               </gov:Target>
</gov:CQLQuery>


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<language name="Objective-C++" version="10" kateversion="5.0" section="Sources" extensions="*.mm;*.M;*.h" mimetype="text/x-objcpp-src;text/x-c-hdr" author="Gennady Telegin (gepo@lvk.cs.msu.su">
  <highlighting>
    <list name="keywords">
      <item>break</item>
      <item>case</item>
      <item>continue</item>
      <item>default</item>
      <item>do</item>
      <item>else</item>
      <item>enum</item>
      <item>extern</item>
      <item>for</item>
      <item>goto</item>
      <item>if</item>
      <item>return</item>
      <item>sizeof</item>
      <item>struct</item>
      <item>switch</item>
      <item>typedef</item>
      <item>union</item>
      <item>while</item>
      <item>@class</item>
      <item>@defs</item>
      <item>@encode</item>
      <item>@end</item>
      <item>@implementation</item>
      <item>@interface</item>
      <item>@private</item>
      <item>@protected</item>
      <item>@protocol</item>
      <item>@public</item>
      <item>@selector</item>
      <item>self</item>
      <item>super</item>

      <item>asm</item>
      <item>catch</item>
      <item>class</item>
      <item>const_cast</item>
      <item>delete</item>
      <item>dynamic_cast</item>
      <item>explicit</item>
      <item>export</item>
      <item>false</item>
      <item>friend</item>
      <item>inline</item>
      <item>namespace</item>
      <item>new</item>
      <item>operator</item>
      <item>private</item>
      <item>protected</item>
      <item>public</item>
      <item>qobject_cast</item>
      <item>reinterpret_cast</item>
      <item>static_cast</item>
      <item>template</item>
      <item>this</item>
      <item>throw</item>
      <item>true</item>
      <item>try</item>
      <item>typeid</item>
      <item>type_info</item>
      <item>typename</item>
      <item>using</item>
      <item>virtual</item>

      <item>and</item>
      <item>and_eq</item>
      <item>bad_cast</item>
      <item>bad_typeid</item>
      <item>bitand</item>
      <item>bitor</item>
      <item>compl</item>
      <item>not</item>
      <item>not_eq</item>
      <item>or</item>
      <item>or_eq</item>
      <item>xor</item>
      <item>xor_eq</item>
    </list>
    <list name="extensions">
      <item>K_DCOP</item>
      <item>SLOT</item>
      <item>SIGNAL</item>
      <item>Q_CLASSINFO</item>
      <item>Q_ENUMS</item>
      <item>Q_EXPORT</item>
      <item>Q_OBJECT</item>
      <item>Q_OVERRIDE</item>
      <item>Q_PROPERTY</item>
      <item>Q_SETS</item>
      <item>Q_SIGNALS</item>
      <item>Q_SLOTS</item>
      <item>Q_FOREACH</item>
      <item>Q_DECLARE_FLAGS</item>
      <item>Q_INIT_RESOURCE</item>
      <item>Q_CLEANUP_RESOURCE</item>
      <item>Q_GLOBAL_STATIC</item>
      <item>Q_GLOBAL_STATIC_WITH_ARGS</item>
      <item>Q_DECLARE_INTERFACE</item>
      <item>Q_DECLARE_TYPEINFO</item>
      <item>Q_DECLARE_SHARED</item>
      <item>Q_DECLARE_FLAGS</item>
      <item>Q_DECLARE_OPERATORS_FOR_FLAGS</item>
      <item>Q_FOREVER</item>
      <item>Q_DECLARE_PRIVATE</item>
      <item>Q_DECLARE_PUBLIC</item>
      <item>Q_D</item>
      <item>Q_Q</item>
      <item>Q_DISABLE_COPY</item>
      <item>Q_INTERFACES</item>
      <item>Q_FLAGS</item>
      <item>Q_SCRIPTABLE</item>
      <item>Q_INVOKABLE</item>
      <item>Q_GADGET</item>
      <item>Q_ARG</item>
      <item>Q_RETURN_ARG</item>
      <item>Q_ASSERT</item>
      <item>Q_ASSERT_X</item>
      <item>TRUE</item>
      <item>FALSE</item>
      <item>connect</item>
      <item>disconnect</item>
      <item>emit</item>
      <item>signals</item>
      <item>slots</item>
      <item>foreach</item>
      <item>forever</item>
    </list>
    <list name="types">
      <item>auto</item>
      <item>char</item>
      <item>const</item>
      <item>double</item>
      <item>float</item>
      <item>int</item>
      <item>long</item>
      <item>register</item>
      <item>short</item>
      <item>signed</item>
      <item>static</item>
      <item>unsigned</item>
      <item>void</item>
      <item>volatile</item>

      <item>bool</item>
      <item>mutable</item>
      <item>uchar</item>
      <item>uint</item>
      <item>int8_t</item>
      <item>int16_t</item>
      <item>int32_t</item>
      <item>int64_t</item>
      <item>uint8_t</item>
      <item>uint16_t</item>
      <item>uint32_t</item>
      <item>uint64_t</item>
      <item>wchar_t</item>
    </list>
    <contexts>
      <context attribute="Normal Text" lineEndContext="#stay" name="Default">
        <DetectSpaces />
        <RegExpr attribute="Preprocessor" context="Outscoped" String="#\s*if\s+0" beginRegion="Outscoped" firstNonSpace="true" />
        <DetectChar attribute="Preprocessor" context="Preprocessor" char="#" firstNonSpace="true" />

        <keyword attribute="Keyword" context="#stay" String="keywords"/>
        <keyword attribute="Data Type" context="#stay" String="types"/>
        <DetectChar attribute="Symbol" context="#stay" char="{" beginRegion="Brace1" />
        <DetectChar attribute="Symbol" context="#stay" char="}" endRegion="Brace1" />

        <DetectIdentifier />
        <Float attribute="Float" context="Float Suffixes"/>
        <HlCOct attribute="Octal" context="#stay"/>
        <HlCHex attribute="Hex" context="#stay"/>
        <Int attribute="Decimal" context="Int Suffixes"/>
        <HlCChar attribute="Char" context="#stay"/>
        <DetectChar attribute="String" context="String" char="""/>

        <IncludeRules context="FindComments" />

        <Detect2Chars attribute="String" context="String" char="@" char1=""" />

        <keyword attribute="Extensions" context="#stay" String="extensions" />

        <AnyChar attribute="Symbol" context="#stay" String=":!%&()+,-/.*<=>?[]{|}~^;"/>
      </context>

      <context name="FindComments" attribute="Normal Text" lineEndContext="#pop">
        <Detect2Chars attribute="Comment" context="MatchComment" char="/" char1="/" lookAhead="true"/>
        <Detect2Chars attribute="Comment" context="MatchComment" char="/" char1="*" lookAhead="true" />
      </context>

      <context name="MatchComment" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
        <StringDetect attribute="Region Marker" context="#pop!Region Marker" String="//BEGIN" beginRegion="Region1" firstNonSpace="true" />
        <StringDetect attribute="Region Marker" context="#pop!Region Marker" String="//END" endRegion="Region1" firstNonSpace="true" />
        <IncludeRules context="##Doxygen" />
        <Detect2Chars attribute="Comment" context="#pop!SingleLineComment" char="/" char1="/" />
        <Detect2Chars attribute="Comment" context="#pop!MultiLineComment" char="/" char1="*" beginRegion="Comment" />
      </context>

      <context name="Float Suffixes" attribute="Float" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
          <AnyChar String="fF" attribute="Float" context="#pop"/>
      </context>
      <context name="Int Suffixes" attribute="Decimal" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
          <StringDetect attribute="Decimal" context="#pop" String="ULL" insensitive="true"/>
          <StringDetect attribute="Decimal" context="#pop" String="LLU" insensitive="true"/>
          <StringDetect attribute="Decimal" context="#pop" String="UL" insensitive="true"/>
          <StringDetect attribute="Decimal" context="#pop" String="LU" insensitive="true"/>
          <StringDetect attribute="Decimal" context="#pop" String="LL" insensitive="true"/>
          <AnyChar attribute="Decimal" context="#pop" String="ULuL"/>
      </context>
      <context attribute="String" lineEndContext="#pop" name="String">
        <LineContinue attribute="String" context="#stay"/>
        <HlCStringChar attribute="String Char" context="#stay"/>
        <DetectChar attribute="String" context="#pop" char="""/>
      </context>
      <context attribute="Comment" lineEndContext="#pop" name="SingleLineComment">
        <DetectSpaces />
        <IncludeRules context="##Comments" />
      </context>
      <context attribute="Comment" lineEndContext="#stay" name="MultiLineComment">
        <DetectSpaces />
        <Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" endRegion="Comment"/>
        <IncludeRules context="##Comments" />
        <DetectIdentifier />
      </context>

      <!-- from c++ -->

      <context attribute="Region Marker" lineEndContext="#pop" name="Region Marker">
      </context>

      <context attribute="Preprocessor" lineEndContext="#pop" name="Preprocessor">
        <LineContinue attribute="Preprocessor" context="#stay"/>
        <RegExpr attribute="Preprocessor" context="#stay" String="define(?:[^\\]++|\\.)++"/>
        <RangeDetect attribute="Prep. Lib" context="#stay" char=""" char1="""/>
        <RangeDetect attribute="Prep. Lib" context="#stay" char="<" char1=">"/>
        <IncludeRules context="FindComments" />
      </context>

      <context attribute="Comment" lineEndContext="#stay" name="Outscoped" >
        <DetectSpaces />
        <IncludeRules context="##Comments" />
        <DetectIdentifier />
        <DetectChar attribute="String" context="String" char="""/>
        <IncludeRules context="FindComments" />
        <RegExpr attribute="Comment" context="Outscoped intern" String="#\s*if" beginRegion="Outscoped" firstNonSpace="true" />
        <RegExpr attribute="Preprocessor" context="#pop" String="#\s*(?:endif|else|elif)" endRegion="Outscoped" firstNonSpace="true" />
      </context>

      <context attribute="Comment" lineEndContext="#stay" name="Outscoped intern">
        <DetectSpaces />
        <IncludeRules context="##Comments" />
        <DetectIdentifier />
        <DetectChar attribute="String" context="String" char="""/>
        <IncludeRules context="FindComments" />
        <RegExpr attribute="Comment" context="Outscoped intern" String="#\s*if" beginRegion="Outscoped" firstNonSpace="true"/>
        <RegExpr attribute="Comment" context="#pop" String="#\s*endif" endRegion="Outscoped" firstNonSpace="true"/>
      </context>

    </contexts>
    <itemDatas>
      <itemData name="Normal Text"   defStyleNum="dsNormal" spellChecking="false"/>
      <itemData name="Keyword"       defStyleNum="dsKeyword" spellChecking="false"/>
      <itemData name="Extensions"    defStyleNum="dsExtension" spellChecking="false"/>
      <itemData name="Data Type"     defStyleNum="dsDataType" spellChecking="false"/>
      <itemData name="Decimal"       defStyleNum="dsDecVal" spellChecking="false"/>
      <itemData name="Octal"         defStyleNum="dsBaseN" spellChecking="false"/>
      <itemData name="Hex"           defStyleNum="dsBaseN" spellChecking="false"/>
      <itemData name="Float"         defStyleNum="dsFloat" spellChecking="false"/>
      <itemData name="Char"          defStyleNum="dsChar" spellChecking="false"/>
      <itemData name="String"        defStyleNum="dsString"/>
      <itemData name="String Char"   defStyleNum="dsSpecialChar" spellChecking="false"/>
      <itemData name="Comment"       defStyleNum="dsComment"/>
      <itemData name="Symbol"        defStyleNum="dsOperator" spellChecking="false"/>
      <itemData name="Preprocessor"  defStyleNum="dsPreprocessor" spellChecking="false"/>
      <itemData name="Prep. Lib"     defStyleNum="dsImport" spellChecking="false"/>
      <itemData name="Region Marker" defStyleNum="dsRegionMarker"/>
    </itemDatas>
  </highlighting>

  <general>
    <comments>
      <comment name="singleLine" start="//" />
      <comment name="multiLine" start="/*" end="*/" region="Comment" />
    </comments>
    <keywords casesensitive="1" />
  </general>
</language>
<!-- kate: replace-tabs on; tab-width 2; indent-width 2; -->


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-transitional.dtd">

  <title>column_selector (::PostgreSQL)</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />

# File lib/jdbc_adapter/jdbc_postgre.rb, line 33
    def self.column_selector
      [/postgre/i, lambda {|cfg,col| col.extend(::JdbcSpec::PostgreSQL::Column)}]
    end


text:
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
    jcr:primaryType="cq:Page">
    <jcr:content
        cq:deviceGroups="[/etc/mobile/groups/responsive]"
        cq:lastModified="{Date}2018-04-11T10:35:59.928+05:30"
        cq:lastModifiedBy="admin"
        cq:template="/conf/citraining/settings/wcm/templates/article-page-template"
        jcr:primaryType="cq:PageContent"
        sling:resourceType="citraining/components/structure/page">
        <root
            jcr:lastModified="{Date}2018-04-10T11:23:04.607+05:30"
            jcr:lastModifiedBy="admin"
            jcr:primaryType="nt:unstructured"
            sling:resourceType="wcm/foundation/components/responsivegrid">
            <header
                jcr:created="{Date}2018-04-11T10:13:06.520+05:30"
                jcr:createdBy="admin"
                jcr:lastModified="{Date}2018-04-11T10:13:06.520+05:30"
                jcr:lastModifiedBy="admin"
                jcr:primaryType="nt:unstructured"
                sling:resourceType="citraining/components/structure/header">
                <navigation
                    jcr:lastModified="{Date}2018-04-11T10:35:59.923+05:30"
                    jcr:lastModifiedBy="admin"
                    jcr:primaryType="nt:unstructured"
                    sling:resourceType="citraining/components/structure/navigation"
                    collectAllPages="false"
                    navigationRoot="/content/citraining/en"
                    skipNavigationRoot="true"
                    structureDepth="1"/>
                <search
                    jcr:primaryType="nt:unstructured"
                    sling:resourceType="citraining/components/structure/search"/>
            </header>
            <image
                jcr:created="{Date}2018-04-10T13:32:19.333+05:30"
                jcr:createdBy="admin"
                jcr:lastModified="{Date}2018-04-10T13:32:19.333+05:30"
                jcr:lastModifiedBy="admin"
                jcr:primaryType="nt:unstructured"
                sling:resourceType="citraining/components/content/image"
                editable="{Boolean}true"/>
            <breadcrumb
                jcr:created="{Date}2018-04-10T13:33:06.521+05:30"
                jcr:createdBy="admin"
                jcr:lastModified="{Date}2018-04-10T13:33:06.521+05:30"
                jcr:lastModifiedBy="admin"
                jcr:primaryType="nt:unstructured"
                sling:resourceType="citraining/components/content/breadcrumb"/>
            <title
                jcr:created="{Date}2018-04-10T13:34:06.472+05:30"
                jcr:createdBy="admin"
                jcr:lastModified="{Date}2018-04-10T13:34:06.472+05:30"
                jcr:lastModifiedBy="admin"
                jcr:primaryType="nt:unstructured"
                sling:resourceType="citraining/components/content/title"
                editable="{Boolean}true"/>
            <responsivegrid
                jcr:created="{Date}2018-04-10T11:23:16.225+05:30"
                jcr:createdBy="admin"
                jcr:lastModified="{Date}2018-04-10T11:23:16.225+05:30"
                jcr:lastModifiedBy="admin"
                jcr:primaryType="nt:unstructured"
                sling:resourceType="wcm/foundation/components/responsivegrid"
                editable="{Boolean}true">
                <cq:responsive jcr:primaryType="nt:unstructured">
                    <default
                        jcr:primaryType="nt:unstructured"
                        offset="0"
                        width="8"/>
                    <phone
                        jcr:primaryType="nt:unstructured"
                        width="11"/>
                </cq:responsive>
            </responsivegrid>
            <responsivegrid_1539433064
                jcr:created="{Date}2018-04-10T13:35:16.843+05:30"
                jcr:createdBy="admin"
                jcr:lastModified="{Date}2018-04-10T13:35:16.843+05:30"
                jcr:lastModifiedBy="admin"
                jcr:primaryType="nt:unstructured"
                sling:resourceType="wcm/foundation/components/responsivegrid"
                editable="{Boolean}true">
                <cq:responsive jcr:primaryType="nt:unstructured">
                    <default
                        jcr:primaryType="nt:unstructured"
                        behavior="none"
                        offset="0"
                        width="4"/>
                    <phone
                        jcr:primaryType="nt:unstructured"
                        behavior="hide"/>
                </cq:responsive>
            </responsivegrid_1539433064>
            <responsivegrid_1148456505
                jcr:created="{Date}2018-04-10T14:34:16.333+05:30"
                jcr:createdBy="admin"
                jcr:lastModified="{Date}2018-04-11T09:44:18.613+05:30"
                jcr:lastModifiedBy="admin"
                jcr:primaryType="nt:unstructured"
                sling:resourceType="wcm/foundation/components/responsivegrid">
                <navigation
                    jcr:created="{Date}2018-04-11T09:46:09.990+05:30"
                    jcr:createdBy="admin"
                    jcr:lastModified="{Date}2018-04-11T09:46:09.990+05:30"
                    jcr:lastModifiedBy="admin"
                    jcr:primaryType="nt:unstructured"
                    sling:resourceType="citraining/components/structure/navigation"/>
            </responsivegrid_1148456505>
        </root>
        <cq:responsive jcr:primaryType="nt:unstructured">
            <breakpoints jcr:primaryType="nt:unstructured">
                <phone
                    jcr:primaryType="nt:unstructured"
                    title="Smaller Screen"
                    width="{Long}768"/>
                <tablet
                    jcr:primaryType="nt:unstructured"
                    title="Tablet"
                    width="{Long}1200"/>
            </breakpoints>
        </cq:responsive>
    </jcr:content>
</jcr:root>


text:
layout: default
---

{% include nav.html %}

Research materials

Handel scholars and enthusiasts have access to a growing repository of resources, including many digital and online materials. The following highlights select research materials that may be useful to anyone engaged in the study of Handel.

The Librettos of Handel's Operas: A Collection of Seventy-one Librettos Documenting Handel's Operatic Career. New York: Garland, 1989. Digital version available via the Hathi Trust Library.

The British Library hosts digitized copies of most of Handel's autograph manuscripts available for free through their online catalogue.

The Handel Institute maintains up-to-date listings of recent research, notable publications, and Handel scholars.


text:
The MIT License (MIT)

Copyright (c) [2015] [Daniel Elliott]

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 "HalfAngleSlicing.h"
#include "SlicedVolumeActor.h"
#include "ProceduralMeshComponent.h"
#include <Engine.h>

// Sets default values
ASlicedVolumeActor::ASlicedVolumeActor()
{
 	// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;
    volumeComp = CreateDefaultSubobject<UProceduralMeshComponent>(TEXT("VolumeComponent"));
   // tx = CreateAbstractDefaultSubobject<USceneComponent>("mainTX");

//    for (int i = 0; i > -50; i--){
//
//    FProceduralMeshVertex v0;
//    FProceduralMeshVertex v1;
//    FProceduralMeshVertex v2;
//
//    FProceduralMeshTriangle t1;
//
//    v0.Position = FVector(i*30, 0.0f, 0.0f);
//    v0.U=0.0;
//    v0.V=0.0;
//
//    v1.Position = FVector(i*30, 1000.0f, 1000.0f);
//    v1.U=1.0;
//    v1.V=1.0;
//
//    v2.Position = FVector(i*30, 0.0f, 1000.0f);
//    v2.U=0.0;
//    v2.V=1.0;
//
//
//    t1.Vertex0 = v0;
//    t1.Vertex1 = v1;
//    t1.Vertex2 = v2;
//
//
//
//    newTris.Add(t1);
//    }

    //volumeComp->SetProceduralMeshTriangles(newTris);
    RootComponent = volumeComp;
  //  volumeComp->AttachTo(tx);

}

// Called when the game starts or when spawned
void ASlicedVolumeActor::BeginPlay()
{
	Super::BeginPlay();

}

// Called every frame
void ASlicedVolumeActor::Tick( float DeltaTime )
{
	Super::Tick( DeltaTime );
	FRotator ar = GetActorRotation();
	SetActorRotation(FRotator(ar.Pitch, ar.Yaw + (DeltaTime * 3), ar.Roll));
	//GEngine->AddOnScreenDebugMessage(-1, 4.0f, FColor::Red, FString::Printf(TEXT("actor rotation is %f"), ar.Yaw) );

    //volumeComp->ClearProceduralMeshTriangles();
    //volumeComp->SetProceduralMeshTriangles(newTris);

}


text:
from captaincloud.engine.executor import TaskExecutor, TaskExecutorStatus

import argparse
import importlib

def load_modules(modules):
    for module in modules:
        if module == '':
            continue
        try:
            importlib.import_module(module)
        except ImportError:
            raise Exception('Failed to load the module.')

def parse_args():
    parser = argparse.ArgumentParser()
    parser.add_argument('--task', default='stdin', help='Task file')
    parser.add_argument('--task-out', default='stdout',
                        help='Task output after execution')
    parser.add_argument('--modules', default='',
                        help='Modules to load to register necessary tasks')
    return parser.parse_args()

def main():
    args = parse_args()

    load_modules(args.modules.split(','))

    executor = TaskExecutor()
    executor.load_task(args.task)

    executor.execute()

    if executor.status == TaskExecutorStatus.SUCCESS:
        executor.dump_task(args.task_out)

if __name__ == '__main__':
    main()


text:
package jetbrains.jetpad.model.collections;

public interface CollectionListener<ItemT> {
  void onItemAdded(CollectionItemEvent<? extends ItemT> event);
  void onItemSet(CollectionItemEvent<? extends ItemT> event);
  void onItemRemoved(CollectionItemEvent<? extends ItemT> event);
}


text:
<?php
namespace Chamilo\Libraries\Architecture\Exceptions;

use Chamilo\Libraries\Platform\Security;

/**
 * Extension on the exception class to make clear to the system that this is an exception
 * that should be shown to the user
 *
 * @package Chamilo\Libraries\Architecture\Exceptions
 * @author Sven Vanpoucke - Hogeschool Gent
 */
class UserException extends \Exception
{
    /**
     * UserException constructor.
     *
     * @param $message
     */
    public function __construct($message)
    {
        $security = new Security();
        $message = $security->removeXSS($message);
        parent::__construct($message);
    }
}


text:
<?php

namespace App\Exceptions;

use Exception;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

class Handler extends ExceptionHandler
{
    /**
     * A list of the exception types that should not be reported.
     *
     * @var array
     */
    protected $dontReport = [
        HttpException::class,
        ModelNotFoundException::class,
    ];

    /**
     * Report or log an exception.
     *
     * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
     *
     * @param  \Exception  $e
     * @return void
     */
    public function report(Exception $e)
    {
        return parent::report($e);
    }

    /**
     * Render an exception into an HTTP response.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Exception  $e
     * @return \Illuminate\Http\Response
     */
    public function render($request, Exception $e)
    {
        if ($e instanceof ModelNotFoundException) {
            $e = new NotFoundHttpException($e->getMessage(), $e);
        }

        if ($this->shouldReport($e)) {
            app('sentry')->captureException($e);
        }

        if (config('app.debug')) {
            $whoops = new \Whoops\Run;

            if ($request->ajax()) {
                $whoops->pushHandler(new \Whoops\Handler\JsonResponseHandler);
            } else {
                $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
            }

            return response($whoops->handleException($e),
                $e->getStatusCode(),
                $e->getHeaders()
            );
        }

        return parent::render($request, $e);
    }
}


text:
var Bootstrap3ConfirmModal= Backbone.View.extend({

    events: {
        'click button[type="submit"]': 'onClickConfirm',
        'hidden.bs.modal': 'onHideModal',
        'show.bs.modal': 'onShowModal'
    },

    hide: function() {
        this.$el.modal('hide');
    },

    show: function() {
        this.$el.modal('show');
    },

    onClickConfirm: function(e) {
        e.preventDefault();
    },

    onHideModal: function(e){
        this.remove();
    },

    onShowModal: function(e){},

});


text:
MyGame.Game = function(game){

	this.tower;

	this.money;
	this.score;
	this.health;

	this.healthText;
	this.moneyText;
	this.scoreText;

};

MyGame.Game.prototype = {

	create: function(){

		this.tower = MyGame.newSprite(this.world.centerX, this.world.centerY, 'player', this);

		this.money = 250;
		this.score = 0;
		this.health = 100;

		this.createText();
	},

	createText: function(){

		var style = MyGame.newStyle(12, '#ffffff');

		this.healthText = this.add.text(10, 10, 'Health: ' + this.health.toString(), style);
		this.moneyText = this.add.text(10, 25, 'Money: ' + this.money.toString(), style);
		this.scoreText = this.add.text(10, 40, 'Score: ' + this.score.toString(), style);
	},

	newEnemy: function(x, y){

	},

	update: function(){

	},

};


text:
<?php

namespace Matthias\SymfonyConsoleForm\Console\Input;

use RuntimeException;
use Symfony\Component\Config\ConfigCache;
use Symfony\Component\Console\Input\InputDefinition;

class CachedInputDefinitionFactory implements InputDefinitionFactory
{
    /**
     * @var InputDefinitionFactory
     */
    private $inputDefinitionFactory;

    /**
     * @var string
     */
    private $cacheDirectory;

    /**
     * @var bool
     */
    private $debug;

    public function __construct(InputDefinitionFactory $inputDefinitionFactory, string $cacheDirectory, bool $debug)
    {
        $this->inputDefinitionFactory = $inputDefinitionFactory;
        $this->cacheDirectory = $cacheDirectory;
        $this->debug = $debug;
    }

    public function createForFormType(string $formType, array &$resources = []): InputDefinition
    {
        $cache = $this->configCacheFor($formType);

        if ($cache->isFresh()) {
            return $this->inputDefinitionFromCache($cache->getPath());
        }

        return $this->freshInputDefinition($formType, $cache, $resources);
    }

    protected function configCacheFor(string $formType): ConfigCache
    {
        return new ConfigCache($this->cacheDirectory . '/' . $formType, $this->debug);
    }

    /**
     * @param string $cacheFile
     */
    private function inputDefinitionFromCache(string $cacheFile): InputDefinition
    {
        $unserialized = unserialize(file_get_contents($cacheFile));

        if (!$unserialized instanceof InputDefinition) {
            throw new RuntimeException('Expected to get an object of type InputDefinition from the cache');
        }

        return $unserialized;
    }

    private function freshInputDefinition(string $formType, ConfigCache $cache, array &$resources): InputDefinition
    {
        $inputDefinition = $this->inputDefinitionFactory->createForFormType($formType, $resources);
        $cache->write(serialize($inputDefinition), $resources);

        return $inputDefinition;
    }
}


text:
<?php

declare (strict_types=1);
namespace Ssch\TYPO3Rector\Rector\v10\v1;

use PhpParser\Node;
use PhpParser\Node\Expr\BinaryOp\Concat;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\Node\Expr\Variable;
use PHPStan\Type\ObjectType;
use Rector\Core\Rector\AbstractRector;
use Ssch\TYPO3Rector\Helper\StringUtility;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
 * @changelog https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/10.1/Deprecation-88995-CallingRegisterPluginWithVendorName.html
 * @see \Ssch\TYPO3Rector\Tests\Rector\v10\v1\RegisterPluginWithVendorNameRector\RegisterPluginWithVendorNameRectorTest
 */
final class RegisterPluginWithVendorNameRector extends \Rector\Core\Rector\AbstractRector
{
    /**
     * @return array<class-string<Node>>
     */
    public function getNodeTypes() : array
    {
        return [\PhpParser\Node\Expr\StaticCall::class];
    }
    /**
     * @param StaticCall $node
     */
    public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
    {
        if (!$this->nodeTypeResolver->isMethodStaticCallOrClassMethodObjectType($node, new \PHPStan\Type\ObjectType('TYPO3\\CMS\\Extbase\\Utility\\ExtensionUtility'))) {
            return null;
        }
        if (!$this->isName($node->name, 'registerPlugin')) {
            return null;
        }
        return $this->removeVendorNameIfNeeded($node);
    }
    /**
     * @codeCoverageIgnore
     */
    public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
    {
        return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('Remove vendor name from registerPlugin call', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample('TYPO3\\CMS\\Extbase\\Utility\\ExtensionUtility' . '::registerPlugin(
   \'TYPO3.CMS.Form\',
   \'Formframework\',
   \'Form\',
   \'content-form\',
);', 'TYPO3\\CMS\\Extbase\\Utility\\ExtensionUtility' . '::registerPlugin(
   \'Form\',
   \'Formframework\',
   \'Form\',
   \'content-form\',
);')]);
    }
    private function removeVendorNameIfNeeded(\PhpParser\Node\Expr\StaticCall $node) : ?\PhpParser\Node
    {
        $extensionNameArgumentValue = $node->args[0]->value;
        $extensionName = $this->valueResolver->getValue($extensionNameArgumentValue);
        $fileInfo = $this->file->getSmartFileInfo();
        if ($extensionNameArgumentValue instanceof \PhpParser\Node\Expr\BinaryOp\Concat && $this->isPotentiallyUndefinedExtensionKeyVariable($extensionNameArgumentValue)) {
            $extensionName = $this->valueResolver->getValue($extensionNameArgumentValue->left) . \basename($fileInfo->getRelativeDirectoryPath());
        }
        if (!\is_string($extensionName)) {
            return null;
        }
        $delimiterPosition = \strrpos($extensionName, '.');
        if (\false === $delimiterPosition) {
            return null;
        }
        $extensionName = \Ssch\TYPO3Rector\Helper\StringUtility::prepareExtensionName($extensionName, $delimiterPosition);
        $node->args[0] = $this->nodeFactory->createArg($extensionName);
        return $node;
    }
    private function isPotentiallyUndefinedExtensionKeyVariable(\PhpParser\Node\Expr\BinaryOp\Concat $extensionNameArgumentValue) : bool
    {
        if (!$extensionNameArgumentValue->right instanceof \PhpParser\Node\Expr\Variable) {
            return \false;
        }
        if (null !== $this->valueResolver->getValue($extensionNameArgumentValue->right)) {
            return \false;
        }
        return $this->isNames($extensionNameArgumentValue->right, ['_EXTKEY', 'extensionKey']);
    }
}


text:
namespace Swan.Test.Mocks;

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

/// <summary>
/// Represents a record that maps to the dbo.Projects table.
/// </summary>
[Table("Projects", Schema = "dbo")]
public record Project
{
    /// <summary>
    /// Creates a new instance of the <see cref="Project" /> class.
    /// </summary>
    public Project() { /* placeholder */ }

    /// <summary>
    /// Gets or sets a value for Project Id.
    /// </summary>
    [Key]
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    [Column(nameof(ProjectId), Order = 0)]
    public int ProjectId { get; set; }

    /// <summary>
    /// Gets or sets a value for Name.
    /// </summary>
    [MaxLength(100)]
    [Column(nameof(Name), Order = 1)]
    public string? Name { get; set; }

    /// <summary>
    /// Gets or sets a value for Project Type.
    /// </summary>
    [Column(nameof(ProjectType), Order = 2)]
    public ProjectTypes ProjectType { get; set; }

    /// <summary>
    /// Gets or sets a value for Company Id.
    /// </summary>
    [Column(nameof(CompanyId), Order = 3)]
    public int? CompanyId { get; set; }

    /// <summary>
    /// Gets or sets a value for Is Active.
    /// </summary>
    [Column(nameof(IsActive), Order = 4)]
    public bool IsActive { get; set; }

    /// <summary>
    /// Gets or sets a value for Start Date.
    /// </summary>
    [Column(nameof(StartDate), Order = 5)]
    public DateTime? StartDate { get; set; }

    /// <summary>
    /// Gets or sets a value for End Date.
    /// </summary>
    [Column(nameof(EndDate), Order = 6)]
    public DateTime? EndDate { get; set; }

    /// <summary>
    /// Gets or sets a value for Project Scope.
    /// </summary>
    [MaxLength(2147483647)]
    [Column(nameof(ProjectScope), Order = 7)]
    public string ProjectScope { get; set; }
}

[Table("ProjectNoColumns", Schema = "dbo")]
public record ProjectNoColumns
{
    /// <summary>
    /// Creates a new instance of the <see cref="Project" /> class.
    /// </summary>
    public ProjectNoColumns() { /* placeholder */ }

    /// <summary>
    /// Gets or sets a value for Project Id.
    /// </summary>
    [Key]
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    [Column(nameof(ProjectId), Order = 0)]
    public int ProjectId { get; set; }
}

public enum ProjectTypes
{
    Boring,
    Exciting
}


text:
package org.apache.activemq.security;

import java.net.URI;

import javax.jms.Connection;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;

import junit.framework.TestCase;

import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.broker.BrokerFactory;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.command.ActiveMQQueue;

public class JaasNetworkTest extends TestCase {

   BrokerService broker1;
   BrokerService broker2;

   @Override
   public void setUp() throws Exception {
      System.setProperty("java.security.auth.login.config", "src/test/resources/login.config");
      broker1 = BrokerFactory.createBroker(new URI("xbean:org/apache/activemq/security/broker1.xml"));
      broker2 = BrokerFactory.createBroker(new URI("xbean:org/apache/activemq/security/broker2.xml"));
      broker1.waitUntilStarted();
      broker2.waitUntilStarted();
      Thread.sleep(2000);
   }

   @Override
   protected void tearDown() throws Exception {
      super.tearDown();
      broker1.stop();
      broker1.waitUntilStopped();
      broker2.stop();
      broker2.waitUntilStopped();
   }

   public void testNetwork() throws Exception {

      System.setProperty("javax.net.ssl.trustStore", "src/test/resources/org/apache/activemq/security/client.ts");
      System.setProperty("javax.net.ssl.trustStorePassword", "password");
      System.setProperty("javax.net.ssl.trustStoreType", "jks");
      System.setProperty("javax.net.ssl.keyStore", "src/test/resources/org/apache/activemq/security/client.ks");
      System.setProperty("javax.net.ssl.keyStorePassword", "password");
      System.setProperty("javax.net.ssl.keyStoreType", "jks");

      ActiveMQConnectionFactory producerFactory = new ActiveMQConnectionFactory("ssl://localhost:61617");
      Connection producerConn = producerFactory.createConnection();
      Session producerSess = producerConn.createSession(false, Session.AUTO_ACKNOWLEDGE);
      MessageProducer producer = producerSess.createProducer(new ActiveMQQueue("test"));
      producerConn.start();
      TextMessage sentMessage = producerSess.createTextMessage("test");
      producer.send(sentMessage);

      ActiveMQConnectionFactory consumerFactory = new ActiveMQConnectionFactory("ssl://localhost:61618");
      Connection consumerConn = consumerFactory.createConnection();
      Session consumerSess = consumerConn.createSession(false, Session.AUTO_ACKNOWLEDGE);
      consumerConn.start();
      MessageConsumer consumer = consumerSess.createConsumer(new ActiveMQQueue("test"));
      TextMessage receivedMessage = (TextMessage) consumer.receive(100);
      assertEquals(sentMessage, receivedMessage);

   }

}


text:
'use strict';

var Promise = require('bluebird');
var _ = require('lodash');

module.exports = function() {
    var teraslice, es_client, es_helper;

    describe('elasticsearch_bulk', function() {

        it('multisend should generate correct number of docs', function(done) {
            var job_spec = _.cloneDeep(require('../../fixtures/jobs/multisend.json'));
            job_spec.name = 'multisend'
            job_spec.operations[1].index = 'test-multisend-10000';

            teraslice.jobs.submit(job_spec)
                .then(function(job) {
                    expect(job).toBeDefined();
                    expect(job.id()).toBeDefined();

                    // The job may run for a while so we have to wait for it to finish.
                    return job.waitForStatus('completed');
                })
                .then(function() {
                    return es_helper.documentCountForIndex('test-multisend-10000')
                        .then(function(stats) {
                            expect(stats.count).toBe(10000);
                        });
                })
                .catch(fail)
                .finally(done)
        });
    });

    return function(connections) {
        es_client = connections.es_client;
        teraslice = connections.teraslice_client;
        es_helper = require('../helpers/es_helper')(es_client);
    }
};


text:
package org.apache.uima.examples.tagger.trainAndTest;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;

/**
 * Reader for Brown Corpus from NLTK Distribution (nltk.sourceforge.net)
 */
public class BrownReader implements CorpusReader{

  /**
   * Reads Brown Corpus from NLTK Distribution Format. Iterates over all files in the directory,
   * which are in a sentence per line format, and returns all tokens in the collection in a List of
   * {@link Token}s}
   *
   */

  public List<Token> read_corpus(String directory, MappingInterface mapping) {

    // Reads file names from Directory and returns an array of file names in the directory
    File dir = new File(directory);
    String[] list = dir.list();
    String[] new_list = new String[list.length];
    for (int i = 0; i < list.length; i++) {
      String dir_list = directory + "/" + list[i];
      new_list[i] = dir_list;
    }

    String line;
    List<Token> text = new ArrayList<Token>();

    // simple tokenizer: match one or more spaces
    // String delimiters = " +";

    Pattern delimiters = Pattern.compile("[ ]+");
    // Split input with the pattern

    int line_count = 0;

    for (int i = 0; i < new_list.length; i++) {
      String file = new_list[i];
      try {
        BufferedReader in = new BufferedReader(new FileReader(file));

        while ((line = in.readLine()) != null) {
          if (line.trim().length() > 0) {
            line_count += 1;
            String[] tokens = delimiters.split(line);

            for (int x = 0; x < tokens.length; x++) { // iterate over tokens with their
              // corresponding POS
              tokens[x] = tokens[x].replaceAll("[\\n\\t]+", "");

              // for cases in Brown corpus like "//in" :(
              if (tokens[x].startsWith("//")) {
                String t = tokens[x].replace("//", "per/");
                tokens[x] = t;
              }

              // and that was not all, further for cases like:
              // "before/in /l//nn and/cc AAb//nn or/cc /r//nn ./. " (text j in NLTK distribution)
              if (tokens[x].startsWith("/", 0)) {
                String t = tokens[x].substring(1);
                tokens[x] = t;
              }
              // for cases like : "AAb//nn" (s. above)
              if (tokens[x].contains("//")) {
                int j = tokens[x].indexOf("//");

                String t = tokens[x].substring(0, j) + tokens[x].substring(j + 1);
                tokens[x] = t;
              }

              // for cases in brown like: "lb/day/nn" (text 'J', sentence N. 8940)
              int first = tokens[x].indexOf("/");
              int last = tokens[x].lastIndexOf("/");
              if (first != last) {
                String[] zw = tokens[x].split("/");
                StringBuffer t = new StringBuffer();
                for (int w = 0; w < zw.length - 1; w++) {

                  t.append(zw[w]);
                }

                t.append("/");
                t.append(zw[zw.length - 1]);
                tokens[x] = t.toString();
              }

              String[] t = tokens[x].split("/");

              Token token = new Token(t[0], t[1]);

              text.add(token);
            }
          }
        }
        in.close();
      } catch (IOException e) {
        System.out.println(e);
        return null;
      }
    }
    System.out.println(line_count + " sentences in the corpus");
    if (mapping != null) {
      text = mapping.map_tags(text); // in case we need to map
    }
    return text;
  }
  /*
   * public static void main(String[] args) { // BrownReader b = new BrownReader("Brown_test"); }
   */
}


text:
namespace blink {
namespace scheduler {

WebFakeThreadScheduler::WebFakeThreadScheduler() = default;

WebFakeThreadScheduler::~WebFakeThreadScheduler() = default;

std::unique_ptr<MainThread> WebFakeThreadScheduler::CreateMainThread() {
  return nullptr;
}

scoped_refptr<base::SingleThreadTaskRunner>
WebFakeThreadScheduler::CompositorTaskRunner() {
  return base::ThreadTaskRunnerHandle::Get();
}

std::unique_ptr<WebAgentGroupScheduler>
WebFakeThreadScheduler::CreateAgentGroupScheduler() {
  return std::make_unique<FakeAgentGroupScheduler>(*this);
}

WebAgentGroupScheduler*
WebFakeThreadScheduler::GetCurrentAgentGroupScheduler() {
  return nullptr;
}

void WebFakeThreadScheduler::SetRendererHidden(bool hidden) {}

void WebFakeThreadScheduler::SetRendererBackgrounded(bool backgrounded) {}

#if BUILDFLAG(IS_ANDROID)
void WebFakeThreadScheduler::PauseTimersForAndroidWebView() {}

void WebFakeThreadScheduler::ResumeTimersForAndroidWebView() {}
#endif

void WebFakeThreadScheduler::Shutdown() {}

void WebFakeThreadScheduler::SetRendererProcessType(
    WebRendererProcessType type) {}

}  // namespace scheduler
}  // namespace blink


text:
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/jiffies.h>
#include <linux/debugfs.h>
#include <linux/io.h>
#include <linux/idr.h>
#include <linux/string.h>
#include <linux/sched.h>
#include <linux/wait.h>
#include <linux/delay.h>
#include <linux/completion.h>
#include <linux/ipc_logging.h>

#include "ipc_logging_private.h"

static DEFINE_MUTEX(ipc_log_debugfs_init_lock);
static struct dentry *root_dent;

static int debug_log(struct ipc_log_context *ilctxt,
		     char *buff, int size, int cont)
{
	int i = 0;
	int ret;

	if (size < MAX_MSG_DECODED_SIZE) {
		pr_err("%s: buffer size %d < %d\n", __func__, size,
			MAX_MSG_DECODED_SIZE);
		return -ENOMEM;
	}
	do {
		i = ipc_log_extract(ilctxt, buff, size - 1);
		if (cont && i == 0) {
			ret = wait_for_completion_interruptible(
				&ilctxt->read_avail);
			if (ret < 0)
				return ret;
		}
	} while (cont && i == 0);

	return i;
}

/*
 * VFS Read operation helper which dispatches the call to the debugfs
 * read command stored in file->private_data.
 *
 * @file  File structure
 * @buff   user buffer
 * @count size of user buffer
 * @ppos  file position to read from (only a value of 0 is accepted)
 * @cont  1 = continuous mode (don't return 0 to signal end-of-file)
 *
 * @returns ==0 end of file
 *           >0 number of bytes read
 *           <0 error
 */
static ssize_t debug_read_helper(struct file *file, char __user *buff,
				 size_t count, loff_t *ppos, int cont)
{
	struct ipc_log_context *ilctxt = file->private_data;
	char *buffer;
	int bsize;

	buffer = kmalloc(count, GFP_KERNEL);
	if (!buffer)
		return -ENOMEM;

	bsize = debug_log(ilctxt, buffer, count, cont);
	if (bsize > 0) {
		if (copy_to_user(buff, buffer, bsize)) {
			kfree(buffer);
			return -EFAULT;
		}
		*ppos += bsize;
	}
	kfree(buffer);
	return bsize;
}

static ssize_t debug_read(struct file *file, char __user *buff,
			  size_t count, loff_t *ppos)
{
	return debug_read_helper(file, buff, count, ppos, 0);
}

static ssize_t debug_read_cont(struct file *file, char __user *buff,
			       size_t count, loff_t *ppos)
{
	return debug_read_helper(file, buff, count, ppos, 1);
}

static int debug_open(struct inode *inode, struct file *file)
{
	file->private_data = inode->i_private;
	return 0;
}

static const struct file_operations debug_ops = {
	.read = debug_read,
	.open = debug_open,
};

static const struct file_operations debug_ops_cont = {
	.read = debug_read_cont,
	.open = debug_open,
};

static void debug_create(const char *name, mode_t mode,
			 struct dentry *dent,
			 struct ipc_log_context *ilctxt,
			 const struct file_operations *fops)
{
	debugfs_create_file(name, mode, dent, ilctxt, fops);
}

static void dfunc_string(struct encode_context *ectxt,
			 struct decode_context *dctxt)
{
	tsv_timestamp_read(ectxt, dctxt, " ");
	tsv_byte_array_read(ectxt, dctxt, "");

	/* add trailing \n if necessary */
	if (*(dctxt->buff - 1) != '\n') {
		if (dctxt->size) {
			++dctxt->buff;
			--dctxt->size;
		}
		*(dctxt->buff - 1) = '\n';
	}
}

void check_and_create_debugfs(void)
{
	mutex_lock(&ipc_log_debugfs_init_lock);
	if (!root_dent) {
		root_dent = debugfs_create_dir("ipc_logging", 0);

		if (IS_ERR(root_dent)) {
			pr_err("%s: unable to create debugfs %ld\n",
				__func__, IS_ERR(root_dent));
			root_dent = NULL;
		}
	}
	mutex_unlock(&ipc_log_debugfs_init_lock);
}
EXPORT_SYMBOL(check_and_create_debugfs);

void create_ctx_debugfs(struct ipc_log_context *ctxt,
			const char *mod_name)
{
	if (!root_dent)
		check_and_create_debugfs();

	if (root_dent) {
		ctxt->dent = debugfs_create_dir(mod_name, root_dent);
		if (!IS_ERR(ctxt->dent)) {
			debug_create("log", 0444, ctxt->dent,
				     ctxt, &debug_ops);
			debug_create("log_cont", 0444, ctxt->dent,
				     ctxt, &debug_ops_cont);
		}
	}
	add_deserialization_func((void *)ctxt,
				 TSV_TYPE_STRING, dfunc_string);
}
EXPORT_SYMBOL(create_ctx_debugfs);


text:
Example using Caffe with realtime data augmentation for [Kaggle's National Data Science Bowl](https://www.kaggle.com/c/datasciencebowl).

You should get a logloss about ~0.67xx.

## Instruction
* download data from the [competition website](https://www.kaggle.com/c/datasciencebowl/data) and put all the data into `./Data` dir. You should have
 - `./Data/train`
 - `./Data/test`
 - `./Data/sampleSubmission.csv`
* run `./caffe_windows/prepare_data.sh` to convert data into Caffe accepted format.
* run `./caffe_windows/train_caffenet.bat` to train Caffe model. Besides the model, it will also save the screen print into a log file which will be used in the next step.
* use `./caffe_windows/utils/plot_caffe_training_logloss.py` to plot the training and validation logloss (from the saved log file) and then pick up the best model.
* (optional) you can try to finetune the best model by 1) lowering the loss_weight for the coarse classifier, 2) lowering the learning rate, 3) decreasing the augmentation (trick from Dr. Benjamin Graham in the [winning solution for Cifar10](https://www.kaggle.com/c/cifar-10/forums/t/10493/train-you-very-own-deep-convolutional-network/56267)).
* run `./caffe_windows/make_submission.sh` to generate Kaggle submission by averaging the predictions from random augmentation. Be sure you set the weight file to the best model in the script.
* use `./caffe_windows/utils/plot_caffe_ensemble_logloss.py` to see the effect of averaging predictions.

## Additional Info

1. Make sure you set the right path in the above file.
2. For execution of .sh script under Windows, I use Cygwin64.
3. There is greedy bagging ensemble (and also naive averaging) for ensembling predictions based on the validation logloss. Have a look at `./caffe_windows/make_submission_ens.sh` and `./caffe_windows/utils/greedy_bagging_ensemble.py`.


text:
/** @file steiner_modified_final.c
 * @author Franziska Schlösser
 * @date July 2017
 * @brief Main programm fulfilling ex10
 */

#include <argp.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

#ifdef _OPENMP
#include <omp.h>
#endif

#include "../library/graph.h"
#include "../library/misc.h"

/** @brief Solves Exercise 10
 *
 * Reads in a graph from a file and calculates an approximation to a steiner tree on the prime nodes
 */
int main(int argc, char **argv) {

    // ############### parse commandlineargs
    char *help = "Please provide filename as first argument, number of starting points a positive integer as optional second argument and '-s' as parameter indicating that the best approximation to the steiner tree should be printed.\n";
    if (argc < 2) {
        printf("%s", help);
        exit(0);
    }
    // filename is first commandlinearg
    char *file = argv[1];
    // number of starting points is second commandlinearg
    unsigned int primebound = 100;
    if (argc == 3) {
        primebound = atoi(argv[2]);
        if (primebound < 1) {
            printf("%s", help);
        }
    }
    bool verbose = false;
    if (argc == 4) {
        if (strcmp(argv[3], "-s") == 0) {
            verbose = true;
        } else {
            printf("Can't parse argument '%s'", argv[3]);
            printf("%s", help);
            exit(0);
        }
    }

    // ############### init from file
    Graph *g = malloc(sizeof(Graph));
    init_from_graph_file(g, file);

    // ############### find upper bound on startvertices
    // steiner tree connecting prime nodes
    unsigned int *mask = get_primes(g->n_verts);

    unsigned int walker = 0;
    for(int i = 0; i < g->n_verts; i++) { // find the bound up to the n'th prime
        if (mask[i]==1) {
            walker++;
        }
        if (walker == primebound || i == g->n_verts-1) {
            walker = i;
            break;
        }
    }
    // walker should now be the n'th prime or index of last vertex of g
    unsigned int upperbound = walker+1;

    // ############### start steiner search
    // start the clocks
    clock_t cpustart = clock();
    struct timespec wallstart, wallend;
    clock_gettime( CLOCK_REALTIME, &wallstart);

	unsigned int **vertex_mask = malloc(sizeof(*vertex_mask) * g->n_verts);
	unsigned int **prev = malloc(sizeof(*prev) * g->n_verts);

	# pragma omp parallel for
    for(int i = 0; i < upperbound; i++) { // search in parallel for startterminals smaller than n'th prime
		if (mask[i]==0) { // only search with terminals as start vertices
			continue;
		}

        // prepare the vertex masks
	    vertex_mask[i] = malloc(sizeof(*vertex_mask[i]) * g->n_verts);
		memcpy(vertex_mask[i], mask, sizeof(*vertex_mask[i]) * g->n_verts);
		prev[i] = steiner_modified(g, i+1, vertex_mask[i]);
	}
    // stop the clocks
    clock_t cpuend = clock();
    clock_gettime(CLOCK_REALTIME, &wallend);

    // ############### find and print result
    unsigned long *obj = malloc(sizeof(*obj) * g->n_verts);
	# pragma omp parallel for
    for(int i = 0; i < upperbound; i++) {
        if(mask[i]==0) {
            obj[i] = ULONG_MAX;
        } else {
            obj[i] = weight_of_tree(g, vertex_mask[i], prev[i]);
        }
    }
	unsigned int min = 0;
    unsigned long minobjective = ULONG_MAX;
	for(int i = 0; i < upperbound; i++) {
		// calculate the objective
        unsigned long objective = obj[i];
		if (objective < minobjective) {
            minobjective = objective;
			min = i;
		}
	}
	// check result
	unsigned int *terminal_mask = malloc(sizeof(*terminal_mask) * g->n_verts);
	memcpy(terminal_mask, mask, sizeof(*terminal_mask) * g->n_verts);
    assert(check_steiner(g, terminal_mask, vertex_mask[min], prev[min]));
    free(terminal_mask);

    // print result
    printf("TLEN: %li\n", minobjective);
    if (verbose) {
        printf("TREE: ");
        print_tree(g, vertex_mask[min], prev[min]);
    }
    printf("TIME: %f\n", (float) (cpuend-cpustart) / CLOCKS_PER_SEC);
    double secs = (wallend.tv_sec - wallstart.tv_sec);
    double ns = (wallend.tv_nsec - wallstart.tv_nsec)/1000000000.f;
    printf("WALL: %f\n", secs + ns);

    // ############### free memory
	for(int i = 0; i < upperbound; i++) {
        if (mask[i]!=0) {
		    free(prev[i]);
    	    free(vertex_mask[i]);
        }
	}
    free(obj);
    free(prev);
    free(vertex_mask);
    delete_graph(g);
    free(g);
	free(mask);

    return 0; // everything went fine (hopefully)
}