text:
import React from 'react'
import ReactDOM from 'react-dom'
import Route from '../../react-router/modules/Route'
import { I, H, B, PAD, lightGray, red } from './bricks'
import MarkdownViewer from './MarkdownViewer'
import ScrollToMe from './ScrollToMe'

export const API = [
  { name: 'Route',
    path: '/Route',
    html: require('../api/Route.md')
  },
  { name: 'Switch',
    path: '/Switch',
    html: require('../api/Switch.md')
  },
  { name: 'Link',
    path: '/Link',
    html: require('../api/Link.md')
  },
  { name: 'Redirect',
    path: '/Redirect',
    html: require('../api/Redirect.md')
  },
  { name: 'Prompt',
    path: '/Prompt',
    html: require('../api/Prompt.md')
  },
  { name: 'BrowserRouter',
    path: '/BrowserRouter',
    html: require('../api/BrowserRouter.md')
  },
  { name: 'HashRouter',
    path: '/HashRouter',
    html: require('../api/HashRouter.md')
  },
  { name: 'MemoryRouter',
    path: '/MemoryRouter',
    html: require('../api/MemoryRouter.md')
  },
  { name: 'ServerRouter',
    path: '/ServerRouter',
    html: require('../api/ServerRouter.md')
  }
]

const $ = (node, selector) => (
  [].slice.call(node.querySelectorAll(selector))
)

class APIDocs extends React.Component {
  componentDidMount() {
    const items = $(this.el, '.api-entry').map(entry => {
      const name = $(entry, 'h1')[0].childNodes[1].textContent.trim()
      const hash = $(entry, 'h1 a')[0].hash
      const children = $(entry, 'h2').map(node => ({
        name: node.childNodes[1].textContent.trim(),
        hash: $(node, 'a')[0].hash
      }))
      return { name, hash, children }
    })
    this.renderMenu(items)
  }

  renderMenu(items) {
    const el = (

        {items.map(item => (

            {item.name}

              {item.children.map(({ hash, name }) => (
                {name}
              ))}

        ))}

    )

    ReactDOM.render(el, this.menu)
  }

  render() {
    return (
       this.el = n }}>
        <Route exact path="/api" component={ScrollToMe}/>
        <H height="100vh">
           this.menu = n }} height="100%" overflow="auto" fontSize="80%" padding="40px" background="#f0f0f0"/>

            {API.map((doc, i) => (

                <MarkdownViewer html={doc.html}/>

            ))}

        </H>

    )
  }
}

export default APIDocs


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

#if false
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using Azure.Core.TestFramework;
using Azure.ResourceManager.CosmosDB.Models;
using NUnit;
using NUnit.Framework;

namespace Azure.ResourceManager.CosmosDB.Tests
{
    public class SqlResourcesOperationsTests : CosmosDBManagementClientBase
    {
        private string location;
        private string resourceGroupName;
        private string databaseAccountName;
        private string databaseName;
        private string containerName;
        private string storedProcedureName;
        private string triggerName;
        private string userDefinedFunctionName;
        private string sqlContainersThroughputType;
        private string sqlDatabasesThroughputType;
        private int sampleThroughput1;
        private int sampleThroughput2;
        private int defaultThroughput;
        private int defaultMaxThroughput;
        private bool setupRun = false;
        private Dictionary<string, string> tags = new Dictionary<string, string>
        {
            {"key3","value3"},
            {"key4","value4"}
        };
        public SqlResourcesOperationsTests(bool isAsync) : base(isAsync)
        {
        }
        private void GenerateSampleValues()
        {
            resourceGroupName = Recording.GenerateAssetName(CosmosDBTestUtilities.ResourceGroupPrefix);
            databaseAccountName = Recording.GenerateAssetName("cosmosdb");
            databaseName = Recording.GenerateAssetName("databaseName");
            containerName = Recording.GenerateAssetName("containerName");
            storedProcedureName = Recording.GenerateAssetName("storedProcedureName");
            triggerName = Recording.GenerateAssetName("triggerName");
            userDefinedFunctionName = Recording.GenerateAssetName("userDefinedFunctionName");
            location = "EAST US";
            sqlContainersThroughputType = "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/throughputSettings";
            sqlDatabasesThroughputType = "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/throughputSettings";
            sampleThroughput1 = 700;
            sampleThroughput2 = 1000;
            defaultThroughput = 400;
            defaultMaxThroughput = 4000;
        }

        [SetUp]
        public async Task ClearAndInitialize()
        {
            if (Mode == RecordedTestMode.Record || Mode == RecordedTestMode.Playback)
            {
                if ((Mode == RecordedTestMode.Record || Mode == RecordedTestMode.Playback) && !setupRun)
                {
                    await InitializeClients();
                    GenerateSampleValues();
                    await CosmosDBTestUtilities.TryRegisterResourceGroupAsync(ResourceGroupsOperations,
                        CosmosDBTestUtilities.Location,
                        this.resourceGroupName);
                    await PrepareDatabaseAccount();
                    setupRun = true;
                }
                else if (setupRun)
                {
                    await initNewRecord();
                }
            }
        }

        [OneTimeTearDown]
        public async Task CleanupResourceGroup()
        {
            await CleanupResourceGroupsAsync();
        }

        [TestCase, Order(1)]
        public async Task SqlDatabaseCreateAndUpdateTest()
        {
            SqlDatabaseCreateUpdateParameters sqlDatabaseCreateUpdateParameters1 = new SqlDatabaseCreateUpdateParameters(
                new CosmosDBSqlDatabaseResource(databaseName), new CosmosDBCreateUpdateConfig(sampleThroughput1, new AutoscaleSettings()));
            CosmosDBSqlDatabaseResource sqlDatabase1 = await WaitForCompletionAsync(
                await CosmosDBManagementClient.SqlResources.StartCreateUpdateSqlDatabaseAsync(
                    resourceGroupName, databaseAccountName, databaseName, sqlDatabaseCreateUpdateParameters1));
            Assert.NotNull(sqlDatabase1);
            CosmosDBSqlDatabaseResource sqlDatabase2 = await CosmosDBManagementClient.SqlResources.GetSqlDatabaseAsync(
                resourceGroupName, databaseAccountName, databaseName);
            Assert.NotNull(sqlDatabase2);
            VerifySqlDatabases(sqlDatabase1, sqlDatabase2);
            ThroughputSettingsData throughputSettings1 =
                await CosmosDBManagementClient.SqlResources.GetSqlDatabaseThroughputAsync(resourceGroupName, databaseAccountName, databaseName);
            Assert.NotNull(throughputSettings1);
            Assert.NotNull(throughputSettings1.Name);
            Assert.AreEqual(sqlDatabasesThroughputType, throughputSettings1.Type);
            Assert.AreEqual(sampleThroughput1, throughputSettings1.Resource.Throughput);

            SqlDatabaseCreateUpdateParameters sqlDatabaseCreateUpdateParameters2 =
                new SqlDatabaseCreateUpdateParameters(
                    id: default(string),
                    name: default(string),
                    type: default(string),
                    location: location,
                    tags: tags,
                    resource: new CosmosDBSqlDatabaseResource(databaseName),
                    options: new CosmosDBCreateUpdateConfig { Throughput = sampleThroughput2 });
            CosmosDBSqlDatabaseResource sqlDatabase3 = await WaitForCompletionAsync(
                await CosmosDBManagementClient.SqlResources.StartCreateUpdateSqlDatabaseAsync(
                    resourceGroupName, databaseAccountName, databaseName, sqlDatabaseCreateUpdateParameters2));
            Assert.NotNull(sqlDatabase3);
            CosmosDBSqlDatabaseResource sqlDatabase4 = await CosmosDBManagementClient.SqlResources.GetSqlDatabaseAsync(
                resourceGroupName, databaseAccountName, databaseName);
            Assert.NotNull(sqlDatabase4);
            VerifySqlDatabases(sqlDatabase3, sqlDatabase4);
            ThroughputSettingsData throughputSettings2 =
                await CosmosDBManagementClient.SqlResources.GetSqlDatabaseThroughputAsync(resourceGroupName, databaseAccountName, databaseName);
            Assert.NotNull(throughputSettings2);
            Assert.NotNull(throughputSettings2.Name);
            Assert.AreEqual(sqlDatabasesThroughputType, throughputSettings2.Type);
            Assert.AreEqual(sampleThroughput2, throughputSettings2.Resource.Throughput);
        }

        [TestCase, Order(2)]
        public async Task SqlDatabaseListTest()
        {
            List<CosmosDBSqlDatabaseResource> sqlDatabases = await CosmosDBManagementClient.SqlResources.ListSqlDatabasesAsync(
                resourceGroupName, databaseAccountName).ToEnumerableAsync();
            Assert.NotNull(sqlDatabases);
            Assert.AreEqual(1, sqlDatabases.Count);
            CosmosDBSqlDatabaseResource sqlDatabase = await CosmosDBManagementClient.SqlResources.GetSqlDatabaseAsync(
                resourceGroupName, databaseAccountName, databaseName);
            Assert.NotNull(sqlDatabase);
            Assert.AreEqual(sqlDatabase.Name, sqlDatabases[0].Name);
            VerifySqlDatabases(sqlDatabase, sqlDatabases[0]);
        }

        [TestCase, Order(2)]
        public async Task SqlDatabaseThroughputUpdateTest()
        {
            ThroughputSettingsData ThroughputSettingsData = await WaitForCompletionAsync(
                await CosmosDBManagementClient.SqlResources.StartUpdateSqlDatabaseThroughputAsync(
                    resourceGroupName,
                    databaseAccountName,
                    databaseName,
                    new ThroughputSettingsUpdateParameters(new ThroughputSettingsResource(sampleThroughput2, null, null, null))));
            Assert.NotNull(throughputSettings);
            Assert.AreEqual(sampleThroughput2, throughputSettings.Resource.Throughput);
        }

        [TestCase, Order(3)]
        public async Task SqlDatabaseMigrateToAutoscaleTest()
        {
            ThroughputSettingsData ThroughputSettingsData = await WaitForCompletionAsync(
                await CosmosDBManagementClient.SqlResources.StartMigrateSqlDatabaseToAutoscaleAsync(resourceGroupName, databaseAccountName, databaseName));
            Assert.NotNull(throughputSettings);
            Assert.NotNull(throughputSettings.Resource.AutoscaleSettings);
            Assert.AreEqual(defaultMaxThroughput, throughputSettings.Resource.AutoscaleSettings.MaxThroughput);
            Assert.AreEqual(defaultThroughput, throughputSettings.Resource.Throughput);
        }

        [TestCase, Order(4)]
        public async Task SqlDatabaseMigrateToManualThroughputTest()
        {
            ThroughputSettingsData ThroughputSettingsData = await WaitForCompletionAsync(
                await CosmosDBManagementClient.SqlResources.StartMigrateSqlDatabaseToManualThroughputAsync(resourceGroupName, databaseAccountName, databaseName));
            Assert.NotNull(throughputSettings);
            Assert.IsNull(throughputSettings.Resource.AutoscaleSettings);
            Assert.AreEqual(defaultMaxThroughput, throughputSettings.Resource.Throughput);
        }

