text:
using System;
using System.Data.Common;

namespace SmartAssembly.DatabaseSample.Data
{
    public struct ExceptionReportInformation
    {
        public ExceptionReportInformation(DbDataReader reader)
        {
            ID = string.Empty;
            ProjectID = string.Empty;
            AssemblyID = string.Empty;
            UserID = string.Empty;
            CreationDate = DateTime.Now;
            ExceptionType = string.Empty;
            ExceptionMessage = string.Empty;
            TypeName = string.Empty;
            MethodName = string.Empty;
            Unread = true;
            Fixed = false;
            Flag = 0;

            for (var i = 0; i < reader.FieldCount; i++)
            {
                var fieldValue = reader.GetValue(i);
                if (fieldValue == DBNull.Value) continue;

                switch (reader.GetName(i))
                {
                    case "ID":
                        ID = ((Guid) fieldValue).ToString("B");
                        break;

                    case "ProjectID":
                        ProjectID = ((Guid) fieldValue).ToString("B");
                        break;

                    case "AssemblyID":
                        AssemblyID = ((Guid) fieldValue).ToString("B");
                        break;

                    case "CreationDate":
                        CreationDate = (DateTime) fieldValue;
                        break;

                    case "ExceptionType":
                        ExceptionType = (string) fieldValue;
                        break;

                    case "ExceptionMessage":
                        ExceptionMessage = (string) fieldValue;
                        break;

                    case "TypeName":
                        TypeName = (string) fieldValue;
                        break;

                    case "MethodName":
                        MethodName = (string) fieldValue;
                        break;

                    case "Unread":
                        Unread = (bool) fieldValue;
                        break;

                    case "Fixed":
                        Fixed = (bool) fieldValue;
                        break;

                    case "Flag":
                        Flag = (Flag) (byte) fieldValue;
                        break;

                    case "UserID":
                        UserID = ((Guid) fieldValue).ToString("B");
                        break;

                    case "Data":
                        break;
                }
            }
        }

        public string ID { get; }
        public string ProjectID { get; }
        public string UserID { get; }
        public string AssemblyID { get; }
        public DateTime CreationDate { get; }
        public string ExceptionType { get; }
        public string ExceptionMessage { get; }
        public string TypeName { get; }
        public string MethodName { get; }
        public bool Unread { get; }
        public bool Fixed { get; }

        public bool Flagged
        {
            get { return (int) Flag > 0; }
        }

        public Flag Flag { get; }
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>ModelAuditTrailEntry (ARX GUI Documentation)</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.deidentifier.arx.gui.model

Class ModelAuditTrailEntry

java.lang.Object

org.deidentifier.arx.gui.model.ModelAuditTrailEntry

All Implemented Interfaces:

java.io.Serializable

Direct Known Subclasses:

ModelAuditTrailEntry.AuditTrailEntryFindReplace

public abstract class ModelAuditTrailEntry
extends java.lang.Object
implements java.io.Serializable

This class implements an entry for the audit trail. Actions that are logged should
 extend this abstract base class.

See Also:

Serialized Form

Nested Class Summary

Nested Classes

Modifier and Type
Class and Description

static class
ModelAuditTrailEntry.AuditTrailEntryFindReplace

Find and replace entry

Constructor Summary

Constructors

Constructor and Description

ModelAuditTrailEntry()

Method Summary

Methods

Modifier and Type
Method and Description

static ModelAuditTrailEntry
createfindReplaceEntry(java.lang.String attribute,
                      java.lang.String searchString,
                      java.lang.String replacementString)

Returns an entry for the according action

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

ModelAuditTrailEntry

public ModelAuditTrailEntry()

Method Detail

createfindReplaceEntry

public static ModelAuditTrailEntry createfindReplaceEntry(java.lang.String attribute,
                                          java.lang.String searchString,
                                          java.lang.String replacementString)

Returns an entry for the according action

Parameters:

attribute -

searchString -

replacementString -

Returns:

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

redpajama_set_name: RedPajamaGithub


text:
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE GADTs #-}

{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}

module FowardMat where

import qualified Data.Vector.Unboxed as U

import           ForwardVector

import           Numeric.AD.Internal.Forward.Double
import           Numeric.AD.Mode
import           Numeric.AD.Internal.Identity
import           Numeric.AD.Jacobian
import           Numeric.AD.Mode

import           Data.Proxy
import           GHC.TypeLits

newtype Mat (w :: Nat) (h :: Nat) where
  Mat :: U.Vector ForwardDouble -> Mat w h

width :: forall w h. KnownNat w => Mat w h -> Int
width _ = fromInteger $ natVal (Proxy :: Proxy w)

height :: forall w h. KnownNat h => Mat w h -> Int
height _ = fromInteger $ natVal (Proxy :: Proxy h)

index :: KnownNat w => Mat w h -> Int -> Int -> ForwardDouble
index m@(Mat v) x y = v U.! (x + y * width m)

instance Functor (Mat w h) where
    fmap f (Mat v) = Mat $ U.map f v
deriving instance (U.Unbox a, Show a) => Show (Mat w h a)

deriving instance Num (Mat w h ForwardDouble)

instance Mode (Mat w h ForwardDouble) where
    type Scalar (Mat w h ForwardDouble) = Double
    auto = Mat . U.singleton . auto

instance Jacobian (Mat w h ForwardDouble) where
    type D (Mat w h ForwardDouble) = Id Double


text:
Problem 309

Integer Ladders

In the classic "Crossing Ladders" problem, we are given the lengths <var>x</var> and <var>y</var> of two ladders resting on the opposite walls of a narrow, level street. We are also given the height <var>h</var> above the street where the two ladders cross and we are asked to find the width of the street (<var>w</var>).

Here, we are only concerned with instances where all four variables are positive integers.

For example, if <var>x</var> = 70, <var>y</var> = 119 and <var>h</var> = 30, we can calculate that <var>w</var> = 56.

In fact, for integer values <var>x</var>, <var>y</var>, <var>h</var> and 0 x y x,<var>y</var>,<var>h</var>) producing integer solutions for <var>w</var>:

(70, 119, 30), (74, 182, 21), (87, 105, 35), (100, 116, 35) and (119, 175, 40).

For integer values <var>x</var>, <var>y</var>, <var>h</var> and 0 x y x,<var>y</var>,<var>h</var>) produce integer solutions for <var>w</var>?


text:
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;

using CodeJam.PerfTests;
using CodeJam.Ranges;

using JetBrains.Annotations;

using NUnit.Framework;

using static CodeJam.PerfTests.CompetitionHelpers;

namespace CodeJam.RangesAlternatives
{
	/// <summary>
	/// Test to choose valid Range(of T) implementation.
	/// </summary>
	[TestFixture(Category = PerfTestCategory + ": Ranges")]
	[PublicAPI]
	[SuppressMessage("ReSharper", "PassStringInterpolation")]
	[CompetitionBurstMode]
	public class RangeAlternativesUnionPerfTests
	{
		[Test]
		public void RunRangeUnionIntCase() => Competition.Run<RangeUnionIntCase>();

		[PublicAPI]
		public class RangeUnionIntCase
		{
			private static readonly int Count = CompetitionRunHelpers.BurstModeLoopCount / 16;

			private readonly KeyValuePair<int, int>[] _data;
			private readonly KeyValuePair<int, int>[] _data2;
			private readonly RangeStub<int>[] _rangeData;
			private readonly RangeStub<int>[] _rangeData2;
			private readonly Range<int>[] _rangeDataImpl;
			private readonly Range<int>[] _rangeDataImpl2;

			public RangeUnionIntCase()
			{
				_data = new KeyValuePair<int, int>[Count];
				_data2 = new KeyValuePair<int, int>[Count];
				_rangeData = new RangeStub<int>[Count];
				_rangeData2 = new RangeStub<int>[Count];
				_rangeDataImpl = new Range<int>[Count];
				_rangeDataImpl2 = new Range<int>[Count];

				for (var i = 0; i < _data.Length; i++)
				{
					var fromBoundary = i % 7 == 0 ? RangeBoundaryFrom<int>.NegativeInfinity : Range.BoundaryFrom(i);
					var toBoundary = i % 5 == 0 ? RangeBoundaryTo<int>.PositiveInfinity : Range.BoundaryTo(i);
					_data[i] = new KeyValuePair<int, int>(i, i + 1);
					_data2[i] = new KeyValuePair<int, int>(i - 1, i);
					_rangeData[i] = new RangeStub<int>(fromBoundary, Range.BoundaryTo(i + 1));
					_rangeData2[i] = new RangeStub<int>(Range.BoundaryFrom(i - 1), toBoundary);
					_rangeDataImpl[i] = new Range<int>(fromBoundary, Range.BoundaryTo(i + 1));
					_rangeDataImpl2[i] = new Range<int>(Range.BoundaryFrom(i - 1), toBoundary);
				}
			}

			[CompetitionBaseline]
			[GcAllocations(0)]
			public KeyValuePair<int, int> Test00DirectCompare()
			{
				var result = _data[0];
				for (var i = 1; i < _data.Length; i++)
				{
					result = new KeyValuePair<int, int>(
						Math.Min(_data[i].Key, _data2[i].Key),
						Math.Max(_data[i].Value, _data2[i].Value));
				}
				return result;
			}

			[CompetitionBenchmark(8.58, 17.92)]
			[GcAllocations(0)]
			public RangeStub<int> Test01RangeInstance()
			{
				var result = _rangeData[0];
				for (var i = 1; i < _rangeData.Length; i++)
				{
					result = _rangeData[i].UnionInstance(_rangeData2[i]);
				}
				return result;
			}

			[CompetitionBenchmark(8.99, 20.38)]
			[GcAllocations(0)]
			public RangeStub<int> Test02RangeExtension()
			{
				var result = _rangeData[0];
				for (var i = 1; i < _rangeData.Length; i++)
				{
					result = _rangeData[i].Union(_rangeData2[i]);
				}
				return result;
			}
		}

		[Test]
		public void RunRangeUnionNullableIntCase() => Competition.Run<RangeUnionNIntCase>();

		[PublicAPI]
		public class RangeUnionNIntCase
		{
			private static readonly int Count = CompetitionRunHelpers.BurstModeLoopCount / 16;
			private readonly KeyValuePair<int?, int?>[] _data;
			private readonly KeyValuePair<int?, int?>[] _data2;
			private readonly RangeStub<int?>[] _rangeData;
			private readonly RangeStub<int?>[] _rangeData2;
			private readonly Range<int?>[] _rangeDataImpl;
			private readonly Range<int?>[] _rangeDataImpl2;

			public RangeUnionNIntCase()
			{
				_data = new KeyValuePair<int?, int?>[Count];
				_data2 = new KeyValuePair<int?, int?>[Count];
				_rangeData = new RangeStub<int?>[Count];
				_rangeData2 = new RangeStub<int?>[Count];
				_rangeDataImpl = new Range<int?>[Count];
				_rangeDataImpl2 = new Range<int?>[Count];

				for (var i = 0; i < _data.Length; i++)
				{
					var fromBoundary = i % 7 == 0 ? RangeBoundaryFrom<int?>.NegativeInfinity : Range.BoundaryFrom((int?)i);
					var toBoundary = i % 5 == 0 ? RangeBoundaryTo<int?>.PositiveInfinity : Range.BoundaryTo((int?)i);
					_data[i] = new KeyValuePair<int?, int?>(i, i + 1);
					_data2[i] = new KeyValuePair<int?, int?>(i - 1, i);
					_rangeData[i] = new RangeStub<int?>(fromBoundary, Range.BoundaryTo((int?)i + 1));
					_rangeData2[i] = new RangeStub<int?>(Range.BoundaryFrom((int?)i - 1), toBoundary);
					_rangeDataImpl[i] = new Range<int?>(fromBoundary, Range.BoundaryTo((int?)i + 1));
					_rangeDataImpl2[i] = new Range<int?>(Range.BoundaryFrom((int?)i - 1), toBoundary);
				}
			}

			private static int? Min(int? a, int? b) => a < b ? a : b;
			private static int? Max(int? a, int? b) => a < b ? b : a;

			[CompetitionBaseline]
			[GcAllocations(0)]
			public KeyValuePair<int?, int?> Test00DirectCompare()
			{
				var result = _data[0];
				for (var i = 1; i < _data.Length; i++)
				{
					result = new KeyValuePair<int?, int?>(
						Min(_data[i].Key, _data2[i].Key),
						Max(_data[i].Value, _data2[i].Value));
				}

				return result;
			}

