text:
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
require File.expand_path(File.dirname(__FILE__) + '/../git_patch_snippets')

class GitPatchTest < Test::Unit::TestCase

  def test_can_split_into_changes
    git_patch = patch_from_snippet(GitPatchSnippets::TWO_ADDS)
    assert_equal 2, git_patch.changes.size
  end

  def test_change_detail_on_add_non_binary_file
    change = first_change_from_snippet(GitPatchSnippets::TWO_ADDS)
    assert_equal 'person.rb', change.path
    assert_equal [:added], change.change_type
    assert !change.binary?
  end

  def test_change_detail_on_delete_non_binary_file
    change = first_change_from_snippet(GitPatchSnippets::DELETE)
    assert_equal 'salary.rb', change.path
    assert_equal [:deleted], change.change_type
    assert !change.binary?
  end

  def test_change_detail_on_modify_non_binary_file
    change = first_change_from_snippet(GitPatchSnippets::MODIFY)
    assert_equal 'person.rb', change.path
    assert_equal [:modified], change.change_type
    assert !change.binary?
  end

  def test_change_detail_on_rename_non_binary_file_with_modify
    change = first_change_from_snippet(GitPatchSnippets::RENAME_WITH_MODIFY)
    assert_equal 'todo.rb', change.path
    assert_equal 'task.rb', change.renamed_from_path
    assert_equal [:renamed, :modified], change.change_type
    assert !change.binary?
  end

  def test_change_detail_on_rename_non_binary_file_without_modify
    # rename w/o mods can only be tested directly against repsitory
    repository = TestRepositoryFactory.create_repository_without_source_browser('renames')
    git_patch = repository.git_patch_for(repository.changeset('1'))
    change = git_patch.changes.last
    assert_equal 'some_stuff.txt', change.path
    assert_equal 'stuff.txt', change.renamed_from_path
    assert_equal [:renamed], change.change_type
    assert !change.binary?
  end

  #todo (low): create bundle to avoid stub
  def test_change_path_when_path_itself_looks_like_the_diff_format
    repos_stub = Object.new
    def repos_stub.binary?(path, changeset)
      false
    end
    change = first_change_from_snippet(GitPatchSnippets::FUNKY_PATHS, repos_stub)
    assert_equal 'foo/n o o b/README.txt', change.path
  end

  def test_change_detail_on_add_binary_file
    change = first_change_from_snippet(GitPatchSnippets::BINARY_ADD)
    assert_equal 'image.png', change.path
    assert_equal [:added], change.change_type
    assert change.binary?
  end

  def test_change_detail_on_delete_binary_file
    change = first_change_from_snippet(GitPatchSnippets::BINARY_DELETE)
    assert_equal 'image.png', change.path
    assert_equal [:deleted], change.change_type
    assert change.binary?
  end

  def test_change_detail_on_modify_binary_file
    change = first_change_from_snippet(GitPatchSnippets::BINARY_MODIFY)
    assert_equal 'image.png', change.path
    assert_equal [:modified], change.change_type
    assert change.binary?
  end

  def test_change_detail_on_rename_binary_file_with_modify
    change = first_change_from_snippet(GitPatchSnippets::BINARY_RENAME_WITH_MODIFY)
    assert_equal 'picture.png', change.path
    assert_equal 'image.png', change.renamed_from_path
    assert_equal [:renamed, :modified], change.change_type
    assert change.binary?
  end

  def test_change_detail_on_rename_binary_file_without_modify
    # rename w/o mods should only be tested directly against repsitory
    repository = TestRepositoryFactory.create_repository_without_source_browser('renames')
    git_patch = repository.git_patch_for(repository.changeset('1'))
    change = git_patch.changes.first
    assert_equal 'WorstestEver.png', change.path
    assert_equal 'WorstEver.png', change.renamed_from_path
    assert_equal [:renamed], change.change_type
    assert change.binary?
  end

  def test_change_detail_on_copy_non_binary_file
    change = first_change_from_snippet(GitPatchSnippets::COPY)
    assert_equal 'tags/thought_viscera-3.6/README', change.path
    assert_equal [:added], change.change_type
    assert !change.binary?
  end

  # no idea how Cruise rev 0 got in this state, but we need to handle it...
  def test_changeset_with_no_changes_simply_returns_empty_list_of_changes
    repository = TestRepositoryFactory.create_repository_without_source_browser('empty_rev')
    git_patch = repository.git_patch_for(repository.changeset('0'))
    assert git_patch.changes.empty?
  end

  def test_changes_are_truncated_when_diff_too_large
    repository = TestRepositoryFactory.create_repository_without_source_browser('big_diff')
    git_patch = repository.git_patch_for(repository.changeset('1'), 10)
    assert git_patch.changes[0].truncated?
    assert_equal git_patch.changes[0].lines.size, 10
  end

  def test_changes_are_not_truncated_when_diff_is_exactly_at_limit
    repository = TestRepositoryFactory.create_repository_without_source_browser('big_diff')
    git_patch = repository.git_patch_for(repository.changeset('1'), 35)
    assert !git_patch.changes[0].truncated?
    assert_equal git_patch.changes[0].lines.size, 35
  end

  def test_changes_are_not_truncated_when_diff_is_below_limit
    repository = TestRepositoryFactory.create_repository_without_source_browser('big_diff')
    git_patch = repository.git_patch_for(repository.changeset('1'), 100)
    assert !git_patch.changes[0].truncated?
    assert_equal git_patch.changes[0].lines.size, 35
  end

  def first_change_from_snippet(snippet_text, repos_stub = nil)
    patch_from_snippet(snippet_text, repos_stub).changes.first
  end

  def patch_from_snippet(snippet_text, repos_stub = nil)
    patch = HgGitPatch.new(nil, repos_stub)
    StringIO.new(snippet_text).each do |line|
      patch.add_line(line)
    end
    patch.done_adding_lines
    patch
  end

end


text:
using EnigmaWeb.Models;
using EnigmaWeb.Models.Raw;
using EnigmaWeb.Parsers;

namespace EnigmaWeb.Ioc
{
    internal static class IocConfig
    {
        public static IServiceLocator BuildDefault()
        {
            var context = new ServiceContainer();

            context.Register<IParse<string, E2Event>>(new E2EventParser());
            context.Register<IParse<RawE2Event, E2Event>>(new E2EventParser());
            context.Register<IParse<string, E2EventList>>(new E2EventListParser());
            context.Register<IParse<RawE2EventList, E2EventList>>(new E2EventListParser());

            context.Register<IParse<string, E2Service>>(new E2ServiceParser());
            context.Register<IParse<RawE2Service, E2Service>>(new E2ServiceParser());
            context.Register<IParse<string, E2ServiceList>>(new E2ServiceListParser());
            context.Register<IParse<RawE2ServiceList, E2ServiceList>>(new E2ServiceListParser());

            context.Register<IParse<string, E2SessionId>>(new E2SessionIdParser());
            context.Register<IParse<RawE2SessionId, E2SessionId>>(new E2SessionIdParser());

            context.Register<IParse<string, E2SimpleXmlResult>>(new E2SimpleXmlResultParser());
            context.Register<IParse<RawE2SimpleXmlResult, E2SimpleXmlResult>>(new E2SimpleXmlResultParser());

            context.Register<IParse<RawE2Timer, E2Timer>>(new E2TimerParser());
            context.Register<IParse<string, E2Timer>>(new E2TimerParser());
            context.Register<IParse<RawE2TimerList, E2TimerList>>(new E2TimerListParser());
            context.Register<IParse<string, E2TimerList>>(new E2TimerListParser());

            return context;
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
from setuptools import setup, find_packages

setup(name='hyde',
      version='0.4',
      description='static site generator',
      packages=find_packages(),
      install_requires=(
          'django',
          'pyYAML',
          'markdown2',
          'pygments',
          'pyrss2gen',
      ),
)


text:
package com.microsoft.bingads.customerbilling;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for anonymous complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType>
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="AccountId" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
 *         <element name="InsertionOrderIds" type="{http://schemas.microsoft.com/2003/10/Serialization/Arrays}ArrayOflong" minOccurs="0"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "accountId",
    "insertionOrderIds"
})
@XmlRootElement(name = "GetInsertionOrdersByAccountRequest")
public class GetInsertionOrdersByAccountRequest {

    @XmlElement(name = "AccountId")
    protected Long accountId;
    @XmlElement(name = "InsertionOrderIds", nillable = true)
    protected ArrayOflong insertionOrderIds;

    /**
     * Gets the value of the accountId property.
     *
     * @return
     *     possible object is
     *     {@link Long }
     *
     */
    public Long getAccountId() {
        return accountId;
    }

    /**
     * Sets the value of the accountId property.
     *
     * @param value
     *     allowed object is
     *     {@link Long }
     *
     */
    public void setAccountId(Long value) {
        this.accountId = value;
    }

    /**
     * Gets the value of the insertionOrderIds property.
     *
     * @return
     *     possible object is
     *     {@link ArrayOflong }
     *
     */
    public ArrayOflong getInsertionOrderIds() {
        return insertionOrderIds;
    }

    /**
     * Sets the value of the insertionOrderIds property.
     *
     * @param value
     *     allowed object is
     *     {@link ArrayOflong }
     *
     */
    public void setInsertionOrderIds(ArrayOflong value) {
        this.insertionOrderIds = value;
    }

}


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:fab="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/main_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/background"
    tools:context="pl.snowdog.dzialajlokalnie.LoginActivity">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
            app:layout_scrollFlags="scroll|enterAlways" />

    </android.support.design.widget.AppBarLayout>
    <RelativeLayout
        android:id="@+id/login_container"
        android:layout_below="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:padding="@dimen/activity_horizontal_margin"
        >
        <android.support.design.widget.TextInputLayout
            android:id="@+id/etEmailWrapper"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            >