        [TestCase, Order(2)]
        public async Task SqlContainerCreateAndUpdateTest()
        {
            SqlContainerCreateUpdateParameters sqlContainerCreateUpdateParameters = new SqlContainerCreateUpdateParameters(
                resource: new CosmosDBSqlContainerResource(containerName)
                {
                    PartitionKeyResource = new ContainerPartitionKey(new List<string> { "/address/zipCode" }, null, null)
                    {
                        Kind = new PartitionKind("Hash")
                    },
                    IndexingPolicyResource = new IndexingPolicy(
                        true,
                        IndexingMode.Consistent,
                        new List<IncludedPath>
                        {
                            new IncludedPath { Path = "/*"}
                        },
                        new List<ExcludedPath>
                        {
                            new ExcludedPath { Path = "/pathToNotIndex/*"}
                        },
                        new List<IList<CompositePath>>
                        {
                            new List<CompositePath>
                            {
                                new CompositePath { Path = "/orderByPath1", Order = CompositePathSortOrder.Ascending },
                                new CompositePath { Path = "/orderByPath2", Order = CompositePathSortOrder.Descending }
                            }
                        },
                        new List<SpatialSpec>
                        {
                            new SpatialSpec
                            (
                                    "/*",
                                    new List<SpatialType>
                                    {
                                        new SpatialType("Point")
                                    }
                            ),
                        }
                    )
                },
                options: new CosmosDBCreateUpdateConfig
                {
                    Throughput = sampleThroughput1
                }
            );
            CosmosDBSqlContainerResource sqlContainer1 = await WaitForCompletionAsync(
                await CosmosDBManagementClient.SqlResources.StartCreateUpdateSqlContainerAsync(
                    resourceGroupName, databaseAccountName, databaseName, containerName, sqlContainerCreateUpdateParameters));
            Assert.NotNull(sqlContainer1);
            CosmosDBSqlContainerResource sqlContainer2 = await CosmosDBManagementClient.SqlResources.GetSqlContainerAsync(
                resourceGroupName, databaseAccountName, databaseName, containerName);
            Assert.NotNull(sqlContainer2);
            VerifySqlContainers(sqlContainer1, sqlContainer2);
            ThroughputSettingsData throughputSettings1 =
                await CosmosDBManagementClient.SqlResources.GetSqlContainerThroughputAsync(resourceGroupName, databaseAccountName, databaseName, containerName);
            Assert.NotNull(throughputSettings1);
            Assert.NotNull(throughputSettings1.Name);
            Assert.AreEqual(sqlContainersThroughputType, throughputSettings1.Type);
            Assert.AreEqual(sampleThroughput1, throughputSettings1.Resource.Throughput);

            sqlContainerCreateUpdateParameters = new SqlContainerCreateUpdateParameters(
                resource: new CosmosDBSqlContainerResource(containerName)
                {
                    PartitionKeyResource = new ContainerPartitionKey(new List<string> { "/address/zipCode" }, null, null)
                    {
                        Kind = new PartitionKind("Hash")
                    },
                    IndexingPolicyResource = new IndexingPolicy(
                        true,
                        IndexingMode.Consistent,
                        new List<IncludedPath>
                        {
                            new IncludedPath { Path = "/*"}
                        },
                        new List<ExcludedPath>
                        {
                            new ExcludedPath { Path = "/pathToNotIndex/*"}
                        },
                        new List<IList<CompositePath>>
                        {
                            new List<CompositePath>
                            {
                                new CompositePath { Path = "/orderByPath3", Order = CompositePathSortOrder.Ascending },
                                new CompositePath { Path = "/orderByPath4", Order = CompositePathSortOrder.Descending }
                            }
                        },
                        new List<SpatialSpec>
                        {
                            new SpatialSpec
                            (
                                    "/*",
                                    new List<SpatialType>
                                    {
                                        new SpatialType("Point")
                                    }
                            ),
                        }
                    )
                },
                options: new CosmosDBCreateUpdateConfig
                {
                    Throughput = sampleThroughput2
                }
            );
            CosmosDBSqlContainerResource sqlContainer3 = await WaitForCompletionAsync(
                await CosmosDBManagementClient.SqlResources.StartCreateUpdateSqlContainerAsync(
                    resourceGroupName, databaseAccountName, databaseName, containerName, sqlContainerCreateUpdateParameters));
            Assert.NotNull(sqlContainer3);
            CosmosDBSqlContainerResource sqlContainer4 = await CosmosDBManagementClient.SqlResources.GetSqlContainerAsync(
                resourceGroupName, databaseAccountName, databaseName, containerName);
            Assert.NotNull(sqlContainer4);
            VerifySqlContainers(sqlContainer3, sqlContainer4);
            ThroughputSettingsData throughputSettings2 =
                await CosmosDBManagementClient.SqlResources.GetSqlContainerThroughputAsync(resourceGroupName, databaseAccountName, databaseName, containerName);
            Assert.NotNull(throughputSettings2);
            Assert.NotNull(throughputSettings2.Name);
            Assert.AreEqual(sqlContainersThroughputType, throughputSettings2.Type);
            Assert.AreEqual(sampleThroughput2, throughputSettings2.Resource.Throughput);
        }

        [TestCase, Order(3)]
        public async Task SqlContainerListTest()
        {
            List<CosmosDBSqlContainerResource> sqlContainers = await CosmosDBManagementClient.SqlResources.ListSqlContainersAsync(
                resourceGroupName, databaseAccountName, databaseName).ToEnumerableAsync();
            Assert.NotNull(sqlContainers);
            Assert.AreEqual(1, sqlContainers.Count);
            CosmosDBSqlContainerResource sqlContainer = await CosmosDBManagementClient.SqlResources.GetSqlContainerAsync(
                resourceGroupName, databaseAccountName, databaseName, containerName);
            Assert.NotNull(sqlContainer);
            VerifySqlContainers(sqlContainer, sqlContainers[0]);
        }

        [TestCase, Order(3)]
        public async Task SqlContainerUpdateThroughputTest()
        {
            ThroughputSettingsData ThroughputSettingsData = await WaitForCompletionAsync(
                await CosmosDBManagementClient.SqlResources.StartUpdateSqlContainerThroughputAsync(
                    resourceGroupName,
                    databaseAccountName,
                    databaseName,
                    containerName,
                    new ThroughputSettingsUpdateParameters(new ThroughputSettingsResource(sampleThroughput2, null, null, null))));
            Assert.NotNull(throughputSettings);
            Assert.NotNull(throughputSettings.Name);
            Assert.AreEqual(sqlContainersThroughputType, throughputSettings.Type);
            Assert.AreEqual(sampleThroughput2, throughputSettings.Resource.Throughput);
        }

        [TestCase, Order(4)]
        public async Task SqlContainerMigrateToAutoscaleTest()
        {
            ThroughputSettingsData ThroughputSettingsData = await WaitForCompletionAsync(
                await CosmosDBManagementClient.SqlResources.StartMigrateSqlContainerToAutoscaleAsync(
                    resourceGroupName, databaseAccountName, databaseName, containerName));
            Assert.NotNull(throughputSettings);
            Assert.NotNull(throughputSettings.Resource.AutoscaleSettings);
            Assert.AreEqual(defaultMaxThroughput, throughputSettings.Resource.AutoscaleSettings.MaxThroughput);
            Assert.AreEqual(defaultThroughput, throughputSettings.Resource.Throughput);
        }

        [TestCase, Order(5)]
        public async Task SqlContainerMigrateToManualThroughputTest()
        {
            ThroughputSettingsData ThroughputSettingsData = await WaitForCompletionAsync(
                await CosmosDBManagementClient.SqlResources.StartMigrateSqlContainerToManualThroughputAsync(
                    resourceGroupName, databaseAccountName, databaseName, containerName));
            Assert.NotNull(throughputSettings);
            Assert.IsNull(throughputSettings.Resource.AutoscaleSettings);
            Assert.AreEqual(defaultMaxThroughput, throughputSettings.Resource.Throughput);
        }

        [TestCase, Order(3)]
        public async Task SqlStoredProcedureCreateAndUpdateTest()
        {
            SqlStoredProcedureCreateUpdateParameters sqlStoredProcedureCreateUpdateParameters = new SqlStoredProcedureCreateUpdateParameters(
                new SqlStoredProcedureResource(storedProcedureName)
                {
                    Body = "function () { var updatetext = getContext(); " +
                            "var response = context.getResponse();" +
                            "response.setBody('First Hello World');" +
                            "}"
                },
                new CosmosDBCreateUpdateConfig()
            );
            ;
            SqlStoredProcedureResource sqlStoredProcedure1 = await WaitForCompletionAsync(
                await CosmosDBManagementClient.SqlResources.StartCreateUpdateSqlStoredProcedureAsync(
                    resourceGroupName, databaseAccountName, databaseName, containerName, storedProcedureName, sqlStoredProcedureCreateUpdateParameters));
            Assert.NotNull(sqlStoredProcedure1);
            SqlStoredProcedureResource sqlStoredProcedure2 = await CosmosDBManagementClient.SqlResources.GetSqlStoredProcedureAsync(
                resourceGroupName, databaseAccountName, databaseName, containerName, storedProcedureName);
            Assert.NotNull(sqlStoredProcedure2);
            VerifySqlStoredProcedures(sqlStoredProcedure1, sqlStoredProcedure2);

            sqlStoredProcedureCreateUpdateParameters = new SqlStoredProcedureCreateUpdateParameters(
                new SqlStoredProcedureResource(storedProcedureName)
                {
                    Body = "function () { var updatetext = getContext(); " +
                            "var response = context.getResponse();" +
                            "response.setBody('Second Hello World');" +
                            "}"
                },
                new CosmosDBCreateUpdateConfig()
            );
            SqlStoredProcedureResource sqlStoredProcedure3 = await WaitForCompletionAsync(
                await CosmosDBManagementClient.SqlResources.StartCreateUpdateSqlStoredProcedureAsync(
                    resourceGroupName, databaseAccountName, databaseName, containerName, storedProcedureName, sqlStoredProcedureCreateUpdateParameters));
            Assert.NotNull(sqlStoredProcedure3);
            SqlStoredProcedureResource sqlStoredProcedure4 = await CosmosDBManagementClient.SqlResources.GetSqlStoredProcedureAsync(
                resourceGroupName, databaseAccountName, databaseName, containerName, storedProcedureName);
            Assert.NotNull(sqlStoredProcedure4);
            VerifySqlStoredProcedures(sqlStoredProcedure3, sqlStoredProcedure4);
        }

        [TestCase, Order(4)]
        public async Task SqlStoredProcedureListTest()
        {
            List<SqlStoredProcedureResource> sqlStoredProcedures = await CosmosDBManagementClient.SqlResources.ListSqlStoredProceduresAsync(
                resourceGroupName, databaseAccountName, databaseName, containerName).ToEnumerableAsync();
            Assert.NotNull(sqlStoredProcedures);
            Assert.AreEqual(1, sqlStoredProcedures.Count);
            SqlStoredProcedureResource sqlStoredProcedure = await CosmosDBManagementClient.SqlResources.GetSqlStoredProcedureAsync(
                resourceGroupName, databaseAccountName, databaseName, containerName, storedProcedureName);
            Assert.NotNull(sqlStoredProcedure);
            VerifySqlStoredProcedures(sqlStoredProcedure, sqlStoredProcedures[0]);
        }