			[CompetitionBenchmark(1.26, 1.99)]
			[GcAllocations(0)]
			public RangeStub<int?> Test01RangeInstance()
			{
				var result = _rangeData[0];
				for (var i = 1; i < _rangeData.Length; i++)
				{
					result = _rangeData[i].UnionInstance(_rangeData2[i]);
				}
				return result;
			}

			[CompetitionBenchmark(1.48, 2.92)]
			[GcAllocations(0)]
			public RangeStub<int?> Test02RangeExtension()
			{
				var result = _rangeData[0];
				for (var i = 1; i < _rangeData.Length; i++)
				{
					result = _rangeData[i].Union(_rangeData2[i]);
				}
				return result;
			}
		}
	}
}


text:
* [Improvement] Update to Cake.Core v2.0.0

### New in 1.0.1 (Released 2021/04/05)
* [Improvement] Add cake-addin nuget tag
* [Bug] not including `System.Management.Automation.dll`

### New in 1.0.0 (Released 2021/02/25)
* [Improvement] Update to Cake.Core v1.0.0
* [Feature] Cross platform support

### New in 0.4.8 (Released 2019/05/12)
* [Improvement] Update to Cake.Core v0.33

### New in 0.4.7 (Released 2018/10/31)
* [Feature] Partial Linux support

### New in 0.4.6 (Released 2018/08/12)
* [Improvement] Update to Cake.Core v0.29
* [Improvement] Update build scripts

### New in 0.4.5 (Released 2018/03/20)
* [Improvement] Remove extra references

### New in 0.4.4 (Released 2018/03/06)
* [Improvement] Updated to Cake v0.26
* [Improvement] Added AuthenticationMechanism

### New in 0.4.3 (Released 2017/11/28)
* [Improvement] Throw on errors
* [Improvement] dot sourcing

### New in 0.4.2 (Released 2017/10/24)
* [Bug] Wrong nuspec folder

### New in 0.4.1 (Released 2017/10/24)
* [Improvement] Move down to net46 to bring the project inline with Cake.Core

### New in 0.4.0 (Released 2017/09/19)
* [Improvement] Updated Cake reference to v0.22.0
* [Improvement] Moved to net461 for Cake compatibility
* [Improvement] Upgraded solution to vs2017
* [Improvement] New .net core based build scripts

### New in 0.3.5 (Released 2017/08/18)
* [Improvement] Exception handling

### New in 0.3.4 (Released 2017/03/27)
* [Improvement] Remove region Indentation
* [Improvement] Update CakeContrib icon

### New in 0.3.3 (Released 2017/03/27)
* [Bug] Immediate output not escaping brackets

### New in 0.3.2 (Released 2017/03/19)
* [Feature] Immediate Powershell Output

### New in 0.3.1 (Released 2017/03/06)
* [Improvement] Don't use strong named references

### New in 0.3.0 (Released 2017/02/03)
* [Bug] Format output messages to replace brackets

### New in 0.2.9 (Released 2017/02/03)
* [Improvement] Update Cake.Core reference

### New in 0.2.8 (Released 2016/12/19)
* [Bug] Fix bug with ImportModule

### New in 0.2.7 (Released 2016/10/04)
* [Bug] Check for braces when logging commands to Cake

### New in 0.2.6 (Released 2016/07/05)
* [Improvement] Array Arguments

### New in 0.2.5 (Released 2016/05/26)
* [Improvement] Provide setting to not output to the console

### New in 0.2.4 (Released 2016/05/23)
* [Improvement] StringLiteralArgument

### New in 0.2.3 (Released 2016/05/17)
* [Improvement] Target Powershell 5.0
* [Improvement] Add nuget dependencies
* [Improvement] Update all packages
* [Improvement] Setup / Teardown with context

### New in 0.2.2 (Released 2016/04/29)
* [Bug] Fixed missing quotes from set-location command

### New in 0.2.1 (Released 2016/01/16)
* [Bug] Fixed SolutionInfo link

### New in 0.2.0 (Released 2015/12/28)
* [Improvement] Add xml documentation

### New in 0.1.9 (Released 2015/12/10)
* [Improvement] Add Cake namespace docs
* [Improvement] Update Cake.Core reference

### New in 0.1.8 (Released 2015/10/24)
* [Bug] Remove Cake.Core from nuget

### New in 0.1.7 (Released 2015/09/18)
* [Improvement] Complete documentation

### New in 0.1.6 (Released 2015/08/06)
* [Bug] Force build

### New in 0.1.5 (Released 2015/07/28)
* [Improvement] Added namespace imports

### New in 0.1.4 (Released 2015/06/18)
* [Improvement] Improved code documentation
* [Improvement] Copy tools to test folder

### New in 0.1.3 (Released 2015/06/14)
* [Bug] Fix Nuget references

### New in 0.1.2 (Released 2015/06/03)
* [Improvement] Named argument extensions with format

### New in 0.1.1 (Released 2015/06/02)
* [Improvement] Additional aliases with arguments instead of settings

### New in 0.1.0 (Released 2015/06/01)
* [Bug] Only use the environment locally when setting the working directory

### New in 0.0.9 (Released 2015/05/31)
* [Improvement] Output Powershell exceptions to the cake console

### New in 0.0.8 (Released 2015/05/31)
* [Bug] Fixed bug in outputting to the cake console

### New in 0.0.7 (Released 2015/05/29)
* [Improvement] Changes to package publishing

### New in 0.0.6 (Released 2015/05/28)
* [Improvement] Changes to fluent arguments

### New in 0.0.5 (Released 2015/05/26)
* [Improvement] Download remote script files
* [Improvement] Logging host output

### New in 0.0.4 (Released 2015/05/21)
* [Improvement] Switch to XUnit tests

### New in 0.0.3 (Released 2015/05/20)
* [Feature] Support script files

### New in 0.0.2 (Released 2015/05/19)
* [Feature] Remote connections
* [Improvement] Fluent Arguments

### New in 0.0.1 (Released 2015/05/18)
* [Feature] First release.


text:
package solid.converters;

import solid.collections.SolidSet;
import solid.functions.SolidFunc1;

public class ToSolidSet<T> implements SolidFunc1<Iterable<T>, SolidSet<T>> {

    private static final ToSolidSet TO_SOLID_SET = new ToSolidSet<>();

    /**
     * Returns a method that can be used with {@link solid.stream.Stream#collect(SolidFunc1)}
     * to convert a stream into {@link SolidSet}.
     *
     * @param <T> a type of {@link SolidSet} values.
     * @return a method that converts an iterable into {@link SolidSet}.
     */
    public static <T> SolidFunc1<Iterable<T>, SolidSet<T>> toSolidSet() {
        //noinspection unchecked
        return TO_SOLID_SET;
    }

    /**
     * Returns a method that can be used with {@link solid.stream.Stream#collect(SolidFunc1)}
     * to convert a stream into {@link SolidSet}.
     *
     * @param <T>             a type of {@link SolidSet} values.
     * @param initialCapacity initial capacity of the set.
     * @return a method that converts an iterable into {@link SolidSet}.
     */
    public static <T> SolidFunc1<Iterable<T>, SolidSet<T>> toSolidSet(int initialCapacity) {
        return new ToSolidSet<>(initialCapacity);
    }

    private int initialCapacity;

    public ToSolidSet() {
    }

    public ToSolidSet(int initialCapacity) {
        this.initialCapacity = initialCapacity;
    }

    @Override
    public SolidSet<T> call(Iterable<T> iterable) {
        return new SolidSet<>(iterable, initialCapacity);
    }
}


text:
policy_data = """
{
    "context_is_admin": "role:admin or role:administrator",

    "os_compute_api:servers:show:host_status": "",
    "os_compute_api:servers:migrations:force_complete": "",
    "os_compute_api:os-admin-actions:inject_network_info": "",
    "os_compute_api:os-admin-actions:reset_network": "",
    "os_compute_api:os-admin-actions:reset_state": "",
    "os_compute_api:os-admin-password": "",
    "os_compute_api:os-agents": "",
    "os_compute_api:os-attach-interfaces": "",
    "os_compute_api:os-baremetal-nodes": "",
    "os_compute_api:os-cells": "",
    "os_compute_api:os-certificates:create": "",
    "os_compute_api:os-certificates:show": "",
    "os_compute_api:os-cloudpipe": "",
    "os_compute_api:os-config-drive": "",
    "os_compute_api:os-console-output": "",
    "os_compute_api:os-remote-consoles": "",
    "os_compute_api:os-consoles:create": "",
    "os_compute_api:os-consoles:delete": "",
    "os_compute_api:os-consoles:index": "",
    "os_compute_api:os-consoles:show": "",
    "os_compute_api:os-create-backup": "",
    "os_compute_api:os-deferred-delete": "",
    "os_compute_api:os-extended-server-attributes": "",
    "os_compute_api:os-extended-status": "",
    "os_compute_api:os-extended-availability-zone": "",
    "os_compute_api:ips:index": "",
    "os_compute_api:ips:show": "",
    "os_compute_api:os-extended-volumes": "",
    "os_compute_api:extensions": "",
    "os_compute_api:os-fixed-ips": "",
    "os_compute_api:os-flavor-access": "",
    "os_compute_api:os-flavor-access:remove_tenant_access": "",
    "os_compute_api:os-flavor-access:add_tenant_access": "",
    "os_compute_api:os-flavor-rxtx": "",
    "os_compute_api:os-flavor-extra-specs:index": "",
    "os_compute_api:os-flavor-extra-specs:show": "",
    "os_compute_api:os-flavor-manage": "",
    "os_compute_api:os-floating-ip-dns": "",
    "os_compute_api:os-floating-ip-dns:domain:update": "",
    "os_compute_api:os-floating-ip-dns:domain:delete": "",
    "os_compute_api:os-floating-ip-pools": "",
    "os_compute_api:os-floating-ips": "",
    "os_compute_api:os-floating-ips-bulk": "",
    "os_compute_api:os-fping": "",
    "os_compute_api:os-hide-server-addresses": "",
    "os_compute_api:image-size": "",
    "os_compute_api:os-instance-actions": "",
    "os_compute_api:os-instance-usage-audit-log": "",

    "os_compute_api:os-keypairs": "",
    "os_compute_api:os-lock-server:lock": "",
    "os_compute_api:os-lock-server:unlock": "",
    "os_compute_api:os-migrate-server:migrate": "",
    "os_compute_api:os-migrate-server:migrate_live": "",
    "os_compute_api:os-multinic": "",
    "os_compute_api:os-networks": "",
    "os_compute_api:os-networks:view": "",
    "os_compute_api:os-networks-associate": "",
    "os_compute_api:os-tenant-networks": "",
    "os_compute_api:os-pause-server:pause": "",
    "os_compute_api:os-pause-server:unpause": "",
    "os_compute_api:os-pci:pci_servers": "",
    "os_compute_api:os-pci:index": "",
    "os_compute_api:os-pci:detail": "",
    "os_compute_api:os-pci:show": "",
    "os_compute_api:os-quota-sets:show": "",
    "os_compute_api:os-quota-sets:update": "",
    "os_compute_api:os-quota-sets:delete": "",
    "os_compute_api:os-quota-sets:detail": "",
    "os_compute_api:os-quota-sets:defaults": "",
    "os_compute_api:os-quota-class-sets:update": "",
    "os_compute_api:os-quota-class-sets:show": "",
    "os_compute_api:os-rescue": "",
    "os_compute_api:os-security-group-default-rules": "",
    "os_compute_api:os-security-groups": "",
    "os_compute_api:os-server-diagnostics": "",
    "os_compute_api:os-server-password": "",
    "os_compute_api:os-server-tags:index": "",
    "os_compute_api:os-server-tags:show": "",
    "os_compute_api:os-server-tags:update": "",
    "os_compute_api:os-server-tags:update_all": "",
    "os_compute_api:os-server-tags:delete": "",
    "os_compute_api:os-server-tags:delete_all": "",
    "os_compute_api:os-server-usage": "",
    "os_compute_api:os-server-groups": "",
    "os_compute_api:os-services": "",
    "os_compute_api:os-shelve:shelve": "",
    "os_compute_api:os-shelve:shelve_offload": "",
    "os_compute_api:os-simple-tenant-usage:show": "",
    "os_compute_api:os-simple-tenant-usage:list": "",
    "os_compute_api:os-shelve:unshelve": "",
    "os_compute_api:os-suspend-server:suspend": "",
    "os_compute_api:os-suspend-server:resume": "",
    "os_compute_api:os-virtual-interfaces": "",
    "os_compute_api:os-volumes": "",
    "os_compute_api:os-volumes-attachments:index": "",
    "os_compute_api:os-volumes-attachments:show": "",
    "os_compute_api:os-volumes-attachments:create": "",
    "os_compute_api:os-volumes-attachments:update": "",
    "os_compute_api:os-volumes-attachments:delete": "",
    "os_compute_api:os-availability-zone:list": "",
    "os_compute_api:os-availability-zone:detail": "",
    "os_compute_api:limits": "",
    "os_compute_api:os-assisted-volume-snapshots:create": "",
    "os_compute_api:os-assisted-volume-snapshots:delete": "",
    "os_compute_api:server-metadata:create": "",
    "os_compute_api:server-metadata:update": "",
    "os_compute_api:server-metadata:update_all": "",
    "os_compute_api:server-metadata:delete": "",
    "os_compute_api:server-metadata:show": "",
    "os_compute_api:server-metadata:index": ""
}
"""