            <EditText
                android:id="@+id/etEmail"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="textEmailAddress"
                android:singleLine="true"
                android:hint="@string/email" />

        </android.support.design.widget.TextInputLayout>

        <android.support.design.widget.TextInputLayout
            android:id="@+id/etPasswordWrapper"
            android:layout_below="@id/etEmailWrapper"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            >

            <EditText
                android:id="@+id/etPassword"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="textPassword"
                android:singleLine="true"

                android:hint="@string/pass" />

        </android.support.design.widget.TextInputLayout>
        <Button
            android:id="@+id/btnLogin"
            android:layout_below="@+id/etPasswordWrapper"
            android:textColor="@color/colorAccent"
            android:text="@string/login_action"
            android:layout_alignParentRight="true"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            style="?android:attr/borderlessButtonStyle" />
        <RelativeLayout
            android:id="@+id/register_container"
            android:layout_below="@+id/btnLogin"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <TextView
                android:id="@+id/tvRegisterCTA"

                android:text="@string/register_cta"
                android:layout_centerVertical="true"
                android:layout_alignParentLeft="true"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                />
            <Button
                android:id="@+id/btnRegister"
                android:layout_marginLeft="@dimen/activity_horizontal_margin"
                android:layout_toRightOf="@+id/tvRegisterCTA"
                android:textColor="@color/colorAccent"
                android:text="@string/register_cta2"
                android:layout_centerVertical="true"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                style="?android:attr/borderlessButtonStyle"
                />
        </RelativeLayout>

        <RelativeLayout
            android:id="@+id/orContainer"
            android:layout_below="@id/register_container"
            android:layout_marginTop="@dimen/activity_horizontal_margin"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <View
                android:layout_alignParentLeft="true"
                android:layout_toLeftOf="@+id/tvOr"
                android:layout_centerVertical="true"
                android:layout_width="wrap_content"
                android:layout_height="1dp"
                android:background="?android:attr/dividerVertical" />
            <TextView
                android:id="@+id/tvOr"
                android:layout_marginLeft="@dimen/activity_horizontal_margin"
                android:layout_marginRight="@dimen/activity_horizontal_margin"
                android:layout_centerHorizontal="true"
                android:text="@string/or"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />
            <View
                android:layout_alignParentRight="true"
                android:layout_toRightOf="@+id/tvOr"
                android:layout_centerVertical="true"
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:background="?android:attr/dividerVertical" />
        </RelativeLayout>
        <com.facebook.login.widget.LoginButton
            android:id="@+id/btnLoginFacebook"
            android:layout_below="@id/orContainer"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="@dimen/activity_horizontal_margin"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            />
    </RelativeLayout>

</RelativeLayout>


text:
import cv2

def read_image_white_text(file_path):
    image = cv2.imread(file_path, cv2.IMREAD_GRAYSCALE)
    th, dst = cv2.threshold(image, 130, 255, cv2.THRESH_BINARY_INV)
    file_path = 'white_text.jpg'
    cv2.imwrite(file_path, dst)
    return file_path


text:
package com.amazonaws.services.cloudformation.model;

import java.io.Serializable;
import javax.annotation.Generated;

/**
 *

 * Detailed information about the drift status of the stack set.
 *

 *

 * For stack sets, contains information about the last completed drift operation performed on the stack set.
 * Information about drift operations in-progress isn't included.
 *

 *

 * For stack set operations, includes information about drift operations currently being performed on the stack set.
 *

 *

 * For more information, see Detecting unmanaged
 * changes in stack sets in the CloudFormation User Guide.
 *

 *
 * @see AWS API Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class StackSetDriftDetectionDetails implements Serializable, Cloneable {

    /**
     *

     * Status of the stack set's actual configuration compared to its expected template and parameter configuration. A
     * stack set is considered to have drifted if one or more of its stack instances have drifted from their expected
     * template and parameter configuration.
     *

     *

     *

     *

     * DRIFTED: One or more of the stack instances belonging to the stack set stack differs from the
     * expected template and parameter configuration. A stack instance is considered to have drifted if one or more of
     * the resources in the associated stack have drifted.
     *

     *

     *

     *

     * NOT_CHECKED: CloudFormation hasn't checked the stack set for drift.
     *

     *

     *

     *

     * IN_SYNC: All of the stack instances belonging to the stack set stack match from the expected
     * template and parameter configuration.
     *

     *

     *

     */
    private String driftStatus;
    /**
     *

     * The status of the stack set drift detection operation.
     *

     *

     *

     *

     * COMPLETED: The drift detection operation completed without failing on any stack instances.
     *

     *

     *

     *

     * FAILED: The drift detection operation exceeded the specified failure tolerance.
     *

     *

     *

     *

     * PARTIAL_SUCCESS: The drift detection operation completed without exceeding the failure tolerance for
     * the operation.
     *

     *

     *

     *

     * IN_PROGRESS: The drift detection operation is currently being performed.
     *

     *

     *

     *

     * STOPPED: The user has canceled the drift detection operation.
     *

     *

     *

     */
    private String driftDetectionStatus;
    /**
     *

     * Most recent time when CloudFormation performed a drift detection operation on the stack set. This value will be
     * NULL for any stack set on which drift detection hasn't yet been performed.
     *

     */
    private java.util.Date lastDriftCheckTimestamp;
    /**
     *

     * The total number of stack instances belonging to this stack set.
     *

     *

     * The total number of stack instances is equal to the total of:
     *

     *

     *

     *

     * Stack instances that match the stack set configuration.
     *

     *

     *

     *

     * Stack instances that have drifted from the stack set configuration.
     *

     *

     *

     *

     * Stack instances where the drift detection operation has failed.
     *

     *

     *

     *

     * Stack instances currently being checked for drift.
     *

     *

     *

     */
    private Integer totalStackInstancesCount;
    /**
     *

     * The number of stack instances that have drifted from the expected template and parameter configuration of the
     * stack set. A stack instance is considered to have drifted if one or more of the resources in the associated stack
     * don't match their expected configuration.
     *

     */
    private Integer driftedStackInstancesCount;
    /**
     *

     * The number of stack instances which match the expected template and parameter configuration of the stack set.
     *

     */
    private Integer inSyncStackInstancesCount;
    /**
     *

     * The number of stack instances that are currently being checked for drift.
     *

     */
    private Integer inProgressStackInstancesCount;
    /**
     *

     * The number of stack instances for which the drift detection operation failed.
     *

     */
    private Integer failedStackInstancesCount;

    /**
     *

     * Status of the stack set's actual configuration compared to its expected template and parameter configuration. A
     * stack set is considered to have drifted if one or more of its stack instances have drifted from their expected
     * template and parameter configuration.
     *

     *

     *

     *

     * DRIFTED: One or more of the stack instances belonging to the stack set stack differs from the
     * expected template and parameter configuration. A stack instance is considered to have drifted if one or more of
     * the resources in the associated stack have drifted.
     *

     *

     *

     *

     * NOT_CHECKED: CloudFormation hasn't checked the stack set for drift.
     *

     *

     *

     *

     * IN_SYNC: All of the stack instances belonging to the stack set stack match from the expected
     * template and parameter configuration.
     *

     *

     *

     *
     * @param driftStatus
     *        Status of the stack set's actual configuration compared to its expected template and parameter
     *        configuration. A stack set is considered to have drifted if one or more of its stack instances have
     *        drifted from their expected template and parameter configuration.

     *

     *

     *

     *        DRIFTED: One or more of the stack instances belonging to the stack set stack differs from the
     *        expected template and parameter configuration. A stack instance is considered to have drifted if one or
     *        more of the resources in the associated stack have drifted.
     *

     *

     *

     *

     *        NOT_CHECKED: CloudFormation hasn't checked the stack set for drift.
     *

     *

     *

     *

     *        IN_SYNC: All of the stack instances belonging to the stack set stack match from the expected
     *        template and parameter configuration.
     *

     *

     * @see StackSetDriftStatus
     */

    public void setDriftStatus(String driftStatus) {
        this.driftStatus = driftStatus;
    }

    /**
     *

     * Status of the stack set's actual configuration compared to its expected template and parameter configuration. A
     * stack set is considered to have drifted if one or more of its stack instances have drifted from their expected
     * template and parameter configuration.
     *

     *

     *

     *

     * DRIFTED: One or more of the stack instances belonging to the stack set stack differs from the
     * expected template and parameter configuration. A stack instance is considered to have drifted if one or more of
     * the resources in the associated stack have drifted.
     *

     *

     *

     *

     * NOT_CHECKED: CloudFormation hasn't checked the stack set for drift.
     *

     *

     *

     *

     * IN_SYNC: All of the stack instances belonging to the stack set stack match from the expected
     * template and parameter configuration.
     *

     *

     *

     *
     * @return Status of the stack set's actual configuration compared to its expected template and parameter
     *         configuration. A stack set is considered to have drifted if one or more of its stack instances have
     *         drifted from their expected template and parameter configuration.

     *

     *

     *

     *         DRIFTED: One or more of the stack instances belonging to the stack set stack differs from
     *         the expected template and parameter configuration. A stack instance is considered to have drifted if one
     *         or more of the resources in the associated stack have drifted.
     *

     *

     *

     *

     *         NOT_CHECKED: CloudFormation hasn't checked the stack set for drift.
     *

     *

     *

     *

     *         IN_SYNC: All of the stack instances belonging to the stack set stack match from the expected
     *         template and parameter configuration.
     *

     *

     * @see StackSetDriftStatus
     */

    public String getDriftStatus() {
        return this.driftStatus;
    }