        [TestCase, Order(3)]
        public async Task SqlUserDefinedFunctionCreateAndUpdateTest()
        {
            SqlUserDefinedFunctionCreateUpdateParameters sqlUserDefinedFunctionCreateUpdateParameters = new SqlUserDefinedFunctionCreateUpdateParameters(
                resource: new SqlUserDefinedFunctionResource(userDefinedFunctionName)
                {
                    Body = "function () { var updatetext = getContext(); " +
                            "var response = context.getResponse();" +
                            "response.setBody('First Hello World');" +
                            "}"
                },
                options: new CosmosDBCreateUpdateConfig()
            );
            SqlUserDefinedFunctionResource sqlUserDefinedFunction1 = await WaitForCompletionAsync(
                await CosmosDBManagementClient.SqlResources.StartCreateUpdateSqlUserDefinedFunctionAsync(
                    resourceGroupName, databaseAccountName, databaseName, containerName, userDefinedFunctionName, sqlUserDefinedFunctionCreateUpdateParameters));
            Assert.NotNull(sqlUserDefinedFunction1);
            SqlUserDefinedFunctionResource sqlUserDefinedFunction2 = await CosmosDBManagementClient.SqlResources.GetSqlUserDefinedFunctionAsync(
                resourceGroupName, databaseAccountName, databaseName, containerName, userDefinedFunctionName);
            Assert.NotNull(sqlUserDefinedFunction2);
            VerifySqlUserDefinedFunctions(sqlUserDefinedFunction1, sqlUserDefinedFunction2);

            sqlUserDefinedFunctionCreateUpdateParameters = new SqlUserDefinedFunctionCreateUpdateParameters(
                resource: new SqlUserDefinedFunctionResource(userDefinedFunctionName)
                {
                    Body = "function () { var updatetext = getContext(); " +
                            "var response = context.getResponse();" +
                            "response.setBody('Second Hello World');" +
                            "}"
                },
                options: new CosmosDBCreateUpdateConfig()
            );
            SqlUserDefinedFunctionResource sqlUserDefinedFunction3 = await WaitForCompletionAsync(
                await CosmosDBManagementClient.SqlResources.StartCreateUpdateSqlUserDefinedFunctionAsync(
                    resourceGroupName, databaseAccountName, databaseName, containerName, userDefinedFunctionName, sqlUserDefinedFunctionCreateUpdateParameters));
            Assert.NotNull(sqlUserDefinedFunction3);
            SqlUserDefinedFunctionResource sqlUserDefinedFunction4 = await CosmosDBManagementClient.SqlResources.GetSqlUserDefinedFunctionAsync(
                resourceGroupName, databaseAccountName, databaseName, containerName, userDefinedFunctionName);
            Assert.NotNull(sqlUserDefinedFunction4);
            VerifySqlUserDefinedFunctions(sqlUserDefinedFunction3, sqlUserDefinedFunction4);
        }

        [TestCase, Order(4)]
        public async Task SqlUserDefinedFunctionListTest()
        {
            List<SqlUserDefinedFunctionResource> sqlUserDefinedFunctions = await CosmosDBManagementClient.SqlResources.ListSqlUserDefinedFunctionsAsync(
                resourceGroupName, databaseAccountName, databaseName, containerName).ToEnumerableAsync();
            Assert.NotNull(sqlUserDefinedFunctions);
            Assert.AreEqual(1, sqlUserDefinedFunctions.Count);
            SqlUserDefinedFunctionResource sqlUserDefinedFunction = await CosmosDBManagementClient.SqlResources.GetSqlUserDefinedFunctionAsync(
                resourceGroupName, databaseAccountName, databaseName, containerName, userDefinedFunctionName);
            VerifySqlUserDefinedFunctions(sqlUserDefinedFunction, sqlUserDefinedFunctions[0]);
        }

        [TestCase, Order(3)]
        public async Task SqlTriggerCreateAndUpdateTest()
        {
            SqlTriggerCreateUpdateParameters sqlTriggerCreateUpdateParameters = new SqlTriggerCreateUpdateParameters(
                resource: new CosmosDBSqlTriggerResource(triggerName)
                {
                    TriggerOperation = "All",
                    TriggerType = "Pre",
                    Body = "function () { var context = getContext(); " +
                            "var response = context.getResponse();" +
                            "response.setBody('First Hello World');" +
                            "}"
                },
                options: new CosmosDBCreateUpdateConfig()
            );
            CosmosDBSqlTriggerResource sqlTrigger1 = await WaitForCompletionAsync(
                await CosmosDBManagementClient.SqlResources.StartCreateUpdateSqlTriggerAsync(
                    resourceGroupName, databaseAccountName, databaseName, containerName, triggerName, sqlTriggerCreateUpdateParameters));
            Assert.NotNull(sqlTrigger1);
            CosmosDBSqlTriggerResource sqlTrigger2 = await CosmosDBManagementClient.SqlResources.GetSqlTriggerAsync(
                resourceGroupName, databaseAccountName, databaseName, containerName, triggerName);
            Assert.NotNull(sqlTrigger2);
            VerifySqlTriggers(sqlTrigger1, sqlTrigger2);

            sqlTriggerCreateUpdateParameters = new SqlTriggerCreateUpdateParameters(
                resource: new CosmosDBSqlTriggerResource(triggerName)
                {
                    TriggerOperation = "All",
                    TriggerType = "Post",
                    Body = "function () { var context = getContext(); " +
                            "var response = context.getResponse();" +
                            "response.setBody('Second Hello World');" +
                            "}"
                },
                options: new CosmosDBCreateUpdateConfig()
            );
            CosmosDBSqlTriggerResource sqlTrigger3 = await WaitForCompletionAsync(
                await CosmosDBManagementClient.SqlResources.StartCreateUpdateSqlTriggerAsync(
                    resourceGroupName, databaseAccountName, databaseName, containerName, triggerName, sqlTriggerCreateUpdateParameters));
            Assert.NotNull(sqlTrigger3);
            CosmosDBSqlTriggerResource sqlTrigger4 = await CosmosDBManagementClient.SqlResources.GetSqlTriggerAsync(
                resourceGroupName, databaseAccountName, databaseName, containerName, triggerName);
            Assert.NotNull(sqlTrigger4);
            VerifySqlTriggers(sqlTrigger3, sqlTrigger4);
        }

        [TestCase, Order(4)]
        public async Task SqlTriggerListTest()
        {
            List<CosmosDBSqlTriggerResource> sqlTriggers = await CosmosDBManagementClient.SqlResources.ListSqlTriggersAsync(
                resourceGroupName, databaseAccountName, databaseName, containerName).ToEnumerableAsync();
            Assert.NotNull(sqlTriggers);
            Assert.AreEqual(1, sqlTriggers.Count);
            CosmosDBSqlTriggerResource sqlTrigger = await CosmosDBManagementClient.SqlResources.GetSqlTriggerAsync(
                resourceGroupName, databaseAccountName, databaseName, containerName, triggerName);
            VerifySqlTriggers(sqlTrigger, sqlTriggers[0]);
        }

        [TestCase, Order(5)]
        public async Task SqlDeleteTests()
        {
            await WaitForCompletionAsync(
                await CosmosDBManagementClient.SqlResources.StartDeleteSqlTriggerAsync(resourceGroupName, databaseAccountName, databaseName, containerName, triggerName));
            List<CosmosDBSqlTriggerResource> sqlTriggers = await CosmosDBManagementClient.SqlResources.ListSqlTriggersAsync(
                resourceGroupName, databaseAccountName, databaseName, containerName).ToEnumerableAsync();
            Assert.NotNull(sqlTriggers);
            Assert.AreEqual(0, sqlTriggers.Count);

            await WaitForCompletionAsync(
                await CosmosDBManagementClient.SqlResources.StartDeleteSqlUserDefinedFunctionAsync(
                    resourceGroupName, databaseAccountName, databaseName, containerName, userDefinedFunctionName));
            List<SqlUserDefinedFunctionResource> sqlUserDefinedFunctions = await CosmosDBManagementClient.SqlResources.ListSqlUserDefinedFunctionsAsync(
                resourceGroupName, databaseAccountName, databaseName, containerName).ToEnumerableAsync();
            Assert.NotNull(sqlUserDefinedFunctions);
            Assert.AreEqual(0, sqlUserDefinedFunctions.Count);

            await WaitForCompletionAsync(
                await CosmosDBManagementClient.SqlResources.StartDeleteSqlStoredProcedureAsync(
                    resourceGroupName, databaseAccountName, databaseName, containerName, storedProcedureName));
            List<SqlStoredProcedureResource> sqlStoredProcedures = await CosmosDBManagementClient.SqlResources.ListSqlStoredProceduresAsync(
                resourceGroupName, databaseAccountName, databaseName, containerName).ToEnumerableAsync();
            Assert.NotNull(sqlStoredProcedures);
            Assert.AreEqual(0, sqlStoredProcedures.Count);

            await WaitForCompletionAsync(
                await CosmosDBManagementClient.SqlResources.StartDeleteSqlContainerAsync(resourceGroupName, databaseAccountName, databaseName, containerName));
            List<CosmosDBSqlContainerResource> sqlContainers = await CosmosDBManagementClient.SqlResources.ListSqlContainersAsync(
                resourceGroupName, databaseAccountName, databaseName).ToEnumerableAsync();
            Assert.NotNull(sqlContainers);
            Assert.AreEqual(0, sqlContainers.Count);

            await WaitForCompletionAsync(
                await CosmosDBManagementClient.SqlResources.StartDeleteSqlDatabaseAsync(resourceGroupName, databaseAccountName, databaseName));
            List<CosmosDBSqlDatabaseResource> sqlDatabases = await CosmosDBManagementClient.SqlResources.ListSqlDatabasesAsync(
                resourceGroupName, databaseAccountName).ToEnumerableAsync();
            Assert.NotNull(sqlDatabases);
            Assert.AreEqual(0, sqlDatabases.Count);
        }

        private async Task PrepareDatabaseAccount()
        {
            var locations = new List<Location>()
            {
                {
                    new Location(
                        id:default(string),
                        locationName: location,
                        documentEndpoint:default(string),
                        provisioningState: default(string),
                        failoverPriority: default(int?),
                        isZoneRedundant: default(bool?))
                }
            };
            DatabaseAccountCreateUpdateParameters databaseAccountCreateUpdateParameters = new DatabaseAccountCreateUpdateParameters(locations)
            {
                Location = location,
                Kind = DatabaseAccountKind.GlobalDocumentDB,
            };
            CosmosDBAccountResource databaseAccount = await WaitForCompletionAsync(
                await CosmosDBManagementClient.DatabaseAccounts.StartCreateOrUpdateAsync(resourceGroupName, databaseAccountName, databaseAccountCreateUpdateParameters));
            Assert.AreEqual(databaseAccount.Name, databaseAccountName);
            var isDatabaseNameExists = await CosmosDBManagementClient.DatabaseAccounts.CheckNameExistsAsync(databaseAccountName);
            Assert.AreEqual(true, isDatabaseNameExists.Value);
            Assert.AreEqual(200, isDatabaseNameExists.GetRawResponse().Status);
        }

