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

import java.io.Serializable;

import com.amazonaws.AmazonWebServiceRequest;

/**
 * Container for the parameters to the {@link com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflow#getWorkflowExecutionHistory(GetWorkflowExecutionHistoryRequest) GetWorkflowExecutionHistory operation}.
 *

 * Returns the history of the specified workflow execution. The results
 * may be split into multiple pages. To retrieve subsequent pages, make
 * the call again using the nextPageToken returned by the
 * initial call.
 *

 *

 * NOTE:This operation is eventually consistent. The results are
 * best effort and may not exactly reflect recent updates and changes.
 *

 *

 * Access Control
 *

 *

 * You can use IAM policies to control this action's access to Amazon SWF
 * resources as follows:
 *

 *
 *

 *
Use a Resource element with the domain name to limit
 * the action to only specified domains.

 *
Use an Action element to allow or deny permission to
 * call this action.

 *
You cannot use an IAM policy to constrain this action's
 * parameters.

 *
 *

 *

 * If the caller does not have sufficient permissions to invoke the
 * action, or the parameter values fall outside the specified
 * constraints, the action fails. The associated event attribute's
 * cause parameter will be set to OPERATION_NOT_PERMITTED. For
 * details and example IAM policies, see
 *  Using IAM to Manage Access to Amazon SWF Workflows
 * .
 *

 *
 * @see com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflow#getWorkflowExecutionHistory(GetWorkflowExecutionHistoryRequest)
 */
public class GetWorkflowExecutionHistoryRequest extends AmazonWebServiceRequest implements Serializable, Cloneable {

    /**
     * The name of the domain containing the workflow execution.
     *

     * Constraints:

     * Length: 1 - 256

     */
    private String domain;

    /**
     * Specifies the workflow execution for which to return the history.
     */
    private WorkflowExecution execution;

    /**
     * If a NextPageToken was returned by a previous call, there
     * are more results available. To retrieve the next page of results, make
     * the call again using the returned token in nextPageToken.
     * Keep all other arguments unchanged.
The configured
     * maximumPageSize determines how many results can be
     * returned in a single call.
     *

     * Constraints:

     * Length: 0 - 2048

     */
    private String nextPageToken;

    /**
     * The maximum number of results that will be returned per call.
     * nextPageToken can be used to obtain futher pages of
     * results. The default is 1000, which is the maximum allowed page size.
     * You can, however, specify a page size smaller than the maximum.
     *
This is an upper limit only; the actual number of results returned
     * per call may be fewer than the specified maximum.
     *

     * Constraints:

     * Range: 0 - 1000

     */
    private Integer maximumPageSize;

    /**
     * When set to true, returns the events in reverse order. By
     * default the results are returned in ascending order of the
     * eventTimeStamp of the events.
     */
    private Boolean reverseOrder;

    /**
     * The name of the domain containing the workflow execution.
     *

     * Constraints:

     * Length: 1 - 256

     *
     * @return The name of the domain containing the workflow execution.
     */
    public String getDomain() {
        return domain;
    }

    /**
     * The name of the domain containing the workflow execution.
     *

     * Constraints:

     * Length: 1 - 256

     *
     * @param domain The name of the domain containing the workflow execution.
     */
    public void setDomain(String domain) {
        this.domain = domain;
    }

    /**
     * The name of the domain containing the workflow execution.
     *

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

     * Constraints:

     * Length: 1 - 256

     *
     * @param domain The name of the domain containing the workflow execution.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public GetWorkflowExecutionHistoryRequest withDomain(String domain) {
        this.domain = domain;
        return this;
    }

    /**
     * Specifies the workflow execution for which to return the history.
     *
     * @return Specifies the workflow execution for which to return the history.
     */
    public WorkflowExecution getExecution() {
        return execution;
    }

    /**
     * Specifies the workflow execution for which to return the history.
     *
     * @param execution Specifies the workflow execution for which to return the history.
     */
    public void setExecution(WorkflowExecution execution) {
        this.execution = execution;
    }

    /**
     * Specifies the workflow execution for which to return the history.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param execution Specifies the workflow execution for which to return the history.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public GetWorkflowExecutionHistoryRequest withExecution(WorkflowExecution execution) {
        this.execution = execution;
        return this;
    }

    /**
     * If a NextPageToken was returned by a previous call, there
     * are more results available. To retrieve the next page of results, make
     * the call again using the returned token in nextPageToken.
     * Keep all other arguments unchanged.
The configured
     * maximumPageSize determines how many results can be
     * returned in a single call.
     *

     * Constraints:

     * Length: 0 - 2048

     *
     * @return If a NextPageToken was returned by a previous call, there
     *         are more results available. To retrieve the next page of results, make
     *         the call again using the returned token in nextPageToken.
     *         Keep all other arguments unchanged.
The configured
     *         maximumPageSize determines how many results can be
     *         returned in a single call.
     */
    public String getNextPageToken() {
        return nextPageToken;
    }

    /**
     * If a NextPageToken was returned by a previous call, there
     * are more results available. To retrieve the next page of results, make
     * the call again using the returned token in nextPageToken.
     * Keep all other arguments unchanged.
The configured
     * maximumPageSize determines how many results can be
     * returned in a single call.
     *

     * Constraints:

     * Length: 0 - 2048

     *
     * @param nextPageToken If a NextPageToken was returned by a previous call, there
     *         are more results available. To retrieve the next page of results, make
     *         the call again using the returned token in nextPageToken.
     *         Keep all other arguments unchanged.
The configured
     *         maximumPageSize determines how many results can be
     *         returned in a single call.
     */
    public void setNextPageToken(String nextPageToken) {
        this.nextPageToken = nextPageToken;
    }

    /**
     * If a NextPageToken was returned by a previous call, there
     * are more results available. To retrieve the next page of results, make
     * the call again using the returned token in nextPageToken.
     * Keep all other arguments unchanged.
The configured
     * maximumPageSize determines how many results can be
     * returned in a single call.
     *

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

     * Constraints:

     * Length: 0 - 2048

     *
     * @param nextPageToken If a NextPageToken was returned by a previous call, there
     *         are more results available. To retrieve the next page of results, make
     *         the call again using the returned token in nextPageToken.
     *         Keep all other arguments unchanged.
The configured
     *         maximumPageSize determines how many results can be
     *         returned in a single call.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public GetWorkflowExecutionHistoryRequest withNextPageToken(String nextPageToken) {
        this.nextPageToken = nextPageToken;
        return this;
    }

    /**
     * The maximum number of results that will be returned per call.
     * nextPageToken can be used to obtain futher pages of
     * results. The default is 1000, which is the maximum allowed page size.
     * You can, however, specify a page size smaller than the maximum.
     *
This is an upper limit only; the actual number of results returned
     * per call may be fewer than the specified maximum.
     *

     * Constraints:

     * Range: 0 - 1000

     *
     * @return The maximum number of results that will be returned per call.
     *         nextPageToken can be used to obtain futher pages of
     *         results. The default is 1000, which is the maximum allowed page size.
     *         You can, however, specify a page size smaller than the maximum.
     *
This is an upper limit only; the actual number of results returned
     *         per call may be fewer than the specified maximum.
     */
    public Integer getMaximumPageSize() {
        return maximumPageSize;
    }

    /**
     * The maximum number of results that will be returned per call.
     * nextPageToken can be used to obtain futher pages of
     * results. The default is 1000, which is the maximum allowed page size.
     * You can, however, specify a page size smaller than the maximum.
     *
This is an upper limit only; the actual number of results returned
     * per call may be fewer than the specified maximum.
     *

     * Constraints:

     * Range: 0 - 1000

     *
     * @param maximumPageSize The maximum number of results that will be returned per call.
     *         nextPageToken can be used to obtain futher pages of
     *         results. The default is 1000, which is the maximum allowed page size.
     *         You can, however, specify a page size smaller than the maximum.
     *
This is an upper limit only; the actual number of results returned
     *         per call may be fewer than the specified maximum.
     */
    public void setMaximumPageSize(Integer maximumPageSize) {
        this.maximumPageSize = maximumPageSize;
    }

    /**
     * The maximum number of results that will be returned per call.
     * nextPageToken can be used to obtain futher pages of
     * results. The default is 1000, which is the maximum allowed page size.
     * You can, however, specify a page size smaller than the maximum.
     *
This is an upper limit only; the actual number of results returned
     * per call may be fewer than the specified maximum.
     *

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

     * Constraints:

     * Range: 0 - 1000

     *
     * @param maximumPageSize The maximum number of results that will be returned per call.
     *         nextPageToken can be used to obtain futher pages of
     *         results. The default is 1000, which is the maximum allowed page size.
     *         You can, however, specify a page size smaller than the maximum.
     *
This is an upper limit only; the actual number of results returned
     *         per call may be fewer than the specified maximum.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public GetWorkflowExecutionHistoryRequest withMaximumPageSize(Integer maximumPageSize) {
        this.maximumPageSize = maximumPageSize;
        return this;
    }

    /**
     * When set to true, returns the events in reverse order. By
     * default the results are returned in ascending order of the
     * eventTimeStamp of the events.
     *
     * @return When set to true, returns the events in reverse order. By
     *         default the results are returned in ascending order of the
     *         eventTimeStamp of the events.
     */
    public Boolean isReverseOrder() {
        return reverseOrder;
    }

    /**
     * When set to true, returns the events in reverse order. By
     * default the results are returned in ascending order of the
     * eventTimeStamp of the events.
     *
     * @param reverseOrder When set to true, returns the events in reverse order. By
     *         default the results are returned in ascending order of the
     *         eventTimeStamp of the events.
     */
    public void setReverseOrder(Boolean reverseOrder) {
        this.reverseOrder = reverseOrder;
    }

    /**
     * When set to true, returns the events in reverse order. By
     * default the results are returned in ascending order of the
     * eventTimeStamp of the events.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param reverseOrder When set to true, returns the events in reverse order. By
     *         default the results are returned in ascending order of the
     *         eventTimeStamp of the events.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public GetWorkflowExecutionHistoryRequest withReverseOrder(Boolean reverseOrder) {
        this.reverseOrder = reverseOrder;
        return this;
    }

    /**
     * When set to true, returns the events in reverse order. By
     * default the results are returned in ascending order of the
     * eventTimeStamp of the events.
     *
     * @return When set to true, returns the events in reverse order. By
     *         default the results are returned in ascending order of the
     *         eventTimeStamp of the events.
     */
    public Boolean getReverseOrder() {
        return reverseOrder;
    }

