text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the AOS Community (AOS) under one or more
  contributor license agreements.  See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership.  The AOS licenses this file
  to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, either express or implied.  See the License for the
  specific language governing permissions and limitations
  under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:broker="http://activemq.apache.org/schema/core"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
       http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">

    <!-- define the activemq Camel component so we can integrate with the AMQ broker below -->
    <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
        <property name="brokerURL" value="tcp://localhost:61616"/>
    </bean>

    <!-- setup a local JMS Broker for testing purpose -->
    <!-- in reality it may be a remote JMS broker -->
    <broker:broker useJmx="false" persistent="false" brokerName="localhost">
        <broker:transportConnectors>
            <broker:transportConnector uri="tcp://localhost:61616"/>
        </broker:transportConnectors>
    </broker:broker>

    <!-- the order service -->
    <bean id="order" class="camelinaction.OrderService"/>

    <!-- the camel route -->
    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">

        <route>
            <!-- incoming orders arrive on this queue -->
            <from uri="activemq:queue:order"/>
            <log message="Incoming order ${body}"/>

            <!-- process the order -->
            <choice>
                <when>
                    <!-- if the order is valid then process it and send it to the confirm queue -->
                    <method ref="order" method="validateOrder"/>
                    <log message="Valid order ${body}"/>
                    <bean ref="order" method="processOrder"/>
                    <to uri="activemq:queue:confirm"/>
                </when>
                <otherwise>
                    <!-- for invalid orders move them to the invalid queue -->
                    <log message="Invalid order ${body}"/>
                    <to uri="activemq:queue:invalid"/>
                </otherwise>
            </choice>

        </route>

    </camelContext>

</beans>


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

<title>ApiController</title>
<meta name="date" content="2012-06-27">
<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

ohtu.beddit.api

Interface ApiController

All Known Implementing Classes:

ApiControllerClassImpl

public interface ApiController

Interface for requesting data updates and getting the data from Beddit API.

Method Summary

Methods

Modifier and Type
Method and Description

String
getAccessToken(String url)

Retrieves access token json from given url with BedditConnectorImpl.getJsonFromServer(String, boolean),
 parses it to TokenData with BedditJsonParser and
 returns access token as String

QueueData
getQueueData(Context context)

Parses saved queue data json and returns it as QueueData object.

SleepData
getSleepData(Context context)

Parses saved sleep data json and returns it as SleepData object.

UserData
getUserData(Context context)

Parses saved user data json and returns it as UserData object.

boolean
hasUserChanged(Context context)

returns true if user has changed after the last call to updateSleepData(android.content.Context)

boolean
isSleepInfoOutdated()

void
requestInfoUpdate(Context context)

void
updateQueueData(Context context)

Retrieves queue data json from Beddit with BedditConnectorImpl.getJsonFromServer(String, boolean)
 and saves it to a static variable.

void
updateSleepData(Context context)

Retrieves sleep data json from Beddit with BedditConnectorImpl.getJsonFromServer(String, boolean)
 and saves it to a static variable.

void
updateUserData(Context context)

Retrieves user data json from Beddit with BedditConnectorImpl.getJsonFromServer(String, boolean)
 and saves it to a static variable.

Method Detail

updateUserData

void updateUserData(Context context)
                    throws BedditConnectionException

Retrieves user data json from Beddit with BedditConnectorImpl.getJsonFromServer(String, boolean)
 and saves it to a static variable.

Parameters:

context - android context

Throws:

BedditConnectionException

updateSleepData

void updateSleepData(Context context)
                     throws BedditConnectionException

Retrieves sleep data json from Beddit with BedditConnectorImpl.getJsonFromServer(String, boolean)
 and saves it to a static variable.

Parameters:

context - android context

Throws:

BedditConnectionException

updateQueueData

void updateQueueData(Context context)
                     throws BedditConnectionException

Retrieves queue data json from Beddit with BedditConnectorImpl.getJsonFromServer(String, boolean)
 and saves it to a static variable.

Parameters:

context - android context

Throws:

BedditConnectionException

requestInfoUpdate

void requestInfoUpdate(Context context)
                       throws BedditConnectionException

Throws:

BedditConnectionException

getAccessToken

String getAccessToken(String url)
                      throws BedditException

Retrieves access token json from given url with BedditConnectorImpl.getJsonFromServer(String, boolean),
 parses it to TokenData with BedditJsonParser and
 returns access token as String

Parameters:

url -

Returns:

access token as String

Throws:

BedditException

getQueueData

QueueData getQueueData(Context context)
                       throws BedditException

Parses saved queue data json and returns it as QueueData object.
 Remember to call updateQueueData(android.content.Context) first if needed.

Parameters:

context - android context

Returns:

data about api queue status

Throws:

BedditException

getUserData

UserData getUserData(Context context)
                     throws BedditException

Parses saved user data json and returns it as UserData object.
 Remember to call updateUserData(android.content.Context) first if needed.

Parameters:

context - android context

Returns:

data about users

Throws:

BedditException

getSleepData

SleepData getSleepData(Context context)
                       throws BedditException

Parses saved sleep data json and returns it as SleepData object.
 Remember to call updateSleepData(android.content.Context) first if needed.

Parameters:

context - android context

Returns:

data about last nights sleep

Throws:

BedditException

hasUserChanged

boolean hasUserChanged(Context context)

returns true if user has changed after the last call to updateSleepData(android.content.Context)

Parameters:

context - android context

Returns:

true if user has changed after the last call to updateSleepData(android.content.Context)

isSleepInfoOutdated

boolean isSleepInfoOutdated()

Returns:

true if sleep data has been updated more than 1 minutes ago

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:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Bull. trimest. Soc. mycol. Fr. 48(1): 41 (1932)

#### Original name
Poria litschaueri Pilát

### Remarks
null


text:
using System;
using System.IO;
using System.Reflection;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using RoslynQuoter;
using Xunit;
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;

public class Tests
{
    [Fact]
    public void TestInterpolatedStringWithNewLine()
    {
        var expected = $@"InterpolatedStringExpression(
    Token(SyntaxKind.InterpolatedStringStartToken))
.WithContents(
    SingletonList<InterpolatedStringContentSyntax>(
        InterpolatedStringText()
        .WithTextToken(
            Token(
                TriviaList(),
                SyntaxKind.InterpolatedStringTextToken,
                ""Foo \\n!"",
                @""Foo {"\n"}!"",
                TriviaList()))))
.NormalizeWhitespace()";