        private void VerifySqlContainers(CosmosDBSqlContainerResource expectedValue, CosmosDBSqlContainerResource actualValue)
        {
            Assert.AreEqual(expectedValue.Id, actualValue.Id);
            Assert.AreEqual(expectedValue.Name, actualValue.Name);
            Assert.AreEqual(expectedValue.Resource.Id, actualValue.Resource.Id);
            Assert.AreEqual(expectedValue.Resource.IndexingPolicy.IndexingMode, actualValue.Resource.IndexingPolicy.IndexingMode);
            Assert.AreEqual(expectedValue.Resource.PartitionKey.Kind, actualValue.Resource.PartitionKey.Kind);
            Assert.AreEqual(expectedValue.Resource.PartitionKey.Paths, actualValue.Resource.PartitionKey.Paths);
            Assert.AreEqual(expectedValue.Resource.DefaultTtl, actualValue.Resource.DefaultTtl);
        }

        private void VerifySqlDatabases(CosmosDBSqlDatabaseResource expectedValue, CosmosDBSqlDatabaseResource actualValue)
        {
            Assert.AreEqual(expectedValue.Id, actualValue.Id);
            Assert.AreEqual(expectedValue.Name, actualValue.Name);
            Assert.AreEqual(expectedValue.Resource.Id, actualValue.Resource.Id);
            Assert.AreEqual(expectedValue.Resource.Rid, actualValue.Resource.Rid);
            Assert.AreEqual(expectedValue.Resource.Timestamp, actualValue.Resource.Timestamp);
            Assert.AreEqual(expectedValue.Resource.ETag, actualValue.Resource.ETag);
            Assert.AreEqual(expectedValue.Resource.Colls, actualValue.Resource.Colls);
            Assert.AreEqual(expectedValue.Resource.Users, actualValue.Resource.Users);
        }

        private void VerifySqlStoredProcedures(SqlStoredProcedureResource expectedValue, SqlStoredProcedureResource actualValue)
        {
            Assert.AreEqual(expectedValue.Id, actualValue.Id);
            Assert.AreEqual(expectedValue.Name, actualValue.Name);
            Assert.AreEqual(expectedValue.Resource.Id, actualValue.Resource.Id);
            Assert.AreEqual(expectedValue.Resource.Rid, actualValue.Resource.Rid);
            Assert.AreEqual(expectedValue.Resource.Timestamp, actualValue.Resource.Timestamp);
            Assert.AreEqual(expectedValue.Resource.ETag, actualValue.Resource.ETag);
            Assert.AreEqual(expectedValue.Resource.Body, actualValue.Resource.Body);
        }

        private void VerifySqlTriggers(CosmosDBSqlTriggerResource expectedValue, CosmosDBSqlTriggerResource actualValue)
        {
            Assert.AreEqual(expectedValue.Id, actualValue.Id);
            Assert.AreEqual(expectedValue.Name, actualValue.Name);
            Assert.AreEqual(expectedValue.Resource.Id, actualValue.Resource.Id);
            Assert.AreEqual(expectedValue.Resource.Rid, actualValue.Resource.Rid);
            Assert.AreEqual(expectedValue.Resource.Timestamp, actualValue.Resource.Timestamp);
            Assert.AreEqual(expectedValue.Resource.ETag, actualValue.Resource.ETag);
            Assert.AreEqual(expectedValue.Resource.Body, actualValue.Resource.Body);
            Assert.AreEqual(expectedValue.Resource.TriggerType, actualValue.Resource.TriggerType);
            Assert.AreEqual(expectedValue.Resource.TriggerOperation, actualValue.Resource.TriggerOperation);
        }

        private void VerifySqlUserDefinedFunctions(SqlUserDefinedFunctionResource expectedValue, SqlUserDefinedFunctionResource actualValue)
        {
            Assert.AreEqual(expectedValue.Id, actualValue.Id);
            Assert.AreEqual(expectedValue.Name, actualValue.Name);
            Assert.AreEqual(expectedValue.Resource.Id, actualValue.Resource.Id);
            Assert.AreEqual(expectedValue.Resource.Rid, actualValue.Resource.Rid);
            Assert.AreEqual(expectedValue.Resource.Timestamp, actualValue.Resource.Timestamp);
            Assert.AreEqual(expectedValue.Resource.ETag, actualValue.Resource.ETag);
            Assert.AreEqual(expectedValue.Resource.Body, actualValue.Resource.Body);
        }
    }
}
#endif

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="utf-8"?><!--
  ~ Copyright 2018 Coinbase, Inc.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginLeft="16dp"
    android:layout_marginRight="16dp"
    android:orientation="vertical">

    <TextView
        android:id="@+id/info"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginBottom="8dp"
        android:layout_marginTop="8dp"
        android:gravity="center"
        android:padding="4dp"
        android:text="@string/authorization_information"
        android:textAppearance="@style/TextAppearance.AppCompat.Medium"
        app:layout_constraintBottom_toTopOf="@+id/progressBar"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <ProgressBar
        android:id="@+id/progressBar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_margin="16dp"
        android:layout_marginTop="8dp"
        app:layout_constraintVertical_bias="0.75"
        android:visibility="invisible"
        app:layout_constraintBottom_toTopOf="@+id/signUpButton"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        tools:visibility="visible" />

    <Button
        android:id="@+id/signUpButton"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginEnd="16dp"
        android:layout_marginStart="16dp"
        android:text="@string/sign_up"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.75" />

    <Button
        android:id="@+id/loginCustomTabButton"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginEnd="16dp"
        android:layout_marginStart="16dp"
        android:layout_marginTop="8dp"
        android:text="@string/login_with_chrome_tab"
        app:layout_constraintTop_toBottomOf="@id/signUpButton" />

</android.support.constraint.ConstraintLayout>


text:
"use strict";

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.rebuild = exports.installOrRebuild = undefined;

var _bluebirdLst;

function _load_bluebirdLst() {
    return _bluebirdLst = require("bluebird-lst");
}

var _bluebirdLst2;

function _load_bluebirdLst2() {
    return _bluebirdLst2 = _interopRequireDefault(require("bluebird-lst"));
}

/** @internal */
let installOrRebuild = exports.installOrRebuild = (() => {
    var _ref = (0, (_bluebirdLst || _load_bluebirdLst()).coroutine)(function* (config, appDir, options) {
        let forceInstall = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

        const effectiveOptions = Object.assign({ buildFromSource: config.buildDependenciesFromSource === true, additionalArgs: (0, (_builderUtil || _load_builderUtil()).asArray)(config.npmArgs) }, options);
        if (forceInstall || !(yield (0, (_fs || _load_fs()).exists)(_path.join(appDir, "node_modules")))) {
            yield installDependencies(appDir, effectiveOptions);
        } else {
            yield rebuild(appDir, effectiveOptions);
        }
    });

    return function installOrRebuild(_x, _x2, _x3) {
        return _ref.apply(this, arguments);
    };
})();

/** @internal */
let rebuild = exports.rebuild = (() => {
    var _ref2 = (0, (_bluebirdLst || _load_bluebirdLst()).coroutine)(function* (appDir, options) {
        const nativeDeps = yield (_bluebirdLst2 || _load_bluebirdLst2()).default.filter((yield options.productionDeps.value), function (it) {
            return (0, (_fs || _load_fs()).exists)(_path.join(it.path, "binding.gyp"));
        }, { concurrency: 8 });
        if (nativeDeps.length === 0) {
            (0, (_builderUtil || _load_builderUtil()).log)(`No native production dependencies`);
            return;
        }
        const platform = options.platform || process.platform;
        const arch = options.arch || process.arch;
        const additionalArgs = options.additionalArgs;
        (0, (_builderUtil || _load_builderUtil()).log)(`Rebuilding native production dependencies for ${platform}:${arch}`);
        let execPath = process.env.npm_execpath || process.env.NPM_CLI_JS;
        const isYarn = isYarnPath(execPath);
        const execArgs = [];
        if (execPath == null) {
            execPath = getPackageToolPath();
        } else {
            execArgs.push(execPath);
            execPath = process.env.npm_node_execpath || process.env.NODE_EXE || "node";
        }
        const env = getGypEnv(options.frameworkInfo, platform, arch, options.buildFromSource === true);
        if (isYarn) {
            execArgs.push("run", "install", "--");
            if (additionalArgs != null) {
                execArgs.push.apply(execArgs, _toConsumableArray(additionalArgs));
            }
            yield (_bluebirdLst2 || _load_bluebirdLst2()).default.map(nativeDeps, function (dep) {
                (0, (_builderUtil || _load_builderUtil()).log)(`Rebuilding native dependency ${dep.name}`);
                return (0, (_builderUtil || _load_builderUtil()).spawn)(execPath, execArgs, {
                    cwd: dep.path,
                    env
                }).catch(function (error) {
                    if (dep.optional) {
                        (0, (_builderUtil || _load_builderUtil()).warn)(`Cannot build optional native dep ${dep.name}`);
                    } else {
                        throw error;
                    }
                });
            }, { concurrency: process.platform === "win32" ? 1 : 2 });
        } else {
            execArgs.push("rebuild");
            if (additionalArgs != null) {
                execArgs.push.apply(execArgs, _toConsumableArray(additionalArgs));
            }
            execArgs.push.apply(execArgs, _toConsumableArray(nativeDeps.map(function (it) {
                return `${it.name}@${it.version}`;
            })));
            yield (0, (_builderUtil || _load_builderUtil()).spawn)(execPath, execArgs, {
                cwd: appDir,
                env
            });
        }
    });

    return function rebuild(_x5, _x6) {
        return _ref2.apply(this, arguments);
    };
})();
//# sourceMappingURL=yarn.js.map

exports.getGypEnv = getGypEnv;

var _builderUtil;

function _load_builderUtil() {
    return _builderUtil = require("builder-util");
}

var _fs;

function _load_fs() {
    return _fs = require("builder-util/out/fs");
}

var _os;

function _load_os() {
    return _os = require("os");
}

var _path = _interopRequireWildcard(require("path"));

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }

function getElectronGypCacheDir() {
    return _path.join((0, (_os || _load_os()).homedir)(), ".electron-gyp");
}
/** @internal */
function getGypEnv(frameworkInfo, platform, arch, buildFromSource) {
    if (!frameworkInfo.useCustomDist) {
        return Object.assign({}, process.env, { npm_config_arch: arch, npm_config_target_arch: arch, npm_config_platform: platform, npm_config_build_from_source: buildFromSource });
    }
    // https://github.com/nodejs/node-gyp/issues/21
    return Object.assign({}, process.env, { npm_config_disturl: "https://atom.io/download/electron", npm_config_target: frameworkInfo.version, npm_config_runtime: "electron", npm_config_arch: arch, npm_config_target_arch: arch, npm_config_platform: platform,
        // required for node-pre-gyp
        npm_config_target_platform: platform, npm_config_fallback_to_build: true, npm_config_build_from_source: buildFromSource, npm_config_devdir: getElectronGypCacheDir() });
}
function installDependencies(appDir, options) {
    const platform = options.platform || process.platform;
    const arch = options.arch || process.arch;
    const additionalArgs = options.additionalArgs;
    (0, (_builderUtil || _load_builderUtil()).log)(`Installing app dependencies for ${platform}:${arch} to ${appDir}`);
    let execPath = process.env.npm_execpath || process.env.NPM_CLI_JS;
    const execArgs = ["install", "--production"];
    if (!isYarnPath(execPath)) {
        if (process.env.NPM_NO_BIN_LINKS === "true") {
            execArgs.push("--no-bin-links");
        }
        execArgs.push("--cache-min", "999999999");
    }
    if (execPath == null) {
        execPath = getPackageToolPath();
    } else {
        execArgs.unshift(execPath);
        execPath = process.env.npm_node_execpath || process.env.NODE_EXE || "node";
    }
    if (additionalArgs != null) {
        execArgs.push.apply(execArgs, _toConsumableArray(additionalArgs));
    }
    return (0, (_builderUtil || _load_builderUtil()).spawn)(execPath, execArgs, {
        cwd: appDir,
        env: getGypEnv(options.frameworkInfo, platform, arch, options.buildFromSource === true)
    });
}
function getPackageToolPath() {
    if (process.env.FORCE_YARN === "true") {
        return process.platform === "win32" ? "yarn.cmd" : "yarn";
    } else {
        return process.platform === "win32" ? "npm.cmd" : "npm";
    }
}
function isYarnPath(execPath) {
    return process.env.FORCE_YARN === "true" || execPath != null && _path.basename(execPath).startsWith("yarn");
}