    /**
     * Returns a string representation of this object; useful for testing and
     * debugging.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getDomain() != null) sb.append("Domain: " + getDomain() + ",");
        if (getExecution() != null) sb.append("Execution: " + getExecution() + ",");
        if (getNextPageToken() != null) sb.append("NextPageToken: " + getNextPageToken() + ",");
        if (getMaximumPageSize() != null) sb.append("MaximumPageSize: " + getMaximumPageSize() + ",");
        if (isReverseOrder() != null) sb.append("ReverseOrder: " + isReverseOrder() );
        sb.append("}");
        return sb.toString();
    }

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

        hashCode = prime * hashCode + ((getDomain() == null) ? 0 : getDomain().hashCode());
        hashCode = prime * hashCode + ((getExecution() == null) ? 0 : getExecution().hashCode());
        hashCode = prime * hashCode + ((getNextPageToken() == null) ? 0 : getNextPageToken().hashCode());
        hashCode = prime * hashCode + ((getMaximumPageSize() == null) ? 0 : getMaximumPageSize().hashCode());
        hashCode = prime * hashCode + ((isReverseOrder() == null) ? 0 : isReverseOrder().hashCode());
        return hashCode;
    }

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

        if (obj instanceof GetWorkflowExecutionHistoryRequest == false) return false;
        GetWorkflowExecutionHistoryRequest other = (GetWorkflowExecutionHistoryRequest)obj;

        if (other.getDomain() == null ^ this.getDomain() == null) return false;
        if (other.getDomain() != null && other.getDomain().equals(this.getDomain()) == false) return false;
        if (other.getExecution() == null ^ this.getExecution() == null) return false;
        if (other.getExecution() != null && other.getExecution().equals(this.getExecution()) == false) return false;
        if (other.getNextPageToken() == null ^ this.getNextPageToken() == null) return false;
        if (other.getNextPageToken() != null && other.getNextPageToken().equals(this.getNextPageToken()) == false) return false;
        if (other.getMaximumPageSize() == null ^ this.getMaximumPageSize() == null) return false;
        if (other.getMaximumPageSize() != null && other.getMaximumPageSize().equals(this.getMaximumPageSize()) == false) return false;
        if (other.isReverseOrder() == null ^ this.isReverseOrder() == null) return false;
        if (other.isReverseOrder() != null && other.isReverseOrder().equals(this.isReverseOrder()) == false) return false;
        return true;
    }

    @Override
    public GetWorkflowExecutionHistoryRequest clone() {

            return (GetWorkflowExecutionHistoryRequest) super.clone();
    }

}


text:
use [$(MaintDBName)]
go

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

if exists (select 1 from sys.schemas where name='base')
	begin
		print '"base" schema detected. This means, "base" module is already installed.'
		print 'Not everything from "base" module may be installed multiple times.'
		print 'Setting NOEXEC=ON...'
		set noexec on
	end
go

create schema base
go

create table base.tblVersion (
	strModuleName varchar(255) not null,
	lngVersionMajor integer not null,
	lngVersionMinor integer not null,
	constraint PK_base_tblVersion primary key (strModuleName)
)
go

create table base.tblConfigValue (
	strConfigValueName varchar(255) not null,
	strValue varchar(255) not null,
	constraint PK_base_tblConfigValues primary key (strConfigValueName)
)
go

set nocount on
insert into base.tblConfigValue (strConfigValueName, strValue)
	values
		('tools.wmi_xml_dir', '$(WmiXmlDir)'),

		('maint.max_log_size', '1000'),
		('maint.history_retention', '4'),
		('maint.backup_path', '$$$NOTSET$$$'),
		('maint.backup_retention_days', '4'),

		('base.mail_profile', db_name() + '-MailProfile'),

		('maint.notify_operator', db_name() + '-DBA'),
		('tools.notify_operator', db_name() + '-DBA'),
		('pol.notify_operator', db_name() + '-DBA')
set nocount off
go

create table base.tblVolumeBound (
	strVolumeName varchar(100) not null,
	numWarningPct numeric(10, 2) not null,
	numErrorPct numeric(10, 2) not null,

	constraint PK_base_tblVolumeBound primary key (strVolumeName),
	constraint CK_base_tblVolumeBound check
		(
			numWarningPct between 1 and 100 and
			numErrorPct between	1 and 100 and
			numWarningPct < numErrorPct
		)
)
go

create table base.tblIndividualBackupSetting (
	strDBName varchar(255) not null,
	lngBackupRetentionDays integer not null,

	constraint PK_base_tblIndividualBackupSetting primary key (strDBName)
)
go

set noexec off
print 'NOEXEC is now set to OFF...'
go

if exists (select 1 from sys.procedures where schema_name(schema_id)='base' and name='usp_prepare_object_creation')
	execute ('drop procedure base.usp_prepare_object_creation')
go

create procedure base.usp_prepare_object_creation
	@SchemaName varchar(255),
	@ObjectName varchar(255),
	@Verbose bit = 0 as

begin

	declare @Cmd varchar(max)

	if exists (select * from sys.schemas where name=@SchemaName)
		begin
			if @Verbose=convert(bit, -1)
				print @SchemaName + ' schema already exists.'
		end
	else
		begin
			if @Verbose=convert(bit, -1)
				print @SchemaName + ' schema does not exist - creating...'
			set @Cmd = 'create schema [' + @SchemaName + ']'
			execute (@Cmd)
		end

	if @ObjectName is not null
		begin

			declare @ObjType varchar(2) =
				(
					select rtrim(O.type)
					from sys.objects O
					where schema_name(o.schema_id)=@SchemaName and O.name=@ObjectName
				)

			declare @FullName varchar(max) = '[' + @SchemaName + '].[' + @ObjectName + ']'

			if @ObjType is not null
				begin
					if @Verbose=convert(bit, -1)
						print 'Object ' + @FullName + ' already exists. It will be dropped first.'
					set @Cmd =
						'drop ' +
						case @ObjType
							when 'U' then 'table'
							when 'P' then 'procedure'
							when 'FN' then 'function' -- scalar function
							when 'IF' then 'function' -- in-line table-function
							when 'TF' then 'function' -- table function
						end +
						' ' + @FullName
					execute (@Cmd)
				end

		end

end
go

execute base.usp_prepare_object_creation 'base', 'udf_errmsg'
go

create function base.udf_errmsg()
returns varchar(max) as
begin
	return 'Server Error ' + convert(varchar, error_number()) + ' at ' + isnull(error_procedure(), 'UNKNOWN') + ', Line ' + isnull(convert(varchar, error_line()), 'UNKNOWN') + ': ' + error_message()
end
go

execute base.usp_prepare_object_creation 'base', 'usp_update_module_info'
go

create procedure base.usp_update_module_info
	@ModuleName varchar(255),
	@VersionMajor integer,
	@VersionMinor integer as

begin

	print
		'Updating module information: ' + @ModuleName +
		' V' + convert(varchar, @VersionMajor) + '.' + convert(varchar, @VersionMinor)

	set nocount on

	;with NewVersion as (
		select
			@ModuleName as strModuleName,
			@VersionMajor as lngVersionMajor,
			@VersionMinor as lngVersionMinor
	)
	merge
		into base.tblVersion T
		using NewVersion S
		on T.strModuleName=S.strModuleName
	when not matched by target
		then insert (strModuleName, lngVersionMajor, lngVersionMinor)
			values (S.strModuleName, S.lngVersionMajor, S.lngVersionMinor)
	when matched
		then update
			set
				T.lngVersionMajor=S.lngVersionMajor,
				T.lngVersionMinor=S.lngVersionMinor;

end
go

execute base.usp_prepare_object_creation 'base', 'udf_csv2table'
go

create function base.udf_csv2table (@CsvList varchar(max))
returns @Values table (
	strValue varchar(255)
) as
begin

	declare @X xml =
		convert(xml,
			'<Value>' +
			replace(@CsvList, ',', '</Value><Value>') +
			'</Value>'
		)

	insert into @Values
		select ltrim(rtrim(T.C.value('.', 'varchar(max)')))
		from @X.nodes('Value') as T(C)

	return

end
go

execute base.usp_prepare_object_creation 'base', 'udf_expand_dbpattern_raw'
go

create function base.udf_expand_dbpattern_raw (@Pattern varchar(max))
returns @DBFilter table (
	dbname sysname not null,
	dbstate tinyint not null
) as
begin

	if @Pattern='*system' -- all system databases
		insert into @DBFilter values
			('master', 0),
			('model', 0),
			('msdb', 0)
	else
		if @Pattern='*user' -- all user databases
			insert into @DBFilter
				select name, [state] from sys.databases
				where name not in ('master', 'tempdb', 'model', 'msdb')
		else
			if @Pattern='*' -- all databases
				insert into @DBFilter
					select name, [state] from sys.databases
			else
				if @Pattern like 'list(%)' -- comma-separated list of database names
					begin
						declare @ListBody varchar(max) = substring(@Pattern, 6, len(@Pattern) - 6)

						if @ListBody='$usedefinition' -- pre-defined list
							select @ListBody = strValue
							from base.tblConfigValue
							where strConfigValueName='base.database_list'

						insert into @DBFilter
							select SD.[name], SD.[state]
							from sys.databases SD inner join base.udf_csv2table(@ListBody) L on SD.[name]=L.strValue
					end
				else -- only one specific database
					insert into @DBFilter
						select name, [state] from sys.databases
						where name=@Pattern

	return

end
go

execute base.usp_prepare_object_creation 'base', 'usp_for_each_db'
go

create procedure base.usp_for_each_db
	@Pattern varchar(max),
	@Stmt nvarchar(max),
	@SkipReadOnly bit = 0,
	@UseReplaceInsteadParametrization bit = 0 as

begin

	begin try

		declare @DBFilter table (
			dbname sysname not null,
			dbstate tinyint not null
		)

		set nocount on
		insert into @DBFilter
			select dbname, dbstate
			from base.udf_expand_dbpattern_raw(@Pattern)
		set nocount off

		set nocount on
		delete from DBF
		from
			@DBFilter DBF
		where
			DBF.dbstate<>0 -- only ONLINE databases
		if @@rowcount<>0
			begin
				print 'Some non-ONLINE databases were detected.'
				print 'They will be skipped.'
				print ''
			end
		set nocount off

		if @SkipReadOnly=convert(bit, -1)
			begin
				set nocount on
				delete from DBF
				from
					@DBFilter DBF
				where
					databasepropertyex(DBF.dbname, 'Updateability')='READ_ONLY'
				if @@rowcount<>0
					begin
						print 'Some READ_ONLY databases were detected.'
						print 'They will be skipped.'
						print ''
					end
				set nocount off
			end

		print 'List of the affected databases:'
		print ''
		set nocount on
		select left(dbname, 40) as Name, db_id(dbname) as ID from @DBFilter order by 1
		set nocount off

		declare DBNames cursor local fast_forward for
			select dbname from @DBFilter order by 1

		declare @CurDBName varchar(255), @FirstInList bit = convert(bit, -1)

		open DBNames
		fetch next from DBNames into @CurDBName

		while @@fetch_status=0
			begin
				declare @OutStr varchar(max) = convert(varchar, getdate(), 120) + ' Command: ' + @Stmt + '; @DBName=' + @CurDBName
				if @FirstInList=convert(bit, -1) set @FirstInList = convert(bit, 0)	else print ''
				print replicate('-', len(@OutStr))
				print @OutStr
				print replicate('-', len(@OutStr))
				if @UseReplaceInsteadParametrization = convert(bit, 0)
					execute sp_executesql @Stmt, N'@DBName varchar(255)', @CurDBName
				else
					begin
						declare @PrepStmt varchar(max) = replace(@Stmt, '@DBName', @CurDBName)
						execute (@PrepStmt)
					end
				fetch next from DBNames into @CurDBName
			end

		deallocate DBNames

	end try

	begin catch
		if @@trancount<>0 rollback transaction
		declare @EM varchar(max) = base.udf_errmsg()
		print convert(varchar, getdate()) + ' Error encountered!'
		raiserror(@EM, 16, 1)
	end catch

end
go

execute base.usp_prepare_object_creation 'base', 'udf_get_config_value'
go

create function base.udf_get_config_value(@BaseConfigValueName varchar(255))
returns varchar(255) as
begin
	return (select strValue from base.tblConfigValue where strConfigValueName=@BaseConfigValueName)
end
go

execute base.usp_prepare_object_creation 'base', 'udf_get_mail_profile'
go

create function base.udf_get_mail_profile()
returns varchar(255) as
begin
	return base.udf_get_config_value('base.mail_profile')
end
go

execute base.usp_prepare_object_creation 'base', 'udf_get_operator_mail'
go

create function base.udf_get_operator_mail(@BaseConfigValueName varchar(255))
returns varchar(255) as
begin
	return (select email_address from msdb.dbo.sysoperators where name=base.udf_get_config_value(@BaseConfigValueName))
end
go

execute base.usp_prepare_object_creation 'base', 'udf_to_safe_os_string'
go

create function base.udf_to_safe_os_string(@SourceString varchar(255))
returns varchar(255) as
begin

	declare @SafeOSString varchar(255) = @SourceString

	set @SafeOSString = replace(@SafeOSString, '.', '_')
	set @SafeOSString = replace(@SafeOSString, '\', '_')
	set @SafeOSString = replace(@SafeOSString, '/', '_')
	set @SafeOSString = replace(@SafeOSString, ':', '_')
	set @SafeOSString = replace(@SafeOSString, '*', '_')
	set @SafeOSString = replace(@SafeOSString, '?', '_')
	set @SafeOSString = replace(@SafeOSString, '<', '_')
	set @SafeOSString = replace(@SafeOSString, '>', '_')
	set @SafeOSString = replace(@SafeOSString, '|', '_')

	return @SafeOSString

end
go

execute base.usp_prepare_object_creation 'base', 'usp_set_context'
go

create procedure base.usp_set_context
	@Value varchar(128) as
begin

	declare @BinValue varbinary(128) = cast(@Value as varbinary(128))

	set context_info @BinValue

end
go

execute base.usp_prepare_object_creation 'base', 'udf_get_context'
go

create function base.udf_get_context()
returns varchar(128) as
begin

	return replace(cast(context_info() as varchar(128)) collate Latin1_General_100_BIN, 0x00, '')

end
go

execute base.usp_update_module_info 'base', 1, 4
go

redpajama_set_name: RedPajamaGithub


text:
import sys, os, re

# Check Sphinx version
import sphinx
if sphinx.__version__ < "0.5":
    raise RuntimeError("Sphinx 0.5.dev or newer required")

# -----------------------------------------------------------------------------
# General configuration
# -----------------------------------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.

sys.path.insert(0, os.path.abspath('../sphinxext'))

extensions = ['sphinx.ext.autodoc', 'sphinx.ext.pngmath', 'numpydoc',
              'sphinx.ext.intersphinx', 'sphinx.ext.coverage',
              'plot_directive']

if sphinx.__version__ >= "0.7":
    extensions.append('sphinx.ext.autosummary')
else:
    extensions.append('autosummary')
    extensions.append('only_directives')

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# The suffix of source filenames.
source_suffix = '.rst'

# The master toctree document.
#master_doc = 'index'

# General substitutions.
project = 'NumPy'
copyright = '2008-2009, The Scipy community'

# The default replacements for |version| and |release|, also used in various
# other places throughout the built documents.
#
import numpy
# The short X.Y version (including .devXXXX, rcX, b1 suffixes if present)
version = re.sub(r'(\d+\.\d+)\.\d+(.*)', r'\1\2', numpy.__version__)
version = re.sub(r'(\.dev\d+).*?$', r'\1', version)
# The full version, including alpha/beta/rc tags.
release = numpy.__version__
print version, release

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
today_fmt = '%B %d, %Y'

# List of documents that shouldn't be included in the build.
#unused_docs = []

# The reST default role (used for this markup: `text`) to use for all documents.
default_role = "autolink"

# List of directories, relative to source directories, that shouldn't be searched
# for source files.
exclude_dirs = []

# If true, '()' will be appended to :func: etc. cross-reference text.
add_function_parentheses = False

# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True

# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

# -----------------------------------------------------------------------------
# HTML output
# -----------------------------------------------------------------------------

# The style sheet to use for HTML and HTML Help pages. A file of that name
# must exist either in Sphinx' static/ path, or in one of the custom paths
# given in html_static_path.
html_style = 'scipy.css'

# The name for this set of Sphinx documents.  If None, it defaults to
# "<project> v<release> documentation".
html_title = "%s v%s Manual (DRAFT)" % (project, version)

# The name of an image file (within the static path) to place at the top of
# the sidebar.
html_logo = 'scipyshiny_small.png'

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
html_last_updated_fmt = '%b %d, %Y'

# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True

# Custom sidebar templates, maps document names to template names.
html_sidebars = {
    'index': 'indexsidebar.html'
}

# Additional templates that should be rendered to pages, maps page names to
# template names.
html_additional_pages = {
    'index': 'indexcontent.html',
}

# If false, no module index is generated.
html_use_modindex = True

# If true, the reST sources are included in the HTML build as _sources/<name>.
#html_copy_source = True

# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it.  The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''

# If nonempty, this is the file name suffix for HTML files (e.g. ".html").
#html_file_suffix = '.html'

# Output file base name for HTML help builder.
htmlhelp_basename = 'numpy'

# Pngmath should try to align formulas properly
pngmath_use_preview = True

# -----------------------------------------------------------------------------
# LaTeX output
# -----------------------------------------------------------------------------

# The paper size ('letter' or 'a4').
#latex_paper_size = 'letter'

# The font size ('10pt', '11pt' or '12pt').
#latex_font_size = '10pt'

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, document class [howto/manual]).
_stdauthor = 'Written by the NumPy community'
latex_documents = [
  ('reference/index', 'numpy-ref.tex', 'NumPy Reference',
   _stdauthor, 'manual'),
  ('user/index', 'numpy-user.tex', 'NumPy User Guide',
   _stdauthor, 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None

# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False

# Additional stuff for the LaTeX preamble.
latex_preamble = r'''
\usepackage{amsmath}
\DeclareUnicodeCharacter{00A0}{\nobreakspace}

% In the parameters section, place a newline after the Parameters
% header
\usepackage{expdlist}
\let\latexdescription=\description
\def\description{\latexdescription{}{} \breaklabel}

% Make Examples/etc section headers smaller and more compact
\makeatletter
\titleformat{\paragraph}{\normalsize\py@HeaderFamily}%
            {\py@TitleColor}{0em}{\py@TitleColor}{\py@NormalColor}
\titlespacing*{\paragraph}{0pt}{1ex}{0pt}
\makeatother

% Fix footer/header
\renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase{\thechapter.\ #1}}{}}
\renewcommand{\sectionmark}[1]{\markright{\MakeUppercase{\thesection.\ #1}}}
'''

# Documents to append as an appendix to all manuals.
#latex_appendices = []

# If false, no module index is generated.
latex_use_modindex = False

# -----------------------------------------------------------------------------
# Intersphinx configuration
# -----------------------------------------------------------------------------
intersphinx_mapping = {'http://docs.python.org/dev': None}

# -----------------------------------------------------------------------------
# Numpy extensions
# -----------------------------------------------------------------------------

# If we want to do a phantom import from an XML file for all autodocs
phantom_import_file = 'dump.xml'

# Make numpydoc to generate plots for example sections
numpydoc_use_plots = True

# -----------------------------------------------------------------------------
# Autosummary
# -----------------------------------------------------------------------------

if sphinx.__version__ >= "0.7":
    import glob
    autosummary_generate = glob.glob("reference/*.rst")

# -----------------------------------------------------------------------------
# Coverage checker
# -----------------------------------------------------------------------------
coverage_ignore_modules = r"""
    """.split()
coverage_ignore_functions = r"""
    test($|_) (some|all)true bitwise_not cumproduct pkgload
    generic\.
    """.split()
coverage_ignore_classes = r"""
    """.split()

coverage_c_path = []
coverage_c_regexes = {}
coverage_ignore_c_items = {}

# -----------------------------------------------------------------------------
# Plots
# -----------------------------------------------------------------------------
plot_pre_code = """
import numpy as np
np.random.seed(0)
"""
plot_include_source = True
plot_formats = [('png', 100), 'pdf']

import math
phi = (math.sqrt(5) + 1)/2

import matplotlib
matplotlib.rcParams.update({
    'font.size': 8,
    'axes.titlesize': 8,
    'axes.labelsize': 8,
    'xtick.labelsize': 8,
    'ytick.labelsize': 8,
    'legend.fontsize': 8,
    'figure.figsize': (3*phi, 3),
    'figure.subplot.bottom': 0.2,
    'figure.subplot.left': 0.2,
    'figure.subplot.right': 0.9,
    'figure.subplot.top': 0.85,
    'figure.subplot.wspace': 0.4,
    'text.usetex': False,
})


text:
#pragma once
#include "Singleton.h"

namespace cd
{
	class CDAPIModule final : public Singleton<CDAPIModule>
	{
		DECL_SINGLETON(CDAPIModule);
	public:
		bool IsReady() { return true; }

	private:
		CDAPIModule();
		~CDAPIModule() = default;
	};
}


text:
namespace QuantityTypes
{
    using System;
#if !PCL
    using System.ComponentModel;
#endif
    using System.Globalization;
    using System.Runtime.Serialization;
    using System.Xml.Serialization;

    /// <summary>
    /// Represents the electric conductivity quantity.
    /// </summary>
    [DataContract]
#if !PCL
    [Serializable]
    [TypeConverter(typeof(QuantityTypeConverter<ElectricConductivity>))]
#endif
    public partial struct ElectricConductivity : IQuantity<ElectricConductivity>
    {
        /// <summary>
        /// The backing field for the <see cref="SiemensPerMetre" /> property.
        /// </summary>
        private static readonly ElectricConductivity SiemensPerMetreField = new ElectricConductivity(1);

        /// <summary>
        /// The backing field for the <see cref="SiemensPerCentimeter" /> property.
        /// </summary>
        private static readonly ElectricConductivity SiemensPerCentimeterField = new ElectricConductivity(1e2);

        /// <summary>
        /// The backing field for the <see cref="MillisiemensPerCentimeter" /> property.
        /// </summary>
        private static readonly ElectricConductivity MillisiemensPerCentimeterField = new ElectricConductivity(1e-1);

        /// <summary>
        /// The backing field for the <see cref="MicrosiemensPerCentimeter" /> property.
        /// </summary>
        private static readonly ElectricConductivity MicrosiemensPerCentimeterField = new ElectricConductivity(1e-4);

        /// <summary>
        /// The value.
        /// </summary>
        private double value;

        /// <summary>
        /// Initializes a new instance of the <see cref="ElectricConductivity"/> struct.
        /// </summary>
        /// <param name="value">
        /// The value.
        /// </param>
        public ElectricConductivity(double value)
        {
            this.value = value;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="ElectricConductivity"/> struct.
        /// </summary>
        /// <param name="value">
        /// The value.
        /// </param>
        /// <param name="unitProvider">
        /// The unit provider.
        /// </param>
        public ElectricConductivity(string value, IUnitProvider unitProvider = null)
        {
            this.value = Parse(value, unitProvider ?? UnitProvider.Default).value;
        }

        /// <summary>
        /// Gets the "S/m" unit.
        /// </summary>
        [Unit("S/m", true)]
        public static ElectricConductivity SiemensPerMetre
        {
            get { return SiemensPerMetreField; }
        }

        /// <summary>
        /// Gets the "S/cm" unit.
        /// </summary>
        [Unit("S/cm")]
        public static ElectricConductivity SiemensPerCentimeter
        {
            get { return SiemensPerCentimeterField; }
        }

        /// <summary>
        /// Gets the "mS/cm" unit.
        /// </summary>
        [Unit("mS/cm")]
        public static ElectricConductivity MillisiemensPerCentimeter
        {
            get { return MillisiemensPerCentimeterField; }
        }

        /// <summary>
        /// Gets the "uS/cm" unit.
        /// </summary>
        [Unit("uS/cm")]
        public static ElectricConductivity MicrosiemensPerCentimeter
        {
            get { return MicrosiemensPerCentimeterField; }
        }

        /// <summary>
        /// Gets or sets the electric conductivity as a string.
        /// </summary>
        /// <value>The string.</value>
        /// <remarks>
        /// This property is used for XML serialization.
        /// </remarks>
        [XmlText]
        [DataMember]
        public string XmlValue
        {
            get
            {
                // Use round-trip format
                return this.ToString("R", CultureInfo.InvariantCulture);
            }

            set
            {
                this.value = Parse(value, CultureInfo.InvariantCulture).value;
            }
        }

        /// <summary>
        /// Gets the value of the electric conductivity in the base unit.
        /// </summary>
        public double Value
        {
            get
            {
                return this.value;
            }
        }

        /// <summary>
        /// Converts a string representation of a quantity in a specific culture-specific format with a specific unit provider.
        /// </summary>
        /// <param name="input">
        /// A string that contains the quantity to convert.
        /// </param>
        /// <param name="provider">
        /// An object that supplies culture-specific formatting information about <paramref name="input" />. If not specified, the culture of the default <see cref="UnitProvider" /> is used.
        /// </param>
        /// <param name="unitProvider">
        /// The unit provider. If not specified, the default <see cref="UnitProvider" /> is used.
        /// </param>
        /// <returns>
        /// A <see cref="ElectricConductivity"/> that represents the quantity in <paramref name="input" />.
        /// </returns>
        public static ElectricConductivity Parse(string input, IFormatProvider provider, IUnitProvider unitProvider)
        {
            if (unitProvider == null)
            {
                unitProvider = provider as IUnitProvider ?? UnitProvider.Default;
            }

            ElectricConductivity value;
            if (!unitProvider.TryParse(input, provider, out value))
            {
                throw new FormatException("Invalid format.");
            }

            return value;
        }

        /// <summary>
        /// Converts a string representation of a quantity in a specific culture-specific format.
        /// </summary>
        /// <param name="input">
        /// A string that contains the quantity to convert.
        /// </param>
        /// <param name="provider">
        /// An object that supplies culture-specific formatting information about <paramref name="input" />. If not specified, the culture of the default <see cref="UnitProvider" /> is used.
        /// </param>
        /// <returns>
        /// A <see cref="ElectricConductivity"/> that represents the quantity in <paramref name="input" />.
        /// </returns>
        public static ElectricConductivity Parse(string input, IFormatProvider provider = null)
        {
            var unitProvider = provider as IUnitProvider ?? UnitProvider.Default;

            ElectricConductivity value;
            if (!unitProvider.TryParse(input, provider, out value))
            {
                throw new FormatException("Invalid format.");
            }

            return value;
        }

        /// <summary>
        /// Converts a string representation of a quantity with a specific unit provider.
        /// </summary>
        /// <param name="input">
        /// A string that contains the quantity to convert.
        /// </param>
        /// <param name="unitProvider">
        /// The unit provider. If not specified, the default <see cref="UnitProvider" /> is used.
        /// </param>
        /// <returns>
        /// A <see cref="ElectricConductivity"/> that represents the quantity in <paramref name="input" />.
        /// </returns>
        public static ElectricConductivity Parse(string input, IUnitProvider unitProvider)
        {
            if (unitProvider == null)
            {
                unitProvider = UnitProvider.Default;
            }

            ElectricConductivity value;
            if (!unitProvider.TryParse(input, unitProvider.Culture, out value))
            {
                throw new FormatException("Invalid format.");
            }

            return value;
        }

        /// <summary>
        /// Tries to parse the specified string.
        /// </summary>
        /// <param name="input">The input string.</param>
        /// <param name="provider">The format provider.</param>
        /// <param name="unitProvider">The unit provider.</param>
        /// <param name="result">The result.</param>
        /// <returns><c>true</c> if the string was parsed, <c>false</c> otherwise.</returns>
        public static bool TryParse(string input, IFormatProvider provider, IUnitProvider unitProvider, out ElectricConductivity result)
        {
            if (unitProvider == null)
            {
                unitProvider = provider as IUnitProvider ?? UnitProvider.Default;
            }

            return unitProvider.TryParse(input, provider, out result);
        }

        /// <summary>
        /// Parses the specified JSON string.
        /// </summary>
        /// <param name="input">The JSON input.</param>
        /// <returns>
        /// The <see cref="ElectricConductivity"/> .
        /// </returns>
        public static ElectricConductivity ParseJson(string input)
        {
            return Parse(input, CultureInfo.InvariantCulture);
        }

        /// <summary>
        /// Implements the operator +.
        /// </summary>
        /// <param name="x">
        /// The first value.
        /// </param>
        /// <param name="y">
        /// The second value.
        /// </param>
        /// <returns>
        /// The result of the operator.
        /// </returns>
        public static ElectricConductivity operator +(ElectricConductivity x, ElectricConductivity y)
        {
            return new ElectricConductivity(x.value + y.value);
        }

        /// <summary>
        /// Implements the operator /.
        /// </summary>
        /// <param name="x">
        /// The x.
        /// </param>
        /// <param name="y">
        /// The y.
        /// </param>
        /// <returns>
        /// The result of the operator.
        /// </returns>
        public static ElectricConductivity operator /(ElectricConductivity x, double y)
        {
            return new ElectricConductivity(x.value / y);
        }

        /// <summary>
        /// Implements the operator /.
        /// </summary>
        /// <param name="x">
        /// The x.
        /// </param>
        /// <param name="y">
        /// The y.
        /// </param>
        /// <returns>
        /// The result of the operator.
        /// </returns>
        public static double operator /(ElectricConductivity x, ElectricConductivity y)
        {
            return x.value / y.value;
        }

        /// <summary>
        /// Implements the operator ==.
        /// </summary>
        /// <param name="x">
        /// The x.
        /// </param>
        /// <param name="y">
        /// The y.
        /// </param>
        /// <returns>
        /// The result of the operator.
        /// </returns>
        public static bool operator ==(ElectricConductivity x, ElectricConductivity y)
        {
            return x.value.Equals(y.value);
        }

        /// <summary>
        /// Implements the operator >.
        /// </summary>
        /// <param name="x">
        /// The x.
        /// </param>
        /// <param name="y">
        /// The y.
        /// </param>
        /// <returns>
        /// The result of the operator.
        /// </returns>
        public static bool operator >(ElectricConductivity x, ElectricConductivity y)
        {
            return x.value > y.value;
        }

        /// <summary>
        /// Implements the operator >=.
        /// </summary>
        /// <param name="x">
        /// The x.
        /// </param>
        /// <param name="y">
        /// The y.
        /// </param>
        /// <returns>
        /// The result of the operator.
        /// </returns>
        public static bool operator >=(ElectricConductivity x, ElectricConductivity y)
        {
            return x.value >= y.value;
        }

        /// <summary>
        /// Implements the operator !=.
        /// </summary>
        /// <param name="x">
        /// The x.
        /// </param>
        /// <param name="y">
        /// The y.
        /// </param>
        /// <returns>
        /// The result of the operator.
        /// </returns>
        public static bool operator !=(ElectricConductivity x, ElectricConductivity y)
        {
            return !x.value.Equals(y.value);
        }

        /// <summary>
        /// Implements the operator <.
        /// </summary>
        /// <param name="x">
        /// The x.
        /// </param>
        /// <param name="y">
        /// The y.
        /// </param>
        /// <returns>
        /// The result of the operator.
        /// </returns>
        public static bool operator <(ElectricConductivity x, ElectricConductivity y)
        {
            return x.value < y.value;
        }

        /// <summary>
        /// Implements the operator <=.
        /// </summary>
        /// <param name="x">
        /// The x.
        /// </param>
        /// <param name="y">
        /// The y.
        /// </param>
        /// <returns>
        /// The result of the operator.
        /// </returns>
        public static bool operator <=(ElectricConductivity x, ElectricConductivity y)
        {
            return x.value <= y.value;
        }

        /// <summary>
        /// Implements the operator *.
        /// </summary>
        /// <param name="x">
        /// The x.
        /// </param>
        /// <param name="y">
        /// The y.
        /// </param>
        /// <returns>
        /// The result of the operator.
        /// </returns>
        public static ElectricConductivity operator *(double x, ElectricConductivity y)
        {
            return new ElectricConductivity(x * y.value);
        }

        /// <summary>
        /// Implements the operator *.
        /// </summary>
        /// <param name="x">
        /// The x.
        /// </param>
        /// <param name="y">
        /// The y.
        /// </param>
        /// <returns>
        /// The result of the operator.
        /// </returns>
        public static ElectricConductivity operator *(ElectricConductivity x, double y)
        {
            return new ElectricConductivity(x.value * y);
        }

        /// <summary>
        /// Implements the operator -.
        /// </summary>
        /// <param name="x">
        /// The x.
        /// </param>
        /// <param name="y">
        /// The y.
        /// </param>
        /// <returns>
        /// The result of the operator.
        /// </returns>
        public static ElectricConductivity operator -(ElectricConductivity x, ElectricConductivity y)
        {
            return new ElectricConductivity(x.value - y.value);
        }

        /// <summary>
        /// Implements the unary plus operator.
        /// </summary>
        /// <param name="x">
        /// The x.
        /// </param>
        /// <returns>
        /// The result of the operator.
        /// </returns>
        public static ElectricConductivity operator +(ElectricConductivity x)
        {
            return new ElectricConductivity(x.value);
        }

        /// <summary>
        /// Implements the unary minus operator.
        /// </summary>
        /// <param name="x">
        /// The x.
        /// </param>
        /// <returns>
        /// The result of the operator.
        /// </returns>
        public static ElectricConductivity operator -(ElectricConductivity x)
        {
            return new ElectricConductivity(-x.value);
        }

        /// <summary>
        /// Compares this instance to the specified <see cref="ElectricConductivity"/> and returns an indication of their relative values.
        /// </summary>
        /// <param name="other">
        /// The other <see cref="ElectricConductivity"/> .
        /// </param>
        /// <returns>
        /// A signed number indicating the relative values of this instance and the other value.
        /// </returns>
        public int CompareTo(ElectricConductivity other)
        {
            return this.value.CompareTo(other.value);
        }

        /// <summary>
        /// Compares the current instance with another object of the same type and returns an integer that indicates whether the
        /// current instance precedes, follows, or occurs in the same position in the sort order as the other object.
        /// </summary>
        /// <param name="obj">An object to compare with this instance.</param>
        /// <returns>
        /// A value that indicates the relative order of the objects being compared. The return value has these meanings:
        /// Value Meaning Less than zero This instance is less than <paramref name="obj" />. Zero This instance is equal to
        /// <paramref name="obj" />. Greater than zero This instance is greater than <paramref name="obj" />.
        /// </returns>
        public int CompareTo(object obj)
        {
            return this.CompareTo((ElectricConductivity)obj);
        }

        /// <summary>
        /// Converts the quantity to the specified unit.
        /// </summary>
        /// <param name="unit">The unit.</param>
        /// <returns>The amount of the specified unit.</returns>
        double IQuantity.ConvertTo(IQuantity unit)
        {
            return this.ConvertTo((ElectricConductivity)unit);
        }

        /// <summary>
        /// Converts to the specified unit.
        /// </summary>
        /// <param name="unit">
        /// The unit.
        /// </param>
        /// <returns>
        /// The value in the specified unit.
        /// </returns>
        public double ConvertTo(ElectricConductivity unit)
        {
            return this.value / unit.Value;
        }

        /// <summary>
        /// Determines whether the specified <see cref="System.Object"/> is equal to this instance.
        /// </summary>
        /// <param name="obj">
        /// The <see cref="System.Object"/> to compare with this instance.
        /// </param>
        /// <returns>
        /// <c>true</c> if the specified <see cref="System.Object"/> is equal to this instance; otherwise, <c>false</c> .
        /// </returns>
        public override bool Equals(object obj)
        {
            if (obj is ElectricConductivity)
            {
                return this.Equals((ElectricConductivity)obj);
            }

            return false;
        }

        /// <summary>
        /// Determines if the specified <see cref="ElectricConductivity"/> is equal to this instance.
        /// </summary>
        /// <param name="other">
        /// The other <see cref="ElectricConductivity"/> .
        /// </param>
        /// <returns>
        /// True if the values are equal.
        /// </returns>
        public bool Equals(ElectricConductivity other)
        {
            return this.value.Equals(other.value);
        }

        /// <summary>
        /// Returns a hash code for this instance.
        /// </summary>
        /// <returns>
        /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
        /// </returns>
        public override int GetHashCode()
        {
            return this.Value.GetHashCode();
        }

        /// <summary>
        /// Multiplies by the specified number.
        /// </summary>
        /// <param name="x">The number.</param>
        /// <returns>The new quantity.</returns>
        public IQuantity MultiplyBy(double x)
        {
            return this * x;
        }

        /// <summary>
        /// Adds the specified quantity.
        /// </summary>
        /// <param name="x">The quantity to add.</param>
        /// <returns>The sum.</returns>
        public IQuantity Add(IQuantity x)
        {
            if (!(x is ElectricConductivity))
            {
                throw new InvalidOperationException("Can only add quantities of the same types.");
            }

            return new ElectricConductivity(this.value + x.Value);
        }

        /// <summary>
        /// Sets the value from the specified string.
        /// </summary>
        /// <param name="s">
        /// The s.
        /// </param>
        /// <param name="provider">
        /// The provider.
        /// </param>
        public void SetFromString(string s, IUnitProvider provider)
        {
            this.value = Parse(s, provider).value;
        }

        /// <summary>
        /// Returns a <see cref="System.String"/> that represents this instance.
        /// </summary>
        /// <returns>
        /// A <see cref="System.String"/> that represents this instance.
        /// </returns>
        public override string ToString()
        {
            return this.ToString(null, UnitProvider.Default);
        }

        /// <summary>
        /// Returns a <see cref="System.String"/> that represents this instance.
        /// </summary>
        /// <param name="formatProvider">
        /// The format provider.
        /// </param>
        /// <returns>
        /// A <see cref="System.String"/> that represents this instance.
        /// </returns>
        public string ToString(IFormatProvider formatProvider)
        {
            var unitProvider = formatProvider as IUnitProvider ?? UnitProvider.Default;

            return this.ToString(null, formatProvider, unitProvider);
        }

        /// <summary>
        /// Returns a <see cref="System.String"/> that represents this instance.
        /// </summary>
        /// <param name="format">
        /// The format.
        /// </param>
        /// <param name="formatProvider">
        /// The format provider.
        /// </param>
        /// <returns>
        /// A <see cref="System.String"/> that represents this instance.
        /// </returns>
        public string ToString(string format, IFormatProvider formatProvider = null)
        {
            var unitProvider = formatProvider as IUnitProvider ?? UnitProvider.Default;

            return this.ToString(format, formatProvider, unitProvider);
        }

        /// <summary>
        /// Returns a <see cref="System.String"/> that represents this instance.
        /// </summary>
        /// <param name="format">
        /// The format.
        /// </param>
        /// <param name="formatProvider">
        /// The format provider.
        /// </param>
        /// <param name="unitProvider">
        /// The unit provider.
        /// </param>
        /// <returns>
        /// A <see cref="System.String"/> that represents this instance.
        /// </returns>
        public string ToString(string format, IFormatProvider formatProvider, IUnitProvider unitProvider)
        {
            if (unitProvider == null)
            {
                unitProvider = formatProvider as IUnitProvider ?? UnitProvider.Default;
            }

            return unitProvider.Format(format, formatProvider, this);
        }
    }
}


text:
@interface OpenGLES_Ch7_2ViewController ()

@property (strong, nonatomic) UtilityModelManager *modelManager;
@property (strong, nonatomic) UtilityArmatureBaseEffect
   *baseEffect;
@property (strong, nonatomic) UtilityModel *bone0;
@property (strong, nonatomic) UtilityModel *bone1;
@property (strong, nonatomic) UtilityModel *bone2;
@property (assign, nonatomic) float joint0AngleRadians;
@property (assign, nonatomic) float joint1AngleRadians;
@property (assign, nonatomic) float joint2AngleRadians;

@end

@implementation OpenGLES_Ch7_2ViewController

@synthesize modelManager;
@synthesize baseEffect;
@synthesize bone0;
@synthesize bone1;
@synthesize bone2;
@synthesize joint0AngleRadians;
@synthesize joint1AngleRadians;
@synthesize joint2AngleRadians;

/////////////////////////////////////////////////////////////////
// Called when the view controller's view is loaded
// Perform initialization before the view is asked to draw
- (void)viewDidLoad
{
   [super viewDidLoad];

   // Verify the type of view created automatically by the
   // Interface Builder storyboard
   GLKView *view = (GLKView *)self.view;
   NSAssert([view isKindOfClass:[GLKView class]],
      @"View controller's view is not a GLKView");

   // Use high resolution depth buffer
   view.drawableDepthFormat = GLKViewDrawableDepthFormat24;

   // Create an OpenGL ES 2.0 context and provide it to the
   // view
   view.context = [[AGLKContext alloc]
      initWithAPI:kEAGLRenderingAPIOpenGLES2];

   // Make the new context current andenable depth testing
   [AGLKContext setCurrentContext:view.context];
   [((AGLKContext *)view.context) enable:GL_DEPTH_TEST];

   // Create a base effect that provides standard OpenGL ES 2.0
   // shading language programs and set constants to be used for
   // all subsequent rendering
   self.baseEffect = [[UtilityArmatureBaseEffect alloc] init];

   // Configure a light
   self.baseEffect.light0.enabled = GL_TRUE;
   self.baseEffect.light0.ambientColor = GLKVector4Make(
      0.7f, // Red
      0.7f, // Green
      0.7f, // Blue
      1.0f);// Alpha
   self.baseEffect.light0.diffuseColor = GLKVector4Make(
      1.0f, // Red
      1.0f, // Green
      1.0f, // Blue
      1.0f);// Alpha
   self.baseEffect.light0Position = GLKVector4Make(
      1.0f,
      0.8f,
      0.4f,
      0.0f);// Directional light

   // Set the background color
   ((AGLKContext *)view.context).clearColor = GLKVector4Make(
      0.0f, // Red
      0.0f, // Green
      0.0f, // Blue
      1.0f);// Alpha

   // The model manager loads models and sends the data to GPU.
   // Each loaded model can be accesssed by name.
   NSString *modelsPath = [[NSBundle mainBundle] pathForResource:
      @"armature" ofType:@"modelplist"];
   if(nil != modelsPath)
   {
      self.modelManager =
         [[UtilityModelManager alloc] initWithModelPath:
            modelsPath];
   }

   // Load models used to draw the Utility
   self.bone0 = [self.modelManager
      modelNamed:@"bone0"];
   NSAssert(nil != self.bone0,
      @"Failed to load bone0 model");
   [self.bone0 assignJoint:0];

   self.bone1 = [self.modelManager
      modelNamed:@"bone1"];
   NSAssert(nil != self.bone1,
      @"Failed to load bone1 model");
   [self.bone1 assignJoint:1];

   self.bone2 = [self.modelManager
      modelNamed:@"bone2"];
   NSAssert(nil != self.bone2,
      @"Failed to load bone2 model");
   [self.bone2 assignJoint:2];

   // Create collection of joints
   UtilityJoint *bone0Joint = [[UtilityJoint alloc]
      initWithDisplacement:GLKVector3Make(0, 0, 0)
      parent:nil];
   float bone0Length = self.bone0.axisAlignedBoundingBox.max.y -
      self.bone0.axisAlignedBoundingBox.min.y;
   UtilityJoint *bone1Joint = [[UtilityJoint alloc]
      initWithDisplacement:GLKVector3Make(0, bone0Length, 0)
      parent:bone0Joint];
   float bone1Length = self.bone1.axisAlignedBoundingBox.max.y -
      self.bone1.axisAlignedBoundingBox.min.y;
   UtilityJoint *bone2Joint = [[UtilityJoint alloc]
      initWithDisplacement:GLKVector3Make(0, bone1Length, 0)
      parent:bone1Joint];

   baseEffect.jointsArray = [NSArray arrayWithObjects:
      bone0Joint,
      bone1Joint,
      bone2Joint,
      nil];

   // Set initial point of view to reasonable arbitrary values
   // These values make most of the simulated rink visible
   self.baseEffect.transform.modelviewMatrix =
      GLKMatrix4MakeLookAt(
         5.0, 10.0, 15.0,// Eye position
         0.0, 2.0, 0.0,  // Look-at position
         0.0, 1.0, 0.0); // Up direction

   // Start armature joints in default positions
   [self setJoint0AngleRadians:0];
   [self setJoint1AngleRadians:0];
   [self setJoint2AngleRadians:0];
}

/////////////////////////////////////////////////////////////////
// This method is called automatically at the update rate of the
// receiver (default 30 Hz).
- (void)update
{
}

/////////////////////////////////////////////////////////////////
// GLKView delegate method: Called by the view controller's view
// whenever Cocoa Touch asks the view controller's view to
// draw itself. (In this case, render into a frame buffer that
// shares memory with a Core Animation Layer)
- (void)glkView:(GLKView *)view drawInRect:(CGRect)rect
{
   // Clear back frame buffer (erase previous drawing)
   // and depth buffer
   [((AGLKContext *)view.context)
      clear:GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT];

   // Cull back faces: Important! many Sketchup models have back
   // faces that cause Z fighting if back faces are not culled.
   [((AGLKContext *)view.context) enable:GL_CULL_FACE];

   // Calculate the aspect ratio for the Utility and setup a
   // perspective projection
   const GLfloat  aspectRatio =
      (GLfloat)view.drawableWidth / (GLfloat)view.drawableHeight;

   self.baseEffect.transform.projectionMatrix =
      GLKMatrix4MakePerspective(
         GLKMathDegreesToRadians(35.0f),// Standard field of view
         aspectRatio,
         4.0f,   // Don't make near plane too close
         20.0f); // Far arbitrarily far enough to contain Utility

   [self.modelManager prepareToDrawWithJointInfluence];
   [self.baseEffect prepareToDrawArmature];

   // Draw the bones
   [self.bone0 draw];
   [self.bone1 draw];
   [self.bone2 draw];

#ifdef DEBUG
   {  // Report any errors
      GLenum error = glGetError();
      if(GL_NO_ERROR != error)
      {
         NSLog(@"GL Error: 0x%x", error);
      }
   }
#endif
}

/////////////////////////////////////////////////////////////////
// Called when the view controller's view has been unloaded
// Perform clean-up that is possible when you know the view
// controller's view won't be asked to draw again soon.
- (void)viewDidUnload
{
   [super viewDidUnload];

   // Make the view's context current
   GLKView *view = (GLKView *)self.view;
   [AGLKContext setCurrentContext:view.context];

   // Stop using the context created in -viewDidLoad
   ((GLKView *)self.view).context = nil;
   [EAGLContext setCurrentContext:nil];

   baseEffect = nil;
   bone0 = nil;
   bone1 = nil;
   bone2 = nil;
}

/////////////////////////////////////////////////////////////////
// This method is called automatically and allows all standard
// device orientations.
- (BOOL)shouldAutorotateToInterfaceOrientation:
   (UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
   if ([[UIDevice currentDevice] userInterfaceIdiom] ==
      UIUserInterfaceIdiomPhone)
   {
      return (interfaceOrientation !=
         UIInterfaceOrientationPortraitUpsideDown);
   }
   else
   {
       return YES;
   }
}

/////////////////////////////////////////////////////////////////
//
- (void)setJoint0AngleRadians:(float)value
{
   joint0AngleRadians = value;

   GLKMatrix4  rotateZMatrix = GLKMatrix4MakeRotation(
      value * M_PI * 0.5, 0, 0, 1);

   [(UtilityJoint *)[baseEffect.jointsArray objectAtIndex:0]
      setMatrix:rotateZMatrix];
}

/////////////////////////////////////////////////////////////////
//
- (void)setJoint1AngleRadians:(float)value
{
   joint1AngleRadians = value;

   GLKMatrix4  rotateZMatrix = GLKMatrix4MakeRotation(
      value * M_PI * 0.5, 0, 0, 1);

   [(UtilityJoint *)[baseEffect.jointsArray objectAtIndex:1]
      setMatrix:rotateZMatrix];
}

/////////////////////////////////////////////////////////////////
//
- (void)setJoint2AngleRadians:(float)value
{
   joint2AngleRadians = value;

   GLKMatrix4  rotateZMatrix = GLKMatrix4MakeRotation(
      value * M_PI * 0.5, 0, 0, 1);

   [(UtilityJoint *)[baseEffect.jointsArray objectAtIndex:2]
      setMatrix:rotateZMatrix];
}

/////////////////////////////////////////////////////////////////
//
- (IBAction)takeAngle0From:(UISlider *)sender
{
   [self setJoint0AngleRadians:[sender value]];
}

/////////////////////////////////////////////////////////////////
//
- (IBAction)takeAngle1From:(UISlider *)sender
{
   [self setJoint1AngleRadians:[sender value]];
}

/////////////////////////////////////////////////////////////////
//
- (IBAction)takeAngle2From:(UISlider *)sender
{
   [self setJoint2AngleRadians:[sender value]];
}

@end


text:
using System;

public static class Program {
    public static unsafe void Main (string[] args) {
        var ints = new int[] { 0, 1, 2, 3 };

        fixed (int* pInts = &ints[1]) {
            Console.WriteLine(pInts[0]);
            Console.WriteLine(pInts[2]);
        }
    }
}


text:
<?php

namespace NerdsAndCompany\Schematic\Events;

use yii\base\Event;

class SourceMappingEvent extends Event
{
    /**
     * @var string
     */
    public $source;