    /**
     *

     * Status of the stack set's actual configuration compared to its expected template and parameter configuration. A
     * stack set is considered to have drifted if one or more of its stack instances have drifted from their expected
     * template and parameter configuration.
     *

     *

     *

     *

     * DRIFTED: One or more of the stack instances belonging to the stack set stack differs from the
     * expected template and parameter configuration. A stack instance is considered to have drifted if one or more of
     * the resources in the associated stack have drifted.
     *

     *

     *

     *

     * NOT_CHECKED: CloudFormation hasn't checked the stack set for drift.
     *

     *

     *

     *

     * IN_SYNC: All of the stack instances belonging to the stack set stack match from the expected
     * template and parameter configuration.
     *

     *

     *

     *
     * @param driftStatus
     *        Status of the stack set's actual configuration compared to its expected template and parameter
     *        configuration. A stack set is considered to have drifted if one or more of its stack instances have
     *        drifted from their expected template and parameter configuration.

     *

     *

     *

     *        DRIFTED: One or more of the stack instances belonging to the stack set stack differs from the
     *        expected template and parameter configuration. A stack instance is considered to have drifted if one or
     *        more of the resources in the associated stack have drifted.
     *

     *

     *

     *

     *        NOT_CHECKED: CloudFormation hasn't checked the stack set for drift.
     *

     *

     *

     *

     *        IN_SYNC: All of the stack instances belonging to the stack set stack match from the expected
     *        template and parameter configuration.
     *

     *

     * @return Returns a reference to this object so that method calls can be chained together.
     * @see StackSetDriftStatus
     */

    public StackSetDriftDetectionDetails withDriftStatus(String driftStatus) {
        setDriftStatus(driftStatus);
        return this;
    }

    /**
     *

     * Status of the stack set's actual configuration compared to its expected template and parameter configuration. A
     * stack set is considered to have drifted if one or more of its stack instances have drifted from their expected
     * template and parameter configuration.
     *

     *

     *

     *

     * DRIFTED: One or more of the stack instances belonging to the stack set stack differs from the
     * expected template and parameter configuration. A stack instance is considered to have drifted if one or more of
     * the resources in the associated stack have drifted.
     *

     *

     *

     *

     * NOT_CHECKED: CloudFormation hasn't checked the stack set for drift.
     *

     *

     *

     *

     * IN_SYNC: All of the stack instances belonging to the stack set stack match from the expected
     * template and parameter configuration.
     *

     *

     *

     *
     * @param driftStatus
     *        Status of the stack set's actual configuration compared to its expected template and parameter
     *        configuration. A stack set is considered to have drifted if one or more of its stack instances have
     *        drifted from their expected template and parameter configuration.

     *

     *

     *

     *        DRIFTED: One or more of the stack instances belonging to the stack set stack differs from the
     *        expected template and parameter configuration. A stack instance is considered to have drifted if one or
     *        more of the resources in the associated stack have drifted.
     *

     *

     *

     *

     *        NOT_CHECKED: CloudFormation hasn't checked the stack set for drift.
     *

     *

     *

     *

     *        IN_SYNC: All of the stack instances belonging to the stack set stack match from the expected
     *        template and parameter configuration.
     *

     *

     * @return Returns a reference to this object so that method calls can be chained together.
     * @see StackSetDriftStatus
     */

    public StackSetDriftDetectionDetails withDriftStatus(StackSetDriftStatus driftStatus) {
        this.driftStatus = driftStatus.toString();
        return this;
    }

    /**
     *

     * The status of the stack set drift detection operation.
     *

     *

     *

     *

     * COMPLETED: The drift detection operation completed without failing on any stack instances.
     *

     *

     *

     *

     * FAILED: The drift detection operation exceeded the specified failure tolerance.
     *

     *

     *

     *

     * PARTIAL_SUCCESS: The drift detection operation completed without exceeding the failure tolerance for
     * the operation.
     *

     *

     *

     *

     * IN_PROGRESS: The drift detection operation is currently being performed.
     *

     *

     *

     *

     * STOPPED: The user has canceled the drift detection operation.
     *

     *

     *

     *
     * @param driftDetectionStatus
     *        The status of the stack set drift detection operation.

     *

     *

     *

     *        COMPLETED: The drift detection operation completed without failing on any stack instances.
     *

     *

     *

     *

     *        FAILED: The drift detection operation exceeded the specified failure tolerance.
     *

     *

     *

     *

     *        PARTIAL_SUCCESS: The drift detection operation completed without exceeding the failure
     *        tolerance for the operation.
     *

     *

     *

     *

     *        IN_PROGRESS: The drift detection operation is currently being performed.
     *

     *

     *

     *

     *        STOPPED: The user has canceled the drift detection operation.
     *

     *

     * @see StackSetDriftDetectionStatus
     */

    public void setDriftDetectionStatus(String driftDetectionStatus) {
        this.driftDetectionStatus = driftDetectionStatus;
    }

    /**
     *

     * The status of the stack set drift detection operation.
     *

     *

     *

     *

     * COMPLETED: The drift detection operation completed without failing on any stack instances.
     *

     *

     *

     *

     * FAILED: The drift detection operation exceeded the specified failure tolerance.
     *

     *

     *

     *

     * PARTIAL_SUCCESS: The drift detection operation completed without exceeding the failure tolerance for
     * the operation.
     *

     *

     *

     *

     * IN_PROGRESS: The drift detection operation is currently being performed.
     *

     *

     *

     *

     * STOPPED: The user has canceled the drift detection operation.
     *

     *

     *

     *
     * @return The status of the stack set drift detection operation.

     *

     *

     *

     *         COMPLETED: The drift detection operation completed without failing on any stack instances.
     *

     *

     *

     *

     *         FAILED: The drift detection operation exceeded the specified failure tolerance.
     *

     *

     *

     *

     *         PARTIAL_SUCCESS: The drift detection operation completed without exceeding the failure
     *         tolerance for the operation.
     *

     *

     *

     *

     *         IN_PROGRESS: The drift detection operation is currently being performed.
     *

     *

     *

     *

     *         STOPPED: The user has canceled the drift detection operation.
     *

     *

     * @see StackSetDriftDetectionStatus
     */

    public String getDriftDetectionStatus() {
        return this.driftDetectionStatus;
    }

    /**
     *

     * The status of the stack set drift detection operation.
     *

     *

     *

     *

     * COMPLETED: The drift detection operation completed without failing on any stack instances.
     *

     *

     *

     *

     * FAILED: The drift detection operation exceeded the specified failure tolerance.
     *

     *

     *

     *

     * PARTIAL_SUCCESS: The drift detection operation completed without exceeding the failure tolerance for
     * the operation.
     *

     *

     *

     *

     * IN_PROGRESS: The drift detection operation is currently being performed.
     *

     *

     *

     *

     * STOPPED: The user has canceled the drift detection operation.
     *

     *

     *

     *
     * @param driftDetectionStatus
     *        The status of the stack set drift detection operation.

     *

     *

     *

     *        COMPLETED: The drift detection operation completed without failing on any stack instances.
     *

     *

     *

     *

     *        FAILED: The drift detection operation exceeded the specified failure tolerance.
     *

     *

     *

     *

     *        PARTIAL_SUCCESS: The drift detection operation completed without exceeding the failure
     *        tolerance for the operation.
     *

     *

     *

     *

     *        IN_PROGRESS: The drift detection operation is currently being performed.
     *

     *

     *

     *

     *        STOPPED: The user has canceled the drift detection operation.
     *

     *

     * @return Returns a reference to this object so that method calls can be chained together.
     * @see StackSetDriftDetectionStatus
     */

    public StackSetDriftDetectionDetails withDriftDetectionStatus(String driftDetectionStatus) {
        setDriftDetectionStatus(driftDetectionStatus);
        return this;
    }

    /**
     *

     * The status of the stack set drift detection operation.
     *

     *

     *

     *

     * COMPLETED: The drift detection operation completed without failing on any stack instances.
     *

     *

     *

     *

     * FAILED: The drift detection operation exceeded the specified failure tolerance.
     *

     *

     *

     *

     * PARTIAL_SUCCESS: The drift detection operation completed without exceeding the failure tolerance for
     * the operation.
     *

     *

     *

     *

     * IN_PROGRESS: The drift detection operation is currently being performed.
     *

     *

     *

     *

     * STOPPED: The user has canceled the drift detection operation.
     *

     *

     *

     *
     * @param driftDetectionStatus
     *        The status of the stack set drift detection operation.

     *

     *

     *

     *        COMPLETED: The drift detection operation completed without failing on any stack instances.
     *

     *

     *

     *

     *        FAILED: The drift detection operation exceeded the specified failure tolerance.
     *

     *

     *

     *

     *        PARTIAL_SUCCESS: The drift detection operation completed without exceeding the failure
     *        tolerance for the operation.
     *

     *

     *

     *

     *        IN_PROGRESS: The drift detection operation is currently being performed.
     *

     *

     *

     *

     *        STOPPED: The user has canceled the drift detection operation.
     *

     *

     * @return Returns a reference to this object so that method calls can be chained together.
     * @see StackSetDriftDetectionStatus
     */

    public StackSetDriftDetectionDetails withDriftDetectionStatus(StackSetDriftDetectionStatus driftDetectionStatus) {
        this.driftDetectionStatus = driftDetectionStatus.toString();
        return this;
    }

    /**
     *

     * Most recent time when CloudFormation performed a drift detection operation on the stack set. This value will be
     * NULL for any stack set on which drift detection hasn't yet been performed.
     *

     *
     * @param lastDriftCheckTimestamp
     *        Most recent time when CloudFormation performed a drift detection operation on the stack set. This value
     *        will be NULL for any stack set on which drift detection hasn't yet been performed.
     */

    public void setLastDriftCheckTimestamp(java.util.Date lastDriftCheckTimestamp) {
        this.lastDriftCheckTimestamp = lastDriftCheckTimestamp;
    }