        Test("$\"Foo \\n!\"", expected, shortenCodeWithUsingStatic: true, nodeKind: NodeKind.Expression);
    }

    [Fact]
    public void TestUsingSystemWithRedundantCalls()
    {
        Test(@"using System;
", @"SyntaxFactory.CompilationUnit()
.WithUsings(
    SyntaxFactory.SingletonList<UsingDirectiveSyntax>(
        SyntaxFactory.UsingDirective(
            SyntaxFactory.IdentifierName(""System""))
        .WithUsingKeyword(
            SyntaxFactory.Token(SyntaxKind.UsingKeyword))
        .WithSemicolonToken(
            SyntaxFactory.Token(SyntaxKind.SemicolonToken))))
.WithEndOfFileToken(
    SyntaxFactory.Token(SyntaxKind.EndOfFileToken))
.NormalizeWhitespace()", removeRedundantModifyingCalls: false);
    }

    [Fact]
    public void TestUsingSystemWithUsingStatic()
    {
        Test(@"using System;
", @"CompilationUnit()
.WithUsings(
    SingletonList<UsingDirectiveSyntax>(
        UsingDirective(
            IdentifierName(""System""))))
.NormalizeWhitespace()", shortenCodeWithUsingStatic: true);
    }

    [Fact]
    public void TestUsingSystem()
    {
        Test(@"using System;
", @"SyntaxFactory.CompilationUnit()
.WithUsings(
    SyntaxFactory.SingletonList<UsingDirectiveSyntax>(
        SyntaxFactory.UsingDirective(
            SyntaxFactory.IdentifierName(""System""))))
.NormalizeWhitespace()");
    }

    [Fact]
    public void TestSimpleClass()
    {
        Test("class C { }", @"SyntaxFactory.CompilationUnit()
.WithMembers(
    SyntaxFactory.SingletonList<MemberDeclarationSyntax>(
        SyntaxFactory.ClassDeclaration(""C"")
        .WithKeyword(
            SyntaxFactory.Token(SyntaxKind.ClassKeyword))
        .WithOpenBraceToken(
            SyntaxFactory.Token(SyntaxKind.OpenBraceToken))
        .WithCloseBraceToken(
            SyntaxFactory.Token(SyntaxKind.CloseBraceToken))))
.WithEndOfFileToken(
    SyntaxFactory.Token(SyntaxKind.EndOfFileToken))
.NormalizeWhitespace()", removeRedundantModifyingCalls: false);
    }

    [Fact]
    public void TestMissingToken()
    {
        Test("class", @"SyntaxFactory.CompilationUnit()
.WithMembers(
    SyntaxFactory.SingletonList<MemberDeclarationSyntax>(
        SyntaxFactory.ClassDeclaration(
            SyntaxFactory.MissingToken(SyntaxKind.IdentifierToken))
        .WithKeyword(
            SyntaxFactory.Token(SyntaxKind.ClassKeyword))
        .WithOpenBraceToken(
            SyntaxFactory.MissingToken(SyntaxKind.OpenBraceToken))
        .WithCloseBraceToken(
            SyntaxFactory.MissingToken(SyntaxKind.CloseBraceToken))))
.WithEndOfFileToken(
    SyntaxFactory.Token(SyntaxKind.EndOfFileToken))
.NormalizeWhitespace()", removeRedundantModifyingCalls: false);
    }

    [Fact]
    public void TestMissingTokenWithUsingStatic()
    {
        Test("class", @"CompilationUnit()
.WithMembers(
    SingletonList<MemberDeclarationSyntax>(
        ClassDeclaration(
            MissingToken(SyntaxKind.IdentifierToken))
        .WithKeyword(
            Token(SyntaxKind.ClassKeyword))
        .WithOpenBraceToken(
            MissingToken(SyntaxKind.OpenBraceToken))
        .WithCloseBraceToken(
            MissingToken(SyntaxKind.CloseBraceToken))))
.WithEndOfFileToken(
    Token(SyntaxKind.EndOfFileToken))
.NormalizeWhitespace()", removeRedundantModifyingCalls: false, shortenCodeWithUsingStatic: true);
    }

    [Fact]
    public void TestGlobal()
    {
        Test(@"class C { void M() { global::System.String s; } }");
    }

    [Fact]
    public void TestEmptyBlock()
    {
        Test(@"class C { void M() { } }");
    }

    [Fact]
    public void TestInterpolatedString()
    {
        Test(@"class C { string s = $""a""; }");
    }

    [Fact]
    public void TestAttribute()
    {
        Test(@"[Foo]class C { }");
    }

    [Fact]
    public void TestHelloWorld()
    {
        Test(@"using System;

namespace N
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(""Hello World""); // comment
        }
    }
}", @"SyntaxFactory.CompilationUnit()
.WithUsings(
    SyntaxFactory.SingletonList<UsingDirectiveSyntax>(
        SyntaxFactory.UsingDirective(
            SyntaxFactory.IdentifierName(""System""))
        .WithUsingKeyword(
            SyntaxFactory.Token(SyntaxKind.UsingKeyword))
        .WithSemicolonToken(
            SyntaxFactory.Token(SyntaxKind.SemicolonToken))))
.WithMembers(
    SyntaxFactory.SingletonList<MemberDeclarationSyntax>(
        SyntaxFactory.NamespaceDeclaration(
            SyntaxFactory.IdentifierName(""N""))
        .WithNamespaceKeyword(
            SyntaxFactory.Token(SyntaxKind.NamespaceKeyword))
        .WithOpenBraceToken(
            SyntaxFactory.Token(SyntaxKind.OpenBraceToken))
        .WithMembers(
            SyntaxFactory.SingletonList<MemberDeclarationSyntax>(
                SyntaxFactory.ClassDeclaration(""Program"")
                .WithKeyword(
                    SyntaxFactory.Token(SyntaxKind.ClassKeyword))
                .WithOpenBraceToken(
                    SyntaxFactory.Token(SyntaxKind.OpenBraceToken))
                .WithMembers(
                    SyntaxFactory.SingletonList<MemberDeclarationSyntax>(
                        SyntaxFactory.MethodDeclaration(
                            SyntaxFactory.PredefinedType(
                                SyntaxFactory.Token(SyntaxKind.VoidKeyword)),
                            SyntaxFactory.Identifier(""Main""))
                        .WithModifiers(
                            SyntaxFactory.TokenList(
                                SyntaxFactory.Token(SyntaxKind.StaticKeyword)))
                        .WithParameterList(
                            SyntaxFactory.ParameterList(
                                SyntaxFactory.SingletonSeparatedList<ParameterSyntax>(
                                    SyntaxFactory.Parameter(
                                        SyntaxFactory.Identifier(""args""))
                                    .WithType(
                                        SyntaxFactory.ArrayType(
                                            SyntaxFactory.PredefinedType(
                                                SyntaxFactory.Token(SyntaxKind.StringKeyword)))
                                        .WithRankSpecifiers(
                                            SyntaxFactory.SingletonList<ArrayRankSpecifierSyntax>(
                                                SyntaxFactory.ArrayRankSpecifier(
                                                    SyntaxFactory.SingletonSeparatedList<ExpressionSyntax>(
                                                        SyntaxFactory.OmittedArraySizeExpression()
                                                        .WithOmittedArraySizeExpressionToken(
                                                            SyntaxFactory.Token(SyntaxKind.OmittedArraySizeExpressionToken))))
                                                .WithOpenBracketToken(
                                                    SyntaxFactory.Token(SyntaxKind.OpenBracketToken))
                                                .WithCloseBracketToken(
                                                    SyntaxFactory.Token(SyntaxKind.CloseBracketToken)))))))
                            .WithOpenParenToken(
                                SyntaxFactory.Token(SyntaxKind.OpenParenToken))
                            .WithCloseParenToken(
                                SyntaxFactory.Token(SyntaxKind.CloseParenToken)))
                        .WithBody(
                            SyntaxFactory.Block(
                                SyntaxFactory.SingletonList<StatementSyntax>(
                                    SyntaxFactory.ExpressionStatement(
                                        SyntaxFactory.InvocationExpression(
                                            SyntaxFactory.MemberAccessExpression(
                                                SyntaxKind.SimpleMemberAccessExpression,
                                                SyntaxFactory.IdentifierName(""Console""),
                                                SyntaxFactory.IdentifierName(""WriteLine""))
                                            .WithOperatorToken(
                                                SyntaxFactory.Token(SyntaxKind.DotToken)))
                                        .WithArgumentList(
                                            SyntaxFactory.ArgumentList(
                                                SyntaxFactory.SingletonSeparatedList<ArgumentSyntax>(
                                                    SyntaxFactory.Argument(
                                                        SyntaxFactory.LiteralExpression(
                                                            SyntaxKind.StringLiteralExpression,
                                                            SyntaxFactory.Literal(""Hello World"")))))
                                            .WithOpenParenToken(
                                                SyntaxFactory.Token(SyntaxKind.OpenParenToken))
                                            .WithCloseParenToken(
                                                SyntaxFactory.Token(SyntaxKind.CloseParenToken))))
                                    .WithSemicolonToken(
                                        SyntaxFactory.Token(
                                            SyntaxFactory.TriviaList(),
                                            SyntaxKind.SemicolonToken,
                                            SyntaxFactory.TriviaList(
                                                SyntaxFactory.Comment(""// comment""))))))
                            .WithOpenBraceToken(
                                SyntaxFactory.Token(SyntaxKind.OpenBraceToken))
                            .WithCloseBraceToken(
                                SyntaxFactory.Token(SyntaxKind.CloseBraceToken)))))
                .WithCloseBraceToken(
                    SyntaxFactory.Token(SyntaxKind.CloseBraceToken))))
        .WithCloseBraceToken(
            SyntaxFactory.Token(SyntaxKind.CloseBraceToken))))
.WithEndOfFileToken(
    SyntaxFactory.Token(SyntaxKind.EndOfFileToken))
.NormalizeWhitespace()", removeRedundantModifyingCalls: false);
    }

    [Fact]
    public void TestComment()
    {
        Test(@"class C
{
  void M()
  {
    A(""M""); // comment
  }
}");
    }

    [Fact]
    public void TestSimpleStringLiteral()
    {
        Test("class C { string s = \"z\"; }"); // "z"
    }

    [Fact]
    public void TestStringLiteralWithBackslash()
    {
        Test("class C { string s = \"a\\b\"");
    }

    [Fact]
    public void TestSimpleIntLiteral()
    {
        Test("class C { int i = 42; }");
    }

    [Fact]
    public void TestSimpleCharLiteral()
    {
        Test("class C { char c = 'z'; }");
    }

    [Theory]
    [InlineData("'")]
    [InlineData("0")]
    [InlineData("a")]
    [InlineData("b")]
    [InlineData("f")]
    [InlineData("n")]
    [InlineData("r")]
    [InlineData("t")]
    [InlineData("v")]
    public void TestEscapedCharLiterals(string ch)
    {
        Test($"'\\{ch}'", $@"SyntaxFactory.LiteralExpression(
    SyntaxKind.CharacterLiteralExpression,
    SyntaxFactory.Literal('\{ch}'))
.NormalizeWhitespace()", nodeKind: NodeKind.Expression);
    }

    [Theory]
    [InlineData("u1234", "ሴ")]
    [InlineData("x123a", "ሺ")]
    [InlineData("U00001234", "ሴ")]
    public void TestEscapedCharLiterals2(string ch, string charValue)
    {
        Test($"'\\{ch}'", $@"SyntaxFactory.LiteralExpression(
    SyntaxKind.CharacterLiteralExpression,
    SyntaxFactory.Literal(
        ""'\\{ch}'"",
        '{charValue}'))
.NormalizeWhitespace()", nodeKind: NodeKind.Expression);
    }

    [Fact]
    public void TestEscapedCharLiterals3()
    {
        Test("'\"'", $@"SyntaxFactory.LiteralExpression(
    SyntaxKind.CharacterLiteralExpression,
    SyntaxFactory.Literal('""'))
.NormalizeWhitespace()", nodeKind: NodeKind.Expression);
    }

    [Fact]
    public void TestEscapedCharLiterals4()
    {
        Test("'\\\\'", $@"SyntaxFactory.LiteralExpression(
    SyntaxKind.CharacterLiteralExpression,
    SyntaxFactory.Literal('\\'))
.NormalizeWhitespace()", nodeKind: NodeKind.Expression);
    }

    [Fact]
    public void TestEscapedChar5()
    {
        Test("\"@abc\\rdef\"", nodeKind: NodeKind.Expression);
    }

    [Fact]
    public void TestEscapedChar6()
    {
        Test("@\"\\n\"", nodeKind: NodeKind.Expression);
    }

    [Fact]
    public void TestTrueFalseAndNull()
    {
        Test("class C { var x = true ? false : null; }");
    }

    [Fact]
    public void Roundtrip1()
    {
        Test("class C { string s = \"\\\"\"; }"); // "\""
    }

    [Fact]
    public void Roundtrip2()
    {
        Test(@"using System;

class Program
{
    static void Main(string[] args)
    {

    }
}");
    }

    [Fact]
    public void Roundtrip3()
    {
        Test("class C { string s = \"\\\"\"; }");
    }

    [Fact]
    public void Roundtrip4()
    {
        Test("class C { string s = @\" zzz \"\" zzz \"; }");
    }

    [Fact]
    public void Roundtrip5()
    {
        Test(@"class C { void M() { M(1, 2); } }");
    }

    [Fact]
    public void RoundtripBoolLiteral()
    {
        Test(@"class C { bool b = true; }");
    }

    [Fact]
    public void Roundtrip7()
    {
        Test(@"#error Foo");
    }

    [Fact]
    public void Roundtrip8()
    {
        Test(@"#if false
int i
#endif");
    }

    [Fact]
    public void Roundtrip9()
    {
        Test(@"\\\");
    }

    [Fact]
    public void Roundtrip10()
    {
        Test(@"/// baz foo bar");
    }

    [Fact]
    public void Roundtrip11()
    {
        Test(@"class /*///*/C");
    }

    [Fact]
    public void Roundtrip12()
    {
        Test("#pragma checksum \"file.txt\" \"{00000000-0000-0000-0000-000000000000}\" \"2453\"");
    }

    [Fact]
    public void Roundtrip13()
    {
        Test(@"class \\u0066 { }");
    }

    [Fact]
    public void Roundtrip14()
    {
        Test(@"class C { }");
    }

    [Fact]
    public void Roundtrip15()
    {
        Test(@"class C { void M() { ((Action)(async () =>
                {
                }))(); } }");
    }

    [Fact]
    public void Roundtrip16()
    {
        Test(@"class C { void M() { a ? b : c; } }");
    }

    [Fact]
    public void NotPattern()
    {
        Test("x is not null", nodeKind: NodeKind.Expression);
    }

    private static string GetPath(string relativePath)
    {
        if (Path.IsPathRooted(relativePath))
        {
            return Path.GetFullPath(relativePath);
        }

        return Path.GetFullPath(
            Path.Combine(
                Path.GetDirectoryName(
                    Assembly.GetExecutingAssembly().Location),
                relativePath));
    }

    private void RoundtripFile(string filePath)
    {
        Test(
            File.ReadAllText(GetPath(filePath)),
            useDefaultFormatting: false,
            removeRedundantCalls: false,
            shortenCodeWithUsingStatic: true);
    }

    [Fact]
    public void Roundtrip20()
    {
        Test("#line 1 \"a\\b\"");
    }

    [Fact]
    public void Roundtrip21()
    {
        Test("#line 1 \"a\\\b\"");
    }

    [Fact]
    public void Roundtrip21_1()
    {
        Test("\"\b\"", nodeKind: NodeKind.Expression);
        Test(" \"\b\"", nodeKind: NodeKind.Expression);
        Test("\"\b\" ", nodeKind: NodeKind.Expression);
        Test(" \"\b\" ", nodeKind: NodeKind.Expression);
        Test("\"a\\\b\"", nodeKind: NodeKind.Expression);
    }

    [Fact]
    public void Roundtrip22()
    {
        Test("#pragma checksum \"..\\..\"");
    }

    [Fact]
    public void Roundtrip23()
    {
        Test("class C { void P { a } }");
    }

    [Fact]
    public void Roundtrip24()
    {
        Test(@"///
class C { }");
    }

    [Fact]
    public void Roundtrip25()
    {
        Test("class C { void M(__arglist) { M(__arglist); } }");
    }

    [Fact]
    public void Roundtrip26()
    {
        Test(@"
namespace @N
{
   public class @A
   {
       public @string @P { get; set; }
   }
}
");
    }

    [Fact]
    public void Roundtrip27()
    {
        Test("class C { void M() { int x; x = 42; } }");
    }

    [Fact]
    public void Roundtrip28()
    {
        Test(@"[module: System.Copyright(""\n\t\u0123(C) \""2009"" + ""\u0123"")]");
    }

    [Fact]
    public void SwitchCase()
    {
        Test(@"class C { public C() { switch(0) { case 1: break; default: break;} } } ");
    }

    [Fact]
    public void TestObsoleteAttribute()
    {
        Test("class C { int i => 0; }");
    }

    [Fact]
    public void TestNewlineInConstant()
    {
        Test(@"[module: System.Copyright(""\n"")]");
    }

    [Fact]
    public void TestQuoteInLiteral()
    {
        Test(@"[module: A(""\"""")]");
    }

    [Fact]
    public void TestQuoteInVerbatimLiteral()
    {
        Test(@"[module: A(@"""""""")]");
    }

    [Fact]
    public void TestBackslashInLiteral()
    {
        Test(@"[module: A(""\\"")]");
    }

    [Fact]
    public void RoundtripMissingToken()
    {
        Test("class");
    }

    [Fact]
    public void TestXmlDocComment()
    {
        Test(@"    ///
    /// test
    ///
class C { }");
    }

    [Fact]
    public void TestXmlDocSummaryWithNamespace()
    {
        Test(@"    ///
    /// test
    ///
class C { }");
    }

    [Fact]
    public void TestXmlDocAll()
    {
        Test(@"///
/// <![CDATA[c]]>
/// <completionlist cref=""a""/>
/// <exception cref=""a"" />
/// <include file='a' path='[@name=""b""]'/>
/// <permission cref=""a"" />
/// <remarks></remarks>
/// <see cref=""a""/>
/// <seealso cref=""a""/>
/// a
/// <example>a</example>
/// <param name=""a"">a</param>
class C { }");
    }

    [Fact]
    public void TestDefaultLiteral()
    {
        Test(@"class C
{
    void A(int x = default)
    {
    }
}");
    }

    [Fact]
    public void TestIssue49()
    {
        Test(
          @"if () {}",
          "Parse error. Have you selected the right Parse As context?",
          nodeKind: NodeKind.MemberDeclaration,
          testRoundtrip: false);
    }

    [Fact]
    public void TestIssue61()
    {
        Test(@"void M() { var a = M() is char and > 'H' }");
    }

    [Fact]
    public void TestIdentifiers()
    {
        Test(@"using System;
var @class = 12;
Console.WriteLine(nameof(@class));");
    }

    [Fact]
    public void TestFloatLiteral()
    {
        Test("1F", @"SyntaxFactory.LiteralExpression(
    SyntaxKind.NumericLiteralExpression,
    SyntaxFactory.Literal(1F))
.NormalizeWhitespace()", nodeKind: NodeKind.Expression);
    }

    [Fact]
    public void TestDoubleLiteral()
    {
        Test("1D", @"SyntaxFactory.LiteralExpression(
    SyntaxKind.NumericLiteralExpression,
    SyntaxFactory.Literal(1D))
.NormalizeWhitespace()", nodeKind: NodeKind.Expression,
        testRoundtrip: false // 1D gets erased to just 1 when we interpret the syntax factory calls
        );
    }

    [Fact]
    public void TestDecimalLiteral()
    {
        Test("1m", @"SyntaxFactory.LiteralExpression(
    SyntaxKind.NumericLiteralExpression,
    SyntaxFactory.Literal(1m))
.NormalizeWhitespace()", nodeKind: NodeKind.Expression,
        testRoundtrip: false // 1m gets converted to 1M during roundtrip
        );
    }

    [Fact]
    public void TestUnsignedLiteral()
    {
        Test("1u", @"SyntaxFactory.LiteralExpression(
    SyntaxKind.NumericLiteralExpression,
    SyntaxFactory.Literal(1u))
.NormalizeWhitespace()", nodeKind: NodeKind.Expression,
        testRoundtrip: false // 1u gets converted to 1L during roundtrip
        );

        Test("0x1u", @"SyntaxFactory.LiteralExpression(
    SyntaxKind.NumericLiteralExpression,
    SyntaxFactory.Literal(0x1u))
.NormalizeWhitespace()", nodeKind: NodeKind.Expression,
        testRoundtrip: false
        );
    }

    [Fact]
    public void TestLongLiteral()
    {
        Test("1l", @"SyntaxFactory.LiteralExpression(
    SyntaxKind.NumericLiteralExpression,
    SyntaxFactory.Literal(1l))
.NormalizeWhitespace()", nodeKind: NodeKind.Expression,
        testRoundtrip: false // 1l gets converted to 1L during roundtrip
        );

        Test("0x1L", @"SyntaxFactory.LiteralExpression(
    SyntaxKind.NumericLiteralExpression,
    SyntaxFactory.Literal(0x1L))
.NormalizeWhitespace()", nodeKind: NodeKind.Expression,
        testRoundtrip: false
        );
    }

    [Theory]
    [InlineData("ul")]
    [InlineData("uL")]
    [InlineData("Ul")]
    [InlineData("UL")]
    [InlineData("lu")]
    [InlineData("lU")]
    [InlineData("Lu")]
    [InlineData("LU")]
    public void TestUnsignedLongLiteral(string suffix)
    {
        Test("1" + suffix, $@"SyntaxFactory.LiteralExpression(
    SyntaxKind.NumericLiteralExpression,
    SyntaxFactory.Literal(1{suffix}))
.NormalizeWhitespace()", nodeKind: NodeKind.Expression,
        testRoundtrip: false
        );

        Test("0x2" + suffix, $@"SyntaxFactory.LiteralExpression(
    SyntaxKind.NumericLiteralExpression,
    SyntaxFactory.Literal(0x2{suffix}))
.NormalizeWhitespace()", nodeKind: NodeKind.Expression,
        testRoundtrip: false
        );
    }

    private void Test(
        string sourceText,
        string expected,
        bool useDefaultFormatting = true,
        bool removeRedundantModifyingCalls = true,
        bool shortenCodeWithUsingStatic = false,
        NodeKind nodeKind = NodeKind.CompilationUnit,
        bool testRoundtrip = true)
    {
        var quoter = new Quoter
        {
            UseDefaultFormatting = useDefaultFormatting,
            RemoveRedundantModifyingCalls = removeRedundantModifyingCalls,
            ShortenCodeWithUsingStatic = shortenCodeWithUsingStatic
        };
        var actual = quoter.QuoteText(sourceText, nodeKind);
        Assert.Equal(expected, actual);

        if (testRoundtrip)
        {
            Test(sourceText, nodeKind);
        }
    }

    private void Test(string sourceText, NodeKind nodeKind = NodeKind.CompilationUnit)
    {
        Test(sourceText, useDefaultFormatting: true, removeRedundantCalls: true, shortenCodeWithUsingStatic: false, nodeKind);
        Test(sourceText, useDefaultFormatting: false, removeRedundantCalls: true, shortenCodeWithUsingStatic: true, nodeKind);
    }

    private static void Test(
      string sourceText,
      bool useDefaultFormatting,
      bool removeRedundantCalls,
      bool shortenCodeWithUsingStatic,
      NodeKind nodeKind = NodeKind.CompilationUnit)
    {
        if (useDefaultFormatting)
        {
            sourceText = CSharpSyntaxTree
                .ParseText(sourceText)
                .GetRoot()
                .NormalizeWhitespace()
                .ToFullString();
        }

        var quoter = new Quoter
        {
            UseDefaultFormatting = useDefaultFormatting,
            RemoveRedundantModifyingCalls = removeRedundantCalls,
            ShortenCodeWithUsingStatic = shortenCodeWithUsingStatic
        };
        var generatedCode = quoter.Quote(sourceText, nodeKind);

        var resultText = quoter.Evaluate(generatedCode);

        if (sourceText != resultText)
        {
            //File.WriteAllText(@"D:\1.txt", sourceText);
            //File.WriteAllText(@"D:\2.txt", resultText);
            //File.WriteAllText(@"D:\3.txt", generatedCode);
        }

        Assert.Equal(sourceText, resultText);
    }

    public void CheckSourceFiles()
    {
        var rootFolder = @"C:\roslyn-internal\Closed\Test\Files\";
        var files = Directory.GetFiles(rootFolder, "*.cs", SearchOption.AllDirectories);
        for (int i = 0; i < files.Length; i++)
        {
            VerifyRoundtrip(files[i]);
        }
    }

    public void VerifyRoundtrip(string file)
    {
        try
        {
            var sourceText = File.ReadAllText(file);
            if (sourceText.Length > 50000)
            {
                //Log("Skipped large file: " + file);
                return;
            }

            Test(sourceText);
        }
        catch (Exception)
        {
            Log("Failed: " + file);
        }
    }

    private static void Log(string text)
    {
        File.AppendAllText(@"Failed.txt", text + Environment.NewLine);
    }
}


text:
package com.google.api.ads.adwords.jaxws.v201409.billing;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
import com.google.api.ads.adwords.jaxws.v201409.cm.ApiError;

/**
 *
 *             Error information returned for CustomerOrderLineService.
 *
 *
 *
Java class for CustomerOrderLineError complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="CustomerOrderLineError">
 *   <complexContent>
 *     <extension base="{https://adwords.google.com/api/adwords/cm/v201409}ApiError">
 *       <sequence>
 *         <element name="reason" type="{https://adwords.google.com/api/adwords/billing/v201409}CustomerOrderLineError.Reason" minOccurs="0"/>
 *       </sequence>
 *     </extension>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CustomerOrderLineError", propOrder = {
    "reason"
})
public class CustomerOrderLineError
    extends ApiError
{

    protected CustomerOrderLineErrorReason reason;

    /**
     * Gets the value of the reason property.
     *
     * @return
     *     possible object is
     *     {@link CustomerOrderLineErrorReason }
     *
     */
    public CustomerOrderLineErrorReason getReason() {
        return reason;
    }

    /**
     * Sets the value of the reason property.
     *
     * @param value
     *     allowed object is
     *     {@link CustomerOrderLineErrorReason }
     *
     */
    public void setReason(CustomerOrderLineErrorReason value) {
        this.reason = value;
    }

}


text:
package main

import (
	"encoding/json"
	"log"
	"math/rand"
	"time"

	"github.com/spf13/viper"

	ss "github.com/codedellemc/mars-challenge/sensorsuite"
	"github.com/codedellemc/mars-challenge/sensorsuite/types"
	"github.com/codedellemc/mars-challenge/websocket/wsblaster"
)

func temperatureRoutine(r *types.TemperatureReading) {
	tickerUpdate := time.NewTicker(1 * time.Second)
	timerTrend := time.NewTimer(0)

	for {
		select {
		case <-tickerUpdate.C:
			r.UpdateTemperature()
		case <-timerTrend.C:
			r.UpdateTemperatureTrend()
			timerTrend.Reset(time.Duration(rand.Intn(
				ss.MaxTrendSec-ss.MinTrendSec+1)+
				ss.MinTrendSec) * time.Second)
		}
	}
}

func main() {
	viper.SetEnvPrefix("SENSOR")
	viper.SetDefault("listen_address", ss.DefaultTempWSAddr)
	viper.SetDefault("flare_address", "localhost"+ss.DefaultFlareWSAddr)
	viper.AutomaticEnv()

	rand.Seed(time.Now().UTC().UnixNano())
	reading := &types.TemperatureReading{
		Temperature: ss.InitTemp,
	}

	flareExit := make(chan bool)
	flareAddr := viper.GetString("flare_address")
	go types.FlareUpdateRoutine(reading, &flareAddr, flareExit)

	go temperatureRoutine(reading)

	addr := viper.GetString("listen_address")
	blaster := wsblaster.GetBlaster(&addr, false)
	go blaster.Run()
	ticker := time.NewTicker(1 * time.Second)
	for {
		select {
		case <-ticker.C:
			reading.RLock()
			m, _ := json.Marshal(reading)
			reading.RUnlock()
			blaster.Write(m)
		case <-flareExit:
			log.Fatal("Unable to connect to Solar Flare source")
		}
	}
}


text:
directory=`dirname $0`
source $directory/Initialize.sh

echo "Run STT..."
python $directory/../IO/STT_Live.py
python $directory/../IO/STT.py

cd -


text:
Rails.application.routes.draw do

  mount ActiveSchema::Engine => "/active_schema"
end


text:
<?php

namespace phpstream\operators;

use InvalidArgumentException;

/**
 * LimitOperator restricts the number of returns elements by skipping the first ones.
 */
class SkipOperator implements StreamOperator {

	/**
	 * Construct a new LimitOperator.
	 *
	 * @param int $limit Number of results to skip.
	 */
	public function __construct(private int $limit) {
		if ($limit < 0) {
			throw new InvalidArgumentException('Limit must be a positive integer.');
		}
	}

	/**
	 * The method returns an `iterable` of the processed elements.
	 *
	 * @param iterable $values Values to process.
	 *
	 * @return iterable The processed values.
	 */
	public function execute(iterable $values): iterable {
		$current = 0;

		foreach ($values as $key => $value) {
			if ($current >= $this->limit) {
				yield $key => $value;
			}
			$current++;
		}
	}
}


text:
package io.netflow.flows.cflow

import java.net.{ InetAddress, InetSocketAddress }
import java.util.UUID

import com.datastax.driver.core.utils.UUIDs
import com.twitter.util.Future
import io.netflow.lib._
import io.netflow.storage
import io.netty.buffer._
import net.liftweb.json.JObject
import net.liftweb.json.JsonDSL._
import org.joda.time.DateTime

import scala.util.{ Failure, Try }

/**
 * NetFlow Version 1
 *
 * *-------*---------------*------------------------------------------------------*
 * | Bytes | Contents      | Description                                          |
 * *-------*---------------*------------------------------------------------------*
 * | 0-1   | version       | The version of NetFlow records exported 005          |
 * *-------*---------------*------------------------------------------------------*
 * | 2-3   | count         | Number of flows exported in this packet (1-30)       |
 * *-------*---------------*------------------------------------------------------*
 * | 4-7   | SysUptime     | Current time in milli since the export device booted |
 * *-------*---------------*------------------------------------------------------*
 * | 8-11  | unix_secs     | Current count of seconds since 0000 UTC 1970         |
 * *-------*---------------*------------------------------------------------------*
 * | 12-15 | unix_nsecs    | Residual nanoseconds since 0000 UTC 1970             |
 * *-------*---------------*------------------------------------------------------*
 */

object NetFlowV1Packet {
  private val headerSize = 16
  private val flowSize = 48

  /**
   * Parse a Version 1 FlowPacket
   *
   * @param sender The sender's InetSocketAddress
   * @param buf Netty ByteBuf containing the UDP Packet
   */
  def apply(sender: InetSocketAddress, buf: ByteBuf): Try[NetFlowV1Packet] = Try[NetFlowV1Packet] {
    val version = buf.getUnsignedInteger(0, 2).toInt
    if (version != 1) return Failure(new InvalidFlowVersionException(version))

    val count = buf.getUnsignedInteger(2, 2).toInt
    if (count <= 0 || buf.readableBytes < headerSize + count * flowSize)
      return Failure(new CorruptFlowPacketException)

    val uptime = buf.getUnsignedInteger(4, 4)
    val timestamp = new DateTime(buf.getUnsignedInteger(8, 4) * 1000)
    val id = UUIDs.startOf(timestamp.getMillis)

    val flows: List[NetFlowV1] = (0 to count - 1).toList.flatMap { i =>
      apply(sender, buf.slice(headerSize + (i * flowSize), flowSize), id, uptime, timestamp)
    }
    NetFlowV1Packet(id, sender, buf.readableBytes, uptime, timestamp, flows)
  }

  /**
   * Parse a Version 1 Flow
   *
   * @param sender The sender's InetSocketAddress
   * @param buf Netty ByteBuf Slice containing the UDP Packet
   * @param fpId FlowPacket-UUID this Flow arrived on
   * @param uptime Millis since UNIX Epoch when the exporting device/sender booted
   * @param timestamp DateTime when this flow was exported
   */
  def apply(sender: InetSocketAddress, buf: ByteBuf, fpId: UUID, uptime: Long, timestamp: DateTime): Option[NetFlowV1] =
    Try[NetFlowV1] {
      NetFlowV1(UUIDs.timeBased(), sender, buf.readableBytes(), uptime, timestamp,
        buf.getUnsignedInteger(32, 2).toInt, // srcPort
        buf.getUnsignedInteger(34, 2).toInt, // dstPort
        None, None, // srcAS and dstAS
        buf.getUnsignedInteger(16, 4), // pkts
        buf.getUnsignedInteger(20, 4), // bytes
        buf.getUnsignedByte(38).toInt, // proto
        buf.getUnsignedByte(39).toInt, // tos
        buf.getUnsignedByte(40).toInt, // tcpflags
        Some(buf.getUnsignedInteger(24, 4)).filter(_ != 0).map(x => timestamp.minus(uptime - x)), // start
        Some(buf.getUnsignedInteger(28, 4)).filter(_ != 0).map(x => timestamp.minus(uptime - x)), // stop
        buf.getInetAddress(0, 4), // srcAddress
        buf.getInetAddress(4, 4), // dstAddress
        Option(buf.getInetAddress(8, 4)).filter(_.getHostAddress != "0.0.0.0"), // nextHop
        buf.getUnsignedInteger(12, 2).toInt, // snmpInput
        buf.getUnsignedInteger(14, 2).toInt, // snmpOutput
        fpId)
    }.toOption

  private def doLayer[T](f: FlowPacketMeta[NetFlowV1Packet] => Future[T]): Future[T] = NodeConfig.values.storage match {
    case Some(StorageLayer.Cassandra) => f(storage.cassandra.NetFlowV1Packet)
    case Some(StorageLayer.Redis) => f(storage.redis.NetFlowV1Packet)
    case _ => Future.exception(NoBackendDefined)
  }

  def persist(fp: NetFlowV1Packet): Unit = doLayer(l => Future.value(l.persist(fp)))
}

case class NetFlowV1Packet(id: UUID, sender: InetSocketAddress, length: Int, uptime: Long, timestamp: DateTime,
                           flows: List[NetFlowV1]) extends FlowPacket {
  def version = "NetFlowV1 Packet"
  def count = flows.length
  def persist(): Unit = NetFlowV1Packet.persist(this)
}

case class NetFlowV1(id: UUID, sender: InetSocketAddress, length: Int, uptime: Long, timestamp: DateTime,
                     srcPort: Int, dstPort: Int, srcAS: Option[Int], dstAS: Option[Int],
                     pkts: Long, bytes: Long, proto: Int, tos: Int, tcpflags: Int,
                     start: Option[DateTime], stop: Option[DateTime],
                     srcAddress: InetAddress, dstAddress: InetAddress, nextHop: Option[InetAddress],
                     snmpInput: Int, snmpOutput: Int, packet: UUID) extends NetFlowData[NetFlowV1] {
  def version = "NetFlowV1"

  override lazy val jsonExtra: JObject = "snmp" -> ("input" -> snmpInput) ~ ("output" -> snmpOutput)
}


text:
/** The type of resource */
export enum ResourceType {
    configuration = 'configuration',
    connector = 'connector',
    formatter = 'formatter',
    parser = 'parser',
    hint = 'hint'
}


text:
package org.apache.pig.test;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.Iterator;

import junit.framework.TestCase;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.pig.EvalFunc;
import org.apache.pig.FuncSpec;
import org.apache.pig.PigServer;
import org.apache.pig.backend.executionengine.ExecException;
import org.apache.pig.builtin.COUNT;
import org.apache.pig.builtin.PigStorage;
import org.apache.pig.data.BagFactory;
import org.apache.pig.data.DataBag;
import org.apache.pig.data.DataType;
import org.apache.pig.data.Tuple;
import org.apache.pig.data.TupleFactory;
import org.apache.pig.impl.io.FileLocalizer;
import org.apache.pig.test.utils.TestHelper;
import org.junit.Before;
import org.junit.Test;

public class TestLocal extends TestCase {

    private Log log = LogFactory.getLog(getClass());

    private PigServer pig;

    @Before
    @Override
    protected void setUp() throws Exception {
        //pig = new PigServer(ExecType.MAPREDUCE, cluster.getProperties());
        pig = new PigServer("local");
    }

    @Test
    public void testBigGroupAll() throws Throwable {

        int LOOP_COUNT = 4*1024;
        File tmpFile = File.createTempFile( this.getName(), ".txt");
        PrintStream ps = new PrintStream(new FileOutputStream(tmpFile));
        for(int i = 0; i < LOOP_COUNT; i++) {
            ps.println(i);
        }
        ps.close();
        assertEquals( new Double( LOOP_COUNT ), bigGroupAll( tmpFile) );
        tmpFile.delete();

    }

    @Test
    public void testBigGroupAllWithNull() throws Throwable {

        int LOOP_COUNT = 4*1024;
        File tmpFile = File.createTempFile( this.getName(), ".txt");
        PrintStream ps = new PrintStream(new FileOutputStream(tmpFile));
        long nonNullCnt = 0;
        for(int i = 0; i < LOOP_COUNT; i++) {
        if ( i % 10 == 0 ){
               ps.println("");
        } else {
               ps.println(i);
               nonNullCnt ++;
        }
        }
        ps.close();

        assertEquals( new Double( nonNullCnt ), bigGroupAll( tmpFile) );

        tmpFile.delete();

    }

    @Test
    public Double bigGroupAll( File tmpFile ) throws Throwable {

        String query = "foreach (group (load '"
                + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pig.getPigContext())
                + "') all) generate " + COUNT.class.getName() + "($1) ;";
        System.out.println(query);
        pig.registerQuery("asdf_id = " + query);
        Iterator it = pig.openIterator("asdf_id");
        Tuple t = (Tuple)it.next();

        return  DataType.toDouble(t.get(0));
    }

    static public class MyApply extends EvalFunc<DataBag> {
        String field0 = "Got";
        public MyApply() {}
        public MyApply(String field0) {
            this.field0 = field0;
        }
        @Override
        public DataBag exec(Tuple input) throws IOException {
            try {
                DataBag output = BagFactory.getInstance().newDefaultBag();
                Iterator<Tuple> it = (DataType.toBag(input.get(0))).iterator();
                while(it.hasNext()) {
                    Tuple t = it.next();
                    Tuple newT = TupleFactory.getInstance().newTuple(2);
                    newT.set(0, field0);
                    newT.set(1, t.get(0).toString());
                    output.add(newT);
                }

                return output;
            } catch (ExecException ee) {
                IOException ioe = new IOException(ee.getMessage());
                ioe.initCause(ee);
                throw ioe;
            }
        }
    }
    static public class MyGroup extends EvalFunc<Tuple> {
        @Override
        public Tuple exec(Tuple input) throws IOException{
            try {
                Tuple output = TupleFactory.getInstance().newTuple(1);
                output.set(0, new String("g"));
                return output;
            } catch (ExecException ee) {
                IOException ioe = new IOException(ee.getMessage());
                ioe.initCause(ee);
                throw ioe;
            }
        }
    }

    static public class MyStorage extends PigStorage {

        final static int COUNT = 10;

        int count = 0;
        boolean hasNulls= false;

        public void setNulls(boolean hasNulls ) { this.hasNulls=hasNulls; }

        /**
         *
         */
        public MyStorage() {
            // initialize delimiter to be "-" for output
            // since that is the delimiter in the tests below
            super("-");
        }

        @Override
        public Tuple getNext() throws IOException {
            if (count < COUNT) {

                   Tuple t = TupleFactory.getInstance().newTuple(Integer.toString(count++));
                   return t;

            }

            return null;
        }

    }

    @Test
    public void testStoreFunction() throws Throwable {
        File tmpFile = File.createTempFile("test", ".txt");
        PrintStream ps = new PrintStream(new FileOutputStream(tmpFile));
        for(int i = 0; i < 10; i++) {
            ps.println(i+"\t"+i);
        }
        ps.close();

    //Load, Execute and Store query
        String query = "foreach (load '"
                + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pig.getPigContext())
                + "') generate $0,$1;";
        System.out.println(query);
        pig.registerQuery("asdf_id = " + query);
        try {
            pig.deleteFile("frog");
        } catch(Exception e) {}
        pig.store("asdf_id", "frog", MyStorage.class.getName()+"()");

    //verify query

        InputStream is = FileLocalizer.open("frog", pig.getPigContext());
        BufferedReader br = new BufferedReader(new InputStreamReader(is));
        String line;
        int i = 0;
        while((line = br.readLine()) != null) {

            assertEquals(line, Integer.toString(i) + '-' + Integer.toString(i));
            i++;
        }
        br.close();
        try {
            pig.deleteFile("frog");
        } catch(Exception e) {}
        tmpFile.delete();

    }

    // This test: "testStoreFunction()" is equivalent to testStoreFunctionNoNulls()

    @Test
    public void testStoreFunctionNoNulls() throws Throwable {

        String[][] data = genDataSetFile1( 10, false );
        storeFunction( data);
    }

    @Test
    public void testStoreFunctionWithNulls() throws Throwable {

        String[][] data = genDataSetFile1( 10, true );
        storeFunction( data);
    }

    public void storeFunction(String[][] data) throws Throwable {

        File tmpFile=TestHelper.createTempFile(data) ;

    // Load, Execute and Store query
        String query = "foreach (load '"
                + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pig.getPigContext())
                + "') generate $0,$1;";
        System.out.println(query);
        pig.registerQuery("asdf_id = " + query);
        try {
            pig.deleteFile("frog");
        } catch(Exception e) {}
        pig.store("asdf_id", "frog", MyStorage.class.getName()+"()");

        InputStream is = FileLocalizer.open("frog", pig.getPigContext());
        BufferedReader br = new BufferedReader(new InputStreamReader(is));
        String line;

    //verify query
        int i= 0;
        while((line = br.readLine()) != null) {

            assertEquals( data[i][0] + '-' + data[i][1], line );
            i++;
        }

        br.close();

        try {
            pig.deleteFile("frog");
        } catch(Exception e) {}
        tmpFile.delete();

    }

    @Test
    public void testQualifiedFunctions() throws Throwable {

        //create file
        File tmpFile = File.createTempFile("test", ".txt");
        PrintStream ps = new PrintStream(new FileOutputStream(tmpFile));
        for(int i = 0; i < 1; i++) {
            ps.println(i);
        }
        ps.close();

        // execute query
        String query = "foreach (group (load '"
                + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pig.getPigContext())
                + "' using " + MyStorage.class.getName() + "()) by "
                + MyGroup.class.getName() + "('all')) generate flatten("
                + MyApply.class.getName() + "($1)) ;";
        System.out.println(query);
        pig.registerQuery("asdf_id = " + query);

        //Verfiy query
        Iterator it = pig.openIterator("asdf_id");
        Tuple t;
        int count = 0;
        while(it.hasNext()) {
            t = (Tuple) it.next();
            assertEquals(t.get(0).toString(), "Got");
            Integer.parseInt(t.get(1).toString());
            count++;
        }

        assertEquals( MyStorage.COUNT, count );
        tmpFile.delete();
    }

    @Test
    public void testQualifiedFunctionsWithNulls() throws Throwable {

        //create file
        File tmpFile = File.createTempFile("test", ".txt");
        PrintStream ps = new PrintStream(new FileOutputStream(tmpFile));
        for(int i = 0; i < 1; i++) {
        if ( i % 10 == 0 ){
               ps.println("");
        } else {
               ps.println(i);
        }
        }
        ps.close();

        // execute query
        String query = "foreach (group (load '"
                + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pig.getPigContext())
                + "' using " + MyStorage.class.getName() + "()) by "
                + MyGroup.class.getName() + "('all')) generate flatten("
                + MyApply.class.getName() + "($1)) ;";
        System.out.println(query);
        pig.registerQuery("asdf_id = " + query);

        //Verfiy query
        Iterator it = pig.openIterator("asdf_id");
        Tuple t;
        int count = 0;
        while(it.hasNext()) {
            t = (Tuple) it.next();
            assertEquals(t.get(0).toString(), "Got");
            Integer.parseInt(t.get(1).toString());
            count++;
        }

        assertEquals( MyStorage.COUNT, count );
        tmpFile.delete();
    }

    @Test
    public void testDefinedFunctions() throws Throwable {

        File tmpFile = File.createTempFile("test", ".txt");
        PrintStream ps = new PrintStream(new FileOutputStream(tmpFile));
        for(int i = 0; i < 1; i++) {
            ps.println(i);
        }
        ps.close();
        pig.registerFunction("foo",
            new FuncSpec(MyApply.class.getName()+"('foo')"));
        String query = "foreach (group (load '"
                + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pig.getPigContext())
                + "' using " + MyStorage.class.getName() + "()) by "
                + MyGroup.class.getName()
                + "('all')) generate flatten(foo($1)) ;";
        System.out.println(query);
        pig.registerQuery("asdf_id = " + query);
        Iterator it = pig.openIterator("asdf_id");
        tmpFile.delete();
        Tuple t;
        int count = 0;
        while(it.hasNext()) {
            t = (Tuple) it.next();
            assertEquals("foo", t.get(0).toString());
            Integer.parseInt(t.get(1).toString());
            count++;
        }
        assertEquals(count, MyStorage.COUNT);
    }

   // this test is equivalent to testDefinedFunctions()
    @Test
    public void testDefinedFunctionsNoNulls() throws Throwable {

        String[][] data = genDataSetFile1( 10, false );
        definedFunctions( data);
    }

    @Test
    public void testDefinedFunctionsWithNulls() throws Throwable {

        String[][] data = genDataSetFile1( 10, true );
        definedFunctions( data);
    }

    @Test
    public void definedFunctions(String[][] data) throws Throwable {

        File tmpFile=TestHelper.createTempFile(data) ;
        PrintStream ps = new PrintStream(new FileOutputStream(tmpFile));
        for(int i = 0; i < 1; i++) {
            ps.println(i);
        }
        ps.close();
        pig.registerFunction("foo",
            new FuncSpec(MyApply.class.getName()+"('foo')"));
        String query = "foreach (group (load '"
                + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pig.getPigContext())
                + "' using " + MyStorage.class.getName() + "()) by "
                + MyGroup.class.getName()
                + "('all')) generate flatten(foo($1)) ;";
        System.out.println(query);
        pig.registerQuery("asdf_id = " + query);
        Iterator it = pig.openIterator("asdf_id");
        tmpFile.delete();
        Tuple t;
        int count = 0;
        while(it.hasNext()) {
            t = (Tuple) it.next();
            assertEquals("foo", t.get(0).toString());

            if ( t.get(1).toString() != "" ) {
               Integer.parseInt(t.get(1).toString());
            }
            count++;
        }
        assertEquals(count, MyStorage.COUNT);
    }