text:
use unicase::UniCase;

header! {
    /// `Access-Control-Request-Headers` header, part of
    /// [CORS](http://www.w3.org/TR/cors/#access-control-request-headers-request-header)
    ///
    /// The `Access-Control-Request-Headers` header indicates which headers will
    /// be used in the actual request as part of the preflight request.
    /// during the actual request.
    ///
    /// # ABNF
    /// ```plain
    /// Access-Control-Allow-Headers: "Access-Control-Allow-Headers" ":" #field-name
    /// ```
    ///
    /// # Example values
    /// * `accept-language, date`
    ///
    /// # Examples
    /// ```
    /// # extern crate hyper;
    /// # extern crate unicase;
    /// # fn main() {
    /// // extern crate unicase;
    ///
    /// use hyper::header::{Headers, AccessControlRequestHeaders};
    /// use unicase::UniCase;
    ///
    /// let mut headers = Headers::new();
    /// headers.set(
    ///     AccessControlRequestHeaders(vec![UniCase("date".to_owned())])
    /// );
    /// # }
    /// ```
    /// ```
    /// # extern crate hyper;
    /// # extern crate unicase;
    /// # fn main() {
    /// // extern crate unicase;
    ///
    /// use hyper::header::{Headers, AccessControlRequestHeaders};
    /// use unicase::UniCase;
    ///
    /// let mut headers = Headers::new();
    /// headers.set(
    ///     AccessControlRequestHeaders(vec![
    ///         UniCase("accept-language".to_owned()),
    ///         UniCase("date".to_owned()),
    ///     ])
    /// );
    /// # }
    /// ```
    (AccessControlRequestHeaders, "Access-Control-Request-Headers") => (UniCase<String>)*

    test_access_control_request_headers {
        test_header!(test1, vec![b"accept-language, date"]);
    }
}


text:
package org.spongepowered.api.world.extent.worker.procedure;

import org.spongepowered.api.world.extent.UnmodifiableBiomeVolume;

/**
 * Reduces a biome given as its volume and coordinates into the ongoing
 * reduction.
 */
@FunctionalInterface
public interface BiomeVolumeReducer<T> {

    /**
     * Reduces a biome given as its volume and coordinates into the ongoing
     * reduction.
     *
     * @param volume The volume containing the biome
     * @param x The x coordinate of the biome
     * @param y The y coordinate of the biome
     * @param z The z coordinate of the biome
     * @param reduction The ongoing reduction
     * @return The new reduction
     */
    T reduce(UnmodifiableBiomeVolume volume, int x, int y, int z, T reduction);

}


text:
"use strict";
import restify = require("restify");
import Q = require("q");
import { IRoute } from "./route";
import { DataAccessLayer } from "../data_access_layer";
import { SchemaModels } from "../schemas";
import { CourseParser } from "./course_parser";

type IUser = SchemaModels.IUser;
type IGrade = Models.IGrade;

export class Homework implements IRoute {

    public handleRequest(req: restify.Request,
                         res: restify.Response,
                         next: restify.Next): void {
        let courseName = req.params.shortCourseName;
        let homeworkName = req.body.name;
        let homeworkSolution = req.body.solution;
        // Find the checker for this homework
        let course = CourseParser.instance.getDetailedInfo(courseName);
        let homework: Models.IHomework = null;
        for (let availableHomework of course.availableHomeworks) {
            if (availableHomework.title === homeworkName) {
                homework = availableHomework;
            }
        }
        let now = Date.now();
        if (!homework || now > homework.endDate.getTime()) {
            res.send(400, "No such homework is currently available.");
            return;
        }
        let checker = CourseParser.instance.findChecker(homework.checker);
        let result = checker(homeworkName, homeworkSolution);

        let sendResults = () => res.send(200);
        let sendError = () => res.send(500, "An unknown error ocurred");
        let user: IUser = (req as any).user;
        this.addResult(user, courseName, result).done(sendResults, sendError);
    }

    private addResult(user: IUser, courseName: string, result: IGrade): any {
        let query = {
            course: courseName,
            user: user._id
        };
        let queryGrades = Q(SchemaModels.CourseData
                                        .findOne(query)
                                        .exec());
        return queryGrades.then(courseData => {
            if (!courseData) {
                courseData = new SchemaModels.CourseData({
                course: courseName,
                user: user._id,
                results: []
                });
            }
            let alreadyDoneHomework = false;
            for (let i = 0; i < courseData.results.length; i++) {
                if (courseData.results[i].source === result.source) {
                    courseData.results[i].grade = result.grade;
                    courseData.results[i].runningTime = result.runningTime;
                    courseData.results[i].max = result.max;
                    courseData.results[i].status = result.status;
                    alreadyDoneHomework = true;
                    break;
                }
            }
            if (!alreadyDoneHomework) {
                courseData.results.push(result);
            }
            return DataAccessLayer.saveAll([courseData]);
    });
    }
}


text:
#include "mbed.h"
#include "greentea-client/test_env.h"
#include "utest/utest.h"
#include "unity/unity.h"
#include "platform/Transaction.h"

using utest::v1::Case;

static void dummy_callback(int)
{
    /* do nothing. */
}

/** Test Transaction class - creation with initialisation
 *
 *  Given is Transaction class.
 *  When object of the Transaction class is created and initialised.
 *  Then get_object() returns object's instance for the transaction and get_transaction() returns the transaction.
 *
 */
template<typename Type>
void test_Transaction_init()
{
    Type object;
    const size_t tx_buffer_size = 24;
    const size_t rx_buffer_size = 16;
    const uint32_t event_id = 123;
    const uint8_t word_width = 8;
    unsigned char tx_buffer[tx_buffer_size];
    unsigned char rx_buffer[rx_buffer_size];
    const event_callback_t &callback = dummy_callback;
    transaction_t transaction_data =
    { tx_buffer, tx_buffer_size, rx_buffer, rx_buffer_size, event_id, callback, word_width };

    Transaction<Type> test_transaction(&object, transaction_data);

    TEST_ASSERT_EQUAL(&object, test_transaction.get_object());

    TEST_ASSERT_EQUAL((void *)tx_buffer, test_transaction.get_transaction()->tx_buffer);
    TEST_ASSERT_EQUAL((void *)rx_buffer, test_transaction.get_transaction()->rx_buffer);
    TEST_ASSERT_EQUAL(tx_buffer_size,   test_transaction.get_transaction()->tx_length);
    TEST_ASSERT_EQUAL(rx_buffer_size,   test_transaction.get_transaction()->rx_length);
    TEST_ASSERT_EQUAL(event_id,         test_transaction.get_transaction()->event);
    TEST_ASSERT_EQUAL(word_width,       test_transaction.get_transaction()->width);
#if MBED_CONF_PLATFORM_CALLBACK_COMPARABLE
    TEST_ASSERT_TRUE(callback == test_transaction.get_transaction()->callback);
#else
    TEST_ASSERT_FALSE(nullptr == test_transaction.get_transaction()->callback)
#endif
}

/** Test Transaction class - creation without initialisation
 *
 *  Given is Transaction class.
 *  When object of the Transaction class is created.
 *  Then this operation is successful.
 *
 */
template<typename Type>
void test_Transaction_empty()
{
    Type object;

    Transaction<Type> test_transaction;

    /* Just indicate successful execution of the test case. */
    TEST_ASSERT_TRUE(true);
}

utest::v1::status_t test_setup(const size_t number_of_cases)
{
    GREENTEA_SETUP(10, "default_auto");
    return utest::v1::verbose_test_setup_handler(number_of_cases);
}

Case cases[] = {
    Case("Test Transaction - init <Timer>", test_Transaction_init<Timer>),
    Case("Test Transaction - init <Ticker>", test_Transaction_init<Ticker>),
    Case("Test Transaction - no init <Timer>", test_Transaction_empty<Timer>),
    Case("Test Transaction - no init <Ticker>", test_Transaction_empty<Ticker>),
};

utest::v1::Specification specification(test_setup, cases);

int main()
{
    return !utest::v1::Harness::run(specification);
}


text:
import { fromJS } from 'immutable';

import * as constants from '../constants';
import createReducer from '../utils/createReducer';

const initialState = {
  loading: false,
  error: null,
  record: { }
};

export const config = createReducer(fromJS(initialState), { // eslint-disable-line import/prefer-default-export
  [constants.FETCH_CONFIGURATION_PENDING]: (state) =>
    state.merge({
      loading: true,
      record: { }
    }),
  [constants.FETCH_CONFIGURATION_REJECTED]: (state, action) =>
    state.merge({
      loading: false,
      error: `An error occured while loading the configuration: ${action.errorMessage}`
    }),
  [constants.FETCH_CONFIGURATION_FULFILLED]: (state, action) => {
    const { data } = action.payload;
    return state.merge({
      loading: false,
      record: fromJS(data)
    });
  }
});


text:
import React from "react"
import ReactDOM from "react-dom"
import { buildClientApp } from "reaction/Artsy/Router/client"
import { getAppRoutes } from "reaction/Apps/getAppRoutes"
import { data as sd } from "sharify"
import { artworkClient } from "./apps/artwork/artworkClient"
import { artistClient } from "./apps/artist/artistClient"
import { loadableReady } from "@loadable/component"

const mediator = require("desktop/lib/mediator.coffee")

buildClientApp({
  routes: getAppRoutes(),
  context: {
    EXPERIMENTAL_APP_SHELL: true,
    user: sd.CURRENT_USER,
    mediator,
  } as any,
})
  .then(({ ClientApp }) => {
    /**
     * Mount route-specific client code here
     */
    const mountClientAppSupport = () => {
      artistClient()
      artworkClient()
    }

    loadableReady(() => {
      mountClientAppSupport()

      /**
       * Render app
       */
      ReactDOM.hydrate(
        <ClientApp />,
        document.getElementById("react-root"),
        () => {
          const pageType = window.location.pathname.split("/")[1]

          if (pageType === "search") {
            document.getElementById("loading-container").remove()
            document.getElementById("search-page-header").remove()
          }
        }
      )
    })
  })
  .catch(error => {
    console.error(error)
  })

if (module.hot) {
  module.hot.accept()
}


text:
package id3v2_test

import (
	"fmt"
	"io/ioutil"
	"log"
	"math/big"
	"os"
	"sync"

	"github.com/bogem/id3v2"
)

func Example() {
	// Open file and parse tag in it.
	tag, err := id3v2.Open("file.mp3", id3v2.Options{Parse: true})
	if err != nil {
		log.Fatal("Error while opening mp3 file: ", err)
	}
	defer tag.Close()

	// Read frames.
	fmt.Println(tag.Artist())
	fmt.Println(tag.Title())

	// Set simple text frames.
	tag.SetArtist("Artist")
	tag.SetTitle("Title")

	// Set comment frame.
	comment := id3v2.CommentFrame{
		Encoding:    id3v2.EncodingUTF8,
		Language:    "eng",
		Description: "My opinion",
		Text:        "Very good song",
	}
	tag.AddCommentFrame(comment)

	// Write tag to file.
	if err = tag.Save(); err != nil {
		log.Fatal("Error while saving a tag: ", err)
	}
}