    /**
     * @var string
     */
    public $service;

    /**
     * @var string
     */
    public $method;
}


text:
import { Figure } from './Figure';
import { images, setup, Direction } from '../engine/constants';

export class Bullet extends Figure {
  parent: Figure;
  life: number;
  speed: number;

  constructor(parent: Figure) {
    super(parent.level);
    this.parent = parent;
    this.life = Math.ceil(2000 / setup.interval);
    this.speed = setup.bullet_v;
  }

  init(x: number, y: number) {
    super.init(x + 31, y + 14);
    this.setImage(images.sprites, 191, 366);
    this.setSize(16, 16);
    this.direction = this.parent.direction;
    this.vy = 0;
    this.vx = this.direction === Direction.right ? this.speed : -this.speed;
  }

  setVelocity(vx: number, vy: number) {
    super.setVelocity(vx, vy);

    if (this.vx === 0) {
      const s = this.speed * Math.sign(this.speed);
      this.vx = this.direction === Direction.right ? -s : s;
    }

    if (this.onground) {
      this.vy = setup.bounce;
    }
  }

  move() {
    if (--this.life) {
      super.move();
    } else {
      this.die();
    }
  }

  hit(opponent: Figure) {
    if (opponent !== this.parent) {
      opponent.die();
      this.die();
    }
  }
}