//    @Test
//    public void testPigServer() throws Throwable {
//        log.debug("creating pig server");
//        PigContext pigContext = new PigContext(ExecType.MAPREDUCE, cluster.getProperties());
//        PigServer pig = new PigServer(pigContext);
//        System.out.println("testing capacity");
//        long capacity = pig.capacity();
//        assertTrue(capacity > 0);
//        String sampleFileName = "/tmp/fileTest";
//        if (!pig.existsFile(sampleFileName)) {
//            ElementDescriptor path = pigContext.getDfs().asElement(sampleFileName);
//            OutputStream os = path.create();
//            os.write("Ben was here!".getBytes());
//            os.close();
//        }
//        long length = pig.fileSize(sampleFileName);
//        assertTrue(length > 0);
//    }

    /***
     * For generating a sample dataset as
     *
     * no nulls:
     *      $0 $1
     *           0  9
     *           1  1
     *           ....
     *           9  9
     *
     * has nulls:
     *      $0 $1
     *           0  9
     *           1  1
     *              2
     *           3  3
     *           4  4
     *           5  5
     *           6
     *           7  7
     *
     *           9  9
     *
     */
    private String[][] genDataSetFile1( int dataLength, boolean hasNulls ) throws IOException {

        String[][] data= new String[dataLength][];

        if ( hasNulls == true ) {

            for (int i = 0; i < dataLength; i++) {

                     data[i] = new String[2] ;
                     if ( i == 2 ) {
                    data[i][0] = "";
                    data[i][1] = new Integer(i).toString();

             } else if ( i == 6 ) {

                    data[i][0] = new Integer(i).toString();
                    data[i][1] = "";

             } else if ( i == 8 ) {

                    data[i][0] = "";
                    data[i][1] = "";

             } else {
                    data[i][0] = new Integer(i).toString();
                    data[i][1] = new Integer(i).toString();
                 }
         }

    } else {

            for (int i = 0; i < dataLength; i++) {
                    data[i] = new String[2] ;
                    data[i][0] = new Integer(i).toString();
                    data[i][1] = new Integer(i).toString();
            }

    }

         return  data;

    }

}