func Example_concurrent() {
	tagPool := sync.Pool{New: func() interface{} { return id3v2.NewEmptyTag() }}

	var wg sync.WaitGroup
	wg.Add(100)
	for i := 0; i < 100; i++ {
		go func() {
			defer wg.Done()

			tag := tagPool.Get().(*id3v2.Tag)
			defer tagPool.Put(tag)

			file, err := os.Open("file.mp3")
			if err != nil {
				log.Fatal("Error while opening file:", err)
			}
			defer file.Close()

			if err := tag.Reset(file, id3v2.Options{Parse: true}); err != nil {
				log.Fatal("Error while reseting tag to file:", err)
			}

			fmt.Println(tag.Artist() + " - " + tag.Title())
		}()
	}
	wg.Wait()
}

func ExampleTag_AddAttachedPicture() {
	tag, err := id3v2.Open("file.mp3", id3v2.Options{Parse: true})
	if tag == nil || err != nil {
		log.Fatal("Error while opening mp3 file: ", err)
	}

	artwork, err := ioutil.ReadFile("artwork.jpg")
	if err != nil {
		log.Fatal("Error while reading artwork file", err)
	}

	pic := id3v2.PictureFrame{
		Encoding:    id3v2.EncodingUTF8,
		MimeType:    "image/jpeg",
		PictureType: id3v2.PTFrontCover,
		Description: "Front cover",
		Picture:     artwork,
	}
	tag.AddAttachedPicture(pic)
}

func ExampleTag_AddCommentFrame() {
	tag, err := id3v2.Open("file.mp3", id3v2.Options{Parse: true})
	if tag == nil || err != nil {
		log.Fatal("Error while opening mp3 file: ", err)
	}

	comment := id3v2.CommentFrame{
		Encoding:    id3v2.EncodingUTF8,
		Language:    "eng",
		Description: "My opinion",
		Text:        "Very good song",
	}
	tag.AddCommentFrame(comment)
}

func ExampleTag_AddUnsynchronisedLyricsFrame() {
	tag, err := id3v2.Open("file.mp3", id3v2.Options{Parse: true})
	if tag == nil || err != nil {
		log.Fatal("Error while opening mp3 file: ", err)
	}

	uslt := id3v2.UnsynchronisedLyricsFrame{
		Encoding:          id3v2.EncodingUTF8,
		Language:          "ger",
		ContentDescriptor: "Deutsche Nationalhymne",
		Lyrics:            "Einigkeit und Recht und Freiheit...",
	}
	tag.AddUnsynchronisedLyricsFrame(uslt)
}

func ExampleTag_GetFrames() {
	tag, err := id3v2.Open("file.mp3", id3v2.Options{Parse: true})
	if tag == nil || err != nil {
		log.Fatal("Error while opening mp3 file: ", err)
	}

	pictures := tag.GetFrames(tag.CommonID("Attached picture"))
	for _, f := range pictures {
		pic, ok := f.(id3v2.PictureFrame)
		if !ok {
			log.Fatal("Couldn't assert picture frame")
		}
		// Do something with picture frame.
		// For example, print description of picture frame:
		fmt.Println(pic.Description)
	}
}

func ExampleTag_GetLastFrame() {
	tag, err := id3v2.Open("file.mp3", id3v2.Options{Parse: true})
	if tag == nil || err != nil {
		log.Fatal("Error while opening mp3 file: ", err)
	}

	bpmFramer := tag.GetLastFrame(tag.CommonID("BPM"))
	if bpmFramer != nil {
		bpm, ok := bpmFramer.(id3v2.TextFrame)
		if !ok {
			log.Fatal("Couldn't assert bpm frame")
		}
		fmt.Println(bpm.Text)
	}
}

func ExampleCommentFrame_get() {
	tag, err := id3v2.Open("file.mp3", id3v2.Options{Parse: true})
	if tag == nil || err != nil {
		log.Fatal("Error while opening mp3 file: ", err)
	}

	comments := tag.GetFrames(tag.CommonID("Comments"))
	for _, f := range comments {
		comment, ok := f.(id3v2.CommentFrame)
		if !ok {
			log.Fatal("Couldn't assert comment frame")
		}

		// Do something with comment frame.
		// For example, print the text:
		fmt.Println(comment.Text)
	}
}

func ExampleCommentFrame_add() {
	tag := id3v2.NewEmptyTag()
	comment := id3v2.CommentFrame{
		Encoding:    id3v2.EncodingUTF8,
		Language:    "eng",
		Description: "My opinion",
		Text:        "Very good song",
	}
	tag.AddCommentFrame(comment)
}

func ExamplePictureFrame_get() {
	tag, err := id3v2.Open("file.mp3", id3v2.Options{Parse: true})
	if tag == nil || err != nil {
		log.Fatal("Error while opening mp3 file: ", err)
	}

	pictures := tag.GetFrames(tag.CommonID("Attached picture"))
	for _, f := range pictures {
		pic, ok := f.(id3v2.PictureFrame)
		if !ok {
			log.Fatal("Couldn't assert picture frame")
		}

		// Do something with picture frame.
		// For example, print the description:
		fmt.Println(pic.Description)
	}
}

func ExamplePictureFrame_add() {
	tag := id3v2.NewEmptyTag()
	artwork, err := ioutil.ReadFile("artwork.jpg")
	if err != nil {
		log.Fatal("Error while reading artwork file", err)
	}

	pic := id3v2.PictureFrame{
		Encoding:    id3v2.EncodingUTF8,
		MimeType:    "image/jpeg",
		PictureType: id3v2.PTFrontCover,
		Description: "Front cover",
		Picture:     artwork,
	}
	tag.AddAttachedPicture(pic)
}

func ExampleTextFrame_get() {
	tag, err := id3v2.Open("file.mp3", id3v2.Options{Parse: true})
	if tag == nil || err != nil {
		log.Fatal("Error while opening mp3 file: ", err)
	}

	tf := tag.GetTextFrame(tag.CommonID("Mood"))
	fmt.Println(tf.Text)
}

func ExampleTextFrame_add() {
	tag := id3v2.NewEmptyTag()
	textFrame := id3v2.TextFrame{
		Encoding: id3v2.EncodingUTF8,
		Text:     "Happy",
	}
	tag.AddFrame(tag.CommonID("Mood"), textFrame)
}

func ExampleUnsynchronisedLyricsFrame_get() {
	tag, err := id3v2.Open("file.mp3", id3v2.Options{Parse: true})
	if tag == nil || err != nil {
		log.Fatal("Error while opening mp3 file: ", err)
	}

	uslfs := tag.GetFrames(tag.CommonID("Unsynchronised lyrics/text transcription"))
	for _, f := range uslfs {
		uslf, ok := f.(id3v2.UnsynchronisedLyricsFrame)
		if !ok {
			log.Fatal("Couldn't assert USLT frame")
		}

		// Do something with USLT frame.
		// For example, print the lyrics:
		fmt.Println(uslf.Lyrics)
	}
}

func ExampleUnsynchronisedLyricsFrame_add() {
	tag := id3v2.NewEmptyTag()
	uslt := id3v2.UnsynchronisedLyricsFrame{
		Encoding:          id3v2.EncodingUTF8,
		Language:          "ger",
		ContentDescriptor: "Deutsche Nationalhymne",
		Lyrics:            "Einigkeit und Recht und Freiheit...",
	}
	tag.AddUnsynchronisedLyricsFrame(uslt)
}

func ExamplePopularimeterFrame_add() {
	tag := id3v2.NewEmptyTag()

	popmFrame := id3v2.PopularimeterFrame{
		Email:   "foo@bar.com",
		Rating:  128,
		Counter: big.NewInt(10000000000000000),
	}
	tag.AddFrame(tag.CommonID("Popularimeter"), popmFrame)
}

func ExamplePopularimeterFrame_get() {
	tag, err := id3v2.Open("file.mp3", id3v2.Options{Parse: true})
	if tag == nil || err != nil {
		log.Fatal("Error while opening mp3 file: ", err)
	}

	f := tag.GetLastFrame(tag.CommonID("Popularimeter"))
	popm, ok := f.(id3v2.PopularimeterFrame)
	if !ok {
		log.Fatal("Couldn't assert POPM frame")
	}

	// do something with POPM Frame
	fmt.Printf("Email: %s, Rating: %d, Counter: %d", popm.Email, popm.Rating, popm.Counter)
}


text:
<?php

namespace EspaceMembers\MainBundle\Behat;

use Behat\Gherkin\Node\PyStringNode;
use Behat\Gherkin\Node\TableNode;
use Behat\Mink\Driver\BrowserKitDriver;
use Behat\Mink\Exception\ElementNotFoundException;

use Symfony\Component\BrowserKit\Cookie;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;

/**
 * WebContext
 *
 * @author Stepanenko Stanislav <dsazztazz@gmail.com>
 */
/**
 * Defines application features from the specific context.
 */
class WebContext extends DefaultContext
{
    /**
     * @Given /^I am logged in as "([^"]*)" with password "([^"]*)"$/
     */
    public function iAmLoggedInAsWithPassword($username, $password)
    {
        $this->visit('/login');
        $this->fillField('username', $username);
        $this->fillField('password', $password);
        $this->pressButton('Login');
    }

    /**
     * @Given /^I am authenticated as "([^"]*)"$/
     */
    public function iAmAuthenticatedAs($username)
    {
        $driver = $this->getSession()->getDriver();
        if (!$driver instanceof BrowserKitDriver) {
            throw new UnsupportedDriverActionException('This step is only supported by the BrowserKitDriver');
        }

        $client = $driver->getClient();
        $client->getCookieJar()->set(new Cookie(session_name(), true));

        $session = $client->getContainer()->get('session');

        $user = $this->getService('fos_user.user_manager')->findUserByUsername($username);
        $providerKey = $this->getContainer()->getParameter('fos_user.firewall_name');

        $token = new UsernamePasswordToken($user, null, $providerKey, $user->getRoles());
        $session->set('_security_'.$providerKey, serialize($token));
        $session->save();

        $cookie = new Cookie($session->getName(), $session->getId());
        $client->getCookieJar()->set($cookie);
    }

    /**
     * @When /^(?:|I )wait (\d+) seconds?$/
     */
    public function waitSeconds($seconds)
    {
        $this->getSession()->wait(1000*$seconds);
    }

    /**
     * Click on the element with the provided CSS Selector
     *
     * @When /^I click on the element "([^"]*)"$/
     */
    public function iClickOnTheElement($cssSelector)
    {
        $element = $this->getSession()->getPage()->find('css', $cssSelector);

        if (null === $element) {
            throw new \InvalidArgumentException(sprintf('Could not evaluate CSS Selector: "%s"', $cssSelector));
        }

        $element->click();
    }

    /**
     * Check that the element contains a class
     *
     * @Then /^the "(?P<cssSelector>(?:[^"]|\\")*)" element should has class "(?P<class>(?:[^"]|\\")*)"$/
     */
    public function theElementShouldHasClass($cssSelector, $class)
    {
        $element = $this->getSession()->getPage()->find('css', $cssSelector);

        if (null === $element) {
            throw new ElementNotFoundException($this->getSession(), 'link', 'class', $cssSelector);
        }

        //TODO: Download Selenium 2.45 because method hasClass not works in current version
        //if (!$element->hasClass($class)) {
            //throw new \Exception(sprintf('Could not find %s class in element: "%s"', $class, $cssSelector));
        //}
    }
}


text: <!DOCTYPE>