text:
package onactivityresult.compiler;

import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;

import static javax.tools.Diagnostic.Kind.ERROR;

final class OnActivityResultProcessingException extends Exception {
    private final Element  element;
    private final String   message;
    private final Object[] args;

    OnActivityResultProcessingException(final Element element, final String message, final Object... args) {
        this.element = element;
        this.message = message;
        this.args = args;
    }

    void printError(final ProcessingEnvironment processingEnvironment) {
        final String location = this.getLocation();
        final String formattedMessage = (args.length > 0 ? String.format(message, args) : message) + ". " + location;
        processingEnvironment.getMessager().printMessage(ERROR, formattedMessage, element);
    }

    private String getLocation() {
        final TypeElement enclosingElement = (TypeElement) element.getEnclosingElement();
        return String.format("(%s.%s)", enclosingElement.getQualifiedName(), element.getSimpleName());
    }
}


text:
package source

import (
	"bytes"
	"io"
	"os"
	"path/filepath"

	"github.com/elm-tangram/tangram/package"
)

// Loader finds the absolute path of files in the project and is able to
// load their source.
type Loader interface {
	// AbsPath returns the absolute path of the file.
	AbsPath(string) string
	// Load reads the source code of the file at the given relative project
	// path.
	Load(string) (io.ReadSeeker, error)
}