text:
require.config({
    baseUrl: "https://raw.github.com/adamjmoon/ToDoApp/master/assets/javascripts/",
    paths: {
        'text': 'vendor/requirejs-text/text',
        'plugins': 'durandal/plugins',
        'transitions': 'durandal/transitions'
        'app': 'app'
    }
});
require(['https://raw.github.com/adamjmoon/ToDoApp/master/assets/javascripts/app.js'], function () {
        "use strict";

        define('knockout', function () {
            return window.ko
        });
        define('jquery', function () {
            return window.$
        });

        require(['durandal/app', 'durandal/viewLocator', 'durandal/system', 'localStorage', 'OT'], function (app, viewLocator, system, LocalStorage, OT) {

            OT.DataService = new LocalStorage();
            //>>excludeStart("build", true);
            system.debug(true);
            //>>excludeEnd("build");

            app.title = 'Todo Durandal';

            app.configurePlugins({
                router: true
            });

            app.start().then(function () {
                //Replace 'viewmodels' in the moduleId with 'views' to locate the view.
                //Look for partial views in a 'views' folder in the root.
                viewLocator.useConvention();

                //Show the app by setting the root view model for our application with a transition.

                app.setRoot('viewmodels/shell');
            });
        });

    }
);


text:
package com.openthinks.webscheduler.task.custom;

import java.util.Enumeration;
import java.util.Optional;

import com.openthinks.libs.utilities.logger.ProcessLogger;
import com.openthinks.webscheduler.model.TaskRunTimeData;
import com.openthinks.webscheduler.task.CustomTaskDefinition;
import com.openthinks.webscheduler.task.TaskContext;

/**
 * @author dailey.yet@outlook.com
 *
 */
public class EchoCustomTask implements CustomTaskDefinition {

	@Override
	public void execute(TaskContext context) {
		ProcessLogger.debug(getClass() + " start...");
		Optional<TaskRunTimeData> optional = getTaskRunTimeData(context);
		if (optional.isPresent()) {
			TaskRunTimeData taskRunTimeData = optional.get();
			if (taskRunTimeData.getTaskRefContent() == null || taskRunTimeData.getTaskRefContent().trim().length() == 0) {
				for (int i = 0; i <= 100; i++) {
					echo("Hello World(" + i + ")");
					sleep();
				}
			} else {
				taskRunTimeData.preparedTaskRef();
				Enumeration<?> enumeration = taskRunTimeData.getTaskRef().propertyNames();
				while (enumeration.hasMoreElements()) {
					String propertyName = (String) enumeration.nextElement();
					if ("exception".equalsIgnoreCase(propertyName)) {
						Optional<String> optional2 = taskRunTimeData.getTaskRef().getProp(propertyName);
						if (optional2.isPresent() && "true".equalsIgnoreCase(optional2.get())) {
							throw new IllegalArgumentException("This is illegal parameter configure items.");
						}
					}
					echo(propertyName + "=" + taskRunTimeData.getTaskRef().getProp(propertyName));
					sleep();
				}
			}
		}
		ProcessLogger.debug(getClass() + " finished");
	}

	protected void echo(String string) {
		ProcessLogger.info(string);

	}

	protected void sleep() {
		try {
			Thread.sleep(1000);
		} catch (InterruptedException e) {

		}
	}

}


text:
module Concurrent

  describe ReadWriteLock do

    context '#write_locked?' do

      it 'returns true when the write lock is held' do
        latch_1 = Concurrent::CountDownLatch.new(1)
        latch_2 = Concurrent::CountDownLatch.new(1)

        thread = Thread.new do
          subject.with_write_lock do
            latch_1.count_down
            latch_2.wait(1)
          end
        end

        latch_1.wait(1)
        expect(subject).to be_write_locked
        latch_2.count_down
        thread.join
      end

      it 'returns false when the write lock is not held' do
        expect(subject).to_not be_write_locked
      end

      it 'returns false when the write lock is not held but there are readers' do
        latch = Concurrent::CountDownLatch.new(1)

        thread = Thread.new do
          subject.with_read_lock do
            latch.wait(1)
          end
        end

        expect(subject).to_not be_write_locked
        latch.count_down
        thread.join
      end
    end

    context '#has_waiters?' do

      it 'returns false when no locks are held' do
        expect(subject).to_not have_waiters
      end

      it 'returns false when there are readers but no writers' do
        latch = Concurrent::CountDownLatch.new(1)

        thread = Thread.new do
          subject.with_read_lock do
            latch.wait(1)
          end
        end

        expect(subject).to_not have_waiters
        latch.count_down
        thread.join
      end

      it 'returns true when the write lock is held and there are waiting readers' do
        latch_1 = Concurrent::CountDownLatch.new(1)
        latch_2 = Concurrent::CountDownLatch.new(1)
        latch_3 = Concurrent::CountDownLatch.new(1)

        thread_1 = Thread.new do
          latch_1.wait(1)
          subject.acquire_write_lock
          latch_2.count_down
          latch_3.wait(1)
          subject.release_write_lock
        end

        thread_2 = Thread.new do
          latch_2.wait(1)
          subject.acquire_read_lock
          subject.release_read_lock
        end

        latch_1.count_down
        latch_2.wait(1)

        expect(subject).to have_waiters

        latch_3.count_down
        [thread_1, thread_2].each(&:join)
      end

      it 'returns true when the write lock is held and there are waiting writers' do
        latch_1 = Concurrent::CountDownLatch.new(1)
        latch_2 = Concurrent::CountDownLatch.new(1)
        latch_3 = Concurrent::CountDownLatch.new(1)

        thread_1 = Thread.new do
          latch_1.wait(1)
          subject.acquire_write_lock
          latch_2.count_down
          latch_3.wait(1)
          subject.release_write_lock
        end

        thread_2 = Thread.new do
          latch_2.wait(1)
          subject.acquire_write_lock
          subject.release_write_lock
        end

        latch_1.count_down
        latch_2.wait(1)

        expect(subject).to have_waiters

        latch_3.count_down
        [thread_1, thread_2].each(&:join)
      end
    end

    context '#with_read_lock' do

      it 'acquires the lock' do
        expect(subject).to receive(:acquire_read_lock).with(no_args)
        subject.with_read_lock { nil }
      end

      it 'returns the value of the block operation' do
        expected = 100
        actual = subject.with_read_lock { expected }
        expect(actual).to eq expected
      end

      it 'releases the lock' do
        expect(subject).to receive(:release_read_lock).with(no_args)
        subject.with_read_lock { nil }
      end

      it 'raises an exception if no block is given' do
        expect {
          subject.with_read_lock
        }.to raise_error(ArgumentError)
      end

      it 'raises an exception if maximum lock limit is exceeded' do
        counter = Concurrent::AtomicFixnum.new(ReadWriteLock::MAX_READERS)
        allow(Concurrent::AtomicFixnum).to receive(:new).with(anything).and_return(counter)
        expect {
          subject.with_read_lock { nil }
        }.to raise_error(Concurrent::ResourceLimitError)
      end

      it 'releases the lock when an exception is raised' do
        expect(subject).to receive(:release_read_lock).with(any_args)
        begin
          subject.release_read_lock { raise StandardError }
        rescue
        end
      end
    end

    context '#with_write_lock' do

      it 'acquires the lock' do
        expect(subject).to receive(:acquire_write_lock).with(no_args)
        subject.with_write_lock { nil }
      end

      it 'returns the value of the block operation' do
        expected = 100
        actual = subject.with_write_lock { expected }
        expect(actual).to eq expected
      end

      it 'releases the lock' do
        expect(subject).to receive(:release_write_lock).with(no_args)
        subject.with_write_lock { nil }
      end

      it 'raises an exception if no block is given' do
        expect {
          subject.with_write_lock
        }.to raise_error(ArgumentError)
      end

      it 'raises an exception if maximum lock limit is exceeded' do
        counter = Concurrent::AtomicFixnum.new(ReadWriteLock::MAX_WRITERS)
        allow(Concurrent::AtomicFixnum).to receive(:new).with(anything).and_return(counter)
        expect {
          subject.with_write_lock { nil }
        }.to raise_error(Concurrent::ResourceLimitError)
      end

      it 'releases the lock when an exception is raised' do
        expect(subject).to receive(:release_write_lock).with(any_args)
        begin
          subject.with_write_lock { raise StandardError }
        rescue
        end
      end
    end

    context '#acquire_read_lock' do

      it 'increments the lock count' do
        counter = Concurrent::AtomicFixnum.new(0)
        allow(Concurrent::AtomicFixnum).to receive(:new).with(anything).and_return(counter)
        subject.acquire_read_lock
        expect(counter.value).to eq 1
      end

      it 'waits for a running writer to finish' do
        latch_1 = Concurrent::CountDownLatch.new(1)
        latch_2 = Concurrent::CountDownLatch.new(1)
        latch_3 = Concurrent::CountDownLatch.new(1)

        write_flag = Concurrent::AtomicBoolean.new(false)
        read_flag = Concurrent::AtomicBoolean.new(false)

        thread_1 = Thread.new do
          latch_1.wait(1)
          subject.acquire_write_lock
          latch_2.count_down
          latch_3.wait(1)
          write_flag.make_true
          subject.release_write_lock
        end

        thread_2 = Thread.new do
          latch_2.wait(1)
          expect(write_flag.value).to be false
          latch_3.count_down
          subject.acquire_read_lock
          expect(write_flag.value).to be true
          read_flag.make_true
          subject.release_read_lock
        end

        latch_1.count_down
        [thread_1, thread_2].each(&:join)

        expect(write_flag.value).to be true
        expect(read_flag.value).to be true
      end

      it 'does not wait for any running readers' do
        counter = Concurrent::AtomicFixnum.new(0)
        allow(Concurrent::AtomicFixnum).to receive(:new).with(anything).and_return(counter)

        latch_1 = Concurrent::CountDownLatch.new(1)
        latch_2 = Concurrent::CountDownLatch.new(1)
        latch_3 = Concurrent::CountDownLatch.new(1)

        read_flag_1 = Concurrent::AtomicBoolean.new(false)
        read_flag_2 = Concurrent::AtomicBoolean.new(false)

        thread_1 = Thread.new do
          latch_1.wait(1)
          subject.acquire_read_lock
          expect(counter.value).to eq 1
          latch_2.count_down
          latch_3.wait(1)
          read_flag_1.make_true
          subject.release_read_lock
        end

        thread_2 = Thread.new do
          latch_2.wait(1)
          expect(read_flag_1.value).to be false
          subject.acquire_read_lock
          expect(counter.value).to eq 2
          latch_3.count_down
          read_flag_2.make_true
          subject.release_read_lock
        end

        latch_1.count_down
        [thread_1, thread_2].each(&:join)

        expect(read_flag_1.value).to be true
        expect(read_flag_2.value).to be true
        expect(counter.value).to eq 0
      end

      it 'raises an exception if maximum lock limit is exceeded' do
        counter = Concurrent::AtomicFixnum.new(ReadWriteLock::MAX_WRITERS)
        allow(Concurrent::AtomicFixnum).to receive(:new).with(anything).and_return(counter)
        expect {
          subject.acquire_write_lock { nil }
        }.to raise_error(Concurrent::ResourceLimitError)
      end

      it 'returns true if the lock is acquired' do
        expect(subject.acquire_read_lock).to be true
      end
    end

    context '#release_read_lock' do

      it 'decrements the counter' do
        counter = Concurrent::AtomicFixnum.new(0)
        allow(Concurrent::AtomicFixnum).to receive(:new).with(anything).and_return(counter)
        subject.acquire_read_lock
        expect(counter.value).to eq 1
        subject.release_read_lock
        expect(counter.value).to eq 0
      end

      it 'unblocks waiting writers' do
        latch_1 = Concurrent::CountDownLatch.new(1)
        latch_2 = Concurrent::CountDownLatch.new(1)
        write_flag = Concurrent::AtomicBoolean.new(false)

        thread = Thread.new do
          latch_1.wait(1)
          latch_2.count_down
          subject.acquire_write_lock
          write_flag.make_true
          subject.release_write_lock
        end

        subject.acquire_read_lock
        latch_1.count_down
        latch_2.wait(1)
        expect(write_flag.value).to be false
        subject.release_read_lock
        thread.join
        expect(write_flag.value).to be true
      end

      it 'returns true if the lock is released' do
        subject.acquire_read_lock
        expect(subject.release_read_lock).to be true
      end

      it 'returns true if the lock was never set' do
        expect(subject.release_read_lock).to be true
      end
    end

    context '#acquire_write_lock' do

      it 'increments the lock count' do
        counter = Concurrent::AtomicFixnum.new(0)
        allow(Concurrent::AtomicFixnum).to receive(:new).with(anything).and_return(counter)
        subject.acquire_write_lock
        expect(counter.value).to be > 1
      end

      it 'waits for a running writer to finish' do
        latch_1 = Concurrent::CountDownLatch.new(1)
        latch_2 = Concurrent::CountDownLatch.new(1)
        latch_3 = Concurrent::CountDownLatch.new(1)

        write_flag_1 = Concurrent::AtomicBoolean.new(false)
        write_flag_2 = Concurrent::AtomicBoolean.new(false)

        thread_1 = Thread.new do
          latch_1.wait(1)
          subject.acquire_write_lock
          latch_2.count_down
          latch_3.wait(1)
          write_flag_1.make_true
          subject.release_write_lock
        end

        thread_2 = Thread.new do
          latch_2.wait(1)
          expect(write_flag_1.value).to be false
          latch_3.count_down
          subject.acquire_write_lock
          expect(write_flag_1.value).to be true
          write_flag_2.make_true
          subject.release_write_lock
        end

        latch_1.count_down
        [thread_1, thread_2].each(&:join)

        expect(write_flag_1.value).to be true
        expect(write_flag_2.value).to be true
      end

      it 'waits for a running reader to finish' do
        latch_1 = Concurrent::CountDownLatch.new(1)
        latch_2 = Concurrent::CountDownLatch.new(1)
        latch_3 = Concurrent::CountDownLatch.new(1)

        read_flag = Concurrent::AtomicBoolean.new(false)
        write_flag = Concurrent::AtomicBoolean.new(false)

        thread_1 = Thread.new do
          latch_1.wait(1)
          subject.acquire_read_lock
          latch_2.count_down
          latch_3.wait(1)
          read_flag.make_true
          subject.release_read_lock
        end

        thread_2 = Thread.new do
          latch_2.wait(1)
          expect(read_flag.value).to be false
          latch_3.count_down
          subject.acquire_write_lock
          expect(read_flag.value).to be true
          write_flag.make_true
          subject.release_write_lock
        end

        latch_1.count_down
        [thread_1, thread_2].each(&:join)

        expect(read_flag.value).to be true
        expect(write_flag.value).to be true
      end

      it 'raises an exception if maximum lock limit is exceeded' do
        counter = Concurrent::AtomicFixnum.new(ReadWriteLock::MAX_WRITERS)
        allow(Concurrent::AtomicFixnum).to receive(:new).with(anything).and_return(counter)
        expect {
          subject.acquire_write_lock { nil }
        }.to raise_error(Concurrent::ResourceLimitError)
      end

      it 'returns true if the lock is acquired' do
        expect(subject.acquire_write_lock).to be true
      end
    end

    context '#release_write_lock' do

      it 'decrements the counter' do
        counter = Concurrent::AtomicFixnum.new(0)
        allow(Concurrent::AtomicFixnum).to receive(:new).with(anything).and_return(counter)
        subject.acquire_write_lock
        expect(counter.value).to be > 1
        subject.release_write_lock
        expect(counter.value).to eq 0
      end

      it 'unblocks waiting readers' do
        latch_1 = Concurrent::CountDownLatch.new(1)
        latch_2 = Concurrent::CountDownLatch.new(1)
        read_flag = Concurrent::AtomicBoolean.new(false)

        thread = Thread.new do
          latch_1.wait(1)
          latch_2.count_down
          subject.acquire_read_lock
          read_flag.make_true
          subject.release_read_lock
        end

        subject.acquire_write_lock
        latch_1.count_down
        latch_2.wait(1)
        expect(read_flag.value).to be false
        subject.release_write_lock
        thread.join
        expect(read_flag.value).to be true
      end

      it 'unblocks waiting writers' do
        latch_1 = Concurrent::CountDownLatch.new(1)
        latch_2 = Concurrent::CountDownLatch.new(1)
        write_flag = Concurrent::AtomicBoolean.new(false)

        thread = Thread.new do
          latch_1.wait(1)
          latch_2.count_down
          subject.acquire_write_lock
          write_flag.make_true
          subject.release_write_lock
        end

        subject.acquire_write_lock
        latch_1.count_down
        latch_2.wait(1)
        expect(write_flag.value).to be false
        subject.release_write_lock
        thread.join
        expect(write_flag.value).to be true
      end

      it 'returns true if the lock is released' do
        subject.acquire_write_lock
        expect(subject.release_write_lock).to be true
      end

      it 'returns true if the lock was never set' do
        expect(subject.release_write_lock).to be true
      end
    end
  end