text:
package provingground.interface
import java.io.PrintStream

object MDocService {
  import os._

  def replResult(code: String): Either[String, String] = {
    pprint.log(code)
    import java.io.ByteArrayOutputStream
    val outputS = new ByteArrayOutputStream()
    val ps = new PrintStream(outputS)
    val md = s"```scala mdoc:to-string\n$code\n```"
    write.over(pwd / "tmp" / "docs" / "fiddle.md", md)
    val td = java.nio.file.Paths.get("tmp/")
    pprint.log(td)
    val exitCode = mdoc.Main.process(Array[String](), ps, td)
    val output = new String(outputS.toByteArray, "UTF-8")
    pprint.log(output)
    def content = read.lines(pwd / "tmp" / "out" / "fiddle.md").drop(1).dropRight(2).mkString("\n")
    if (exitCode == 0) Right(content)
    else Left("--INFO--\n" + "mdoc failed to parse\n" + "--OUTPUT--\n" + output)
      }
}


text:
namespace BookStore.User_Account
{
    partial class NewUser
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Component Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.cmbStatus = new System.Windows.Forms.ComboBox();
            this.cmbAccType = new System.Windows.Forms.ComboBox();
            this.txtConfpass = new System.Windows.Forms.TextBox();
            this.txtPassword = new System.Windows.Forms.TextBox();
            this.txtUName = new System.Windows.Forms.TextBox();
            this.txtName = new System.Windows.Forms.TextBox();
            this.label6 = new System.Windows.Forms.Label();
            this.label5 = new System.Windows.Forms.Label();
            this.label4 = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.label1 = new System.Windows.Forms.Label();
            this.btnSaveNewUser = new System.Windows.Forms.Button();
            this.btnCancel = new System.Windows.Forms.Button();
            this.groupBox1.SuspendLayout();
            this.SuspendLayout();
            //
            // groupBox1
            //
            this.groupBox1.Controls.Add(this.cmbStatus);
            this.groupBox1.Controls.Add(this.cmbAccType);
            this.groupBox1.Controls.Add(this.txtConfpass);
            this.groupBox1.Controls.Add(this.txtPassword);
            this.groupBox1.Controls.Add(this.txtUName);
            this.groupBox1.Controls.Add(this.txtName);
            this.groupBox1.Controls.Add(this.label6);
            this.groupBox1.Controls.Add(this.label5);
            this.groupBox1.Controls.Add(this.label4);
            this.groupBox1.Controls.Add(this.label3);
            this.groupBox1.Controls.Add(this.label2);
            this.groupBox1.Controls.Add(this.label1);
            this.groupBox1.Location = new System.Drawing.Point(3, 3);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(250, 187);
            this.groupBox1.TabIndex = 0;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "Creat New User";
            this.groupBox1.Enter += new System.EventHandler(this.groupBox1_Enter);
            //
            // cmbStatus
            //
            this.cmbStatus.FormattingEnabled = true;
            this.cmbStatus.Items.AddRange(new object[] {
            "Active",
            "Suspended"});
            this.cmbStatus.Location = new System.Drawing.Point(105, 155);
            this.cmbStatus.Name = "cmbStatus";
            this.cmbStatus.Size = new System.Drawing.Size(138, 21);
            this.cmbStatus.TabIndex = 11;
            //
            // cmbAccType
            //
            this.cmbAccType.FormattingEnabled = true;
            this.cmbAccType.Items.AddRange(new object[] {
            "Admin",
            "User"});
            this.cmbAccType.Location = new System.Drawing.Point(105, 128);
            this.cmbAccType.Name = "cmbAccType";
            this.cmbAccType.Size = new System.Drawing.Size(138, 21);
            this.cmbAccType.TabIndex = 10;
            //
            // txtConfpass
            //
            this.txtConfpass.Location = new System.Drawing.Point(105, 102);
            this.txtConfpass.Name = "txtConfpass";
            this.txtConfpass.Size = new System.Drawing.Size(138, 20);
            this.txtConfpass.TabIndex = 9;
            //
            // txtPassword
            //
            this.txtPassword.Location = new System.Drawing.Point(105, 76);
            this.txtPassword.Name = "txtPassword";
            this.txtPassword.Size = new System.Drawing.Size(138, 20);
            this.txtPassword.TabIndex = 8;
            //
            // txtUName
            //
            this.txtUName.Location = new System.Drawing.Point(105, 47);
            this.txtUName.Name = "txtUName";
            this.txtUName.Size = new System.Drawing.Size(138, 20);
            this.txtUName.TabIndex = 7;
            //
            // txtName
            //
            this.txtName.Location = new System.Drawing.Point(105, 18);
            this.txtName.Name = "txtName";
            this.txtName.Size = new System.Drawing.Size(138, 20);
            this.txtName.TabIndex = 6;
            //
            // label6
            //
            this.label6.AutoSize = true;
            this.label6.Location = new System.Drawing.Point(6, 151);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(37, 13);
            this.label6.TabIndex = 5;
            this.label6.Text = "Status";
            //
            // label5
            //
            this.label5.AutoSize = true;
            this.label5.Location = new System.Drawing.Point(6, 127);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(80, 13);
            this.label5.TabIndex = 4;
            this.label5.Text = "Account Type :";
            //
            // label4
            //
            this.label4.AutoSize = true;
            this.label4.Location = new System.Drawing.Point(6, 100);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(101, 13);
            this.label4.TabIndex = 3;
            this.label4.Text = "Conform Password :";
            //
            // label3
            //
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(6, 76);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(59, 13);
            this.label3.TabIndex = 2;
            this.label3.Text = "Password :";
            //
            // label2
            //
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(6, 50);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(66, 13);
            this.label2.TabIndex = 1;
            this.label2.Text = "User Name :";
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(6, 25);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(35, 13);
            this.label1.TabIndex = 0;
            this.label1.Text = "Name";
            //
            // btnSaveNewUser
            //
            this.btnSaveNewUser.Location = new System.Drawing.Point(35, 196);
            this.btnSaveNewUser.Name = "btnSaveNewUser";
            this.btnSaveNewUser.Size = new System.Drawing.Size(75, 23);
            this.btnSaveNewUser.TabIndex = 1;
            this.btnSaveNewUser.Text = "Save";
            this.btnSaveNewUser.UseVisualStyleBackColor = true;
            //
            // btnCancel
            //
            this.btnCancel.Location = new System.Drawing.Point(142, 196);
            this.btnCancel.Name = "btnCancel";
            this.btnCancel.Size = new System.Drawing.Size(75, 23);
            this.btnCancel.TabIndex = 2;
            this.btnCancel.Text = "Cancel";
            this.btnCancel.UseVisualStyleBackColor = true;
            this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
            //
            // NewUser
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.Controls.Add(this.btnCancel);
            this.Controls.Add(this.btnSaveNewUser);
            this.Controls.Add(this.groupBox1);
            this.Name = "NewUser";
            this.Size = new System.Drawing.Size(260, 229);
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.GroupBox groupBox1;
        private System.Windows.Forms.Label label6;
        private System.Windows.Forms.Label label5;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.ComboBox cmbStatus;
        private System.Windows.Forms.ComboBox cmbAccType;
        private System.Windows.Forms.TextBox txtConfpass;
        private System.Windows.Forms.TextBox txtPassword;
        private System.Windows.Forms.TextBox txtUName;
        private System.Windows.Forms.TextBox txtName;
        private System.Windows.Forms.Button btnSaveNewUser;
        private System.Windows.Forms.Button btnCancel;
    }
}