    /**
     *

     * Most recent time when CloudFormation performed a drift detection operation on the stack set. This value will be
     * NULL for any stack set on which drift detection hasn't yet been performed.
     *

     *
     * @return Most recent time when CloudFormation performed a drift detection operation on the stack set. This value
     *         will be NULL for any stack set on which drift detection hasn't yet been performed.
     */

    public java.util.Date getLastDriftCheckTimestamp() {
        return this.lastDriftCheckTimestamp;
    }

    /**
     *

     * Most recent time when CloudFormation performed a drift detection operation on the stack set. This value will be
     * NULL for any stack set on which drift detection hasn't yet been performed.
     *

     *
     * @param lastDriftCheckTimestamp
     *        Most recent time when CloudFormation performed a drift detection operation on the stack set. This value
     *        will be NULL for any stack set on which drift detection hasn't yet been performed.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public StackSetDriftDetectionDetails withLastDriftCheckTimestamp(java.util.Date lastDriftCheckTimestamp) {
        setLastDriftCheckTimestamp(lastDriftCheckTimestamp);
        return this;
    }

    /**
     *

     * The total number of stack instances belonging to this stack set.
     *

     *

     * The total number of stack instances is equal to the total of:
     *

     *

     *

     *

     * Stack instances that match the stack set configuration.
     *

     *

     *

     *

     * Stack instances that have drifted from the stack set configuration.
     *

     *

     *

     *

     * Stack instances where the drift detection operation has failed.
     *

     *

     *

     *

     * Stack instances currently being checked for drift.
     *

     *

     *

     *
     * @param totalStackInstancesCount
     *        The total number of stack instances belonging to this stack set.

     *

     *        The total number of stack instances is equal to the total of:
     *

     *

     *

     *

     *        Stack instances that match the stack set configuration.
     *

     *

     *

     *

     *        Stack instances that have drifted from the stack set configuration.
     *

     *

     *

     *

     *        Stack instances where the drift detection operation has failed.
     *

     *

     *

     *

     *        Stack instances currently being checked for drift.
     *

     *

     */

    public void setTotalStackInstancesCount(Integer totalStackInstancesCount) {
        this.totalStackInstancesCount = totalStackInstancesCount;
    }

    /**
     *

     * The total number of stack instances belonging to this stack set.
     *

     *

     * The total number of stack instances is equal to the total of:
     *

     *

     *

     *

     * Stack instances that match the stack set configuration.
     *

     *

     *

     *

     * Stack instances that have drifted from the stack set configuration.
     *

     *

     *

     *

     * Stack instances where the drift detection operation has failed.
     *

     *

     *

     *

     * Stack instances currently being checked for drift.
     *

     *

     *

     *
     * @return The total number of stack instances belonging to this stack set.

     *

     *         The total number of stack instances is equal to the total of:
     *

     *

     *

     *

     *         Stack instances that match the stack set configuration.
     *

     *

     *

     *

     *         Stack instances that have drifted from the stack set configuration.
     *

     *

     *

     *

     *         Stack instances where the drift detection operation has failed.
     *

     *

     *

     *

     *         Stack instances currently being checked for drift.
     *

     *

     */

    public Integer getTotalStackInstancesCount() {
        return this.totalStackInstancesCount;
    }

    /**
     *

     * The total number of stack instances belonging to this stack set.
     *

     *

     * The total number of stack instances is equal to the total of:
     *

     *

     *

     *

     * Stack instances that match the stack set configuration.
     *

     *

     *

     *

     * Stack instances that have drifted from the stack set configuration.
     *

     *

     *

     *

     * Stack instances where the drift detection operation has failed.
     *

     *

     *

     *

     * Stack instances currently being checked for drift.
     *

     *

     *

     *
     * @param totalStackInstancesCount
     *        The total number of stack instances belonging to this stack set.

     *

     *        The total number of stack instances is equal to the total of:
     *

     *

     *

     *

     *        Stack instances that match the stack set configuration.
     *

     *

     *

     *

     *        Stack instances that have drifted from the stack set configuration.
     *

     *

     *

     *

     *        Stack instances where the drift detection operation has failed.
     *

     *

     *

     *

     *        Stack instances currently being checked for drift.
     *

     *

     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public StackSetDriftDetectionDetails withTotalStackInstancesCount(Integer totalStackInstancesCount) {
        setTotalStackInstancesCount(totalStackInstancesCount);
        return this;
    }

    /**
     *

     * The number of stack instances that have drifted from the expected template and parameter configuration of the
     * stack set. A stack instance is considered to have drifted if one or more of the resources in the associated stack
     * don't match their expected configuration.
     *

     *
     * @param driftedStackInstancesCount
     *        The number of stack instances that have drifted from the expected template and parameter configuration of
     *        the stack set. A stack instance is considered to have drifted if one or more of the resources in the
     *        associated stack don't match their expected configuration.
     */

    public void setDriftedStackInstancesCount(Integer driftedStackInstancesCount) {
        this.driftedStackInstancesCount = driftedStackInstancesCount;
    }

    /**
     *

     * The number of stack instances that have drifted from the expected template and parameter configuration of the
     * stack set. A stack instance is considered to have drifted if one or more of the resources in the associated stack
     * don't match their expected configuration.
     *

     *
     * @return The number of stack instances that have drifted from the expected template and parameter configuration of
     *         the stack set. A stack instance is considered to have drifted if one or more of the resources in the
     *         associated stack don't match their expected configuration.
     */

    public Integer getDriftedStackInstancesCount() {
        return this.driftedStackInstancesCount;
    }

    /**
     *

     * The number of stack instances that have drifted from the expected template and parameter configuration of the
     * stack set. A stack instance is considered to have drifted if one or more of the resources in the associated stack
     * don't match their expected configuration.
     *

     *
     * @param driftedStackInstancesCount
     *        The number of stack instances that have drifted from the expected template and parameter configuration of
     *        the stack set. A stack instance is considered to have drifted if one or more of the resources in the
     *        associated stack don't match their expected configuration.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public StackSetDriftDetectionDetails withDriftedStackInstancesCount(Integer driftedStackInstancesCount) {
        setDriftedStackInstancesCount(driftedStackInstancesCount);
        return this;
    }

    /**
     *

     * The number of stack instances which match the expected template and parameter configuration of the stack set.
     *

     *
     * @param inSyncStackInstancesCount
     *        The number of stack instances which match the expected template and parameter configuration of the stack
     *        set.
     */

    public void setInSyncStackInstancesCount(Integer inSyncStackInstancesCount) {
        this.inSyncStackInstancesCount = inSyncStackInstancesCount;
    }

    /**
     *

     * The number of stack instances which match the expected template and parameter configuration of the stack set.
     *

     *
     * @return The number of stack instances which match the expected template and parameter configuration of the stack
     *         set.
     */

    public Integer getInSyncStackInstancesCount() {
        return this.inSyncStackInstancesCount;
    }

    /**
     *

     * The number of stack instances which match the expected template and parameter configuration of the stack set.
     *

     *
     * @param inSyncStackInstancesCount
     *        The number of stack instances which match the expected template and parameter configuration of the stack
     *        set.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public StackSetDriftDetectionDetails withInSyncStackInstancesCount(Integer inSyncStackInstancesCount) {
        setInSyncStackInstancesCount(inSyncStackInstancesCount);
        return this;
    }

    /**
     *

     * The number of stack instances that are currently being checked for drift.
     *

     *
     * @param inProgressStackInstancesCount
     *        The number of stack instances that are currently being checked for drift.
     */

    public void setInProgressStackInstancesCount(Integer inProgressStackInstancesCount) {
        this.inProgressStackInstancesCount = inProgressStackInstancesCount;
    }

    /**
     *

     * The number of stack instances that are currently being checked for drift.
     *

     *
     * @return The number of stack instances that are currently being checked for drift.
     */

    public Integer getInProgressStackInstancesCount() {
        return this.inProgressStackInstancesCount;
    }

    /**
     *

     * The number of stack instances that are currently being checked for drift.
     *

     *
     * @param inProgressStackInstancesCount
     *        The number of stack instances that are currently being checked for drift.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public StackSetDriftDetectionDetails withInProgressStackInstancesCount(Integer inProgressStackInstancesCount) {
        setInProgressStackInstancesCount(inProgressStackInstancesCount);
        return this;
    }

    /**
     *

     * The number of stack instances for which the drift detection operation failed.
     *

     *
     * @param failedStackInstancesCount
     *        The number of stack instances for which the drift detection operation failed.
     */

    public void setFailedStackInstancesCount(Integer failedStackInstancesCount) {
        this.failedStackInstancesCount = failedStackInstancesCount;
    }

    /**
     *

     * The number of stack instances for which the drift detection operation failed.
     *

     *
     * @return The number of stack instances for which the drift detection operation failed.
     */

    public Integer getFailedStackInstancesCount() {
        return this.failedStackInstancesCount;
    }