end


text:
from pygame import *
from random import *
from const import *
from Item import *
from PHD import *
import func

class Pill(Item):
	tWidth = 64
	def __init__(self, xy, texture):
		self.x, self.y = xy
		self.texture = texture.subsurface(randint(0,2)*64, randint(0,2)*64, 64, 64)
		self.bounds = Rect(GRIDX+GRATIO*self.x,GRIDY+GRATIO*self.y, 32, 64)
		self.digits = func.loadCFont("main.png", 20, 16, 36, size=1.8)

	def use(self, character):
		# Choose random affect and wether its positive or negative

		hasPHD = sum([1 if type(item) == PHD else 0 for item in character.items]) > 0
		self.stats = [0]*6
		self.stats[randint(0,5)] = 1 if randint(0,1) or hasPHD else -1

		return not self.pickedUp


text:
%% plotBelief
%
% This function plots the posterior (also known as belief) for the CBHT,
% where we have a {6 x time x axes} structure. The rows represent the six
% low-level behaviors of the CBHT, the columns represent the duration of
% the trial, and it is repeated across 6 dimensions for each of the six
% force axis elements for which it was computed.
%
% A different line is assigned to the probability of an llb. Six subplots
% are generated for each of the six axes.
%
% The automata Approach State is skipped since it does not contribute info.
%
% The plot is saved at the end in .png, .fig, and .eps formats.
%%
function plotBelief(Path,StratTypeFolder,FolderName,time,posterior,stateTimes)

%% Global Variables

    % Number of Forces Axes
    NumAxes = 6;

    % Global Indeces
    handle = zeros(NumAxes,1);

%% Plot the posterior probability for each of the llbs across the 3 automata states for the Fx axes

    for axes = 1:NumAxes
        handle(axes)=subplot(3,2,axes);
        plot( time, posterior(1,:,axes),'k',...     % FX - black
              time, posterior(2,:,axes),'g',...     % CT - green
              time, posterior(3,:,axes),'b',...     % PS - blue
              time, posterior(4,:,axes),'c',...     % PL - cyan
              time, posterior(5,:,axes),'g',...     % SH - magenta
              time, posterior(6,:,axes),'r');       % AL - red

        % Labels
        title('Belief in Corresponding LLBs');
        xlabel('Time (secs)');
        ylabel('Posterior Probability');

        % Axis adjustment
        Max = 1.1; % Probability can be 1.0 max.
        Min = 0.0;
        axis([time(1) time(end) Min Max])

        % Insert State lines
        FillFlag = 0;   % For this plot eliminate the Approch state
        insertStates(stateTimes,Max,Min,FillFlag)
    end

    % Print a single legend. It will be associated with the last subplot:
    [legend_h,object_h,plot_h,text_strings]=legend('FX','CT','PS','PL','SH','AL','Orientation','horizontal');

    % Get the legend's position
    lg = get(legend_h,'Position'); % 4 position vector ([left bottom width height])

    % Establish the new coordinates for left and bottom points of the
    % legend box. These were derived empirically.
    lg(1) = 0.3;
    lg(2) = 0.01;

    % Set the legend position
    set(legend_h,'Position',lg)

%% Save plot to the results file
    if(ispc)
        % Make matlab folder
        Name = strcat(Path,StratTypeFolder,FolderName,'\\snapData3','ProbabilityPlot');
        saveas(handle(1),Name,'epsc');
        saveas(handle(1),Name,'png');
        saveas(handle(1),Name,'fig');
    else
        print -depsc    ProbabilityPlot.eps;
        print -dpslatex ProbabilityPlot.eps;
        print -dfig     ProbabilityPlot.fig;
        print -dpng     ProbabilityPlot.png;
        print '\home\juan\Documents\Results\SideApproach\snapData3\' -depsc ProbabilityPlot.eps
    end