text:
**Revenj** in Scala supports Postgres database.
Since Revenj understands advanced Postgres features, it can be used as [document-like database](https://en.wikipedia.org/wiki/Object-relational_database), but with types.
Mono/.NET is still required during development since DSL compiler is used for creating SQL migration and for creating Scala files.
This setup will explain how to setup a simple project with [DSL](http://c2.com/cgi/wiki?DomainSpecificLanguage) model running on top of Postgres through [Akka](http://akka.io), in a [REST-like](http://c2.com/cgi/wiki?RestArchitecturalStyle) style.

For setup we will need:

 * Mono/.NET on path - on Linux Mono usually comes with distribution and can be installed with apt-get install mono-complete; for Mac installer can be downloaded through [official webiste](http://www.mono-project.com/download/)
 * Postgres 9.1+ - [Postgres](http://www.postgresql.org/) for persistence
 * SBT - plus DSL Platform plugin for SBT
 * Revenj - we will configure our dependencies in SBT
 * DSL model - we will write DSL model example

### DSL model

Before we can use our REST endpoint we need to write some model which will be exposed through HTTP. While Revenj can be used in purely relational style, in practice most models are object-relational combination. [Wikipedia](https://en.wikipedia.org/wiki/JSON) page about JSON has a simple example which we will replicate here.

JSON document looks like:

    {
      "firstName": "John",
      "lastName": "Smith",
      "isAlive": true,
      "age": 25,
      "address": {
        "streetAddress": "21 2nd Street",
        "city": "New York",
        "state": "NY",
        "postalCode": "10021-3100"
      },
      "phoneNumbers": [
        {
          "type": "home",
          "number": "212 555-1234"
        },
        {
          "type": "office",
          "number": "646 555-4567"
        },
        {
          "type": "mobile",
          "number": "123 456-7890"
        }
      ],
      "children": [],
      "spouse": null
    }

which can be roughly translated into similar DSL:

    module cms {
      aggregate Person {
        String firstName;
        String lastName;
        Boolean isAlive;
        Int age;
        Address address;
        List<PhoneNumber> phoneNumbers;
        List<Person> *children;
        Person? *spouse;
      }
      value Address {
        String streetAddress;
        String city;
        String(2)? state;
        String(40) postalCode;
      }
      enum PhoneType {
        home;
        office;
        mobile;
      }
      value PhoneNumber {
        PhoneType type;
        String(20) number;
      }
    }

while this is will result in slightly different JSON (due some extra fields) it replicates the intent of the original model and it shows off several features which we can utilize during modeling:

 * Enum concept can be used to enumerate types
 * Value concept can be used to group several properties under an object which will be translated to an embedded type in database. This means it will not have its own table, but rather will live under some other table as a column or a property in some other column.
 * References to other aggregates - when referencing other aggregates a pointer (`*`) must be used.
 * Self references

### Setting up the SBT project

To setup a minimalistic SBT project we need several sbt files:

    build.sbt
    project/plugins.sbt

Plugins file is used to bring in the SBT DSL plugin so we can use it inside SBT. Plugins file should contain a line:

    addSbtPlugin("com.dslplatform" % "sbt-dsl-platform" % "0.8.1")

Which will allow the usage of some dsl* tasks within SBT after we enable it in build.sbt which should end up looking like:

    import com.dslplatform.compiler.client.parameters.{Settings => DslSettings}
    import com.dslplatform.compiler.client.parameters.Targets.{Option => DslTarget}
    import com.dslplatform.sbt.SbtDslPlatformPlugin.autoImport.{dsl => revenj}

    name := "revenj-sbt-example"
    version := "1.0"
    scalaVersion := "2.13.4"

    enablePlugins(SbtDslPlatformPlugin)

    libraryDependencies += "net.revenj" %% "revenj-akka" % "1.1.1"

    Compile/revenj/dslNamespace := "example"
    Compile/revenj/dslSources += (DslTarget.REVENJ_SCALA -> sourceManaged.value / "main")
    Compile/revenj/dslPostgres := "127.0.0.1:5432/revenj_sbt?user=revenj&password=revenj"
    Compile/revenj/dslApplyMigration := true
    Compile/revenj/dslSettings ++= Seq(DslSettings.Option.JACKSON)
    Compile/revenj/dslResourcePath := Some((Compile/revenj/resourceDirectory).value / "META-INF" / "services")
    Compile/revenj/dslForce := true

This setup will configure DSL compiler so that:

 * base namespace for generated Scala files is `example`. For our `Person` object full name will be `example.cms.Person` as combination of both namespace, module and name
 * DSL managed sources will be created for REVENJ_SCALA target in source managed folder
 * Postgres database named `revenj_sbt` on localhost gets used and managed by SBT. Due to `dslApplyMigration` set to true it will also get migrated after a `dslMigrate` task is executed.
 * additional code is generated so [Jackson library](https://github.com/FasterXML/jackson-module-scala) can be used. Jackson is not often used in Scala projects due to problems with type system and primitives. But DSL compiler will inject additional boilerplate in the generated code so that such issues are mitigated.
 * force will simplify some operations by skipping on confirmations. Ideally it should not be used in real world projects

By default dsl settings for path to DSL will point to `dsl` folder. Unless we want to change it with `dslDslPath` we can put our cms dsl there. Our sources will be compiled along normal compilation process.
Output should look something along the lines of:

    > compile
    [info] Found 1 DSL files
    [info] Re-compiling DSL files...
    [info] Checking for latest compiler version due to download option
    [info] dsl-compiler.exe at latest version (2020-09-29)
    [info] Creating the source took 4 second(s)
    [info] Source for revenj.scala created in /home/revenj/revenj-sbt-example/target/scala-2.13/src_managed/main
    [success] Total time: 12 s, completed 13.01.2021. 19:38:53

We also need to prepare database via `dsl::dslMigrate` task. If our DB user is a superuser we can create the DB through SBT.
Output should look something along the lines of:

    > dsl::dslMigrate
    [info] Checking for latest compiler version due to download option
    [info] dsl-compiler.exe at latest version (2020-09-29)
    [info] Creating SQL migration for Postgres ...
    [info] Running the migration took 4 second(s)
    [info] Migration saved to /home/revenj/revenj-sbt-example/sql/postgres-sql-migration-1610563274597.sql
    [info] New object Person will be created in schema cms
    [info] New property ID will be created for Person in cms
    [info] New property firstName will be created for Person in cms
    [info] New property lastName will be created for Person in cms
    [info] New property isAlive will be created for Person in cms
    [info] New property age will be created for Person in cms
    [info] New property address will be created for Person in cms
    [info] New property phoneNumbers will be created for Person in cms
    [info] New property spouseID will be created for Person in cms
    [info] New object Address will be created in schema cms
    [info] New property streetAddress will be created for Address in cms
    [info] New property city will be created for Address in cms
    [info] New property state will be created for Address in cms
    [info] New property postalCode will be created for Address in cms
    [info] New object PhoneType will be created in schema cms
    [info] New enum label home will be added to enum object PhoneType in schema cms
    [info] New enum label office will be added to enum object PhoneType in schema cms
    [info] New enum label mobile will be added to enum object PhoneType in schema cms
    [info] New object PhoneNumber will be created in schema cms
    [info] New property type will be created for PhoneNumber in cms
    [info] New property number will be created for PhoneNumber in cms
    [info] Applying migration...
    [info] Database migrated and script renamed to: applied-postgres-sql-migration-1610563274597.sql
    [success] Total time: 5 s, completed 13.01.2021. 19:41:14

Created SQL migration will contain a lot of boilerplate but it will prepare DB in such a way so it can be used in an object-relational way.

To finish setting up the SBT project we need two more things:

 * startup object - entry point into the application which will spin up the server
 * resource configuration - to configure DB connection app will be using

`dslPostgres` setting is only used from SBT. The actual DB connection should be configured somewhere else, for example in resource folder using standard `application.conf` in `src/main/resources`.
It needs to contain url to the DB:

    revenj {
      jdbcUrl = "jdbc:postgresql://127.0.0.1:5432/revenj_sbt?user=revenj&password=revenj"
    }

Which in this case is same as the one in `dslPostgres`.

An example entry point to the application can be set up such as `Startup.scala` in `src/main/scala`:

    import net.revenj.server.WebServer

    object Startup {
      def main(args: Array[String]): Unit = {
        WebServer.start("localhost", 8080)
      }
    }

Before we can start the app we need to setup modules which will be used. This is autowired by default via services which can be managed through `dsl::dslResource`. Resources should be added to `META-INF/services` path.

Now we can start our app via `run` task in SBT. Output should look like:

    > run
    [info] Found 1 DSL files
    [info] Running Startup
    Starting server at http://localhost:8080 ...
    Started server at http://localhost:8080

Now we can access Revenj urls via browser, eg: http://localhost:8080/Domain.svc/search/cms.Person which should list an empty JSON list.
New person can be added through `POST` command on URL:

    http://localhost:8080/Crud.svc/cms.Person

with content such as JSON from the example above which will insert an new person in the DB.

we should get a response from server giving out surrogate ID created for the person.
Now our previous search command should return an value in the list.

Same project can be found in the [repository](/tutorials/sbt/)


text:
This is a simple microservices example that uses Node.js + Express to provide a simple Product Quantities Service for tracking onhand inventories of products. Docker support is included for running locally or deploying to services such as [Cloud66](https://www.cloud66.com)

__Note:__ This isn't production-ready code. The service assumes no Mongo username/password, doesn't force SSL, or enforce security best practices. This is for demonstration and learning purposes only.

# Running locally

Install the required dependencies:

> npm install

Set an environment variable to point to the location of your MongoDB instance (e.g. 127.0.0.01 for localhost, or the specific IP/hostname if not localhost)

> export MONGODB_ADDRESS=127.0.0.1

Run Express:

> npm start

# Running locally using Docker

Use docker-compose to build the service and mongodb containers (takes a few minutes the first time):

> docker-compose build

Then start the the containers:

> docker-compose up

# Deploying to Cloud66

Cloud66 is a Manager Containers as a Service that supports deploying Docker containers onto one or more servers using a bring-your-own-cloud approach.

TODO

# Interacting with the Products Service

Use [Postman](https://www.getpostman.com) or [cURL](https://curl.haxx.se/) to directly interact with the API.

Create/update a product's onhand quantity, given the product identifier of 12345:

> curl -X PUT http://127.0.0.1:8080/product_quantities/12345 -d "quantity_onhand=15"

```
{
  "product_id": "12345",
  "quantity_onhand": 15,
  "created_at": "2016-04-11T16:43:29.000Z",
  "_links": {
    "self": {
      "href": "/product_quantities/12345"
    }
  }
}
```

(make the same PUT call to update the onhand quantity at a later time)

Get the current onhand quantity for a product with the identifier 12345:

> curl -X GET http://127.0.0.1:8080/product_quantities/12345

```
{
  "product_id": "12345",
  "quantity_onhand": 15,
  "created_at": "2016-04-11T16:43:29.000Z",
  "_links": {
    "self": {
      "href": "/product_quantities/12345"
    }
  }
}
```


text:
SEQAN_BEGIN_TESTSUITE(test_basic_alphabet)
{
    // -----------------------------------------------------------------------
    // Test Math Functions
    // -----------------------------------------------------------------------

    SEQAN_CALL_TEST(test_basic_alphabet_math_metafunctions);
    SEQAN_CALL_TEST(test_basic_alphabet_math_min_value);
    SEQAN_CALL_TEST(test_basic_alphabet_math_max_value);

    // -----------------------------------------------------------------------
    // Test Adaptions of Builtin Types
    // -----------------------------------------------------------------------

    SEQAN_CALL_TEST(test_basic_alphabet_adapt_builtins_metafunction_is_char_type);
    SEQAN_CALL_TEST(test_basic_alphabet_adapt_builtins_concepts_bool);
    SEQAN_CALL_TEST(test_basic_alphabet_adapt_builtins_concepts_char);
    SEQAN_CALL_TEST(test_basic_alphabet_adapt_builtins_concepts_short);
    SEQAN_CALL_TEST(test_basic_alphabet_adapt_builtins_concepts_int);
    SEQAN_CALL_TEST(test_basic_alphabet_adapt_builtins_concepts_long);
    SEQAN_CALL_TEST(test_basic_alphabet_adapt_builtins_concepts_int8);
    SEQAN_CALL_TEST(test_basic_alphabet_adapt_builtins_concepts_uint8);
    SEQAN_CALL_TEST(test_basic_alphabet_adapt_builtins_concepts_int16);
    SEQAN_CALL_TEST(test_basic_alphabet_adapt_builtins_concepts_uint16);
    SEQAN_CALL_TEST(test_basic_alphabet_adapt_builtins_concepts_int32);
    SEQAN_CALL_TEST(test_basic_alphabet_adapt_builtins_concepts_uint32);
    SEQAN_CALL_TEST(test_basic_alphabet_adapt_builtins_concepts_int64);
    SEQAN_CALL_TEST(test_basic_alphabet_adapt_builtins_concepts_uint64);
    SEQAN_CALL_TEST(test_basic_alphabet_adapt_builtins_concepts_float);
    SEQAN_CALL_TEST(test_basic_alphabet_adapt_builtins_concepts_double);

    // -----------------------------------------------------------------------
    // Test Alphabet With Qualities
    // -----------------------------------------------------------------------

    SEQAN_CALL_TEST(test_basic_alphabet_qualities_quality_value_size_metafunction);
    SEQAN_CALL_TEST(test_basic_alphabet_qualities_quality_has_qualities_metafunction);
    SEQAN_CALL_TEST(test_basic_alphabet_qualities_convert_quality);

    // -----------------------------------------------------------------------
    // Test Bio Alphabet Features
    // -----------------------------------------------------------------------

    SEQAN_CALL_TEST(test_basic_alphabet_bio_gap_value_function);
    SEQAN_CALL_TEST(test_basic_alphabet_bio_unknown_value_function);

    // -----------------------------------------------------------------------
    // Test Alphabet Storage Code
    // -----------------------------------------------------------------------

    SEQAN_CALL_TEST(test_basic_alphabet_storage_bits_per_value_metafunction);
    SEQAN_CALL_TEST(test_basic_alphabet_storage_value_size_metafunction);
    SEQAN_CALL_TEST(test_basic_alphabet_storage_value_size_function);
    SEQAN_CALL_TEST(test_basic_alphabet_storage_integral_for_value_metafunction);
    SEQAN_CALL_TEST(test_basic_alphabet_storage_bytes_per_value_metafunction);

    // -----------------------------------------------------------------------
    // Test SimpleType
    // -----------------------------------------------------------------------

    // We test this implicitely through the residue types.

    // -----------------------------------------------------------------------
    // Test Residues (SimpleType Specializations)
    // -----------------------------------------------------------------------

    SEQAN_CALL_TEST(test_basic_alphabet_residue_metafunctions_dna);
    SEQAN_CALL_TEST(test_basic_alphabet_residue_metafunctions_dna5);
    SEQAN_CALL_TEST(test_basic_alphabet_residue_metafunctions_dna_q);
    SEQAN_CALL_TEST(test_basic_alphabet_residue_metafunctions_dna5_q);
    SEQAN_CALL_TEST(test_basic_alphabet_residue_metafunctions_rna);
    SEQAN_CALL_TEST(test_basic_alphabet_residue_metafunctions_rna5);
    SEQAN_CALL_TEST(test_basic_alphabet_residue_metafunctions_iupac);
    SEQAN_CALL_TEST(test_basic_alphabet_residue_metafunctions_amino_acid);

    SEQAN_CALL_TEST(test_basic_alphabet_residue_usage_dna);
    SEQAN_CALL_TEST(test_basic_alphabet_residue_usage_dna5);
    SEQAN_CALL_TEST(test_basic_alphabet_residue_usage_dna_q);
    SEQAN_CALL_TEST(test_basic_alphabet_residue_usage_dna5_q);
    SEQAN_CALL_TEST(test_basic_alphabet_residue_usage_rna);
    SEQAN_CALL_TEST(test_basic_alphabet_residue_usage_rna5);
    SEQAN_CALL_TEST(test_basic_alphabet_residue_usage_iupac);
    SEQAN_CALL_TEST(test_basic_alphabet_residue_usage_amino_acid);

    // -----------------------------------------------------------------------
    // Test ProfileChar
    // -----------------------------------------------------------------------

    SEQAN_CALL_TEST(test_basic_alphabet_profile_metafunctions);
    SEQAN_CALL_TEST(test_basic_alphabet_profile_constructors);
    SEQAN_CALL_TEST(test_basic_alphabet_profile_relations);
    SEQAN_CALL_TEST(test_basic_alphabet_profile_empty);
}
SEQAN_END_TESTSUITE


text:
package org.dspace.app.xmlui.aspect.submission.submit;

import java.io.IOException;
import java.sql.SQLException;
import java.util.Map;
import java.util.Set;

import org.apache.avalon.framework.parameters.Parameters;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.environment.SourceResolver;
import org.apache.log4j.Logger;
import org.dspace.app.util.SubmissionConfig;
import org.dspace.app.util.SubmissionStepConfig;
import org.dspace.app.xmlui.utils.UIException;
import org.dspace.app.xmlui.aspect.submission.AbstractStep;
import org.dspace.app.xmlui.aspect.submission.AbstractSubmissionStep;
import org.dspace.app.xmlui.aspect.submission.StepAndPage;
import org.dspace.app.xmlui.wing.Message;
import org.dspace.app.xmlui.wing.WingException;
import org.dspace.app.xmlui.wing.element.Body;
import org.dspace.app.xmlui.wing.element.Division;
import org.dspace.app.xmlui.wing.element.List;
import org.dspace.authorize.AuthorizeException;
import org.dspace.content.Collection;
import org.dspace.submit.step.UploadStep;
import org.xml.sax.SAXException;

/**
 * This is a step of the item submission processes. This is where the user
 * reviews everything they have entered about the item up to this point.
 *

 * This step is dynamic, since when using the Configurable Submission
 * it is unknown what steps are available and in what order.
 *

 * This step builds a form with which consists of a separate section
 * for each step which implements the "addReviewSection()" method
 * of AbstractSubmissionStep class.
 *
 * @author Scott Phillips
 * @author Tim Donohue (updated for Configurable Submission)
 */
public class ReviewStep extends AbstractSubmissionStep
{

	/** Language Strings **/
    protected static final Message T_head =
        message("xmlui.Submission.submit.ReviewStep.head");
    protected static final Message T_yes =
        message("xmlui.Submission.submit.ReviewStep.yes");
    protected static final Message T_no =
        message("xmlui.Submission.submit.ReviewStep.no");
    protected static final Message T_submit_jump =
        message("xmlui.Submission.submit.ReviewStep.submit_jump");
    protected static final Message T_no_metadata =
        message("xmlui.Submission.submit.ReviewStep.no_metadata");
    protected static final Message T_unknown =
        message("xmlui.Submission.submit.ReviewStep.unknown");
    protected static final Message T_known =
        message("xmlui.Submission.submit.ReviewStep.known");
    protected static final Message T_supported =
        message("xmlui.Submission.submit.ReviewStep.supported");

     /* The SourceResolver used to setup this class */
    private SourceResolver resolver;

    /* The source string used to setup this class */
    private String src;

    /** log4j logger */
    private static Logger log = Logger.getLogger(UploadStep.class);

	/**
	 * Establish our required parameters, abstractStep will enforce these.
	 */
	public ReviewStep()
	{
		this.requireSubmission = true;
		this.requireStep = true;
	}

    /**
     * Save these setup parameters, to use for loading up
     * the previous step's review information
     */
    public void setup(SourceResolver resolver, Map objectModel, String src, Parameters parameters)
    throws ProcessingException, SAXException, IOException
    {
        super.setup(resolver,objectModel,src,parameters);

        this.resolver = resolver;
        this.src = src;
    }

	public void addBody(Body body) throws SAXException, WingException,
	UIException, SQLException, IOException, AuthorizeException
	{
		// Get actionable URL
		Collection collection = submission.getCollection();
		String actionURL = contextPath + "/handle/"+collection.getHandle() + "/submit/" + knot.getId() + ".continue";

        SubmissionConfig subConfig = submissionInfo.getSubmissionConfig();

        //Part A:
        // Build the main Review Form!
        Division div = body.addInteractiveDivision("submit-upload", actionURL, Division.METHOD_POST, "primary submission");
        div.setHead(T_submission_head);
        addSubmissionProgressList(div);

        List review = div.addList("submit-review", List.TYPE_FORM);
        review.setHead(T_head);

        // Part B:
        // Add review section for each step

        //get a list of all pages in progress bar
        //(this is to ensure we are no looping through non-interactive steps)
        Set submissionPagesSet = submissionInfo.getProgressBarInfo().keySet();
        String[] submissionPages = (String[]) submissionPagesSet.toArray(new String[submissionPagesSet.size()]);

        //loop through each page in progress bar,
        //adding each as a separate section to the review form
        for(int i=0; i<submissionPages.length; i++)
        {
            StepAndPage currentStepAndPage = new StepAndPage(submissionPages[i]);

            //If the step we are looking at is this current
            // Review/Verify step, exit the for loop,
            // since we have completed all steps up to this one!
            if(currentStepAndPage.equals(this.stepAndPage))
            {
                break;
            }

            //load up step configuration
            SubmissionStepConfig stepConfig = subConfig.getStep(currentStepAndPage.getStep());

            //load the step's XML-UI Class
            AbstractStep stepUIClass = loadXMLUIClass(stepConfig.getXMLUIClassName());

            try
            {
                //initialize this class (with proper step parameter)
                parameters.setParameter("step", currentStepAndPage.toString());
                stepUIClass.setup(resolver, objectModel, src, parameters);
            }
            catch(Exception e)
            {
                throw new UIException("Unable to initialize AbstractStep identified by "
                                        + stepConfig.getXMLUIClassName() + ":", e);
            }

            //If this stepUIClass is not a value AbstractSubmissionStep,
            //we will be unable to display its review information!
            if(stepUIClass instanceof AbstractSubmissionStep)
            {
                //add the Review section for this step,
                //and return a reference to that newly created step section
                List stepSection = ((AbstractSubmissionStep) stepUIClass).addReviewSection(review);

                //as long as this step has something to review
                if(stepSection!=null)
                {
                    //add a Jump To button for this section
                    addJumpButton(stepSection, T_submit_jump, currentStepAndPage);
                }
            }
            else
            {
                //Log a warning that this step cannot be reviewed!
                log.warn("The Step represented by " + stepConfig.getXMLUIClassName() + " is not a valid AbstractSubmissionStep, so it cannot be reviewed during the ReviewStep!");
            }
        }

		// Part C:
        // add standard control/paging buttons
        addControlButtons(review);
	}

    /**
     * Each submission step must define its own information to be reviewed
     * during the final Review/Verify Step in the submission process.
     *

     * The information to review should be tacked onto the passed in
     * List object.
     *

     * NOTE: To remain consistent across all Steps, you should first
     * add a sub-List object (with this step's name as the heading),
     * by using a call to reviewList.addList().   This sublist is
     * the list you return from this method!
     *
     * @param reviewList
     *      The List to which all reviewable information should be added
     * @return
     *      The new sub-List object created by this step, which contains
     *      all the reviewable information.  If this step has nothing to
     *      review, then return null!
     */
    public List addReviewSection(List reviewList) throws SAXException,
        WingException, UIException, SQLException, IOException,
        AuthorizeException
    {
        //Review step cannot review itself :)
        return null;
    }

    /**
     * Loads the specified XML-UI class
     * which will generate the review information
     * for a given step
     *
     * @return AbstractStep which references
     *          the XML-UI Class
     */
    private AbstractStep loadXMLUIClass(String transformerClassName)
        throws UIException
    {
        try
        {
            //retrieve an instance of the transformer class
            ClassLoader loader = this.getClass().getClassLoader();
            Class stepClass = loader
                    .loadClass(transformerClassName);

            // this XML-UI class *must* be a valid AbstractStep,
            // or else we'll have problems here
            return (AbstractStep) stepClass
                        .newInstance();
        }
        catch(ClassNotFoundException cnfe)
        {
            //means that we couldn't find a class by the given name
            throw new UIException("Class Not Found: " + transformerClassName, cnfe);
        }
        catch(Exception e)
        {
            //means we couldn't instantiate the class as an AbstractStep
            throw new UIException("Unable to instantiate class " + transformerClassName + ". " +
                                          "Please make sure it extends org.dspace.app.xmlui.submission.AbstractSubmissionStep!", e);
        }
    }

}


text:
#ifndef IGRAPHICS_H
#define IGRAPHICS_H

#include "imodule.h"
#include "imath.h"

class Font;

typedef struct {
    unsigned int mat;
    unsigned int width;
    unsigned int height;
} Material;

class Color {
public:
    Color(char r = 255, char g = 255, char b = 255, char a = 255)
    : r(r), g(g), b(b), a(a) {};
    char r, g, b, a;
};

class IGraphicsModule : public IModule {
public:
    virtual void init( IModuleManager* modulemanager ) = 0;
    virtual void release() = 0;
    virtual void initDriver( short width, short height ) = 0;
    virtual void update() = 0;
    virtual bool isWindowOpen() = 0;

    virtual Material loadMaterial(const char *matName) = 0;
    virtual Material useMaterial(const char *matName) = 0;
    virtual Material useMaterial(unsigned int mat) = 0;

    virtual Font *loadFont(const char *fontFile, int size) = 0;
    virtual void drawText( Font *font, const char *text, Vector2Df pos ) = 0;

    virtual unsigned int useProgram(const char *programName) = 0;
    virtual unsigned int useProgram(unsigned int program) = 0;
    virtual void setProgramVar1f(unsigned int program, const char *var, float i) = 0;
    virtual void setProgramVar1i(unsigned int program, const char *var, int i) = 0;

    virtual void clear() = 0;

    virtual void setColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a = 255) = 0;

    virtual void drawQuad(float x, float y, float width, float height) = 0;
    virtual void drawQuadUV(float x, float y, float width, float height, float u1, float u2, float v1, float v2) = 0;

    virtual void setCursorVisible( bool visible ) = 0;
    virtual Vector2Df getCursorPos() = 0;

    virtual void pushScissor(bool enable, int x = 0, int y = 0, int width = 0, int height = 0, bool offset = false) = 0;
    virtual void popScissor() = 0;

    virtual short getWidth() = 0;
    virtual short getHeight() = 0;
};

extern IGraphicsModule *graphics;

#endif


text:
require 'test_helper'

module AsUser
  class AboutsControllerTest < ActionController::TestCase
    setup do
    end

    teardown do
    end

    test "should get index" do
      get :index
      assert_response :success
    end
  end
end


text:
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#ifndef SOCKETIO_H
#define SOCKETIO_H

#ifdef __cplusplus
extern "C" {
#include <cstddef>
#else
#include <stddef.h>
#endif /* __cplusplus */

#include "azure_c_shared_utility/xio.h"
#include "azure_c_shared_utility/xlogging.h"

typedef struct SOCKETIO_CONFIG_TAG
{
    const char* hostname;
    int port;
    void* accepted_socket;
} SOCKETIO_CONFIG;

extern CONCRETE_IO_HANDLE socketio_create(void* io_create_parameters, LOGGER_LOG logger_log);
extern void socketio_destroy(CONCRETE_IO_HANDLE socket_io);
extern int socketio_open(CONCRETE_IO_HANDLE socket_io, ON_IO_OPEN_COMPLETE on_io_open_complete, void* on_io_open_complete_context, ON_BYTES_RECEIVED on_bytes_received, void* on_bytes_received_context, ON_IO_ERROR on_io_error, void* on_io_error_context);
extern int socketio_close(CONCRETE_IO_HANDLE socket_io, ON_IO_CLOSE_COMPLETE on_io_close_complete, void* callback_context);
extern int socketio_send(CONCRETE_IO_HANDLE socket_io, const void* buffer, size_t size, ON_SEND_COMPLETE on_send_complete, void* callback_context);
extern void socketio_dowork(CONCRETE_IO_HANDLE socket_io);
extern int socketio_setoption(CONCRETE_IO_HANDLE socket_io, const char* optionName, const void* value);

extern const IO_INTERFACE_DESCRIPTION* socketio_get_interface_description(void);

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* SOCKETIO_H */


text:
@interface RappleViewControllerPresenter : NSObject <UIViewControllerAnimatedTransitioning>
@property (nonatomic, assign) RappleDirection direction;

-(instancetype)initWithDirection:(RappleDirection)direction;

@end


text:
#ifndef HTMLAudioElement_h
#define HTMLAudioElement_h

#include "core/CoreExport.h"
#include "core/html/HTMLMediaElement.h"

namespace blink {

class Document;

class CORE_EXPORT HTMLAudioElement final : public HTMLMediaElement {
  DEFINE_WRAPPERTYPEINFO();

 public:
  static HTMLAudioElement* create(Document&);
  static HTMLAudioElement* createForJSConstructor(Document&,
                                                  const AtomicString& src);

  bool isHTMLAudioElement() const override { return true; }

 private:
  HTMLAudioElement(Document&);
};

}  // namespace blink

#endif  // HTMLAudioElement_h


text:
copyright:
  years: 2015, 2017
lastupdated: "2017-03-09"

---

<!-- Attribute definitions -->
{:new_window: target="_blank"}
{:shortdesc: .shortdesc}
{:codeblock: .codeblock}
{:screen: .screen}
{:pre: .pre}

#Service requirements
{: #requirements}

##MQTT device message requirements

* The MQTT message broker must provide device messages in JSON format on one or more MQTT topics.
* The device messages can contain any number of attributes, but the following three attributes are always required:
	* An attribute that uniquely identifies the device.
	* An attribute that specifies the latitude of the current location of the device.
	* An attribute that specifies the longitude of the current location of the device.
* Two message modes are supported:
	* An MQTT message can contain a JSON object with information about a single device.
	* An MQTT message can contain a JSON array of objects with information about a set of devices.

##MQTT events and configuring the service

Your application subscribes to MQTT messages and controls {{site.data.keyword.geospatialshort_Geospatial}} through its [REST API](https://console.ng.bluemix.net/apidocs/246). The following actions are available through REST API calls:

* Configure and start the service.
* Add and remove geographic regions to monitor.
* Retrieve information about the service status and the set of regions currently defined.
* Stop the service.
* Restart an already configured service.


text:
/* jshint quotmark: false */
'use strict';

exports.type = 'perItem';

exports.active = true;

exports.description = 'converts style to attributes';

exports.params = {
    keepImportant: false
};

var stylingProps = require('./_collections').attrsGroups.presentation,
    rEscape = '\\\\(?:[0-9a-f]{1,6}\\s?|\\r\\n|.)',                 // Like \" or \2051. Code points consume one space.
    rAttr = '\\s*(' + g('[^:;\\\\]', rEscape) + '*?)\\s*',          // attribute name like 'fill'
    rSingleQuotes = "'(?:[^'\\n\\r\\\\]|" + rEscape + ")*?(?:'|$)", // string in single quotes: 'smth'
    rQuotes = '"(?:[^"\\n\\r\\\\]|' + rEscape + ')*?(?:"|$)',       // string in double quotes: "smth"
    rQuotedString = new RegExp('^' + g(rSingleQuotes, rQuotes) + '$'),

    // Parentheses, E.g.: url(data:image/png;base64,iVBO...).
    // ':' and ';' inside of it should be threated as is. (Just like in strings.)
    rParenthesis = '\\(' + g('[^\'"()\\\\]+', rEscape, rSingleQuotes, rQuotes) + '*?' + '\\)',

    // The value. It can have strings and parentheses (see above). Fallbacks to anything in case of unexpected input.
    rValue = '\\s*(' + g('[^!\'"();\\\\]+?', rEscape, rSingleQuotes, rQuotes, rParenthesis, '[^;]*?') + '*?' + ')',

    // End of declaration. Spaces outside of capturing groups help to do natural trimming.
    rDeclEnd = '\\s*(?:;\\s*|$)',

    // Important rule
    rImportant = '(\\s*!important(?![-(\w]))?',

    // Final RegExp to parse CSS declarations.
    regDeclarationBlock = new RegExp(rAttr + ':' + rValue + rImportant + rDeclEnd, 'ig'),

    // Comments expression. Honors escape sequences and strings.
    regStripComments = new RegExp(g(rEscape, rSingleQuotes, rQuotes, '/\\*[^]*?\\*/'), 'ig');

/**
 * Convert style in attributes. Cleanups comments and illegal declarations (without colon) as a side effect.
 *
 * @example
 * <g style="fill:#000; color: #fff;">
 *             ⬇
 * <g fill="#000" color="#fff">
 *
 * @example
 * <g style="fill:#000; color: #fff; -webkit-blah: blah">
 *             ⬇
 * <g fill="#000" color="#fff" style="-webkit-blah: blah">
 *
 * @param {Object} item current iteration item
 * @return {Boolean} if false, item will be filtered out
 *
 * @author Kir Belevich
 */
exports.fn = function(item, params) {
    /* jshint boss: true */

    if (item.elem && item.hasAttr('style')) {
            // ['opacity: 1', 'color: #000']
        var styleValue = item.attr('style').value,
            styles = [],
            attrs = {};

        // Strip CSS comments preserving escape sequences and strings.
        styleValue = styleValue.replace(regStripComments, function(match) {
            return match[0] == '/' ? '' :
                match[0] == '\\' && /[-g-z]/i.test(match[1]) ? match[1] : match;
        });

        regDeclarationBlock.lastIndex = 0;
        for (var rule; rule = regDeclarationBlock.exec(styleValue);) {
            if (!params.keepImportant || !rule[3]) {
                styles.push([rule[1], rule[2]]);
            }
        }

        if (styles.length) {

            styles = styles.filter(function(style) {
                if (style[0]) {
                    var prop = style[0].toLowerCase(),
                        val = style[1];

                    if (rQuotedString.test(val)) {
                        val = val.slice(1, -1);
                    }

                    if (stylingProps.indexOf(prop) > -1) {

                        attrs[prop] = {
                            name: prop,
                            value: val,
                            local: prop,
                            prefix: ''
                        };

                        return false;
                    }
                }

                return true;
            });

            Object.assign(item.attrs, attrs);

            if (styles.length) {
                item.attr('style').value = styles
                    .map(function(declaration) { return declaration.join(':') })
                    .join(';');
            } else {
                item.removeAttr('style');
            }

        }

    }

};

function g() {
    return '(?:' + Array.prototype.join.call(arguments, '|') + ')';
}


text:
var edge = require('../lib/edge');

var readRegistery = edge.func(function () {/*
		using System.Collections.Generic;
		using Microsoft.Win32;

		async (data) =>
		{
			var input = (IDictionary<string,object>)data;
			var keyName = (string) input["keyName"];
			var valueName = (string) input["valueName"];
			var defaultValue = (string) null;
			if (input.ContainsKey("defaultValue"))
			{
				defaultValue = (string) input["defaultValue"];
			}

			var readValue = Registry.GetValue(keyName, valueName, defaultValue);

			return readValue;
		}
	*/}
);

readRegistery({keyName: 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MSBuild\\4.0', valueName: 'MSBuildOverrideTasksPath'}, function (err, result) {
	if (err) {
		throw new Error(err);
	}

	console.log(result);
});


text:
/*!
 * FileInput Polish Translations
 *
 * This file must be loaded after 'fileinput.js'. Patterns in braces '{}', or
 * any HTML markup tags in the messages must not be converted or translated.
 *
 * @see http://github.com/kartik-v/bootstrap-fileinput
 *
 * NOTE: this file must be saved in UTF-8 encoding.
 */
(function ($) {
    "use strict";

    $.fn.fileinputLocales['pl'] = {
        fileSingle: 'plik',
        filePlural: 'pliki',
        browseLabel: 'Przeglądaj …',
        removeLabel: 'Usuń',
        removeTitle: 'Usuń zaznaczone pliki',
        cancelLabel: 'Przerwij',
        cancelTitle: 'Anuluj wysyłanie',
        uploadLabel: 'Wgraj',
        uploadTitle: 'Wgraj zaznaczone pliki',
        msgNo: 'Nie',
        msgNoFilesSelected: 'Brak zaznaczonych plików',
        msgCancelled: 'Odwołany',
        msgZoomModalHeading: 'Szczegółowe Podgląd',
        msgSizeTooLarge: 'Plik o nazwie "{name}" ({size} KB) przekroczył maksymalną dopuszczalną wielkość pliku wynoszącą {maxSize} KB.',
        msgFilesTooLess: 'Musisz wybrać przynajmniej {n} {files} do wgrania.',
        msgFilesTooMany: 'Liczba plików wybranych do wgrania w liczbie ({n}), przekracza maksymalny dozwolony limit wynoszący {m}.',
        msgFileNotFound: 'Plik "{name}" nie istnieje!',
        msgFileSecured: 'Ustawienia zabezpieczeń uniemożliwiają odczyt pliku "{name}".',
        msgFileNotReadable: 'Plik "{name}" nie jest plikiem do odczytu.',
        msgFilePreviewAborted: 'Podgląd pliku "{name}" został przerwany.',
        msgFilePreviewError: 'Wystąpił błąd w czasie odczytu pliku "{name}".',
        msgInvalidFileType: 'Nieznny typ pliku "{name}". Tylko następujące rodzaje plików "{types}", są obsługiwane.',
        msgInvalidFileExtension: 'Złe rozszerzenie dla pliku "{name}". Tylko następujące rozszerzenia plików "{extensions}", są obsługiwane.',
        msgUploadAborted: 'Plik przesyłanie zostało przerwane',
        msgUploadThreshold: 'Processing...',
        msgValidationError: 'Błąd walidacji',
        msgLoading: 'Wczytywanie pliku {index} z {files} …',
        msgProgress: 'Wczytywanie pliku {index} z {files} - {name} - {percent}% zakończone.',
        msgSelected: '{n} {files} zaznaczonych',
        msgFoldersNotAllowed: 'Metodą przeciągnij i upuść, można przenosić tylko pliki. Pominięto {n} katalogów.',
        msgImageWidthSmall: 'Szerokość pliku obrazu "{name}" musi być co najmniej {size} px.',
        msgImageHeightSmall: 'Wysokość pliku obrazu "{name}" musi być co najmniej {size} px.',
        msgImageWidthLarge: 'Szerokość pliku obrazu "{name}" nie może przekraczać {size} px.',
        msgImageHeightLarge: 'Wysokość pliku obrazu "{name}" nie może przekraczać {size} px.',
        msgImageResizeError: 'Nie udało się uzyskać wymiary obrazu, aby zmienić rozmiar.',
        msgImageResizeException: 'Błąd podczas zmiany rozmiaru obrazu.
{errors}
',
        dropZoneTitle: 'Przeciągnij i upuść pliki tu …',
        dropZoneClickTitle: '
(or click to select {files})',
        fileActionSettings: {
            removeTitle: 'Usuń plik',
            uploadTitle: 'przesyłanie pliku',
            zoomTitle: 'Pokaż szczegóły',
            dragTitle: 'Move / Rearrange',
            indicatorNewTitle: 'Jeszcze nie przesłanych',
            indicatorSuccessTitle: 'Dodane',
            indicatorErrorTitle: 'Prześlij błąd',
            indicatorLoadingTitle: 'Zamieszczanie ...'
        },
        previewZoomButtonTitles: {
            prev: 'View previous file',
            next: 'View next file',
            toggleheader: 'Toggle header',
            fullscreen: 'Toggle full screen',
            borderless: 'Toggle borderless mode',
            close: 'Close detailed preview'
        }
    };
})(window.jQuery);


text:
@extends('layouts.app')

@section('content')

商品管理

                    商品管理

                    专题

专题修改

                <form action="{{url('admin/product/topic/' . $topic->id)}}" method="post" enctype="multipart/form-data">
                    {{csrf_field()}}
                    <input type="hidden" value="PUT" name="_method">

                        排序:
                        <input name="topic_sort" value="{{$topic->topic_sort}}" type="number" class="form-control"
                               placeholder="值越小越靠前显示,默认为0">

                        名称:
                        <input name="topic_title" value="{{$topic->topic_title}}" type="text" class="form-control"
                               placeholder="" required>

                        图片:
                        @if($topic->topic_img)
                            topic_img}}" class="img-thumbnail">
                            <input id="file" name="file" type="file" class="form-control hidden">
                        @else
                            <input name="file" type="file" class="form-control" required>
                        @endif

                        状态:

                            <input type="radio" name="disabled" value="1" @if($topic->disabled=="显示") checked @endif> 显示

                            <input type="radio" name="disabled" value="2" @if($topic->disabled=="隐藏") checked @endif> 隐藏

                    <button type="submit" class="btn btn-primary">保存</button>
                </form>

@endsection
@section('scriptTag')

@endsection


text:
import { Component, ViewChild, AfterViewInit } from '@angular/core';

import { ChessBoard, PieceColor, PlayerType } from 'ngx-chess';
import { CHESSJS_CHESS_GAME_PROVIDERS } from 'ngx-chess/plugins/chessjs';

@Component({
  selector: 'home',
  providers: [ ...CHESSJS_CHESS_GAME_PROVIDERS ],
  styleUrls: [ 'home.component.scss' ],
  templateUrl: 'home.component.html'
})
export class HomeComponent implements AfterViewInit {

  @ViewChild('board') private board: ChessBoard;

  constructor() {}

  ngAfterViewInit() {
    this.board.ctrl
      .init()
      .then( () => {
        this.board.ctrl
          .setPlayer(PieceColor.BLACK, PlayerType.HUMAN)
          .setPlayer(PieceColor.WHITE, PlayerType.HUMAN)
          .newGame();
      });
  }

}


text:
require 'rails_helper'

describe 'Filter issues', feature: true do
  include WaitForAjax

  let!(:project)   { create(:project) }
  let!(:user)      { create(:user)}
  let!(:milestone) { create(:milestone, project: project) }
  let!(:label)     { create(:label, project: project) }
  let!(:issue1)    { create(:issue, project: project) }

  before do
    project.team << [user, :master]
    login_as(user)
  end

  describe 'Filter issues for assignee from issues#index' do
    before do
      visit namespace_project_issues_path(project.namespace, project)

      find('.js-assignee-search').click

      find('.dropdown-menu-user-link', text: user.username).click

      wait_for_ajax
    end

    context 'assignee', js: true do
      it 'should update to current user' do
        expect(find('.js-assignee-search .dropdown-toggle-text')).to have_content(user.name)
      end

      it 'should not change when closed link is clicked' do
        find('.issues-state-filters a', text: "Closed").click

        expect(find('.js-assignee-search .dropdown-toggle-text')).to have_content(user.name)
      end

      it 'should not change when all link is clicked' do
        find('.issues-state-filters a', text: "All").click

        expect(find('.js-assignee-search .dropdown-toggle-text')).to have_content(user.name)
      end
    end
  end

  describe 'Filter issues for milestone from issues#index' do
    before do
      visit namespace_project_issues_path(project.namespace, project)

      find('.js-milestone-select').click

      find('.milestone-filter .dropdown-content a', text: milestone.title).click

      wait_for_ajax
    end

    context 'milestone', js: true do
      it 'should update to current milestone' do
        expect(find('.js-milestone-select .dropdown-toggle-text')).to have_content(milestone.title)
      end

      it 'should not change when closed link is clicked' do
        find('.issues-state-filters a', text: "Closed").click

        expect(find('.js-milestone-select .dropdown-toggle-text')).to have_content(milestone.title)
      end

      it 'should not change when all link is clicked' do
        find('.issues-state-filters a', text: "All").click

        expect(find('.js-milestone-select .dropdown-toggle-text')).to have_content(milestone.title)
      end
    end
  end

  describe 'Filter issues for label from issues#index', js: true do
    before do
      visit namespace_project_issues_path(project.namespace, project)
      find('.js-label-select').click
      wait_for_ajax
    end

    it 'should filter by any label' do
      find('.dropdown-menu-labels a', text: 'Any Label').click
      page.first('.labels-filter .dropdown-title .dropdown-menu-close-icon').click
      wait_for_ajax

      expect(find('.labels-filter')).to have_content 'Label'
    end

    it 'should filter by no label' do
      find('.dropdown-menu-labels a', text: 'No Label').click
      page.first('.labels-filter .dropdown-title .dropdown-menu-close-icon').click
      wait_for_ajax

      page.within '.labels-filter' do
        expect(page).to have_content 'No Label'
      end
      expect(find('.js-label-select .dropdown-toggle-text')).to have_content('No Label')
    end

    it 'should filter by no label' do
      find('.dropdown-menu-labels a', text: label.title).click
      page.within '.labels-filter' do
        expect(page).to have_content label.title
      end
      expect(find('.js-label-select .dropdown-toggle-text')).to have_content(label.title)
    end
  end

  describe 'Filter issues for assignee and label from issues#index' do
    before do
      visit namespace_project_issues_path(project.namespace, project)

      find('.js-assignee-search').click

      find('.dropdown-menu-user-link', text: user.username).click

      wait_for_ajax

      find('.js-label-select').click

      find('.dropdown-menu-labels .dropdown-content a', text: label.title).click
      page.first('.labels-filter .dropdown-title .dropdown-menu-close-icon').click

      wait_for_ajax
    end

    context 'assignee and label', js: true do
      it 'should update to current assignee and label' do
        expect(find('.js-assignee-search .dropdown-toggle-text')).to have_content(user.name)
        expect(find('.js-label-select .dropdown-toggle-text')).to have_content(label.title)
      end

      it 'should not change when closed link is clicked' do
        find('.issues-state-filters a', text: "Closed").click

        expect(find('.js-assignee-search .dropdown-toggle-text')).to have_content(user.name)
        expect(find('.js-label-select .dropdown-toggle-text')).to have_content(label.title)
      end

      it 'should not change when all link is clicked' do
        find('.issues-state-filters a', text: "All").click

        expect(find('.js-assignee-search .dropdown-toggle-text')).to have_content(user.name)
        expect(find('.js-label-select .dropdown-toggle-text')).to have_content(label.title)
      end
    end
  end

  describe 'filter issues by text' do
    before do
      create(:issue, title: "Bug", project: project)

      bug_label = create(:label, project: project, title: 'bug')
      milestone = create(:milestone, title: "8", project: project)

      issue = create(:issue,
        title: "Bug 2",
        project: project,
        milestone: milestone,
        author: user,
        assignee: user)
      issue.labels << bug_label

      visit namespace_project_issues_path(project.namespace, project)
    end

    context 'only text', js: true do
      it 'should filter issues by searched text' do
        fill_in 'issue_search', with: 'Bug'

        page.within '.issues-list' do
          expect(page).to have_selector('.issue', count: 2)
        end
      end

      it 'should not show any issues' do
        fill_in 'issue_search', with: 'testing'

        page.within '.issues-list' do
          expect(page).not_to have_selector('.issue')
        end
      end
    end

    context 'text and dropdown options', js: true do
      it 'should filter by text and label' do
        fill_in 'issue_search', with: 'Bug'

        page.within '.issues-list' do
          expect(page).to have_selector('.issue', count: 2)
        end

        click_button 'Label'
        page.within '.labels-filter' do
          click_link 'bug'
        end
        find('.dropdown-menu-close-icon').click

        page.within '.issues-list' do
          expect(page).to have_selector('.issue', count: 1)
        end
      end

      it 'should filter by text and milestone' do
        fill_in 'issue_search', with: 'Bug'

        page.within '.issues-list' do
          expect(page).to have_selector('.issue', count: 2)
        end

        click_button 'Milestone'
        page.within '.milestone-filter' do
          click_link '8'
        end

        page.within '.issues-list' do
          expect(page).to have_selector('.issue', count: 1)
        end
      end

      it 'should filter by text and assignee' do
        fill_in 'issue_search', with: 'Bug'

        page.within '.issues-list' do
          expect(page).to have_selector('.issue', count: 2)
        end

        click_button 'Assignee'
        page.within '.dropdown-menu-assignee' do
          click_link user.name
        end

        page.within '.issues-list' do
          expect(page).to have_selector('.issue', count: 1)
        end
      end

      it 'should filter by text and author' do
        fill_in 'issue_search', with: 'Bug'

        page.within '.issues-list' do
          expect(page).to have_selector('.issue', count: 2)
        end

        click_button 'Author'
        page.within '.dropdown-menu-author' do
          click_link user.name
        end

        page.within '.issues-list' do
          expect(page).to have_selector('.issue', count: 1)
        end
      end
    end
  end

  describe 'filter issues and sort', js: true do
    before do
      bug_label = create(:label, project: project, title: 'bug')
      bug_one = create(:issue, title: "Frontend", project: project)
      bug_two = create(:issue, title: "Bug 2", project: project)

      bug_one.labels << bug_label
      bug_two.labels << bug_label

      visit namespace_project_issues_path(project.namespace, project)
    end

    it 'should be able to filter and sort issues' do
      click_button 'Label'
      wait_for_ajax
      page.within '.labels-filter' do
        click_link 'bug'
      end
      find('.dropdown-menu-close-icon').click
      wait_for_ajax

      page.within '.issues-list' do
        expect(page).to have_selector('.issue', count: 2)
      end

      click_button 'Last created'
      page.within '.dropdown-menu-sort' do
        click_link 'Oldest created'
      end
      wait_for_ajax

      page.within '.issues-list' do
        expect(page).to have_content('Frontend')
      end
    end
  end
end