    /**
     *

     * The number of stack instances for which the drift detection operation failed.
     *

     *
     * @param failedStackInstancesCount
     *        The number of stack instances for which the drift detection operation failed.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public StackSetDriftDetectionDetails withFailedStackInstancesCount(Integer failedStackInstancesCount) {
        setFailedStackInstancesCount(failedStackInstancesCount);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getDriftStatus() != null)
            sb.append("DriftStatus: ").append(getDriftStatus()).append(",");
        if (getDriftDetectionStatus() != null)
            sb.append("DriftDetectionStatus: ").append(getDriftDetectionStatus()).append(",");
        if (getLastDriftCheckTimestamp() != null)
            sb.append("LastDriftCheckTimestamp: ").append(getLastDriftCheckTimestamp()).append(",");
        if (getTotalStackInstancesCount() != null)
            sb.append("TotalStackInstancesCount: ").append(getTotalStackInstancesCount()).append(",");
        if (getDriftedStackInstancesCount() != null)
            sb.append("DriftedStackInstancesCount: ").append(getDriftedStackInstancesCount()).append(",");
        if (getInSyncStackInstancesCount() != null)
            sb.append("InSyncStackInstancesCount: ").append(getInSyncStackInstancesCount()).append(",");
        if (getInProgressStackInstancesCount() != null)
            sb.append("InProgressStackInstancesCount: ").append(getInProgressStackInstancesCount()).append(",");
        if (getFailedStackInstancesCount() != null)
            sb.append("FailedStackInstancesCount: ").append(getFailedStackInstancesCount());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof StackSetDriftDetectionDetails == false)
            return false;
        StackSetDriftDetectionDetails other = (StackSetDriftDetectionDetails) obj;
        if (other.getDriftStatus() == null ^ this.getDriftStatus() == null)
            return false;
        if (other.getDriftStatus() != null && other.getDriftStatus().equals(this.getDriftStatus()) == false)
            return false;
        if (other.getDriftDetectionStatus() == null ^ this.getDriftDetectionStatus() == null)
            return false;
        if (other.getDriftDetectionStatus() != null && other.getDriftDetectionStatus().equals(this.getDriftDetectionStatus()) == false)
            return false;
        if (other.getLastDriftCheckTimestamp() == null ^ this.getLastDriftCheckTimestamp() == null)
            return false;
        if (other.getLastDriftCheckTimestamp() != null && other.getLastDriftCheckTimestamp().equals(this.getLastDriftCheckTimestamp()) == false)
            return false;
        if (other.getTotalStackInstancesCount() == null ^ this.getTotalStackInstancesCount() == null)
            return false;
        if (other.getTotalStackInstancesCount() != null && other.getTotalStackInstancesCount().equals(this.getTotalStackInstancesCount()) == false)
            return false;
        if (other.getDriftedStackInstancesCount() == null ^ this.getDriftedStackInstancesCount() == null)
            return false;
        if (other.getDriftedStackInstancesCount() != null && other.getDriftedStackInstancesCount().equals(this.getDriftedStackInstancesCount()) == false)
            return false;
        if (other.getInSyncStackInstancesCount() == null ^ this.getInSyncStackInstancesCount() == null)
            return false;
        if (other.getInSyncStackInstancesCount() != null && other.getInSyncStackInstancesCount().equals(this.getInSyncStackInstancesCount()) == false)
            return false;
        if (other.getInProgressStackInstancesCount() == null ^ this.getInProgressStackInstancesCount() == null)
            return false;
        if (other.getInProgressStackInstancesCount() != null
                && other.getInProgressStackInstancesCount().equals(this.getInProgressStackInstancesCount()) == false)
            return false;
        if (other.getFailedStackInstancesCount() == null ^ this.getFailedStackInstancesCount() == null)
            return false;
        if (other.getFailedStackInstancesCount() != null && other.getFailedStackInstancesCount().equals(this.getFailedStackInstancesCount()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getDriftStatus() == null) ? 0 : getDriftStatus().hashCode());
        hashCode = prime * hashCode + ((getDriftDetectionStatus() == null) ? 0 : getDriftDetectionStatus().hashCode());
        hashCode = prime * hashCode + ((getLastDriftCheckTimestamp() == null) ? 0 : getLastDriftCheckTimestamp().hashCode());
        hashCode = prime * hashCode + ((getTotalStackInstancesCount() == null) ? 0 : getTotalStackInstancesCount().hashCode());
        hashCode = prime * hashCode + ((getDriftedStackInstancesCount() == null) ? 0 : getDriftedStackInstancesCount().hashCode());
        hashCode = prime * hashCode + ((getInSyncStackInstancesCount() == null) ? 0 : getInSyncStackInstancesCount().hashCode());
        hashCode = prime * hashCode + ((getInProgressStackInstancesCount() == null) ? 0 : getInProgressStackInstancesCount().hashCode());
        hashCode = prime * hashCode + ((getFailedStackInstancesCount() == null) ? 0 : getFailedStackInstancesCount().hashCode());
        return hashCode;
    }

    @Override
    public StackSetDriftDetectionDetails clone() {
        try {
            return (StackSetDriftDetectionDetails) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

}


text:
#if DEVICE_RTC

#include "rtc_api.h"

static uint8_t rtc_init_flag = 0;

/** Initialize the RTC peripheral
 *
 * Powerup the RTC in perpetration for access. This function must be called
 * before any other RTC functions ares called. This does not change the state
 * of the RTC. It just enables access to it.
 *
 * @note This function is safe to call repeatedly - Tested by ::rtc_init_test
 */
void rtc_init(void)
{
    /* make sure RTC only init once */
    if (rtc_init_flag) {
        return;
    }
    rtc_init_flag = 1;

    /* enable PMU and BKPI clocks */
    rcu_periph_clock_enable(RCU_BKPI);
    rcu_periph_clock_enable(RCU_PMU);
    /* allow access to BKP domain */
    pmu_backup_write_enable();

    /* enable LXTAL */
    rcu_osci_on(RCU_LXTAL);
    /* wait till LXTAL is ready */
    rcu_osci_stab_wait(RCU_LXTAL);
    /* select RCU_LXTAL as RTC clock source */
    rcu_rtc_clock_config(RCU_RTCSRC_LXTAL);
    /* enable RTC Clock */
    rcu_periph_clock_enable(RCU_RTC);

    /* wait for RTC registers synchronization */
    rtc_register_sync_wait();
    /* wait until last write operation on RTC registers has finished */
    rtc_lwoff_wait();
    /* set RTC prescaler: set RTC period to 1s */
    rtc_prescaler_set(32767);
    /* wait until last write operation on RTC registers has finished */
    rtc_lwoff_wait();
}

/** Deinitialize RTC
 *
 * Powerdown the RTC in preparation for sleep, powerdown or reset. That should only
 * affect the CPU domain and not the time keeping logic.
 * After this function is called no other RTC functions should be called
 * except for ::rtc_init.
 */
void rtc_free(void)
{
}

/** Check if the RTC has the time set and is counting
 *
 * @retval 0 The time reported by the RTC is not valid
 * @retval 1 The time has been set the RTC is counting
 */
int rtc_isenabled(void)
{
    if (RESET == (RTC_CTL & RTC_CTL_RSYNF)) {
        return 0;
    } else {
        return 1;
    }
}

/** Get the current time from the RTC peripheral
 *
 * @return The current time in seconds
 *
 * @note Some RTCs are not synchronized with the main clock. If
 * this is the case with your RTC then you must read the RTC time
 * in a loop to prevent reading the wrong time due to a glitch.
 * The test ::rtc_glitch_test is intended to catch this bug.
 */
time_t rtc_read(void)
{
    return (rtc_counter_get());
}

/** Write the current time in seconds to the RTC peripheral
 *
 * @param t The current time to be set in seconds.
 */
void rtc_write(time_t t)
{
    rtc_counter_set((uint32_t)t);
    rtc_lwoff_wait();
}

#endif /* DEVICE_RTC */


text:
namespace TALS.TestingFramework.Core.Pages.InstancePage
{
    using ArtOfTest.Common.UnitTesting;
    using TALS.TestingFramework.Core.Base;

    public class InstancePageAsserter : IAsserter
    {
        private InstancePage page;

        public InstancePageAsserter(InstancePage page)
        {
            this.page = page;
        }

        public void DoAssert()
        {
            this.IsDivVissible();
        }

        private void IsDivVissible()
        {
            Assert.IsTrue(this.page.PopUp.IsVisible());
        }
    }
}


text:
package org.apache.ignite.internal.processors.cache.distributed.replicated.preloader;

import java.util.HashMap;
import java.util.Map;
import javax.swing.JOptionPane;
import org.apache.ignite.Ignite;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.internal.util.typedef.X;

/**
 * Test for replicated cache preloader and concurrent undeploys.
 */
public class GridCacheReplicatedPreloadUndeploysTest {
    /**
     * @param args Arguments.
     * @throws Exception If failed.
     */
    public static void main(String[] args) throws Exception {
        try (Ignite g = G.start("examples/config/example-cache.xml")) {
            if (g.cluster().forRemotes().nodes().isEmpty()) {
                X.print(">>> This test needs 1 remote node at start " +
                    "and addition of 1 more node at the end.");

                return;
            }

            X.println(">>> Beginning data population...");

            int cnt = 10000;

            Map<Integer, SampleValue> map = null;

            for (int i = 0; i < cnt; i++) {
                if (i % 200 == 0) {
                    if (map != null && !map.isEmpty()) {
                        g.cache("replicated").putAll(map);

                        X.println(">>> Put entries count: " + i);
                    }

                    map = new HashMap<>();
                }

                map.put(i, new SampleValue());
            }

            if (map != null && !map.isEmpty()) {
                g.cache("replicated").putAll(map);

                X.println(">>> Put entries count: " + cnt);
            }

            JOptionPane.showMessageDialog(null, "Start one more node now and press OK " +
                "while new node is preloading.");
        }
    }

    /**
     *
     */
    private GridCacheReplicatedPreloadUndeploysTest() {
        // No-op.
    }

    /**
     *
     */
    private static class SampleValue {
        // No-op.
    }
}


text:
package jp.gr.java_conf.kgd.library.water.java.core.value;

/**
 * 値の型を{@link Long}に特化し、デフォルトの挙動を定めた{@link MutableLongVector2}。
 *
 * デフォルトの挙動を定めたものであり、原則としてインターフェース部分に使ってはいけません。
 *
 * @author misakura
 */
public interface MutableLongVector2Trait extends MutableLongVector2, LongVector2Trait {
}


text:
layout: feature
title: 'Nmzr'
shortdef: 'Nmzr'
udver: '2'
---