text:
function cancelar(){
	$.win.close();
}

function openURL(){
    Alloy.createController("WebView/WebView",{url:"http://www.nissan.com.mx/modelos#"}).getView().open();
}


text:
using namespace std;
using namespace swganh::object;

GuildFactory::GuildFactory(swganh::app::SwganhKernel* kernel)
    : ObjectFactory(kernel)
{}

void GuildFactory::LoadFromStorage(const std::shared_ptr<sql::Connection>& connection, const std::shared_ptr<Object>& object, boost::unique_lock<boost::mutex>& lock)
{
    ObjectFactory::LoadFromStorage(connection, object, lock);
}

uint32_t GuildFactory::PersistObject(const shared_ptr<Object>& object, boost::unique_lock<boost::mutex>& lock, bool persist_inherited)
{
    return 0;
}

void GuildFactory::DeleteObjectFromStorage(const shared_ptr<Object>& object)
{}

shared_ptr<Object> GuildFactory::CreateObjectFromTemplate(const string& template_name, bool db_persisted, bool db_initialized)
{
    if(db_persisted || db_initialized)
    {
        //TODO: Have to hit the db to make this
        return make_shared<Guild>();
    }
    else
    {
        return make_shared<Guild>();
    }
}


text:
import {Meteor} from 'meteor/meteor';
import {check} from 'meteor/check';