// FsLoader is a loader from file system.
type FsLoader struct {
	pkg *pkg.Package
}

// NewFsLoader creates a new filesystem loader with the given package.
func NewFsLoader(pkg *pkg.Package) *FsLoader {
	return &FsLoader{pkg}
}

// AbsPath returns the absolute path of the given path, which must be relative
// to the root of the loader.
func (l *FsLoader) AbsPath(path string) string {
	return filepath.Join(l.pkg.Root(), path)
}

// Load retrieves the source code of the file at the given module path.
func (l *FsLoader) Load(path string) (io.ReadSeeker, error) {
	f, err := os.Open(path)
	if err != nil {
		return nil, err
	}

	return f, nil
}

// MemLoader is a loader that works in memory. It is intended for test
// purposes and not real use.
type MemLoader struct {
	files map[string]string
}

// NewMemLoader returns a new memory loader.
func NewMemLoader() *MemLoader {
	return &MemLoader{make(map[string]string)}
}

// Add inserts the content for the given path to the memory loader.
func (l *MemLoader) Add(path, content string) {
	l.files[path] = content
}

// AbsPath returns the absolute path of the given path.
func (l *MemLoader) AbsPath(path string) string {
	return path
}

// Load retrieves the content of the given path.
func (l *MemLoader) Load(path string) (io.ReadSeeker, error) {
	if s, ok := l.files[path]; ok {
		return bytes.NewReader([]byte(s)), nil
	}

	return nil, os.ErrNotExist
}