  Values:
  Yes

`Nmzr` is a suffix

### `Yes`: Yes

#### Examples

* _bla bla _ "hare hare"

## Diffs

### Prague Dependency Treebank

The PDT tagset does not distinguish `Ptan` from `Plur` and `Coll` from `Sing`,
therefore this distinction is not being made in the converted data.


text:
layout: frontpage
widget1:
  title: "About Us"
  url: '/about'
  image: ent015_cropped.jpg
  text: 'Capital Region Otolaryngology Head and Neck Group, LLP has been serving the New York Capital District area for more than 50 years. Our mission is to evaluate each patient by performing comprehensive ear, nose, and throat examinations in order to provide the finest treatment.'
widget2:
  title: "Services"
  url: '/services'
  image: humans/ent173.jpg
  link_list:
    - name: Audiology
      url: services/audiology/
    - name: Otology/Ear Diseases
      url: services/otology/
    - name: Pediatric Otolaryngology
      url: services/pediatric_otolaryngology/
    - name: Sinus
      url: services/sinus/
    - name: Head & Neck Surgery
      url: services/head_neck_surgery/
widget3:
  title: "Locations & Hours"
  url: '/locations'
  image: office_albany_2.jpg
  text: 'We have offices in Albany, Troy, and Clifton Park dedicated to serving patients throughout and outside the Capital Region with the utmost care and convenience, Monday through Friday from 9:00 am to 4:15 pm. Click below for directions.'
#
# Use the call for action to show a button on the frontpage
#
# To make internal links, just use a permalink like this
# url: /getting-started/
#
# To style the button in different colors, use no value
# to use the main color or success, alert or secondary.
# To change colors see sass/_01_settings_colors.scss
#
actionbuttons:
  - callforaction1:
    url: /locations/#contact
    text: Make an appointment
    style: primary
  - callforaction2:
    url: https://www.medentmobile.com/portal/index.php?practice_id=8HPZ85s4
    text: Log in to your Patient Portal
    style: secondary

permalink: /index.html
#
# This is a nasty hack to make the navigation highlight
# this page as active in the topbar navigation
#
homepage: true
---

  ×


text:
package betterwithmods.module.tweaks;

import betterwithmods.BWMod;
import betterwithmods.module.Feature;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

public class DarkQuartz extends Feature {

    @Override
    public String getFeatureDescription() {
        return "Makes Nether Quartz a dark material to give it a more hellish feel, as well as make it more unique from Whitestone";
    }

    @Override
    public void preInitClient(FMLPreInitializationEvent event) {
        overrideBlock("quartz_ore");
        overrideBlock("quartz_block_bottom");
        overrideBlock("quartz_block_top");
        overrideBlock("quartz_block_side");
        overrideBlock("quartz_block_chiseled_top");
        overrideBlock("quartz_block_chiseled");
        overrideBlock("quartz_block_lines_top");
        overrideBlock("quartz_block_lines");
        overrideItem("quartz");
    }

    @Override
    public boolean requiresMinecraftRestartToEnable() {
        return true;
    }

}


text:
#import "ViewController.h"

@interface RegisterAccountViewController : UIViewController <UITextFieldDelegate>
- (IBAction)tappedRegister:(id)sender;
@property (weak, nonatomic) IBOutlet UITextField *txtUsername;
@property (weak, nonatomic) IBOutlet UITextField *txtPassword;
@property (weak, nonatomic) IBOutlet UITextField *txtConfirm;
@property (weak, nonatomic) IBOutlet UITextField *txtEmail;
@property (weak, nonatomic) IBOutlet UILabel *lblInfo;

@end


text:
<?php _e( 'Nothing Found', 'flat' ); ?>

	<?php if ( is_home() && current_user_can( 'publish_posts' ) ) : ?>

<?php printf( __( 'Ready to publish your first post? Get started here.', 'flat' ), admin_url( 'post-new.php' ) ); ?>

	<?php elseif ( is_search() ) : ?>

<?php _e( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'flat' ); ?>

	<?php get_search_form(); ?>

	<?php else : ?>

<?php _e( 'It seems we can’t find what you’re looking for. Perhaps searching can help.', 'flat' ); ?>

	<?php get_search_form(); ?>

	<?php endif; ?>


text:
#ifndef __ARDUINO_OTA_H
#define __ARDUINO_OTA_H

#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <functional>

class UdpContext;

typedef enum {
  OTA_IDLE,
  OTA_WAITAUTH,
  OTA_RUNUPDATE
} ota_state_t;

typedef enum {
  OTA_AUTH_ERROR,
  OTA_BEGIN_ERROR,
  OTA_CONNECT_ERROR,
  OTA_RECEIVE_ERROR,
  OTA_END_ERROR
} ota_error_t;

class ArduinoOTAClass
{
  public:
	typedef std::function<void(void)> THandlerFunction;
	typedef std::function<void(ota_error_t)> THandlerFunction_Error;
	typedef std::function<void(unsigned int, unsigned int)> THandlerFunction_Progress;

    ArduinoOTAClass();
    ~ArduinoOTAClass();
    void setPort(uint16_t port);
    void setHostname(const char *hostname);
    String getHostname();
    void setPassword(const char *password);
    void onStart(THandlerFunction fn);
    void onEnd(THandlerFunction fn);
    void onError(THandlerFunction_Error fn);
    void onProgress(THandlerFunction_Progress fn);
    void begin();
    void handle();

  private:
    int _port;
    String _password;
    String _hostname;
    String _nonce;
    UdpContext *_udp_ota;
    bool _initialized;
    ota_state_t _state;
    int _size;
    int _cmd;
    int _ota_port;
    IPAddress _ota_ip;
    String _md5;

    THandlerFunction _start_callback;
    THandlerFunction _end_callback;
    THandlerFunction_Error _error_callback;
    THandlerFunction_Progress _progress_callback;

    void _runUpdate(void);
    void _onRx(void);
    int parseInt(void);
    String readStringUntil(char end);
};

extern ArduinoOTAClass ArduinoOTA;

#endif /* __ARDUINO_OTA_H */


text:
module LogicalTypesHelper

  def with_logical_types
    yield if logical_types?
  end

  def without_logical_types
    yield unless logical_types?
  end

  private

  def logical_types?
    Avro::Schema.instance_methods.include?(:logical_type)
  end
end


text:
import { Component, Injectable, Input, OnInit } from '@angular/core';
import { LiveService } from '../live.service';

@Component({
  selector: 'kirjs-poll',
  templateUrl: './poll.component.html',
  styleUrls: ['./poll.component.css']
})
export class PollComponent {
  @Input() question: string;
  constructor(readonly service: LiveService) {}
}

@Component({
  selector: 'kirjs-poll-answer',
  template: `
    <li (click)="service.storeMyData(value)"><ng-content></ng-content></li>
  `,
  styleUrls: ['./poll.component.css']
})
export class SlidesAnswerComponent implements OnInit {
  @Input() value: string;
  constructor(readonly service: LiveService) {}

  ngOnInit() {}
}


text:
package com.devplant.basics.security.controller;

import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat;
import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;

import java.util.Collections;

import javax.sql.DataSource;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.http.MediaType;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;

import com.devplant.basics.security.controller.model.SimplePage;
import com.devplant.basics.security.model.Book;
import com.devplant.basics.security.repository.BookRepository;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;

@RunWith(SpringRunner.class)
@WebMvcTest(value = BookController.class)
public class BookControllerTest {

    @Autowired
    private MockMvc mockMvc;

    @MockBean
    private BookRepository bookRepository;

    @Autowired
    private ObjectMapper mapper;

    @MockBean
    private DataSource dataSource;

    @Test
    @WithMockUser
    public void testGetAllBooks() throws Exception {
        Book testBook = new Book(1, 2017, "Test Book", "Something", "ISBN", null);
        when(bookRepository.findAll(Mockito.any(Pageable.class))).thenReturn(new PageImpl<>(Collections.singletonList(testBook)));
        MockHttpServletRequestBuilder requestBuilder = get("/api/book")
                .contentType(MediaType.APPLICATION_JSON);
        mockMvc.perform(requestBuilder)
                .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
                .andExpect(mvcResult -> assertThat(mapper.<SimplePage<Book>>readValue(mvcResult.getResponse().getContentAsString(), new TypeReference<SimplePage<Book>>() {
                }).getData().get(0)).isEqualTo(testBook));
    }

    @Test
    @WithMockUser
    public void testGetBookById() throws Exception {
        Book testBook = new Book(1, 2017, "Test Book", "Something", "ISBN", null);
        when(bookRepository.findOne(1L)).thenReturn(testBook);
        MockHttpServletRequestBuilder requestBuilder = get("/api/book/{bookId}", 1)
                .contentType(MediaType.APPLICATION_JSON);
        mockMvc.perform(requestBuilder)
                .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
                .andExpect(mvcResult -> assertThat(mapper.readValue(mvcResult.getResponse().getContentAsString(), Book.class)).isEqualTo(testBook));
    }

    @Test
    @WithMockUser
    public void testFindBookByName() throws Exception {
        Book testBook = new Book(1, 2017, "Test Book", "Something", "ISBN", null);
        when(bookRepository.findFirstByName("Test Book")).thenReturn(testBook);
        MockHttpServletRequestBuilder requestBuilder = get("/api/book/by-name").param("name", "Test Book")
                .contentType(MediaType.APPLICATION_JSON);
        mockMvc.perform(requestBuilder)
                .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
                .andExpect(mvcResult -> assertThat(mapper.readValue(mvcResult.getResponse().getContentAsString(), Book.class)).isEqualTo(testBook));
    }