export default function (methodName, ClassName) {
  Meteor.methods({
    [`${methodName}.create`](toInsert) {
      check(toInsert, Object);

      const instance = new ClassName();
      instance.create(toInsert);
      return instance._id;
    },

    [`${methodName}.edit`](Id, updates) {
      check(Id, String);
      check(updates, Object);

      const instance = ClassName.findOne(Id);
      instance.edit(updates);
    },

    [`${methodName}.delete`](Id) {
      check(Id, String);

      const instance = ClassName.findOne(Id);
      instance.remove();
    }
  });
}


text:
// This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com

/* AthraWorkplace.cs --
 * Ars Magna project, http://arsmagna.ru
 * -------------------------------------------------------
 * Status: poor
 */

#region Using directives

using System.Xml.Serialization;

using AM;

using CodeJam;

using JetBrains.Annotations;

using ManagedIrbis.Mapping;

using MoonSharp.Interpreter;

using Newtonsoft.Json;

#endregion

namespace ManagedIrbis.Fields
{
    /// <summary>
    /// Место работы в базе данных ATHRA.
    /// Поле 910.
    /// </summary>
    [PublicAPI]
    [XmlRoot("workplace")]
    [MoonSharpUserData]
    public sealed class AthraWorkPlace
    {
        #region Constants

        /// <summary>
        /// Known subfield codes.
        /// </summary>
        public const string KnownCodes = "py";

        #endregion

        #region Properties

        /// <summary>
        /// Работает в данной организации.
        /// Подполе y.
        /// </summary>
        [CanBeNull]
        [SubField('y')]
        [XmlElement("here")]
        [JsonProperty("here", NullValueHandling = NullValueHandling.Ignore)]
        public string WorksHere { get; set; }

        /// <summary>
        /// Место работы автора.
        /// Подполе p.
        /// </summary>
        [CanBeNull]
        [SubField('p')]
        [XmlElement("place")]
        [JsonProperty("place", NullValueHandling = NullValueHandling.Ignore)]
        public string WorkPlace { get; set; }

        /// <summary>
        /// Associated <see cref="RecordField"/>.
        /// </summary>
        [CanBeNull]
        [XmlIgnore]
        [JsonIgnore]
        public RecordField Field { get; set; }

        /// <summary>
        /// Arbitrary user data.
        /// </summary>
        [CanBeNull]
        [XmlIgnore]
        [JsonIgnore]
        public object UserData { get; set; }

        #endregion

        #region Public methods

        /// <summary>
        /// Apply to the <see cref="RecordField"/>.
        /// </summary>
        [NotNull]
        public RecordField ApplyTo
            (
                [NotNull] RecordField field
            )
        {
            Code.NotNull(field, "field");

            field.ApplySubField('y', WorksHere)
                .ApplySubField('p', WorkPlace);

            return field;
        }

        /// <summary>
        /// Parse the field.
        /// </summary>
        [CanBeNull]
        public static AthraWorkPlace Parse
            (
                [CanBeNull] RecordField field
            )
        {
            if (ReferenceEquals(field, null))
            {
                return null;
            }

            AthraWorkPlace result = new AthraWorkPlace
            {
                WorksHere = field.GetFirstSubFieldValue('y'),
                WorkPlace = field.GetFirstSubFieldValue('p'),
                Field = field
            };

            return result;
        }

        /// <summary>
        /// Convert back to <see cref="RecordField"/>.
        /// </summary>
        [NotNull]
        public RecordField ToField()
        {
            RecordField result = new RecordField(910)
                .AddNonEmptySubField('p', WorkPlace)
                .AddNonEmptySubField('y', WorksHere);

            return result;
        }

        #endregion

        #region Object members

        /// <inheritdoc cref="object.ToString" />
        public override string ToString()
        {
            return WorkPlace.ToVisibleString();
        }

        #endregion
    }
}


text:
FROM 192.168.0.190:5000/mongo:installlib

ADD Dockerfile /root/Dockerfile

RUN rm -rf /opt/ibm/wlp/usr/servers/defaultServer/server.xml
ADD server.xml /opt/ibm/wlp/usr/servers/defaultServer/server.xml

#RUN installUtility install --acceptLicense defaultServer
RUN rm -rf /opt/ibm/wlp/usr/servers/defaultServer/workarea

ADD ./build/libs/*.war /opt/ibm/wlp/usr/servers/defaultServer/apps

EXPOSE 80

CMD ["/opt/ibm/wlp/bin/server", "run", "defaultServer"]


text:
angular
  .module('hide-on-disable', [])
  .directive('hideOnDisable', function() {
    return {
      restrict: 'A',
      scope: {
        ngDisabled: '=',
        ngModel: '='
      },
      link: function(scope, elem, attrs) {
        var lastVal = null;
        scope.$watch('ngDisabled', function(newVal, oldVal) {
          if (newVal && !oldVal) { // if control has become disabled
            lastVal = scope.ngModel;
            scope.ngModel = undefined; // unset value
          } else if (oldVal && !newVal) { // if control has been reenabled
            if (typeof lastVal !== "undefined" && lastVal !== null) {
              scope.ngModel = lastVal; // reset value
            }
          }
        });
      }
    };
  });


text:
/**
 * Created by Q on 4/1/2015.
 */
'use strict';

angular.module('transcoding-ui.view_form', ['ngRoute', 'ui.bootstrap', 'ngCookies'])

    .config(['$routeProvider', function($routeProvider) {
        $routeProvider.when('/upload', {
            templateUrl: 'view_form/view_form.html',
            controller: 'ViewFormCtrl'
        });
    }])

    .controller('ViewFormCtrl',
        ['$scope',
            '$cookies',
            'localStorageService',
            'awsApiService',
            '$window', function ($scope,$cookies,localStorageService,awsApi, $window) {

        $scope.creds = {
            bucket: 'cp476-vids',
            access_key: 'AKIAI2CYGPH7N5JWYQ7A',
            secret_key: '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'
        };

        $scope.sizeLimit      = 10585760*1000; // 10GB in Bytes
        $scope.uploadProgress = 0;
        $scope.type = 'info';
        $scope.active = 'active';

        $scope.upload = function() {
            AWS.config.update({ accessKeyId: $scope.creds.access_key, secretAccessKey: $scope.creds.secret_key });
            AWS.config.region = 'us-west-2';
            var bucket = new AWS.S3({ params: { Bucket: $scope.creds.bucket } });

            if($scope.file) {
                // Perform File Size Check First
                var fileSize = Math.round(parseInt($scope.file.size));
                if (fileSize > $scope.sizeLimit) {
                    alert('Sorry, your attachment is too big. <br/> Maximum '  + $scope.fileSizeLabel() + ' file attachment allowed');
                    return false;
                }
                // Prepend Unique String To Prevent Overwrites
                $scope.uniqueFileName = localStorageService.get('user')+localStorageService.get('sessionId')+'/' +$scope.uniqueString() + '-' + $scope.file.name;

                var params = { Key: $scope.uniqueFileName, ContentType: $scope.file.type, Body: $scope.file, ServerSideEncryption: 'AES256', ACL: 'public-read' };

                bucket.putObject(params, function(err, data) {
                    if(err) {
                        alert(err.code + ': ' +err.message);
                        $scope.type = 'danger';
                        return false;
                    }
                    else {
                        // Upload Successfully Finished
                        //fix id generation
                        var id = 0;
                        awsApi.postVideo($scope.uniqueFileName).$promise.then(function(response){
                            id = response.id;
                            localStorageService.set(id,$scope.uniqueFileName);
                            setTimeout(function() {
                                    $window.location.href = '#/history';
                                },2000
                            )
                        });

                        // Reset The Progress Bar
                        setTimeout(function() {
                            $scope.uploadProgress = 0;
                            $scope.type = 'info';
                            $scope.active = 'active';
                            $scope.$digest();
                        }, 4000);
                    }
                })
                    .on('httpUploadProgress',function(progress) {
                        $scope.uploadProgress = Math.round(progress.loaded / progress.total * 100);
                        if ($scope.uploadProgress ==100) {
                            $scope.type = 'success';
                            $scope.active = '';
                        }
                        $scope.$digest();
                    });
            }
            else {
                // No File Selected
                alert('Please select a file to upload');
            }
        };

        $scope.fileSizeLabel = function() {
            // Convert Bytes To MB
            return Math.round($scope.sizeLimit / 1024 / 1024) + 'MB';
        };

        $scope.uniqueString = function() {
            var text     = "";
            var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";

            for( var i=0; i < 8; i++ ) {
                text += possible.charAt(Math.floor(Math.random() * possible.length));
            }
            return text;
        };

        $scope.getFileUrl = function(){
            return $scope.creds.bucket +'/'+  $scope.uniqueFileName;
        };

    }]);