end


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace RX02.TestServerClient
{
    class Program
    {
        public static string cLock="";
        static void Main(string[] args)
        {

            for (int x = 1; x != 50; x++)
            {
                Thread thread = new Thread(new ThreadStart(WorkThreadFunction));
                thread.Start();
                lock (cLock)
                {
                    Console.WriteLine("Starting: " + x.ToString());
                }
            }
            Console.ReadLine();
        }

        public static void WorkThreadFunction()
        {
            try
            {
                var client = new Client();
                client.ConnectToServer();

                client.TransmitTestData();
            }
            catch (Exception ex)
            {
                // log errors
            }
        }
    }

    public class Client
    {
        System.Net.Sockets.TcpClient clientSocket = new System.Net.Sockets.TcpClient();
        NetworkStream serverStream;
        public void ConnectToServer()
        {
            clientSocket.Connect("localhost", 23);

        }

        public void TransmitTestData()
        {
            for (int x = 0; x != 10000; x++)
            {

                SendData(x.ToString());
                Thread.Sleep(100);
            }
            CloseConnection();
        }

        public void SendData(string dataTosend)
        {
            if (string.IsNullOrEmpty(dataTosend))
                return;
            NetworkStream serverStream = clientSocket.GetStream();
            byte[] outStream = System.Text.Encoding.ASCII.GetBytes(dataTosend);
            serverStream.Write(outStream, 0, outStream.Length);
            serverStream.Flush();
        }

        public void CloseConnection()
        {
            clientSocket.Close();
        }
        public string ReceiveData()
        {
            StringBuilder message = new StringBuilder();
            NetworkStream serverStream = clientSocket.GetStream();
            serverStream.ReadTimeout = 100;
            //the loop should continue until no dataavailable to read and message string is filled.
            //if data is not available and message is empty then the loop should continue, until
            //data is available and message is filled.
            while (true)
            {
                if (serverStream.DataAvailable)
                {
                    int read = serverStream.ReadByte();
                    if (read > 0)
                        message.Append((char)read);
                    else
                        break;
                }
                else if (message.ToString().Length > 0)
                    break;
            }
            return message.ToString();
        }
    }
}


text:
package com.dosport.springframework.security.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
 * 系统角色权限主键.
 *
 * @author pwl
 *
 */
@Embeddable
public class SysRoleAuthorityPk implements Serializable {

	/**
	 *
	 */
	private static final long serialVersionUID = 6649028505274785436L;

	@Column(name = "ROLE_ID")
	private Long roleId;

	@Column(name = "AUTHORITY_ID")
	private Long authorityId;

	public Long getRoleId() {
		return roleId;
	}

	public void setRoleId(Long roleId) {
		this.roleId = roleId;
	}

	public Long getAuthorityId() {
		return authorityId;
	}

	public void setAuthorityId(Long authorityId) {
		this.authorityId = authorityId;
	}

}


text:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Text;
using System.Runtime.CompilerServices;

using umbraco.DataLayer;
using umbraco.BusinessLogic;

namespace umbraco.cms.businesslogic.datatype
{
    /// <summary>
    /// Any data type in umbraco can have PreValues, which is a simple Key/Value collection of items attached to a specific instance of the data type.
    /// </summary>
    [Obsolete("This class is no longer used and will be removed from the codebase in the future.")]
    public class PreValues
    {
        private static ISqlHelper SqlHelper
        {
            get { return Application.SqlHelper; }
        }

        /// <summary>
        /// Gets the pre values collection.
        /// </summary>
        /// <param name="DataTypeId">The data type id.</param>
        /// <returns></returns>
        public static SortedList GetPreValues(int DataTypeId)
        {
            var retval = new SortedList();
            var dr = SqlHelper.ExecuteReader(
                "Select id, sortorder, [value], alias from cmsDataTypePreValues where DataTypeNodeId = @dataTypeId order by sortorder",
                SqlHelper.CreateParameter("@dataTypeId", DataTypeId));

            int counter = 0;
            while (dr.Read())
            {
                retval.Add(counter, new PreValue(dr.GetInt("id"), dr.GetInt("sortorder"), dr.GetString("value"), dr.GetString("alias")));
                counter++;
            }
            dr.Close();
            return retval;
        }

        /// <summary>
        /// Removes all prevalues with the specified data type definition id
        /// </summary>
        /// <param name="dataTypeDefId"></param>
        public static void DeleteByDataTypeDefinition(int dataTypeDefId)
        {
            SqlHelper.ExecuteNonQuery("delete from cmsDataTypePreValues where datatypenodeid = @dtdefid",
                SqlHelper.CreateParameter("@dtdefid", dataTypeDefId));
        }

        /// <summary>
        /// Returns the number of prevalues for data type definition
        /// </summary>
        /// <param name="dataTypeDefId"></param>
        /// <returns></returns>
        public static int CountOfPreValues(int dataTypeDefId)
        {
            return SqlHelper.ExecuteScalar<int>(
                "select count(id) from cmsDataTypePreValues where dataTypeNodeId = @dataTypeId",
                SqlHelper.CreateParameter("@dataTypeId", dataTypeDefId));
        }

    }

}


text:
package org.jfree.data;

import org.jfree.chart.TestUtilities;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertSame;

/**
 * Tests for the {@link DomainOrder} class.
 */
public class DomainOrderTest {

    /**
     * Some checks for the equals() method.
     */
    @Test
    public void testEquals() {
        assertEquals(DomainOrder.NONE, DomainOrder.NONE);
        assertEquals(DomainOrder.ASCENDING, DomainOrder.ASCENDING);
        assertEquals(DomainOrder.DESCENDING, DomainOrder.DESCENDING);
        assertFalse(DomainOrder.NONE.equals(DomainOrder.ASCENDING));
        assertFalse(DomainOrder.NONE.equals(DomainOrder.DESCENDING));
        assertFalse(DomainOrder.NONE.equals(null));
        assertFalse(DomainOrder.ASCENDING.equals(DomainOrder.NONE));
        assertFalse(DomainOrder.ASCENDING.equals(DomainOrder.DESCENDING));
        assertFalse(DomainOrder.ASCENDING.equals(null));
        assertFalse(DomainOrder.DESCENDING.equals(DomainOrder.NONE));
        assertFalse(DomainOrder.DESCENDING.equals(DomainOrder.ASCENDING));
        assertFalse(DomainOrder.DESCENDING.equals(null));
    }

    /**
     * Two objects that are equal are required to return the same hashCode.
     */
    @Test
    public void testHashCode() {
        DomainOrder d1 = DomainOrder.ASCENDING;
        DomainOrder d2 = DomainOrder.ASCENDING;
        assertTrue(d1.equals(d2));
        int h1 = d1.hashCode();
        int h2 = d2.hashCode();
        assertEquals(h1, h2);
    }

    /**
     * Serialize an instance, restore it, and check for equality.
     */
    @Test
    public void testSerialization() {
        DomainOrder d1 = DomainOrder.ASCENDING;
        DomainOrder d2 = (DomainOrder) TestUtilities.serialised(d1);
        assertSame(d1, d2);
    }

}


text:
package org.jtwig.renderable;

public interface RenderResult {
    RenderResult append(String content);
    RenderResult flush ();
    String content ();
}


text:
layout: post
status: publish
published: true
title: Filtros Avanzados
author: Oscar González
author_login: oscar
author_email: gonzalezgreco@gmail.com
author_url: http://www.oscarvgg.com
wordpress_id: 2669
wordpress_url: http://codehero.co/?p=2669
date: 2013-11-25 00:09:53.000000000 -04:30
serie: jQuery desde Cero
dificultad: Heroe
duracion: 15
description: En este capítulo vamos a estudiar otro grupo de filtros que llevan un paso más adelante el refinamiento de nuestra selección de elementos del documento.
categories:
- Cursos
- jQuery
tags:
- jquery
- selectores
- filtros
---

En el capitulo anterior de jQuery desde Cero hablamos de los selectores y los filtros básicos.

En este capítulo vamos a estudiar otro grupo de filtros que llevan un paso más adelante el refinamiento de nuestra selección de elementos del documento.

Filtros de atributos

Los filtros de atributos son aquellos que refinan los resultados de un selector según los atributos que tenga el elemento.

Podemos filtrar por atributo de la siguiente manera:

[nombreDeAtributo]: Este incluye elementos que tengan el atributo especificado;

[nombreDeAtributo=valor]: incluye los elementos que tengan el atributo solicitado y el valor asignado al mismo;

[nombreDeAtributo!=valor]: incluye los elementos que tengan el atributo solicitado y un el valor asignado al mismo que sea distinto al especificado;

[nombreDeAtributo^=valor]: incluye los elementos que tengan el atributo solicitado y un el valor asignado al mismo empiece con el especificado;

[nombreDeAtributo$=valor]: incluye los elementos que tengan el atributo solicitado y un el valor asignado al mismo empiece con el especificado;

[nombreDeAtributo*=valor]: incluye los elementos que tengan el atributo solicitado y contenga el valor especificado;

[nombreDeAtributo][nombreDeAtributoN]: incluye los elementos que tengan los atributos solicitados.

Veamos algunos ejemplos dado el siguiente html:

```javascript
<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Prueba Selectores</title>

  <script type="text/javascript" src="javascript/jquery-2.0.3.min.js"></script>

</head>
<body>

  <ul id="list1">
    <li class="a">Item 1</li>
    <li class="b">Item 2</li>
    <li class="a">Item 3</li>
    <li class="b">Item 4</li>
  </ul>

  <p class="class1">Mario</p>
  <p class="paragraph1">Luigi</p>
  <p class="class2">Toad</p>
  <p class="paragraph2">Bowser</p>

</body>
</html>
```

Realizaremos las siguientes consultas:

```javascript
<script type="text/javascript">

    $("document").ready(function() {

      // seleccionar todos los párrafos que tengan el atributo class
      $('p[class]');

      // seleccionar todos los párrafos que tengan el atributo id con el valor paragraph1
      $('p[id=paragraph1]');

      // seleccionar todos los párrafos cuyo id empiece por "para"
      $('p[id^=para]');

      // seleccionar todos los párrafos cuyo id empiece por "para" y tenga un atributo llamado align que contenga "center"
      $('p[id^=para][align*=center]');

    });

</script>
```

Filtros de Contenido

Éstos permiten examinar el contenido de elementos seleccionados para determinar si deben ser incluidos o no en los resultados.

:contains(texto): Filtra la selección para incluir solo los que elementos que contengan el texto especificado;

:empty Filtra la selección para incluir solo elementos vacios;

:has(selector): Retorna elementos que contienen al menos un elemento con el selector especificado;

:parent: Encuentra elementos que son padres, es decir, que confinen al menos otro elemento.

Utilizando el mismo HTML anterior veamos los siguientes filtros:

```javascript
// seleccionar todos los párrafos que contengan la palabra "Luigi"
$('p:contains(Luigi)');
```

Ahora si probáramos con $(':contains(a)');, estaríamos seleccionando todos los elementos que contengas una letra "a" sin importar de que tipo sean. Entonces nos retornaría: p, p, body, ¿Por qué body?, porque como los padres contienen a los hijos entonces su contenido es considerado como propio. Tendriamos que hacer una búsqueda un poco mas especifica si quisiéramos solo los
.

Sigamos:

```javascript
// Seleccionar todos los párrafos que contienen al menos un hijo (incluyendo texto)
$('p:parent');

// Seleccionar todos los ul que contengan li con la clase "a"
$('ul:has(li[class=a])');
```

Filtros de Visibilidad

Seleccionan los elementos que sean visibles o no.

1. **visible:** Incluye todos los elementos visibles;
2. **hidden:** Incluye solo los elementos que estén ocultos.

```javascript
// Seleccionar todos los ul que estén visibles
$('ul:visible');
```

Filtros hijo

Los filtros hijo refinan un selector examinando la relación que cada elemento tiene con su elemento padre:

nth-child(indice): Toma el elementos en cierto indice;

nth-child(even): Toma solo elementos pares;

nth-child(odd): Toma solo elementos impares;

nth-child(equation): Toma solo elementos que satisfagan la formula Xn+M;

first-child: Toma el primer elemento hijo del padre

last-child: Toma el último elemento hijo del padre

only-child: Toma el único elemento hijo que contiene el padre

Vamos los ejemplos a continuación:

```javascript
// Seleccionar el elemento li que este de segundo en un elemento ul
$('ul li:nth-child(2)');

// Seleccionar el elemento li que este de último en un elemento ul
$('ul li:last-child');

// Seleccionar el elemento li que esté en una posición 2n en un elemento ul
$('ul li:nth-child(2n)');

// Seleccionar el elemento li que esté en una posición 2n en un elemento ul
$('ul li:nth-child(2n)');

```

Filtros de Formulario

Este tipo de filtros funcionan más o menos igual que los demás solo que son específicos para ayudarnos a trabajar con formularios.

:input: Encuentra todos los input: select, textarea, button;

:text: Selecciona todos los elementos de texto;

:password: Selecciona todos los elementos tipo password;

:checkbox: Selecciona todos los elementos de tipo checkbox;

:submit: Selecciona todos los elementos de tipo submit;

:reset: Selecciona todos los elementos de de tipo reset;

:image: Selecciona todos los elementos de tipo image;

:button: Selecciona todos los elementos button;

:file: Selecciona todos los elementos file;

:enabled: Selecciona todos los elementos que están habilitados;

:disabled: Selecciona todos los elementos que están inhabilitados;

:checked: Selecciona todos los elementos que están en estado de "check" como radiobuttons o checkboxes

:selected: Selecciona todos los elementos que están seleccionados.

Conclusión

Eso es todo por hoy.

Con éste capítulo cerramos el tema de los filtros y selectores.

Cualquier duda déjala en la sección de comentarios de más abajo.

Hasta la próxima.


text:
import { Session } from 'meteor/session';
import { Template } from 'meteor/templating';

Template.burger.helpers({
	unread() {
		return Session.get('unread');
	},
	isMenuOpen() {
		if (Session.equals('isMenuOpen', true)) {
			return 'menu-opened';
		}
	},
	embeddedVersion() {
		return RocketChat.Layout.isEmbedded();
	},
});


text:
package org.immutables.mongo.fixture.sub;

import java.util.List;
import org.immutables.gson.Gson;
import org.immutables.mongo.Mongo;
import org.immutables.mongo.fixture.ImmutableItem;
import org.immutables.mongo.fixture.ItemRepository;
import org.immutables.value.Value;

@Mongo.Repository
@Value.Immutable
//Yet to be generated ImmutableItem or ItemRepository
@Gson.TypeAdapters
public interface Item2 {

  List<ImmutableItem> list();

  ItemRepository repo();
}


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

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>strfromurl</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="Manuel de référence canonique de Csound" />
    <link rel="up" href="OpcodesTop.html" title="Opcodes et opérateurs de l'orchestre" />
    <link rel="prev" href="streson.html" title="streson" />
    <link rel="next" href="strget.html" title="strget" />

          strfromurl

          Précédent
          Opcodes et opérateurs de l'orchestre
           Suivant

          strfromurl

strfromurl —
      Donne à une variable chaîne de caractères une valeur lue depuis une URL.

Description

      strfromurl donne à une variable chaîne de caractères
      durant l'initialisation une valeur trouvée en lisant une URL.

Syntaxe

Sdst strfromurl StringURL

Initialisation

      StringURL -- chaîne de caractères nommant une URL.

      Sdst -- variable chaîne de caractères de destination.

Exemples

      Voici un exemple de l'opcode strfromurl. Il utilise le fichier
      strfromurl.csd.

            Exemple 909. Exemple de l'opcode strfromurl.

Voir les sections Audio en temps réel
        et Options de la ligne de commande pour plus
        d'information sur l'utilisation des options de la ligne de commande.

<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
-odac     ;;;realtime audio out
;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
; For Non-realtime ouput leave only the line below:
; -o strget.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

sr = 44100
ksmps = 32
nchnls = 2
0dbfs  = 1

#include "http://codemist.co.uk/jpff/test.in"

instr 2

Sfile strfromurl "http://codemist.co.uk/jpff/test.in"
  prints Sfile
endin
</CsInstruments>
<CsScore>

i 1 0 1
i 2 1 1
e
</CsScore>
</CsoundSynthesizer>

Voir aussi

strset

Crédits

Auteur : John ffitch

2013

Les URLs sont disponibles à partir de Csound 6.02 s'il a été compilé
    avec leur support.

          Précédent

            Niveau supérieur

           Suivant

          streson

            Sommaire

           strget


text:
categories: admin-panel
layout: article
title: Banner
---

The Banner page provides functionality for displaying a site banner to users on your cluster. Standard banner colors associated with several alert types are provided for convenience, but custom hexadecimal color values of the form `#RRGGBB` can be provided as well. Colors are informational only and have no effect on the functionality of the banner.

![Admin Panel - Banner]({{site.url}}/developers/images/post_images/algo-images-admin/algo-1609265251857.png)

To post a site banner, select the "Enabled" option at the top of the page, enter the desired Theme (color) information and Text (label and message), and click "Update Banner." To remove a site banner, unselect the "Enabled" option and click "Update Banner."


text:
{% extends site.html %}

{% block body_block %}
    404 Page Not Find!!
{% endblock %}


text:
package org.pentaho.di.ui.core.dialog;

import java.util.List;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ShellAdapter;
import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.pentaho.di.core.Const;
import org.pentaho.di.core.RowMetaAndData;
import org.pentaho.di.core.exception.KettleValueException;
import org.pentaho.di.core.row.RowMetaInterface;
import org.pentaho.di.core.row.ValueMetaInterface;
import org.pentaho.di.core.variables.VariableSpace;
import org.pentaho.di.i18n.BaseMessages;
import org.pentaho.di.ui.core.PropsUI;
import org.pentaho.di.ui.core.gui.GUIResource;
import org.pentaho.di.ui.core.gui.WindowProperty;
import org.pentaho.di.ui.core.widget.ColumnInfo;
import org.pentaho.di.ui.core.widget.TableView;
import org.pentaho.di.ui.trans.step.BaseStepDialog;

/**
 * Displays an ArrayList of rows in a TableView and allows you to select one.
 *
 * @author Matt
 */
public class SelectRowDialog extends Dialog {
  private static Class<?> PKG = SelectRowDialog.class; // for i18n purposes, needed by Translator2!!

  private Label wlFields;
  private TableView wFields;
  private FormData fdFields;

  private Button wOK, wCancel;
  private Listener lsOK, lsCancel;

  private Shell shell;
  private List<RowMetaAndData> buffer;
  private PropsUI props;
  private String title;

  private RowMetaAndData selection;
  private RowMetaInterface rowMeta;

  private VariableSpace variables;

  /**
   *
   * @param parent
   * @param style
   * @param buf
   */
  public SelectRowDialog( Shell parent, VariableSpace space, int style, List<RowMetaAndData> buffer ) {
    super( parent, style );
    this.buffer = buffer;
    this.variables = space;
    props = PropsUI.getInstance();

    selection = null;
  }

  public void setTitle( String title ) {
    this.title = title;
  }

  public RowMetaAndData open() {
    Shell parent = getParent();
    Display display = parent.getDisplay();

    shell = new Shell( parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX );
    props.setLook( shell );

    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;

    if ( title == null ) {
      title = BaseMessages.getString( PKG, "SelectRowDialog.Title" );
    }

    shell.setLayout( formLayout );
    shell.setImage( GUIResource.getInstance().getImageTransGraph() );
    shell.setText( title );

    int margin = Const.MARGIN;

    // Simply exit and close in case we don't have anything to edit or show
    //
    if ( buffer == null || buffer.size() == 0 ) {
      return null;
    }

    rowMeta = buffer.get( 0 ).getRowMeta();

    int FieldsRows = buffer.size();

    ColumnInfo[] colinf = new ColumnInfo[rowMeta.size()];
    for ( int i = 0; i < rowMeta.size(); i++ ) {
      ValueMetaInterface v = rowMeta.getValueMeta( i );
      colinf[i] = new ColumnInfo( v.getName(), ColumnInfo.COLUMN_TYPE_TEXT, false );
      colinf[i].setToolTip( v.toStringMeta() );
      colinf[i].setReadOnly( true );
    }

    wFields =
      new TableView(
        variables, shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, null, props );

    wOK = new Button( shell, SWT.PUSH );
    wOK.setText( BaseMessages.getString( PKG, "System.Button.OK" ) );
    wCancel = new Button( shell, SWT.PUSH );
    wCancel.setText( BaseMessages.getString( PKG, "System.Button.Cancel" ) );

    BaseStepDialog.positionBottomButtons( shell, new Button[] { wOK, wCancel }, margin, null );

    fdFields = new FormData();
    fdFields.left = new FormAttachment( 0, 0 );
    fdFields.top = new FormAttachment( wlFields, margin );
    fdFields.right = new FormAttachment( 100, 0 );
    fdFields.bottom = new FormAttachment( wOK, -margin );
    wFields.setLayoutData( fdFields );

    // Add listeners
    lsOK = new Listener() {
      public void handleEvent( Event e ) {
        ok();
      }
    };
    wOK.addListener( SWT.Selection, lsOK );

    lsCancel = new Listener() {
      public void handleEvent( Event e ) {
        close();
      }
    };
    wCancel.addListener( SWT.Selection, lsCancel );

    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener( new ShellAdapter() {
      public void shellClosed( ShellEvent e ) {
        close();
      }
    } );

    getData();

    BaseStepDialog.setSize( shell );

    shell.open();

    while ( !shell.isDisposed() ) {
      if ( !display.readAndDispatch() ) {
        display.sleep();
      }
    }
    return selection;
  }

  public void dispose() {
    props.setScreen( new WindowProperty( shell ) );
    shell.dispose();
  }

  /**
   * Copy information from the input buffer to the dialog fields.
   */
  private void getData() {
    for ( int i = 0; i < buffer.size(); i++ ) {
      RowMetaAndData rowMetaAndData = buffer.get( i );
      RowMetaInterface rowMeta = rowMetaAndData.getRowMeta();
      Object[] rowData = rowMetaAndData.getData();

      for ( int c = 0; c < rowMeta.size(); c++ ) {
        ValueMetaInterface v = rowMeta.getValueMeta( c );
        String show;

        try {
          if ( v.isNumeric() ) {
            show = v.getString( rowData[c] );
          } else {
            show = v.getString( rowData[c] );
          }
        } catch ( KettleValueException e ) {
          show = "<conversion error>";
        }
        if ( show != null ) {
          wFields.table.getItem( i ).setText( c + 1, show );
        }
      }
    }
    wFields.optWidth( true );
  }

  private void close() {
    selection = null;
    dispose();
  }

  private void ok() {
    int[] idx = wFields.getSelectionIndices();
    if ( idx.length > 0 && idx[0] < buffer.size() ) {
      selection = buffer.get( idx[0] );
    }
    dispose();
  }
}


text:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <TextView
        android:id="@+id/text_dialog_message"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="6dip"
        android:paddingLeft="12dip"
        android:paddingRight="12dip" >
    </TextView>

    <NumberPicker
        android:id="@+id/number_picker"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="6dip"
        android:layout_marginTop="6dip" />

</LinearLayout>


text:
"""
Interface is used to establish a connection to MindBoggleDB and settings

"""
from bulbs.rest import Resource
from .base import Database

class Interface(object):
    """
    Establish the connection
    """
    def __init__(self,server):
        Database.resource = Resource(db_url=server)


text: - Updated the Docker image to: *demisto/elasticsearch:1.0.0.26509*.