text:
package opt

import (
	"github.com/syndtr/goleveldb/leveldb/cache"
	"github.com/syndtr/goleveldb/leveldb/comparer"
	"github.com/syndtr/goleveldb/leveldb/filter"
)

const (
	KiB = 1024
	MiB = KiB * 1024
	GiB = MiB * 1024
)

const (
	DefaultBlockCacheSize       = 8 * MiB
	DefaultBlockRestartInterval = 16
	DefaultBlockSize            = 4 * KiB
	DefaultCompressionType      = SnappyCompression
	DefaultMaxOpenFiles         = 1000
	DefaultWriteBuffer          = 4 * MiB
)

type noCache struct{}

func (noCache) SetCapacity(capacity int)               {}
func (noCache) Capacity() int                          { return 0 }
func (noCache) Used() int                              { return 0 }
func (noCache) Size() int                              { return 0 }
func (noCache) GetNamespace(id uint64) cache.Namespace { return nil }
func (noCache) Purge(fin cache.PurgeFin)               {}
func (noCache) Zap()                                   {}

var NoCache cache.Cache = noCache{}

// Compression is the per-block compression algorithm to use.
type Compression uint

func (c Compression) String() string {
	switch c {
	case DefaultCompression:
		return "default"
	case NoCompression:
		return "none"
	case SnappyCompression:
		return "snappy"
	}
	return "invalid"
}

const (
	DefaultCompression Compression = iota
	NoCompression
	SnappyCompression
	nCompression
)

// Strict is the DB strict level.
type Strict uint

const (
	// If present then a corrupted or invalid chunk or block in manifest
	// journal will cause an error istead of being dropped.
	StrictManifest Strict = 1 << iota

	// If present then a corrupted or invalid chunk or block in journal
	// will cause an error istead of being dropped.
	StrictJournal

	// If present then journal chunk checksum will be verified.
	StrictJournalChecksum

	// If present then an invalid key/value pair will cause an error
	// instead of being skipped.
	StrictIterator

	// If present then 'sorted table' block checksum will be verified.
	StrictBlockChecksum

	// StrictAll enables all strict flags.
	StrictAll = StrictManifest | StrictJournal | StrictJournalChecksum | StrictIterator | StrictBlockChecksum

	// DefaultStrict is the default strict flags. Specify any strict flags
	// will override default strict flags as whole (i.e. not OR'ed).
	DefaultStrict = StrictJournalChecksum | StrictBlockChecksum

	// NoStrict disables all strict flags. Override default strict flags.
	NoStrict = ^StrictAll
)