text:
<?php

namespace JMS\Serializer\Tests\Fixtures\Discriminator;

use JMS\Serializer\Annotation as Serializer;

/**
 * @Serializer\Discriminator(field = "type", map = {
 *    "car": "JMS\Serializer\Tests\Fixtures\Discriminator\Car",
 *    "moped": "JMS\Serializer\Tests\Fixtures\Discriminator\Moped",
 * })
 */
abstract class Vehicle
{
    /** @Serializer\Type("integer") */
    public $km;

    public function __construct($km)
    {
        $this->km = (integer) $km;
    }
}


text:
Dashboard

26

New Comments!

					View Details

12

New Tasks!

					View Details

124

New Orders!

					View Details

13

Support Tickets!

					View Details

				 Responsive Timeline

Lorem ipsum dolor

										11 hours ago via Twitter

Lorem ipsum dolor sit amet, consectetur adipisicing elit.
									Libero laboriosam dolor perspiciatis omnis exercitationem.
									Beatae, officia pariatur? Est cum veniam excepturi. Maiores
									praesentium, porro voluptas suscipit facere rem dicta, debitis.

Lorem ipsum dolor

Lorem ipsum dolor sit amet, consectetur adipisicing elit.
									Autem dolorem quibusdam, tenetur commodi provident cumque magni
									voluptatem libero, quis rerum. Fugiat esse debitis optio,
									tempore. Animi officiis alias, officia repellendus.

Lorem ipsum dolor sit amet, consectetur adipisicing elit.
									Laudantium maiores odit qui est tempora eos, nostrum provident
									explicabo dignissimos debitis vel! Adipisci eius voluptates, ad
									aut recusandae minus eaque facere.

Lorem ipsum dolor

Lorem ipsum dolor sit amet, consectetur adipisicing elit.
									Repellendus numquam facilis enim eaque, tenetur nam id qui vel
									velit similique nihil iure molestias aliquam, voluptatem totam
									quaerat, magni commodi quisquam.

Lorem ipsum dolor

Lorem ipsum dolor sit amet, consectetur adipisicing elit.
									Voluptates est quaerat asperiores sapiente, eligendi, nihil.
									Itaque quos, alias sapiente rerum quas odit! Aperiam officiis
									quidem delectus libero, omnis ut debitis!

Lorem ipsum dolor

Lorem ipsum dolor sit amet, consectetur adipisicing elit.
									Nobis minus modi quam ipsum alias at est molestiae excepturi
									delectus nesciunt, quibusdam debitis amet, beatae consequuntur
									impedit nulla qui! Laborum, atque.

									<button type="button"
										class="btn btn-primary btn-sm dropdown-toggle"
										data-toggle="dropdown">

									</button>

Action

Another action

Something else here

Separated link

Lorem ipsum dolor

Lorem ipsum dolor sit amet, consectetur adipisicing elit.
									Sequi fuga odio quibusdam. Iure expedita, incidunt unde quis
									nam! Quod, quisquam. Officia quam qui adipisci quas
									consequuntur nostrum sequi. Consequuntur, commodi.

Lorem ipsum dolor

Lorem ipsum dolor sit amet, consectetur adipisicing elit.
									Deserunt obcaecati, quaerat tempore officia voluptas debitis
									consectetur culpa amet, accusamus dolorum fugiat, animi dicta
									aperiam, enim incidunt quisquam maxime neque eaque.

				 Notifications Panel

					  New Comment 4 minutes ago

					   3 New Followers 12 minutes ago

					   Message Sent 27 minutes ago

					   New Task 43 minutes ago

					   Server Rebooted 11:32 AM
					   Server Crashed! 11:13 AM
					   Server Not Responding 10:57 AM
					   New Order Placed 9:49 AM
					   Payment Received Yesterday

				View All Alerts

	<app-chat></app-chat>


text:
<?php

namespace OtherCode\FController\Components;

/**
 * Class Messages
 * @package OtherCode\FController\Components
 */
class Messages extends \OtherCode\FController\Components\Registry
{
    /**
     * Add a new message to the queue
     * @param string $text
     * @param null|string $type
     */
    public function addMessage($text, $type = null)
    {
        $this->set(null, new \OtherCode\FController\Components\Messages\Message($text, $type));
    }

    /**
     * Purge all the messages
     */
    public function purge()
    {
        foreach ($this as $index => $message) {
            unset($this->$index);
        }
    }
}


text:
namespace OCIO = OCIO_NAMESPACE;

namespace ocigo {

IndexMap<OCIO::ConfigRcPtr> g_Config_map;

}