    @Test
    @WithMockUser
    public void testFindBooksByAuthorName() throws Exception {
        Book testBook = new Book(1, 2017, "Test Book", "Something", "ISBN", null);
        when(bookRepository.findByAuthorName("The Unknown")).thenReturn(Collections.singletonList(testBook));
        MockHttpServletRequestBuilder requestBuilder = get("/api/book/by-author-name").param("authorName", "The Unknown")
                .contentType(MediaType.APPLICATION_JSON);
        mockMvc.perform(requestBuilder)
                .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
                .andExpect(mvcResult -> assertThat(mapper.readValue(mvcResult.getResponse().getContentAsString(), Book[].class)[0]).isEqualTo(testBook));
    }

}


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

/**
   Default DSL, showing use of events
  */

var autoflow = require('../'); // require('autoflow');
autoflow.logEvents(); // turn on logging of all flow and task events for all autoflow functions

function loadUser(uid, cb){ setTimeout(cb, 100, null, "User"+uid); }
function loadFile(filename, cb){ setTimeout(cb, 100, null, 'Filedata'+filename); }
function markdown(filedata) { return 'html'+filedata; }
function prepareDirectory(outDirname, cb){ setTimeout(cb, 200, null, 'dircreated-'+outDirname); }
function writeOutput(html, user, cb){  setTimeout(cb, 300, null, html+'_bytesWritten'); }
function loadEmailTemplate(cb) { setTimeout(cb, 50, null, 'emailmd'); }
function customizeEmail(user, emailHtml) { return 'cust-'+user+emailHtml; }
function deliverEmail(custEmailHtml, cb) { setTimeout(cb, 100, null, 'delivered-'+custEmailHtml); }

function useHtml(err, html, user, bytesWritten) {
  if (err) {
    console.log('***Error: %s', err);
    return;
  }
  console.log('final result: %s, user: %s, written:%s', html, user, bytesWritten);
}

var loadAndSave = autoflow('loadAndSave', 'filename, uid, outDirname, cb -> err, html, user, bytesWritten',  // name, in/out params
  loadUser,         'uid, cb          -> err, user',     // calling async fn loadUser with uid, callback is called with err and user
  loadFile,         'filename, cb     -> err, filedata',
  markdown,         'filedata         -> html',    // using a sync function
  prepareDirectory, 'outDirname, cb   -> err, dircreated',
  writeOutput,      'html, user, cb   -> err, bytesWritten', { after: prepareDirectory },  // only after prepareDirectory done
  loadEmailTemplate, 'cb              -> err, emailmd',
  markdown,         'emailmd          -> emailHtml',   // using a sync function
  customizeEmail,   'user, emailHtml  -> custEmailHtml', // sync fn
  deliverEmail,     'custEmailHtml, cb -> err, deliveredEmail', { after: writeOutput }  // only after writeOutput is done
);

loadAndSave('file.md', 100, '/tmp/foo', useHtml);  // executing the flow


text:
"""ti_sub_state

Revision ID: 128229b9b992
Revises: 1507a7289a2f
Create Date: 2017-11-01 12:34:08.409651

"""

# revision identifiers, used by Alembic.
revision = '128229b9b992'
down_revision = '1507a7289a2f'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('user')
    op.drop_table('task_fail')
    op.create_index('dr_run_id', 'dag_run', ['dag_id', 'run_id'], unique=True)
    op.drop_index('dag_id', table_name='dag_run')
    op.drop_index('dag_id_2', table_name='dag_run')
    op.drop_index('idx_job_state_heartbeat', table_name='job')
    op.add_column('task_instance', sa.Column('sub_state', sa.String(length=32), nullable=True))
    op.add_column('task_instance', sa.Column('sub_state_timestamp', sa.DateTime(), nullable=True))
    op.create_index(op.f('ix_task_instance_sub_state'), 'task_instance', ['sub_state'], unique=False)
    op.drop_index('dag_id', table_name='task_instance_timeout')
    op.drop_index('dagrun_run_id', table_name='task_instance_timeout')
    op.alter_column('xcom', 'execution_date',
               existing_type=mysql.DATETIME(fsp=6),
               nullable=False)
    op.alter_column('xcom', 'timestamp',
               existing_type=mysql.DATETIME(fsp=6),
               nullable=False)
    # ### end Alembic commands ###

def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('xcom', 'timestamp',
               existing_type=mysql.DATETIME(fsp=6),
               nullable=True)
    op.alter_column('xcom', 'execution_date',
               existing_type=mysql.DATETIME(fsp=6),
               nullable=True)
    op.create_index('dagrun_run_id', 'task_instance_timeout', ['dagrun_run_id'], unique=True)
    op.create_index('dag_id', 'task_instance_timeout', ['dag_id', 'task_id', 'execution_date'], unique=True)
    op.drop_index(op.f('ix_task_instance_sub_state'), table_name='task_instance')
    op.drop_column('task_instance', 'sub_state_timestamp')
    op.drop_column('task_instance', 'sub_state')
    op.create_index('idx_job_state_heartbeat', 'job', ['state', 'latest_heartbeat'], unique=False)
    op.create_index('dag_id_2', 'dag_run', ['dag_id', 'run_id'], unique=True)
    op.create_index('dag_id', 'dag_run', ['dag_id', 'execution_date'], unique=True)
    op.drop_index('dr_run_id', table_name='dag_run')
    op.create_table('task_fail',
    sa.Column('id', mysql.INTEGER(display_width=11), nullable=False),
    sa.Column('task_id', mysql.VARCHAR(collation=u'utf8mb4_bin', length=250), nullable=False),
    sa.Column('dag_id', mysql.VARCHAR(collation=u'utf8mb4_bin', length=250), nullable=False),
    sa.Column('execution_date', mysql.DATETIME(fsp=6), nullable=True),
    sa.Column('start_date', mysql.DATETIME(fsp=6), nullable=True),
    sa.Column('end_date', mysql.DATETIME(fsp=6), nullable=True),
    sa.Column('duration', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id'),
    mysql_collate=u'utf8mb4_bin',
    mysql_default_charset=u'utf8mb4',
    mysql_engine=u'InnoDB'
    )
    op.create_table('user',
    sa.Column('id', mysql.INTEGER(display_width=11), nullable=False),
    sa.Column('username', mysql.VARCHAR(collation=u'utf8mb4_bin', length=250), nullable=True),
    sa.Column('email', mysql.VARCHAR(collation=u'utf8mb4_bin', length=500), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    mysql_collate=u'utf8mb4_bin',
    mysql_default_charset=u'utf8mb4',
    mysql_engine=u'InnoDB'
    )
    # ### end Alembic commands ###


text:
class Block : public QObject, public QGraphicsPixmapItem
{
	Q_OBJECT
public:
	Block();
};

#endif // BLOCK_H


text:
package it.pacs.rest.interfaces;

/**
 * @author Stefano Pacifici
 */
public interface RestMethodCallback {

    /**
     * Called on successfully completed request
     *
     * @param id     the async method id (if the method has one)
     * @param result the result
     */
    void onComplete(int id, Object result);

    /**
     * Called if the request fails with an exception
     *
     * @param id        the async method id (if the method has one)
     * @param throwable the thrown exception
     */
    void onException(int id, Throwable throwable);

}


text:
import optparse
import os
import shlex
import sys

class Options:
  def __init__(self, output, rulename, header_guard, flags):
    self.output = output
    self.rulename = rulename
    self.header_guard = header_guard
    self.flags = flags

def GetOptions():
  parser = optparse.OptionParser()
  parser.add_option('--output', help="Output header name inside --gen-dir.")
  parser.add_option('--rulename',
                    help="Helpful name of build rule for including in the " +
                         "comment at the top of the file.")
  parser.add_option('--gen-dir',
                    help="Path to root of generated file directory tree.")
  parser.add_option('--definitions',
                    help="Name of the response file containing the flags.")
  cmdline_options, cmdline_flags = parser.parse_args()

  # Compute header guard by replacing some chars with _ and upper-casing.
  header_guard = cmdline_options.output.upper()
  header_guard = \
      header_guard.replace('/', '_').replace('\\', '_').replace('.', '_')
  header_guard += '_'

  # The actual output file is inside the gen dir.
  output = os.path.join(cmdline_options.gen_dir, cmdline_options.output)

  # Definition file in GYP is newline separated, in GN they are shell formatted.
  # shlex can parse both of these.
  with open(cmdline_options.definitions, 'r') as def_file:
    defs = shlex.split(def_file.read())
  flags_index = defs.index('--flags')

  # Everything after --flags are flags. true/false are remapped to 1/0,
  # everything else is passed through.
  flags = []
  for flag in defs[flags_index + 1 :]:
    equals_index = flag.index('=')
    key = flag[:equals_index]
    value = flag[equals_index + 1:]

    # Canonicalize and validate the value.
    if value == 'true':
      value = '1'
    elif value == 'false':
      value = '0'
    flags.append((key, str(value)))

  return Options(output=output,
                 rulename=cmdline_options.rulename,
                 header_guard=header_guard,
                 flags=flags)

def WriteHeader(options):
  with open(options.output, 'w') as output_file:
    output_file.write("// Generated by build/write_buildflag_header.py\n")
    if options.rulename:
      output_file.write('// From "' + options.rulename + '"\n')

    output_file.write('\n#ifndef %s\n' % options.header_guard)
    output_file.write('#define %s\n\n' % options.header_guard)
    output_file.write('#include "build/buildflag.h"\n\n')

    for pair in options.flags:
      output_file.write('#define BUILDFLAG_INTERNAL_%s() (%s)\n' % pair)

    output_file.write('\n#endif  // %s\n' % options.header_guard)

if os.name == 'nt':
  major, minor, build, platform, service_pack = sys.getwindowsversion()
  # Windows 10 will be 6.2 on Python 2 and 10.0 on Python 3. This check
  # handles both.
  if major < 6 or (major == 6 and minor < 2):
    raise Exception(
        'Unsupported OS. Building Chromium requires Windows 10. %s detected.' %
        str(sys.getwindowsversion()))
options = GetOptions()
WriteHeader(options)


text:
                {{include.talk.name}}

            {{include.talk.date | date_to_string}}

            {{include.talk.city}}

        {% if include.talk.youtube_playlist %}

            Full video playlist

        {% else %}

            Videos coming soon

        {% endif %}

            Conference profile


text:
using _01.LibrarySystem.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace _01.LibrarySystem
{
    public partial class _Default : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        // The return type can be changed to IEnumerable, however to support
        // paging and sorting, the following parameters must be added:
        //     int maximumRows
        //     int startRowIndex
        //     out int totalRowCount
        //     string sortByExpression
        public IQueryable<_01.LibrarySystem.Models.Category> lvCategories_GetData()
        {
            var db = new LibraryDbContext();
            return db.Categories.AsQueryable();
        }

        // The return type can be changed to IEnumerable, however to support
        // paging and sorting, the following parameters must be added:
        //     int maximumRows
        //     int startRowIndex
        //     out int totalRowCount
        //     string sortByExpression
        public IQueryable<Book> lvBooks_GetData()
        {
            var db = new LibraryDbContext();
            return db.Books;
        }

        protected void Search_Click(object sender, EventArgs e)
        {
            var keyword = this.SearchWord.Text;
            Response.Redirect("~/Search.aspx?q=" + keyword);
        }

    }
}


text:
package java2typescript.jackson.module.visitors;

import java2typescript.jackson.module.Configuration;
import java2typescript.jackson.module.grammar.AnyType;
import java2typescript.jackson.module.grammar.ArrayType;
import java2typescript.jackson.module.grammar.BooleanType;
import java2typescript.jackson.module.grammar.NumberType;
import java2typescript.jackson.module.grammar.StringType;
import java2typescript.jackson.module.grammar.base.AbstractType;

import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonArrayFormatVisitor;
import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatTypes;
import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable;

public class TSJsonArrayFormatVisitor extends ABaseTSJsonFormatVisitor<ArrayType> implements JsonArrayFormatVisitor {

	public TSJsonArrayFormatVisitor(ABaseTSJsonFormatVisitor parentHolder, Configuration conf) {
		super(parentHolder, conf);
		type = new ArrayType();
	}

	@Override
	public void itemsFormat(JsonFormatVisitable handler, JavaType elementType) throws JsonMappingException {
		TSJsonFormatVisitorWrapper visitorWrapper = new TSJsonFormatVisitorWrapper(this, conf);
		handler.acceptJsonFormatVisitor(visitorWrapper, elementType);
		type.setItemType(visitorWrapper.getType());
	}

	@Override
	public void itemsFormat(JsonFormatTypes format) throws JsonMappingException {
		type.setItemType(typeScriptTypeFromJsonType(format));
	}

	private static AbstractType typeScriptTypeFromJsonType(JsonFormatTypes type) {
		switch (type) {
		case ANY:
			return AnyType.getInstance();
		case BOOLEAN:
			return BooleanType.getInstance();
		case ARRAY:
			return new ArrayType(AnyType.getInstance());
		case INTEGER: //$FALL-THROUGH$
		case NUMBER:
			return NumberType.getInstance();
		case STRING:
			return StringType.getInstance();
		default:
			throw new UnsupportedOperationException();
		}
	}
}


text:
$namespace('di.console.mgr.ui');

(function() {

    //------------------------------------------
    // 引用
    //------------------------------------------

    var inheritsControl = ecui.inherits;
    var blank = new Function();
    var addClass = ecui.dom.addClass;
    var removeClass = ecui.dom.removeClass;
    var addEventListener = ecui.addEventListener;
    var extend = xutil.object.extend;
    var q = xutil.dom.q;
    var bind = xutil.fn.bind;
    var template = xutil.string.template;
    var preInit = di.helper.Util.preInit;
    var ecuiCreate = di.helper.Util.ecuiCreate;
    var PANEL_PAGE = di.shared.ui.PanelPage;
    var UI_CONTROL = ecui.ui.Control;
    var UI_SELECT = ecui.ui.Select;
    var UI_RADIO_CONTAINER = ecui.ui.RadioContainer;
    var DICT = di.config.Dict;
    var PANEL_PAGE_MANAGER;

    $link(function() {
        PANEL_PAGE_MANAGER = di.shared.model.PanelPageManager;
    });

    //------------------------------------------
    // 类型声明
    //------------------------------------------

    /**
     * 报表列表页主类
     *
     * @class
     * @extends di.shared.ui.PanelPage
     */
    var REPORT_LIST_PAGE = $namespace().ReportListPage =
        inheritsControl(
            PANEL_PAGE,
            'report-list-page',
            function(el, options) {
                preInit(this, el, options);
                el.innerHTML = template(TPL_MAIN);
            },
            function(el, options) {
                createModel(el, options);
                createView(el, options);
            }
        );
    var REPORT_LIST_PAGE_CLASS = REPORT_LIST_PAGE.prototype;

    /* 模板 */
    var TPL_MAIN = [
        '
',
            '报表列表',
        '
',
        '
',
            '表格',
        '
'
    ].join('');

    //------------------------------------------
    // 方法
    //------------------------------------------

    /* 禁用$setSize */
    REPORT_LIST_PAGE_CLASS.$setSize = blank;

    /**
     * 创建Model
     *
     * @private
     */
    function createModel() {
        // TODO
        // this._mXXXModel = new XXXModel();
        // this._mXXXModel = new XXXModel();
    };

    /**
     * 创建View
     *
     * @private
     */
    function createView(el, options) {
        // TODO
        // this._uXXXControl = ecuiCreate(
        //     XXXCONTROL,
        //     q('q-some-el-class', el)[0],
        //     this
        // );
        // this._uXXXControl = ecuiCreate(
        //     XXXCONTROL,
        //     q('q-some-el-class', el)[0],
        //     this
        // );
    };

    /**
     * 初始化
     *
     * @public
     */
    REPORT_LIST_PAGE_CLASS.init = function() {

        // 事件绑定
        // commonModelUpdateHandler = bind(this.$commonModelUpdateHandler, this);
        // addEventListener(this._uAccountRangeType, 'change', bind(this.$accountRangTypeChangeHandler, this));
        // addEventListener(this._uAccountRangeType, 'change', commonModelUpdateHandler);
        // addEventListener(this._uAccountRange, 'change', commonModelUpdateHandler);
        // addEventListener(this._uOpenAccountDuration, 'change', commonModelUpdateHandler);
        // this._eInherit.onclick = commonModelUpdateHandler;

        // init
        // this._mXXXModel.init();
        // this._uXXXControl.init();

        // 初始获取数据
        // this._mXXXModel.sync('INIT');
    };

    /**
     * @override
     */
    REPORT_LIST_PAGE_CLASS.$active = function() {
        // var page = this._mTimeTypePageManager.getCurrentPage();
        // page && page.active();
    };

    /**
     * @override
     */
    REPORT_LIST_PAGE_CLASS.$inactive = function() {
        // var page = this._mTimeTypePageManager.getCurrentPage();
        // page && page.inactive();
    };

    /**
     * @override
     */
    REPORT_LIST_PAGE_CLASS.$dispose = function() {
        // this._eAnalysisArea = null;
        // this._eCondtionArea = null;
        // this._mTimeTypePageManager.dispose();
        // this._eInherit = null;
        REPORT_LIST_PAGE.superClass.$dispose.call(this);
    };

})();


text:
package com.ghawk1ns.morsecodegenerator;

import android.hardware.Camera;
import android.view.View;

/**
 * Created by GHawkins on 8/16/13.
 */
public class CameraHandler {
   private Camera cam;
   private Camera.Parameters params;
   private boolean ledOn;

   CameraHandler(){
      cam = Camera.open();
      params = cam.getParameters();
      params.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH);
      cam.release();
   }

   public void lightSwitch(){
      if(ledOn){
         ledOff();
      } else {
         ledOn();
      }
   }

   public void flicker(long time) {
      lightSwitch();
      try {
         Thread.sleep(time);
      } catch (InterruptedException e) {
         e.printStackTrace();
      }
      lightSwitch();
   }

   private void ledOn() {
      ledOn = true;
      cam = Camera.open();
      cam.setParameters(params);
      cam.startPreview();
   }

   private void ledOff() {
      ledOn = false;
      cam.stopPreview();
      cam.release();
   }

   public void OnDestroy() {
      if(ledOn){
         ledOff();
      }
   }
}


text:
/**
 * @author Pedro Sanders
 * @since v1
 *
 * Unit Test for the "Utils Module"
 */
const assert = require('assert')
const config = require('@routr/core/config_util')()
const {
  buildAddr,
  protocolTransport,
  nearestInterface
} = require('@routr/utils/misc_utils')

describe('Utils Module', () => {
  it('Get transport object for a protocol', function (done) {
    const transport = protocolTransport(config, 'tcp')
    assert.equal(transport.protocol, 'tcp')
    done()
  })

  it('Get transport object for a protocol(fail)', function (done) {
    try {
      protocolTransport(config, 'wss')
      done(new Error(`Force the test to fail since error wasn't thrown`))
    } catch (error) {
      // Constructor threw Error, so test succeeded.
      done()
    }
  })

  it("Target's nearest interface", function (done) {
    const inf = nearestInterface('0.0.0.0', 5060)
    const inf2 = nearestInterface('0.0.0.0', 5060, '10.0.0.1', 42323)
    assert.ok(inf.host === '0.0.0.0')
    assert.ok(inf.port === 5060)
    assert.ok(inf2.host === '10.0.0.1')
    assert.ok(inf2.port === 42323)
    done()
  })
})