// Options holds the optional parameters for the DB at large.
type Options struct {
	// AltFilters defines one or more 'alternative filters'.
	// 'alternative filters' will be used during reads if a filter block
	// does not match with the 'effective filter'.
	//
	// The default value is nil
	AltFilters []filter.Filter

	// BlockCache provides per-block caching for LevelDB. Specify NoCache to
	// disable block caching.
	//
	// By default LevelDB will create LRU-cache with capacity of 8MiB.
	BlockCache cache.Cache

	// BlockRestartInterval is the number of keys between restart points for
	// delta encoding of keys.
	//
	// The default value is 16.
	BlockRestartInterval int

	// BlockSize is the minimum uncompressed size in bytes of each 'sorted table'
	// block.
	//
	// The default value is 4KiB.
	BlockSize int

	// Comparer defines a total ordering over the space of []byte keys: a 'less
	// than' relationship. The same comparison algorithm must be used for reads
	// and writes over the lifetime of the DB.
	//
	// The default value uses the same ordering as bytes.Compare.
	Comparer comparer.Comparer

	// Compression defines the per-block compression to use.
	//
	// The default value (DefaultCompression) uses snappy compression.
	Compression Compression

	// ErrorIfExist defines whether an error should returned if the DB already
	// exist.
	//
	// The default value is false.
	ErrorIfExist bool

	// ErrorIfMissing defines whether an error should returned if the DB is
	// missing. If false then the database will be created if missing, otherwise
	// an error will be returned.
	//
	// The default value is false.
	ErrorIfMissing bool

	// Filter defines an 'effective filter' to use. An 'effective filter'
	// if defined will be used to generate per-table filter block.
	// The filter name will be stored on disk.
	// During reads LevelDB will try to find matching filter from
	// 'effective filter' and 'alternative filters'.
	//
	// Filter can be changed after a DB has been created. It is recommended
	// to put old filter to the 'alternative filters' to mitigate lack of
	// filter during transition period.
	//
	// A filter is used to reduce disk reads when looking for a specific key.
	//
	// The default value is nil.
	Filter filter.Filter

	// MaxOpenFiles defines maximum number of open files to kept around
	// (cached). This is not an hard limit, actual open files may exceed
	// the defined value.
	//
	// The default value is 1000.
	MaxOpenFiles int

	// Strict defines the DB strict level.
	Strict Strict

	// WriteBuffer defines maximum size of a 'memdb' before flushed to
	// 'sorted table'. 'memdb' is an in-memory DB backed by an on-disk
	// unsorted journal.
	//
	// LevelDB may held up to two 'memdb' at the same time.
	//
	// The default value is 4MiB.
	WriteBuffer int
}

func (o *Options) GetAltFilters() []filter.Filter {
	if o == nil {
		return nil
	}
	return o.AltFilters
}

func (o *Options) GetBlockCache() cache.Cache {
	if o == nil {
		return nil
	}
	return o.BlockCache
}

func (o *Options) GetBlockRestartInterval() int {
	if o == nil || o.BlockRestartInterval <= 0 {
		return DefaultBlockRestartInterval
	}
	return o.BlockRestartInterval
}

func (o *Options) GetBlockSize() int {
	if o == nil || o.BlockSize <= 0 {
		return DefaultBlockSize
	}
	return o.BlockSize
}

func (o *Options) GetComparer() comparer.Comparer {
	if o == nil || o.Comparer == nil {
		return comparer.DefaultComparer
	}
	return o.Comparer
}

func (o *Options) GetCompression() Compression {
	if o == nil || o.Compression <= DefaultCompression || o.Compression >= nCompression {
		return DefaultCompressionType
	}
	return o.Compression
}

func (o *Options) GetErrorIfExist() bool {
	if o == nil {
		return false
	}
	return o.ErrorIfExist
}

func (o *Options) GetErrorIfMissing() bool {
	if o == nil {
		return false
	}
	return o.ErrorIfMissing
}

func (o *Options) GetFilter() filter.Filter {
	if o == nil {
		return nil
	}
	return o.Filter
}

func (o *Options) GetMaxOpenFiles() int {
	if o == nil || o.MaxOpenFiles <= 0 {
		return DefaultMaxOpenFiles
	}
	return o.MaxOpenFiles
}

func (o *Options) GetStrict(strict Strict) bool {
	if o == nil || o.Strict == 0 {
		return DefaultStrict&strict != 0
	}
	return o.Strict&strict != 0
}

func (o *Options) GetWriteBuffer() int {
	if o == nil || o.WriteBuffer <= 0 {
		return DefaultWriteBuffer
	}
	return o.WriteBuffer
}

// ReadOptions holds the optional parameters for 'read operation'. The
// 'read operation' includes Get, Find and NewIterator.
type ReadOptions struct {
	// DontFillCache defines whether block reads for this 'read operation'
	// should be cached. If false then the block will be cached. This does
	// not affects already cached block.
	//
	// The default value is false.
	DontFillCache bool

	// Strict overrides global DB strict level. Only StrictIterator and
	// StrictBlockChecksum that does have effects here.
	Strict Strict
}

func (ro *ReadOptions) GetDontFillCache() bool {
	if ro == nil {
		return false
	}
	return ro.DontFillCache
}

func (ro *ReadOptions) GetStrict(strict Strict) bool {
	if ro == nil {
		return false
	}
	return ro.Strict&strict != 0
}

// WriteOptions holds the optional parameters for 'write operation'. The
// 'write operation' includes Write, Put and Delete.
type WriteOptions struct {
	// Sync is whether to sync underlying writes from the OS buffer cache
	// through to actual disk, if applicable. Setting Sync can result in
	// slower writes.
	//
	// If false, and the machine crashes, then some recent writes may be lost.
	// Note that if it is just the process that crashes (and the machine does
	// not) then no writes will be lost.
	//
	// In other words, Sync being false has the same semantics as a write
	// system call. Sync being true means write followed by fsync.
	//
	// The default value is false.
	Sync bool
}

func (wo *WriteOptions) GetSync() bool {
	if wo == nil {
		return false
	}
	return wo.Sync
}


text:
<!DOCTYPE html>

<meta charset="utf-8">
<link rel="stylesheet" href="../doc/doc_brython.css">

<link rel="stylesheet" href="console.css">

Brython version:

Test:
<select name="filename" id="files">
</select>
<button id="test_all">Run all tests</button>

    <button id="run">run</button>
    debug<input type="checkbox" id="set_debug" checked>
    loop timeout<input type="checkbox" id="set_loop_timeout" autocomplete="off">

    <button id="show_console">Show console</button>
    <button id="show_js">Show Javascript</button>

<textarea id="console" autocomplete="off"></textarea>

    <form>
     <fieldset>
      Timeout (sec.)
      <input type="text" name="timeout" id="timeout" value="20" class="text ui-widget-content ui-corner-all">
     </fieldset>
    </form>


text:
require 'mime/types'

module API
  # Project commit statuses API
  class CommitStatuses < Grape::API
    resource :projects do
      before { authenticate! }

      # Get a commit's statuses
      #
      # Parameters:
      #   id (required) - The ID of a project
      #   sha (required) - The commit hash
      #   ref (optional) - The ref
      #   stage (optional) - The stage
      #   name (optional) - The name
      #   all (optional) - Show all statuses, default: false
      # Examples:
      #   GET /projects/:id/repository/commits/:sha/statuses
      get ':id/repository/commits/:sha/statuses' do
        authorize!(:read_commit_status, user_project)

        not_found!('Commit') unless user_project.commit(params[:sha])

        pipelines = user_project.pipelines.where(sha: params[:sha])
        statuses = ::CommitStatus.where(pipeline: pipelines)
        statuses = statuses.latest unless to_boolean(params[:all])
        statuses = statuses.where(ref: params[:ref]) if params[:ref].present?
        statuses = statuses.where(stage: params[:stage]) if params[:stage].present?
        statuses = statuses.where(name: params[:name]) if params[:name].present?
        present paginate(statuses), with: Entities::CommitStatus
      end

      # Post status to commit
      #
      # Parameters:
      #   id (required) - The ID of a project
      #   sha (required) - The commit hash
      #   ref (optional) - The ref
      #   state (required) - The state of the status. Can be: pending, running, success, failed or canceled
      #   target_url (optional) - The target URL to associate with this status
      #   description (optional) - A short description of the status
      #   name or context (optional) - A string label to differentiate this status from the status of other systems. Default: "default"
      # Examples:
      #   POST /projects/:id/statuses/:sha
      post ':id/statuses/:sha' do
        authorize! :create_commit_status, user_project
        required_attributes! [:state]
        attrs = attributes_for_keys [:target_url, :description]
        commit = @project.commit(params[:sha])
        not_found! 'Commit' unless commit

        # Since the CommitStatus is attached to Ci::Pipeline (in the future Pipeline)
        # We need to always have the pipeline object
        # To have a valid pipeline object that can be attached to specific MR
        # Other CI service needs to send `ref`
        # If we don't receive it, we will attach the CommitStatus to
        # the first found branch on that commit

        ref = params[:ref]
        ref ||= @project.repository.branch_names_contains(commit.sha).first
        not_found! 'References for commit' unless ref

        name = params[:name] || params[:context] || 'default'

        pipeline = @project.ensure_pipeline(ref, commit.sha, current_user)

        status = GenericCommitStatus.running_or_pending.find_or_initialize_by(
          project: @project, pipeline: pipeline,
          user: current_user, name: name, ref: ref)
        status.attributes = attrs

        begin
          case params[:state].to_s
          when 'pending'
            status.enqueue!
          when 'running'
            status.enqueue
            status.run!
          when 'success'
            status.success!
          when 'failed'
            status.drop!
          when 'canceled'
            status.cancel!
          else
            render_api_error!('invalid state', 400)
          end

          present status, with: Entities::CommitStatus
        rescue StateMachines::InvalidTransition => e
          render_api_error!(e.message, 400)
        end
      end
    end
  end
end


text:
namespace gpu {

class CommandBuffer;

}  // namespace gpu

class CommandBufferProxy;
class GpuChannelHost;
class PepperParentContextProvider;
class ContentGLContext;

class PlatformContext3DImpl
    : public webkit::ppapi::PluginDelegate::PlatformContext3D {
 public:
  explicit PlatformContext3DImpl(
      PepperParentContextProvider* parent_context_provider);
  virtual ~PlatformContext3DImpl();

  virtual bool Init(const int32* attrib_list) OVERRIDE;
  virtual unsigned GetBackingTextureId() OVERRIDE;
  virtual bool IsOpaque() OVERRIDE;
  virtual gpu::CommandBuffer* GetCommandBuffer() OVERRIDE;
  virtual int GetCommandBufferRouteId() OVERRIDE;
  virtual void SetContextLostCallback(const base::Closure& callback) OVERRIDE;
  virtual void SetOnConsoleMessageCallback(
      const ConsoleMessageCallback& callback) OVERRIDE;
  virtual bool Echo(const base::Closure& task) OVERRIDE;

 private:
  bool InitRaw();
  void OnContextLost();
  void OnConsoleMessage(const std::string& msg, int id);

  // Implicitly weak pointer; must outlive this instance.
  PepperParentContextProvider* parent_context_provider_;
  base::WeakPtr<ContentGLContext> parent_context_;
  scoped_refptr<GpuChannelHost> channel_;
  unsigned int parent_texture_id_;
  bool has_alpha_;
  CommandBufferProxy* command_buffer_;
  base::Closure context_lost_callback_;
  ConsoleMessageCallback console_message_callback_;
  base::WeakPtrFactory<PlatformContext3DImpl> weak_ptr_factory_;
};

#endif  // ENABLE_GPU

#endif  // CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_CONTEXT_3D_IMPL_H_