extern "C" {
    void deleteConfig(Config *p) {
        if (p != NULL) {
            if (p->handle) {
                ocigo::g_Config_map.remove(p->handle);
                p->handle = 0;
            }
            freeHandleContext(p);
        }
    }

    // Config Init
    Config* Config_Create() {
        return (Config*) NEW_HANDLE_CONTEXT(ocigo::g_Config_map.add(OCIO::Config::Create()));
    }

    Config* GetCurrentConfig() {
        Config* c = NEW_HANDLE_CONTEXT();
        BEGIN_CATCH_CTX_ERR(c)
        c->handle = ocigo::g_Config_map.add(
                OCIO_CONST_POINTER_CAST<OCIO::Config>(OCIO::GetCurrentConfig()));
        END_CATCH_CTX_ERR(c)
        return c;
    }

    void SetCurrentConfig(Config* c) {
        BEGIN_CATCH_CTX_ERR(c)
        OCIO::SetCurrentConfig(ocigo::g_Config_map.get(c->handle));
        END_CATCH_CTX_ERR(c)
    }

    Config* Config_CreateFromEnv() {
        Config* c = NEW_HANDLE_CONTEXT();
        BEGIN_CATCH_CTX_ERR(c)
        c->handle = ocigo::g_Config_map.add(
                OCIO_CONST_POINTER_CAST<OCIO::Config>(OCIO::Config::CreateFromEnv()));
        END_CATCH_CTX_ERR(c)
        return c;
    }

    Config* Config_CreateFromFile(const char* filename) {
        Config* c = NEW_HANDLE_CONTEXT();
        BEGIN_CATCH_CTX_ERR(c)
        c->handle = ocigo::g_Config_map.add(
                OCIO_CONST_POINTER_CAST<OCIO::Config>(OCIO::Config::CreateFromFile(filename)));
        END_CATCH_CTX_ERR(c)
        return c;
    }

    Config* Config_CreateFromData(const char* data) {
        std::stringstream s;
        s << data;
        s.seekp(0);

        Config* c = NEW_HANDLE_CONTEXT();

        BEGIN_CATCH_CTX_ERR(c)
        c->handle = ocigo::g_Config_map.add(
                OCIO_CONST_POINTER_CAST<OCIO::Config>(OCIO::Config::CreateFromStream(s)));
        END_CATCH_CTX_ERR(c)

        return c;
    }

    Config* Config_createEditableCopy(Config* p) {
        Config* cpy = NEW_HANDLE_CONTEXT();
        BEGIN_CATCH_CTX_ERR(p)
        cpy->handle = ocigo::g_Config_map.add(ocigo::g_Config_map.get(p->handle).get()->createEditableCopy());
        END_CATCH_CTX_ERR(p)
        return cpy;
    }

    void Config_sanityCheck(Config* p) {
        BEGIN_CATCH_CTX_ERR(p)
        ocigo::g_Config_map.get(p->handle).get()->sanityCheck();
        END_CATCH_CTX_ERR(p)
    }

    char* Config_serialize(Config* p) {
        std::stringstream s;
        BEGIN_CATCH_CTX_ERR(p)
        ocigo::g_Config_map.get(p->handle).get()->serialize(s);
        END_CATCH_CTX_ERR(p)

        char* cstr = new char[s.str().length()+1];
        std::strcpy(cstr, s.str().c_str());

        return cstr;
    }

    const char* Config_getCacheID(Config* p) {
        const char* ret = NULL;
        BEGIN_CATCH_CTX_ERR(p)
        ret = ocigo::g_Config_map.get(p->handle).get()->getCacheID();
        END_CATCH_CTX_ERR(p)
        return ret;
    }

    const char* Config_getCacheIDWithContext(Config* p, ContextId c) {
        const char* ret = NULL;
        OCIO::ConstContextRcPtr context = ocigo::g_Context_map.get(c->handle);
        BEGIN_CATCH_CTX_ERR(p)
        ret = ocigo::g_Config_map.get(p->handle).get()->getCacheID(context);
        END_CATCH_CTX_ERR(p)
        return ret;
    }

    const char* Config_getDescription(Config* p) {
        const char* ret = NULL;
        BEGIN_CATCH_CTX_ERR(p)
        ret = ocigo::g_Config_map.get(p->handle).get()->getDescription();
        END_CATCH_CTX_ERR(p)
        return ret;
    }

    // Config Resources
    ContextId Config_getCurrentContext(Config* p) {
        OCIO::ContextRcPtr ptr;

        BEGIN_CATCH_CTX_ERR(p)
        ptr = OCIO_CONST_POINTER_CAST<OCIO::Context>(ocigo::g_Config_map.get(p->handle).get()->getCurrentContext());
        END_CATCH_CTX_ERR(p)
        if (ptr == NULL) { return 0; }

        return NEW_HANDLE_CONTEXT(ocigo::g_Context_map.add(ptr));
    }

    const char* Config_getSearchPath(Config* p) {
        const char* ret = NULL;
        BEGIN_CATCH_CTX_ERR(p)
        ret = ocigo::g_Config_map.get(p->handle).get()->getSearchPath();
        END_CATCH_CTX_ERR(p)
        return ret;
    }

    const char* Config_getWorkingDir(Config* p) {
        const char* ret = NULL;
        BEGIN_CATCH_CTX_ERR(p)
        ret = ocigo::g_Config_map.get(p->handle).get()->getWorkingDir();
        END_CATCH_CTX_ERR(p)
        return ret;
    }

    // Config Processors
    ProcessorId Config_getProcessor_CT_CS_CS(Config* p, ContextId ct, ColorSpaceId srcCS, ColorSpaceId dstCS) {
        OCIO::ConstProcessorRcPtr   ptr;
        OCIO::ConstContextRcPtr     ct_ptr    = ocigo::g_Context_map.get(ct->handle);
        OCIO::ConstColorSpaceRcPtr  srcCS_ptr = ocigo::g_ColorSpace_map.get(srcCS);
        OCIO::ConstColorSpaceRcPtr  dstCS_ptr = ocigo::g_ColorSpace_map.get(dstCS);

        BEGIN_CATCH_CTX_ERR(p)
        ptr = ocigo::g_Config_map.get(p->handle).get()->getProcessor(ct_ptr, srcCS_ptr, dstCS_ptr);
        END_CATCH_CTX_ERR(p)

        return NEW_HANDLE_CONTEXT(ocigo::g_Processor_map.add(OCIO_CONST_POINTER_CAST<OCIO::Processor>(ptr)));
    }

    ProcessorId Config_getProcessor_CS_CS(Config* p, ColorSpaceId srcCS, ColorSpaceId dstCS) {
        OCIO::ConstProcessorRcPtr   ptr;
        OCIO::ConstColorSpaceRcPtr  srcCS_ptr = ocigo::g_ColorSpace_map.get(srcCS);
        OCIO::ConstColorSpaceRcPtr  dstCS_ptr = ocigo::g_ColorSpace_map.get(dstCS);

        BEGIN_CATCH_CTX_ERR(p)
        ptr = ocigo::g_Config_map.get(p->handle).get()->getProcessor(srcCS_ptr, dstCS_ptr);
        END_CATCH_CTX_ERR(p)

        if ( ptr == NULL) { return 0; }
        return NEW_HANDLE_CONTEXT(ocigo::g_Processor_map.add(OCIO_CONST_POINTER_CAST<OCIO::Processor>(ptr)));
    }

    ProcessorId Config_getProcessor_S_S(Config* p, const char* srcName, const char* dstName) {
        OCIO::ConstProcessorRcPtr ptr;

        BEGIN_CATCH_CTX_ERR(p)
        ptr = ocigo::g_Config_map.get(p->handle).get()->getProcessor(srcName, dstName);
        END_CATCH_CTX_ERR(p)

        if ( ptr == NULL) { return 0; }
        return NEW_HANDLE_CONTEXT(ocigo::g_Processor_map.add(OCIO_CONST_POINTER_CAST<OCIO::Processor>(ptr)));
    }

    ProcessorId Config_getProcessor_CT_S_S(Config* p, ContextId ct, const char* srcName, const char* dstName) {
        OCIO::ConstProcessorRcPtr   ptr;
        OCIO::ConstContextRcPtr     ct_ptr = ocigo::g_Context_map.get(ct->handle);

        BEGIN_CATCH_CTX_ERR(p)
        ptr = ocigo::g_Config_map.get(p->handle).get()->getProcessor(ct_ptr, srcName, dstName);
        END_CATCH_CTX_ERR(p)

        if ( ptr == NULL) { return 0; }
        return NEW_HANDLE_CONTEXT(ocigo::g_Processor_map.add(OCIO_CONST_POINTER_CAST<OCIO::Processor>(ptr)));
    }

    ProcessorId Config_getProcessor_TX(Config* p, TransformId tx) {
        OCIO::ConstProcessorRcPtr ptr;
        OCIO::ConstTransformRcPtr tx_ptr = ocigo::g_Transform_map.get(tx);

        BEGIN_CATCH_CTX_ERR(p)
        ptr = ocigo::g_Config_map.get(p->handle).get()->getProcessor(tx_ptr);
        END_CATCH_CTX_ERR(p)

        if ( ptr == NULL) { return 0; }
        return NEW_HANDLE_CONTEXT(ocigo::g_Processor_map.add(OCIO_CONST_POINTER_CAST<OCIO::Processor>(ptr)));
    }

    ProcessorId Config_getProcessor_TX_D(Config* p, TransformId tx, TransformDirection direction) {
        OCIO::ConstProcessorRcPtr ptr;
        OCIO::ConstTransformRcPtr tx_ptr = ocigo::g_Transform_map.get(tx);

        BEGIN_CATCH_CTX_ERR(p)
        ptr = ocigo::g_Config_map.get(p->handle).get()->getProcessor(
            tx_ptr, (OCIO::TransformDirection)direction);
        END_CATCH_CTX_ERR(p)

        if ( ptr == NULL) { return 0; }
        return NEW_HANDLE_CONTEXT(ocigo::g_Processor_map.add(OCIO_CONST_POINTER_CAST<OCIO::Processor>(ptr)));
    }

    ProcessorId Config_getProcessor_CT_TX_D(Config* p, ContextId ct, TransformId tx, TransformDirection direction) {
        OCIO::ConstProcessorRcPtr ptr;
        OCIO::ConstContextRcPtr ct_ptr = ocigo::g_Context_map.get(ct->handle);
        OCIO::ConstTransformRcPtr tx_ptr = ocigo::g_Transform_map.get(tx);

        BEGIN_CATCH_CTX_ERR(p)
        ptr = ocigo::g_Config_map.get(p->handle).get()->getProcessor(
            ct_ptr, tx_ptr, (OCIO::TransformDirection)direction);
        END_CATCH_CTX_ERR(p)

        if ( ptr == NULL) { return 0; }
        return NEW_HANDLE_CONTEXT(ocigo::g_Processor_map.add(OCIO_CONST_POINTER_CAST<OCIO::Processor>(ptr)));
    }

    // Config ColorSpaces
    int Config_getNumColorSpaces(Config* p) {
        int ret = 0;
        BEGIN_CATCH_CTX_ERR(p)
        ret = ocigo::g_Config_map.get(p->handle).get()->getNumColorSpaces();
        END_CATCH_CTX_ERR(p)
        return ret;
    }

    const char* Config_getColorSpaceNameByIndex(Config* p, int index) {
        const char* ret = NULL;
        BEGIN_CATCH_CTX_ERR(p)
        ret = ocigo::g_Config_map.get(p->handle).get()->getColorSpaceNameByIndex(index);
        END_CATCH_CTX_ERR(p)
        return ret;
    }

    ColorSpaceId Config_getColorSpace(Config* p, const char* name) {
        OCIO::ConstColorSpaceRcPtr ptr;

        BEGIN_CATCH_CTX_ERR(p)
        ptr = ocigo::g_Config_map.get(p->handle).get()->getColorSpace(name);
        END_CATCH_CTX_ERR(p)

        if ( ptr == NULL) { return 0; }
        return ocigo::g_ColorSpace_map.add(OCIO_CONST_POINTER_CAST<OCIO::ColorSpace>(ptr));
    }

    int Config_getIndexForColorSpace(Config* p, const char* name) {
        int ret = -1;
        BEGIN_CATCH_CTX_ERR(p)
        ret =  ocigo::g_Config_map.get(p->handle).get()->getIndexForColorSpace(name);
        END_CATCH_CTX_ERR(p)
        return ret;
    }

    void Config_addColorSpace(Config* p, ColorSpaceId cs) {
        OCIO::ConstColorSpaceRcPtr colorspace = ocigo::g_ColorSpace_map.get(cs);
        BEGIN_CATCH_CTX_ERR(p)
        ocigo::g_Config_map.get(p->handle).get()->addColorSpace(colorspace);
        END_CATCH_CTX_ERR(p)
    }

    void Config_clearColorSpaces(Config* p) {
        BEGIN_CATCH_CTX_ERR(p)
        ocigo::g_Config_map.get(p->handle).get()->clearColorSpaces();
        END_CATCH_CTX_ERR(p)
    }

    const char* Config_parseColorSpaceFromString(Config* p, const char* str) {
        const char* ret = NULL;
        BEGIN_CATCH_CTX_ERR(p)
        ret = ocigo::g_Config_map.get(p->handle).get()->parseColorSpaceFromString(str);
        END_CATCH_CTX_ERR(p)
        return ret;
    }

    bool Config_isStrictParsingEnabled(Config* p) {
        bool ret = false;
        BEGIN_CATCH_CTX_ERR(p)
        ret = ocigo::g_Config_map.get(p->handle).get()->isStrictParsingEnabled();
        END_CATCH_CTX_ERR(p)
        return ret;
    }

    void Config_setStrictParsingEnabled(Config* p, bool enabled) {
        BEGIN_CATCH_CTX_ERR(p)
        ocigo::g_Config_map.get(p->handle).get()->setStrictParsingEnabled(enabled);
        END_CATCH_CTX_ERR(p)
    }

    // Config Roles
    void Config_setRole(Config* p, const char* role, const char* colorSpaceName) {
        BEGIN_CATCH_CTX_ERR(p)
        ocigo::g_Config_map.get(p->handle).get()->setRole(role, colorSpaceName);
        END_CATCH_CTX_ERR(p)
    }

    int Config_getNumRoles(Config* p) {
        int ret = 0;
        BEGIN_CATCH_CTX_ERR(p)
        ret = ocigo::g_Config_map.get(p->handle).get()->getNumRoles();
        END_CATCH_CTX_ERR(p)
        return ret;
    }

    bool Config_hasRole(Config* p, const char* role) {
        bool ret = false;
        BEGIN_CATCH_CTX_ERR(p)
        ret = ocigo::g_Config_map.get(p->handle).get()->hasRole(role);
        END_CATCH_CTX_ERR(p)
        return ret;
    }

    const char* Config_getRoleName(Config* p, int index) {
        const char* ret = NULL;
        BEGIN_CATCH_CTX_ERR(p)
        ret = ocigo::g_Config_map.get(p->handle).get()->getRoleName(index);
        END_CATCH_CTX_ERR(p)
        return ret;
    }

    // Config Display/View Registration
    const char* Config_getDefaultDisplay(Config* p) {
        const char* ret = NULL;
        BEGIN_CATCH_CTX_ERR(p)
        ret = ocigo::g_Config_map.get(p->handle).get()->getDefaultDisplay();
        END_CATCH_CTX_ERR(p)
        return ret;
    }

    int Config_getNumDisplays(Config* p) {
        int ret = 0;
        BEGIN_CATCH_CTX_ERR(p)
        ret = ocigo::g_Config_map.get(p->handle).get()->getNumDisplays();
        END_CATCH_CTX_ERR(p)
        return ret;
    }

    const char* Config_getDisplay(Config* p, int index) {
        const char* ret = NULL;
        BEGIN_CATCH_CTX_ERR(p)
        ret = ocigo::g_Config_map.get(p->handle).get()->getDisplay(index);
        END_CATCH_CTX_ERR(p)
        return ret;
    }

    const char* Config_getDefaultView(Config* p, const char* display) {
        const char* ret = NULL;
        BEGIN_CATCH_CTX_ERR(p)
        ret = ocigo::g_Config_map.get(p->handle).get()->getDefaultView(display);
        END_CATCH_CTX_ERR(p)
        return ret;
    }

    int Config_getNumViews(Config* p, const char* display) {
        int ret = 0;
        BEGIN_CATCH_CTX_ERR(p)
        ret = ocigo::g_Config_map.get(p->handle).get()->getNumViews(display);
        END_CATCH_CTX_ERR(p)
        return ret;
    }

    const char* Config_getView(Config* p, const char* display, int index) {
        const char* ret = NULL;
        BEGIN_CATCH_CTX_ERR(p)
        ret =  ocigo::g_Config_map.get(p->handle).get()->getView(display, index);
        END_CATCH_CTX_ERR(p)
        return ret;
    }

    const char* Config_getDisplayColorSpaceName(Config* p, const char* display, const char* view) {
        const char* ret = NULL;
        BEGIN_CATCH_CTX_ERR(p)
        ret =  ocigo::g_Config_map.get(p->handle).get()->getDisplayColorSpaceName(display, view);
        END_CATCH_CTX_ERR(p)
        return ret;
    }

    const char* Config_getDisplayLooks(Config* p, const char* display, const char* view) {
        const char* ret = NULL;
        BEGIN_CATCH_CTX_ERR(p)
        ret =  ocigo::g_Config_map.get(p->handle).get()->getDisplayLooks(display, view);
        END_CATCH_CTX_ERR(p)
        return ret;
    }

    void Config_addDisplay(Config* p, const char* display, const char* view, const char* colorSpaceName, const char* looks) {
        BEGIN_CATCH_CTX_ERR(p)
        ocigo::g_Config_map.get(p->handle).get()->addDisplay(display, view, colorSpaceName, looks);
        END_CATCH_CTX_ERR(p)
    }

    void Config_clearDisplays(Config* p) {
        BEGIN_CATCH_CTX_ERR(p)
        ocigo::g_Config_map.get(p->handle).get()->clearDisplays();
        END_CATCH_CTX_ERR(p)
    }

    void Config_setActiveDisplays(Config* p, const char* displays) {
        BEGIN_CATCH_CTX_ERR(p)
        ocigo::g_Config_map.get(p->handle).get()->setActiveDisplays(displays);
        END_CATCH_CTX_ERR(p)
    }

    const char* Config_getActiveDisplays(Config* p) {
        const char* ret = NULL;
        BEGIN_CATCH_CTX_ERR(p)
        ret = ocigo::g_Config_map.get(p->handle).get()->getActiveDisplays();
        END_CATCH_CTX_ERR(p)
        return ret;
    }

    void Config_setActiveViews(Config* p, const char* views) {
        BEGIN_CATCH_CTX_ERR(p)
        ocigo::g_Config_map.get(p->handle).get()->setActiveViews(views);
        END_CATCH_CTX_ERR(p)
    }

    const char* Config_getActiveViews(Config* p) {
        const char* ret = NULL;
        BEGIN_CATCH_CTX_ERR(p)
        ret = ocigo::g_Config_map.get(p->handle).get()->getActiveViews();
        END_CATCH_CTX_ERR(p)
        return ret;
    }

}