text:
[![npm version](https://img.shields.io/npm/v/chico.svg)](https://www.npmjs.com/package/chico)
![Bower version](https://img.shields.io/bower/v/chico.svg)
[![Build Status](https://travis-ci.org/mercadolibre/chico.svg?branch=master)](https://travis-ci.org/mercadolibre/chico)
[![devDependency Status](https://img.shields.io/david/dev/mercadolibre/chico.svg)](https://david-dm.org/mercadolibre/chico#info=devDependencies)

> Chico UI is a free and open source collection of easy-to-use UI components for designers and developers.

## Installing

Using npm:

```bash
$ npm install chico
```

Using bower:

```bash
$ bower install chico
```

## Development setup

1. Make sure you have [Git](http://git-scm.com/) and [NodeJS](http://nodejs.org/)
   up and running.

2. Open your terminal and clone `mercadolibre/chico` by running:

        $ git clone git@github.com:mercadolibre/chico.git

3. Now go to the project's folder:

        $ cd chico

4. Install its dependencies:

        $ npm install

5. Install `gulp`:

        $ npm install gulp -g

6. Install `BrowserSync`:

        $ npm install browser-sync -g

7. Run dev task

        $ gulp dev

    [http://localhost:3040](http://localhost:3040/) will open in a default browser. Mobile version is located at [http://localhost:3040/mobile](http://localhost:3040/mobile).

8. Develop! :)

**NOTE**

Please read through our code style guides:
- [HTML](https://github.com/mercadolibre/html-style-guide)
- [CSS](https://github.com/mercadolibre/css-style-guide)
- [SASS] (https://github.com/mercadolibre/ui-sass_style_guide)
- [JavaScript](https://github.com/mercadolibre/javascript-style-guide)

## How to use Chico Themes

This is the structure and a small file reference guide:

### Base folder (chico/src)

In the "src" folder you'll find all Sass files. From here you can may make changes that affect the UI project in a fast and organized way.

```
src/
|
|– mobile/ # Properties only for Mobile
|   |
|   |– styles/ # Components list
|       |– _autocomplete.scss  # Autocomplete rules
|       |– _base.scss          # Base rules
|       |– _boxes.scss         # Boxes rules
|       `– mobile-theme.scss   # Imports the components to show
|       ...                    # Etc…
|
|– shared/ # Properties shared in Mobile and UI
|   |
|   |– styles/ # Components list
|       |– _autocomplete.scss  # Autocomplete rules
|       |– _base.scss          # Base rules
|       |– _boxes.scsss        # Boxes rules
|       ...                    # Etc…
|       |
|       `– _variables.scss  # Shared theme and structure variables
|
`– ui/ # Properties only for Desktop Browsers
    |
    `– styles/ # Components list
        |– _autocomplete.scss  # Autocomplete rules
        |– _badges.scss        # Badges rules
        |– _base.scss          # Base rules
        |– ui-theme.scss       # Imports the components to show
        ...                    # Etc…
```

### Styles folder (inside mobile, shared or ui)

This folder have a list of each individual component, within each are there unique properties.

Note:

mobile-theme.scss and ui-theme.scss these files are used to choose which components we have available at the final css. You can also edit the file and choose which components you want to render.

### Reset.scss

This file is very important because it handles all the basic css definitions, such as font-family, color, etc...

### Components structure

Example:

```
            _autocomplete.scss
            `– _autocomplete-variables.scss  # Local component's only variables
```

In the example, the first Sass file (_autocomplete.scss) imports the Sass file from the same folder (_autocomplete-variables.scss ) and includes the extra custom properties of the component.

### How to create a new theme

  * Install `Chico UI` via bower using `npm install chico@2.x.x`
  * Create a theme folder and put a theme file into. E.g. `mkdir mytheme && touch mytheme/mytheme-ui.scss`
  * Edit the `mytheme/mytheme-ui.scss` and put into a minimal required content

```
@import '../node_modules/chico/src/shared/styles/mixins';
@import '../node_modules/chico/src/shared/styles/variables';
```

  * Import all required components

```
...
@import '../node_modules/chico/src/shared/styles/icons';
...
```

  * Compile a theme. The fastest way is using a `sass` command line tool

```sass mytheme/mytheme-ui.scss mytheme/mytheme-ui.css```

Strictly recommended to use some task runner such `grunt` or `gulp`. Typical gulp task may look like

```js
gulp.task('sass:ui', function () {
    return gulp.src('mytheme/mytheme-ui.scss')
        .pipe($.sass())
        .pipe(gulp.dest('mytheme/'));
});
```
  * If you are not interested in components personalization and just want to override default theme's variables
    typical theme file may look like this

```
// File that contain all overrides
@import 'settings';
// Default theme with all components
@import '../node_modules/chico/src/ui/styles/ui-theme';
```

**Note**: Variables reference is pending

## Tests
You can run all tests in a terminal with a PhantomJS headless browser:

    $ npm test

Tests are executing using the karma test runner so feel free to run them in your favorite browser. There is the example
  for Google Chrome:

    ./node_modules/.bin/karma start --browsers Chrome


text:
import { clickTarget, startTimeline } from "jspsych/tests/utils";

import htmlSliderResponse from ".";

jest.useFakeTimers();

describe("html-slider-response", () => {
  test("displays html stimulus", async () => {
    const { getHTML } = await startTimeline([
      {
        type: htmlSliderResponse,
        stimulus: "this is html",
        labels: ["left", "right"],
        button_label: "button",
      },
    ]);

    expect(getHTML()).toContain(
      '
this is html
'
    );
  });

  test("displays labels", async () => {
    const { getHTML } = await startTimeline([
      {
        type: htmlSliderResponse,
        stimulus: "this is html",
        labels: ["left", "right"],
        button_label: "button",
      },
    ]);

    expect(getHTML()).toContain('left');
    expect(getHTML()).toContain('right');
  });

  test("displays button label", async () => {
    const { getHTML } = await startTimeline([
      {
        type: htmlSliderResponse,
        stimulus: "this is html",
        labels: ["left", "right"],
        button_label: "button",
      },
    ]);

    expect(getHTML()).toContain(
      '<button id="jspsych-html-slider-response-next" class="jspsych-btn">button</button>'
    );
  });

  test("should set min, max and step", async () => {
    const { displayElement } = await startTimeline([
      {
        type: htmlSliderResponse,
        stimulus: "this is html",
        labels: ["left", "right"],
        min: 2,
        max: 10,
        step: 2,
        button_label: "button",
      },
    ]);

    const responseElement = displayElement.querySelector<HTMLInputElement>(
      "#jspsych-html-slider-response-response"
    );
    expect(responseElement.min).toBe("2");
    expect(responseElement.max).toBe("10");
    expect(responseElement.step).toBe("2");
  });

  test("should append to bottom on stimulus", async () => {
    const { getHTML } = await startTimeline([
      {
        type: htmlSliderResponse,
        stimulus: "this is html",
        labels: ["left", "right"],
        button_label: "button",
        prompt: "
This is a prompt
",
      },
    ]);

    expect(getHTML()).toContain("
This is a prompt
");
  });

  test("should hide stimulus if stimulus_duration is set", async () => {
    const { displayElement } = await startTimeline([
      {
        type: htmlSliderResponse,
        stimulus: "this is html",
        labels: ["left", "right"],
        button_label: "button",
        stimulus_duration: 500,
      },
    ]);

    const stimulusElement = displayElement.querySelector<HTMLElement>(
      "#jspsych-html-slider-response-stimulus"
    );

    expect(stimulusElement.style.visibility).toBe("");
    jest.advanceTimersByTime(500);
    expect(stimulusElement.style.visibility).toBe("hidden");
  });

  test("should end trial when trial duration is reached", async () => {
    const { getHTML, expectFinished } = await startTimeline([
      {
        type: htmlSliderResponse,
        stimulus: "this is html",
        labels: ["left", "right"],
        button_label: "button",
        trial_duration: 500,
      },
    ]);

    expect(getHTML()).toContain(
      '
this is html
'
    );
    jest.advanceTimersByTime(500);
    await expectFinished();
  });

  test("should end trial when button is clicked", async () => {
    const { getHTML, expectFinished } = await startTimeline([
      {
        type: htmlSliderResponse,
        stimulus: "this is html",
        labels: ["left", "right"],
        button_label: "button",
        response_ends_trial: true,
      },
    ]);

    expect(getHTML()).toContain(
      '
this is html
'
    );

    clickTarget(document.querySelector("#jspsych-html-slider-response-next"));

    await expectFinished();
  });
});


text:
{-# LANGUAGE OverloadedStrings, DeriveDataTypeable #-}
module SimpleServer
( module Wai.Routes
, module Control.Monad.IO.Class
, simpleServer
)
where

import Control.Monad (when)
import Control.Monad.IO.Class (liftIO)

import Config.Dyre
import Config.Dyre.Paths
import System.Console.CmdArgs
import Network.Wai.Handler.Warp
import Network.Wai.Application.Static (staticApp, defaultFileServerSettings)
import Wai.Routes

---------------------
-- WAI Application --
---------------------

runHandlers :: Handlers -> IO ()
runHandlers handlers = do
  settings <- cmdArgs simpleServerCmdArgs
  if paths settings
    then do
      (_,_,p,_,_) <- getPaths simpleServerDyreParams
      putStrLn p
    else do
      v <- getVerbosity
      let p = port settings
      logVerbose v $ "SimpleServer running on port " ++ show p
      run p $ waiApp $ application settings v handlers

application :: SimpleServerConfig -> Verbosity -> Handlers -> RouteM ()
application settings v handlers = do
  when (v == Loud) $ middleware logStdoutDev
  handlers
  catchall $ staticApp $ defaultFileServerSettings $ static settings

logVerbose :: Verbosity -> String -> IO ()
logVerbose Quiet _ = return ()
logVerbose _ s = putStrLn s

----------------------------
-- Command line arguments --
----------------------------

data SimpleServerConfig = SimpleServerConfig
  { port :: Int
  , static :: String
  , paths :: Bool
  }
  deriving (Data, Typeable)

simpleServerCmdArgs :: SimpleServerConfig
simpleServerCmdArgs = SimpleServerConfig
    { port = 8000
        &= help "Port on which the server runs (default 8000)"
        &= opt (8000::Int)
        &= name "p"
    , static = "."
        &= help "Folder with the static files (default (\".\"))"
        &= opt ("."::String)
    , paths = False
        &= help "Print the expected path to the simpleserver config"
    }
    &= verbosity
    &= program "simpleserver"
    &= summary "SimpleServer v0.1.1.2"

-----------------
-- Dyre Config --
-----------------

type Handlers = RouteM ()

-- TODO: This only prints errors on incoming requests
confError :: Handlers -> String -> Handlers
confError _ err = handler $ runHandlerM $ liftIO $ putStrLn $ "Error:" ++ err

simpleServer :: Handlers -> IO ()
simpleServer = wrapMain simpleServerDyreParams

simpleServerDyreParams :: Params Handlers
simpleServerDyreParams = defaultParams
    { projectName  = "simpleServer"
    , showError    = confError
    , realMain     = runHandlers
    }


text:
$card = Balanced\Marketplace::mine()->cards->create(array(
{% for k, v in request.payload %}
    "{{ k }}" => "{{ v }}",
{% endfor %}
));