text:
exports.info = { FormatID: '670',
  FormatName: 'Raw JPEG Stream',
  FormatVersion: '',
  FormatAliases: 'JPEG',
  FormatFamilies: '',
  FormatTypes: 'Image (Raster)',
  FormatDisclosure: '',
  FormatDescription: 'This is an outline record only, and requires further details, research or authentication to provide information that will enable users to further understand the format and to assess digital preservation risks associated with it if appropriate. If you are able to help by supplying any additional information concerning this entry, please return to the main PRONOM page and select 'Add an Entry'.',
  BinaryFileFormat: 'Binary',
  ByteOrders: 'Big-endian (Motorola)',
  ReleaseDate: '',
  WithdrawnDate: '',
  ProvenanceSourceID: '1',
  ProvenanceName: 'Digital Preservation Department / The National Archives',
  ProvenanceSourceDate: '11 Mar 2005',
  ProvenanceDescription: '',
  LastUpdatedDate: '02 Aug 2005',
  FormatNote: '',
  FormatRisk: '',
  TechnicalEnvironment: '',
  FileFormatIdentifier:
   [ { Identifier: 'fmt/41', IdentifierType: 'PUID' },
     { Identifier: 'image/jpeg', IdentifierType: 'MIME' } ],
  ExternalSignature:
   [ { ExternalSignatureID: '554',
       Signature: 'jpe',
       SignatureType: 'File extension' },
     { ExternalSignatureID: '578',
       Signature: 'jpg',
       SignatureType: 'File extension' },
     { ExternalSignatureID: '652',
       Signature: 'jpeg',
       SignatureType: 'File extension' } ],
  InternalSignature:
   [ { SignatureID: '69',
       SignatureName: 'Raw JPEG',
       SignatureNote: 'SOI marker at BOF, EOI marker at EOF',
       ByteSequence:
        [ { ByteSequenceID: '174',
            PositionType: 'Absolute from BOF',
            Offset: '0',
            MaxOffset: '',
            IndirectOffsetLocation: '',
            IndirectOffsetLength: '',
            Endianness: '',
            ByteSequenceValue: 'FFD8FF' },
          { ByteSequenceID: '175',
            PositionType: 'Absolute from EOF',
            Offset: '0',
            MaxOffset: '16000',
            IndirectOffsetLocation: '',
            IndirectOffsetLength: '',
            Endianness: '',
            ByteSequenceValue: 'FFD9' } ] },
     { SignatureID: '697',
       SignatureName: 'Photoshop JPEG',
       SignatureNote: 'BOF: SOI marker (FF|D8), APP14 - Photoshop Segment Marker (FF|ED), segment size {2}, Photoshop identification string, in ASCII: Photoshop 3.0. EOF: EOI marker (FF|D9) with a large offset due to the amount of photoshop metadata seen after the end of image marker in sample files.',
       ByteSequence:
        [ { ByteSequenceID: '868',
            PositionType: 'Absolute from BOF',
            Offset: '0',
            MaxOffset: '',
            IndirectOffsetLocation: '',
            IndirectOffsetLength: '',
            Endianness: '',
            ByteSequenceValue: 'FFD8FFED{2}50686F746F73686F7020332E30003842494D' },
          { ByteSequenceID: '869',
            PositionType: 'Absolute from EOF',
            Offset: '',
            MaxOffset: '16000',
            IndirectOffsetLocation: '',
            IndirectOffsetLength: '',
            Endianness: '',
            ByteSequenceValue: 'FFD9' } ] } ],
  RelatedFormat:
   [ { RelationshipType: 'Has lower priority than',
       RelatedFormatID: '667',
       RelatedFormatName: 'JPEG File Interchange Format',
       RelatedFormatVersion: '1.00' },
     { RelationshipType: 'Has lower priority than',
       RelatedFormatID: '668',
       RelatedFormatName: 'JPEG File Interchange Format',
       RelatedFormatVersion: '1.01' },
     { RelationshipType: 'Has lower priority than',
       RelatedFormatID: '669',
       RelatedFormatName: 'JPEG File Interchange Format',
       RelatedFormatVersion: '1.02' },
     { RelationshipType: 'Has lower priority than',
       RelatedFormatID: '671',
       RelatedFormatName: 'Still Picture Interchange File Format',
       RelatedFormatVersion: '1.0' },
     { RelationshipType: 'Has lower priority than',
       RelatedFormatID: '675',
       RelatedFormatName: 'Exchangeable Image File Format (Compressed)',
       RelatedFormatVersion: '2.1' },
     { RelationshipType: 'Has lower priority than',
       RelatedFormatID: '676',
       RelatedFormatName: 'Exchangeable Image File Format (Compressed)',
       RelatedFormatVersion: '2.2' },
     { RelationshipType: 'Has lower priority than',
       RelatedFormatID: '751',
       RelatedFormatName: 'Exchangeable Image File Format (Compressed)',
       RelatedFormatVersion: '2.0' } ],
  FormatProperties:
   { FormatProperty:
      [ { PropertyName: 'Compression Type',
          PropertyDescription: '',
          PropertyType: 'Instance',
          PropertyRiskScore: '',
          PropertyHighRisk: '',
          PropertyValueDescription: '',
          PropertyRisks: '' },
        { PropertyName: 'Compression Level',
          PropertyDescription: '',
          PropertyType: 'Instance',
          PropertyRiskScore: '',
          PropertyHighRisk: '',
          PropertyValueDescription: '',
          PropertyRisks: '' },
        { PropertyName: 'Image Width',
          PropertyDescription: '',
          PropertyType: 'Instance',
          PropertyRiskScore: '',
          PropertyHighRisk: '',
          PropertyValueDescription: '',
          PropertyRisks: '' },
        { PropertyName: 'Image Height',
          PropertyDescription: '',
          PropertyType: 'Instance',
          PropertyRiskScore: '',
          PropertyHighRisk: '',
          PropertyValueDescription: '',
          PropertyRisks: '' },
        { PropertyName: 'Colour Space',
          PropertyDescription: '',
          PropertyType: 'Instance',
          PropertyRiskScore: '',
          PropertyHighRisk: '',
          PropertyValueDescription: '',
          PropertyRisks: '' },
        { PropertyName: 'Sampling Frequency Unit',
          PropertyDescription: '',
          PropertyType: 'Instance',
          PropertyRiskScore: '',
          PropertyHighRisk: '',
          PropertyValueDescription: '',
          PropertyRisks: '' },
        { PropertyName: 'X Sampling Frequency',
          PropertyDescription: '',
          PropertyType: 'Instance',
          PropertyRiskScore: '',
          PropertyHighRisk: '',
          PropertyValueDescription: '',
          PropertyRisks: '' },
        { PropertyName: 'Y Sampling Frequency',
          PropertyDescription: '',
          PropertyType: 'Instance',
          PropertyRiskScore: '',
          PropertyHighRisk: '',
          PropertyValueDescription: '',
          PropertyRisks: '' },
        { PropertyName: 'Bits Per Sample',
          PropertyDescription: '',
          PropertyType: 'Instance',
          PropertyRiskScore: '',
          PropertyHighRisk: '',
          PropertyValueDescription: '',
          PropertyRisks: '' },
        { PropertyName: 'Samples Per Pixel',
          PropertyDescription: '',
          PropertyType: 'Instance',
          PropertyRiskScore: '',
          PropertyHighRisk: '',
          PropertyValueDescription: '',
          PropertyRisks: '' },
        { PropertyName: 'Byte Order',
          PropertyDescription: '',
          PropertyType: 'Instance',
          PropertyRiskScore: '',
          PropertyHighRisk: '',
          PropertyValueDescription: '',
          PropertyRisks: '' },
        { PropertyName: 'Comments',
          PropertyDescription: '',
          PropertyType: 'Instance',
          PropertyRiskScore: '',
          PropertyHighRisk: '',
          PropertyValueDescription: '',
          PropertyRisks: '' } ] } }


text:
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.

/*=============================================================================
	UniformBuffer.h: Uniform buffer declarations.
=============================================================================*/

#pragma once

#include "RenderCore.h"
#include "RenderResource.h"
#include "RHI.h"

namespace EShaderPrecisionModifier
{
	enum Type
	{
		Float,
		Half,
		Fixed
	};
};

/** A uniform buffer resource. */
template<typename TBufferStruct>
class TUniformBuffer : public FRenderResource
{
public:

	TUniformBuffer()
		: BufferUsage(UniformBuffer_MultiFrame)
	{
		Contents = (uint8*)FMemory::Malloc(sizeof(TBufferStruct),UNIFORM_BUFFER_STRUCT_ALIGNMENT);
	}

	~TUniformBuffer()
	{
		FMemory::Free(Contents);
	}

	/** Sets the contents of the uniform buffer. */
	void SetContents(const TBufferStruct& NewContents)
	{
		check(IsInRenderingThread());
		FMemory::Memcpy(Contents,&NewContents,sizeof(TBufferStruct));
		UpdateRHI();
	}

	// FRenderResource interface.
	virtual void InitDynamicRHI() override
	{
		check(IsInRenderingThread());
		UniformBufferRHI = RHICreateUniformBuffer(Contents,TBufferStruct::StaticStruct.GetLayout(),BufferUsage);
	}
	virtual void ReleaseDynamicRHI() override
	{
		UniformBufferRHI.SafeRelease();
	}

	// Accessors.
	FUniformBufferRHIParamRef GetUniformBufferRHI() const { return UniformBufferRHI; }

	EUniformBufferUsage BufferUsage;
private:

	FUniformBufferRHIRef UniformBufferRHI;
	uint8* Contents;
};

/** A reference to a uniform buffer RHI resource with a specific structure. */
template<typename TBufferStruct>
class TUniformBufferRef : public FUniformBufferRHIRef
{
public:

	/** Initializes the reference to null. */
	TUniformBufferRef()
	{}

	/** Initializes the reference to point to a buffer. */
	TUniformBufferRef(const TUniformBuffer<TBufferStruct>& InBuffer)
	: FUniformBufferRHIRef(InBuffer.GetUniformBufferRHI())
	{}

	/** Creates a uniform buffer with the given value, and returns a structured reference to it. */
	static TUniformBufferRef<TBufferStruct> CreateUniformBufferImmediate(const TBufferStruct& Value, EUniformBufferUsage Usage)
	{
		check(IsInRenderingThread() || IsInRHIThread());
		return TUniformBufferRef<TBufferStruct>(RHICreateUniformBuffer(&Value,TBufferStruct::StaticStruct.GetLayout(),Usage));
	}
	/** Creates a uniform buffer with the given value, and returns a structured reference to it. */
	static FLocalUniformBuffer CreateLocalUniformBuffer(FRHICommandList& RHICmdList, const TBufferStruct& Value, EUniformBufferUsage Usage)
	{
		return RHICmdList.BuildLocalUniformBuffer(&Value, sizeof(TBufferStruct), TBufferStruct::StaticStruct.GetLayout());
	}

private:

	/** A private constructor used to coerce an arbitrary RHI uniform buffer reference to a structured reference. */
	TUniformBufferRef(FUniformBufferRHIParamRef InRHIRef)
	: FUniformBufferRHIRef(InRHIRef)
	{}
};

ENQUEUE_UNIQUE_RENDER_COMMAND_TWOPARAMETER_DECLARE_TEMPLATE(
	SetUniformBufferContents,TBufferStruct,
	TUniformBuffer<TBufferStruct>*,UniformBuffer,&UniformBuffer,
	TBufferStruct,Struct,Struct,
	{
		UniformBuffer->SetContents(Struct);
	});

/** Sends a message to the rendering thread to set the contents of a uniform buffer.  Called by the game thread. */
template<typename TBufferStruct>
void BeginSetUniformBufferContents(
	TUniformBuffer<TBufferStruct>& UniformBuffer,
	const TBufferStruct& Struct
	)
{
	ENQUEUE_UNIQUE_RENDER_COMMAND_TWOPARAMETER_CREATE_TEMPLATE(
		SetUniformBufferContents,TBufferStruct,
		TUniformBuffer<TBufferStruct>*,&UniformBuffer,
		TBufferStruct,Struct);
}

/** Each entry in a resource table is provided to the shader compiler for creating mappings. */
struct FResourceTableEntry
{
	/** The name of the uniform buffer in which this resource exists. */
	FString UniformBufferName;
	/** The type of the resource (EUniformBufferBaseType). */
	uint16 Type;
	/** The index of the resource in the table. */
	uint16 ResourceIndex;
};

/** A uniform buffer struct. */
class RENDERCORE_API FUniformBufferStruct
{
public:

	/** A member of a uniform buffer type. */
	class FMember
	{
	public:

		/** Initialization constructor. */
		FMember(
			const TCHAR* InName,
			const TCHAR* InShaderType,
			uint32 InOffset,
			EUniformBufferBaseType InBaseType,
			EShaderPrecisionModifier::Type InPrecision,
			uint32 InNumRows,
			uint32 InNumColumns,
			uint32 InNumElements,
			const FUniformBufferStruct* InStruct
			)
		:	Name(InName)
		,	ShaderType(InShaderType)
		,	Offset(InOffset)
		,	BaseType(InBaseType)
		,	Precision(InPrecision)
		,	NumRows(InNumRows)
		,	NumColumns(InNumColumns)
		,	NumElements(InNumElements)
		,	Struct(InStruct)
		{}

		const TCHAR* GetName() const { return Name; }
		const TCHAR* GetShaderType() const { return ShaderType; }
		uint32 GetOffset() const { return Offset; }
		EUniformBufferBaseType GetBaseType() const { return BaseType; }
		EShaderPrecisionModifier::Type GetPrecision() const { return Precision; }
		uint32 GetNumRows() const { return NumRows; }
		uint32 GetNumColumns() const { return NumColumns; }
		uint32 GetNumElements() const { return NumElements; }
		const FUniformBufferStruct* GetStruct() const { return Struct; }

	private:

		const TCHAR* Name;
		const TCHAR* ShaderType;
		uint32 Offset;
		EUniformBufferBaseType BaseType;
		EShaderPrecisionModifier::Type Precision;
		uint32 NumRows;
		uint32 NumColumns;
		uint32 NumElements;
		const FUniformBufferStruct* Struct;
	};

	typedef class FShaderUniformBufferParameter* (*ConstructUniformBufferParameterType)();

	/** Initialization constructor. */
	FUniformBufferStruct(const TCHAR* InStructTypeName, const TCHAR* InShaderVariableName, ConstructUniformBufferParameterType InConstructRef, uint32 InSize, const TArray<FMember>& InMembers, bool bRegisterForAutoBinding)
	:	StructTypeName(InStructTypeName)
	,	ShaderVariableName(InShaderVariableName)
	,	ConstructUniformBufferParameterRef(InConstructRef)
	,	Size(InSize)
	,	Members(InMembers)
	,	GlobalListLink(this)
	{
		bool bHasDeclaredResources = false;
		Layout.ConstantBufferSize = InSize;
		Layout.ResourceOffset = 0;
		for (int32 i = 0; i < Members.Num(); ++i)
		{
			bool bIsResource = IsUniformBufferResourceType(Members[i].GetBaseType());
			checkf(!bHasDeclaredResources || bIsResource, TEXT("Constructing invalid uniform buffer struct: member '%s' is not a resource but has been declared after a resource member."), Members[i].GetName());
			if (bIsResource)
			{
				if (!bHasDeclaredResources)
				{
					Layout.ConstantBufferSize = (i == 0) ? 0 : Align(Members[i].GetOffset(),UNIFORM_BUFFER_STRUCT_ALIGNMENT);
					Layout.ResourceOffset = Members[i].GetOffset();
				}
				Layout.Resources.Add(Members[i].GetBaseType());
			}
			bHasDeclaredResources |= bIsResource;
		}

		if (bRegisterForAutoBinding)
		{
			GlobalListLink.Link(GetStructList());
			FName StrutTypeFName(StructTypeName);
			// Verify that during FName creation there's no case conversion
			checkSlow(FCString::Strcmp(StructTypeName, *StrutTypeFName.GetPlainNameString()) == 0);
			GetNameStructMap().Add(FName(StructTypeName), this);
		}
	}

	virtual ~FUniformBufferStruct()
	{
		GlobalListLink.Unlink();
		GetNameStructMap().Remove(FName(StructTypeName, FNAME_Find));
	}

	void AddResourceTableEntries(TMap<FString,FResourceTableEntry>& ResourceTableMap, TMap<FString,uint32>& ResourceTableLayoutHashes) const
	{
		uint16 ResourceIndex = 0;
		for (int32 MemberIndex = 0; MemberIndex < Members.Num(); ++MemberIndex)
		{
			const FMember& Member = Members[MemberIndex];
			if (IsUniformBufferResourceType(Member.GetBaseType()))
			{
				FResourceTableEntry& Entry = ResourceTableMap.FindOrAdd(FString::Printf(TEXT("%s_%s"), ShaderVariableName, Member.GetName()));
				if (Entry.UniformBufferName.IsEmpty())
				{
					Entry.UniformBufferName = ShaderVariableName;
					Entry.Type = Member.GetBaseType();
					Entry.ResourceIndex = ResourceIndex++;
				}
			}
		}
		ResourceTableLayoutHashes.Add(ShaderVariableName,GetLayout().GetHash());
	}

	const TCHAR* GetStructTypeName() const { return StructTypeName; }
	const TCHAR* GetShaderVariableName() const { return ShaderVariableName; }
	const uint32 GetSize() const { return Size; }
	const FRHIUniformBufferLayout& GetLayout() const { return Layout; }
	const TArray<FMember>& GetMembers() const { return Members; }
	FShaderUniformBufferParameter* ConstructTypedParameter() const { return (*ConstructUniformBufferParameterRef)(); }

	static TLinkedList<FUniformBufferStruct*>*& GetStructList();
	/** Speed up finding the uniform buffer by its name */
	static TMap<FName, FUniformBufferStruct*>& GetNameStructMap();

private:
	const TCHAR* StructTypeName;
	const TCHAR* ShaderVariableName;
	ConstructUniformBufferParameterType ConstructUniformBufferParameterRef;
	uint32 Size;
	FRHIUniformBufferLayout Layout;
	TArray<FMember> Members;
	TLinkedList<FUniformBufferStruct*> GlobalListLink;
};

//
// Uniform buffer alignment tools (should only be used by the uniform buffer type infos below).
//

	template<typename T,uint32 Alignment>
	class TAlignedTypedef;

	#define IMPLEMENT_ALIGNED_TYPE(Alignment) \
	template<typename T> \
	class TAlignedTypedef<T,Alignment> \
	{ \
	public: \
		typedef MS_ALIGN(Alignment) T TAlignedType GCC_ALIGN(Alignment); \
	};

	IMPLEMENT_ALIGNED_TYPE(1);
	IMPLEMENT_ALIGNED_TYPE(2);
	IMPLEMENT_ALIGNED_TYPE(4);
	IMPLEMENT_ALIGNED_TYPE(8);
	IMPLEMENT_ALIGNED_TYPE(16);

//
// Template specializations used to map C++ types to uniform buffer member types.
//

	template<typename>
	class TUniformBufferTypeInfo
	{
	public:
		enum { BaseType = UBMT_INVALID };
		enum { NumRows = 0 };
		enum { NumColumns = 0 };
		enum { NumElements = 0 };
		enum { Alignment = 1 };
		enum { IsResource = 0 };
		static const FUniformBufferStruct* GetStruct() { return NULL; }
	};

	template<>
	class TUniformBufferTypeInfo<bool>
	{
	public:
		enum { BaseType = UBMT_BOOL };
		enum { NumRows = 1 };
		enum { NumColumns = 1 };
		enum { NumElements = 0 };
		enum { Alignment = 4 };
		enum { IsResource = 0 };
		typedef TAlignedTypedef<bool,Alignment>::TAlignedType TAlignedType;
		static const FUniformBufferStruct* GetStruct() { return NULL; }
	};

	template<>
	class TUniformBufferTypeInfo<uint32>
	{
	public:
		enum { BaseType = UBMT_UINT32 };
		enum { NumRows = 1 };
		enum { NumColumns = 1 };
		enum { NumElements = 0 };
		enum { Alignment = 4 };
		enum { IsResource = 0 };
		typedef uint32 TAlignedType;
		static const FUniformBufferStruct* GetStruct() { return NULL; }
	};

	template<>
	class TUniformBufferTypeInfo<int32>
	{
	public:
		enum { BaseType = UBMT_INT32 };
		enum { NumRows = 1 };
		enum { NumColumns = 1 };
		enum { NumElements = 0 };
		enum { Alignment = 4 };
		enum { IsResource = 0 };
		typedef int32 TAlignedType;
		static const FUniformBufferStruct* GetStruct() { return NULL; }
	};

	template<>
	class TUniformBufferTypeInfo<float>
	{
	public:
		enum { BaseType = UBMT_FLOAT32 };
		enum { NumRows = 1 };
		enum { NumColumns = 1 };
		enum { NumElements = 0 };
		enum { Alignment = 4 };
		enum { IsResource = 0 };
		typedef float TAlignedType;
		static const FUniformBufferStruct* GetStruct() { return NULL; }
	};

	template<>
	class TUniformBufferTypeInfo<FVector2D>
	{
	public:
		enum { BaseType = UBMT_FLOAT32 };
		enum { NumRows = 1 };
		enum { NumColumns = 2 };
		enum { NumElements = 0 };
		enum { Alignment = 8 };
		enum { IsResource = 0 };
		typedef TAlignedTypedef<FVector2D,Alignment>::TAlignedType TAlignedType;
		static const FUniformBufferStruct* GetStruct() { return NULL; }
	};

	template<>
	class TUniformBufferTypeInfo<FVector>
	{
	public:
		enum { BaseType = UBMT_FLOAT32 };
		enum { NumRows = 1 };
		enum { NumColumns = 3 };
		enum { NumElements = 0 };
		enum { Alignment = 16 };
		enum { IsResource = 0 };
		typedef TAlignedTypedef<FVector,Alignment>::TAlignedType TAlignedType;
		static const FUniformBufferStruct* GetStruct() { return NULL; }
	};

	template<>
	class TUniformBufferTypeInfo<FVector4>
	{
	public:
		enum { BaseType = UBMT_FLOAT32 };
		enum { NumRows = 1 };
		enum { NumColumns = 4 };
		enum { NumElements = 0 };
		enum { Alignment = 16 };
		enum { IsResource = 0 };
		typedef TAlignedTypedef<FVector4,Alignment>::TAlignedType TAlignedType;
		static const FUniformBufferStruct* GetStruct() { return NULL; }
	};

	template<>
	class TUniformBufferTypeInfo<FLinearColor>
	{
	public:
		enum { BaseType = UBMT_FLOAT32 };
		enum { NumRows = 1 };
		enum { NumColumns = 4 };
		enum { NumElements = 0 };
		enum { Alignment = 16 };
		enum { IsResource = 0 };
		typedef TAlignedTypedef<FLinearColor,Alignment>::TAlignedType TAlignedType;
		static const FUniformBufferStruct* GetStruct() { return NULL; }
	};

	template<>
	class TUniformBufferTypeInfo<FIntPoint>
	{
	public:
		enum { BaseType = UBMT_INT32 };
		enum { NumRows = 1 };
		enum { NumColumns = 2 };
		enum { NumElements = 0 };
		enum { Alignment = 8 };
		enum { IsResource = 0 };
		typedef TAlignedTypedef<FIntPoint,Alignment>::TAlignedType TAlignedType;
		static const FUniformBufferStruct* GetStruct() { return NULL; }
	};

	template<>
	class TUniformBufferTypeInfo<FIntVector>
	{
	public:
		enum { BaseType = UBMT_INT32 };
		enum { NumRows = 1 };
		enum { NumColumns = 3 };
		enum { NumElements = 0 };
		enum { Alignment = 16 };
		enum { IsResource = 0 };
		typedef TAlignedTypedef<FIntVector,Alignment>::TAlignedType TAlignedType;
		static const FUniformBufferStruct* GetStruct() { return NULL; }
	};

	template<>
	class TUniformBufferTypeInfo<FIntRect>
	{
	public:
		enum { BaseType = UBMT_INT32 };
		enum { NumRows = 1 };
		enum { NumColumns = 4 };
		enum { NumElements = 0 };
		enum { Alignment = 16 };
		enum { IsResource = 0 };
		typedef TAlignedTypedef<FIntRect,Alignment>::TAlignedType TAlignedType;
		static const FUniformBufferStruct* GetStruct() { return NULL; }
	};

	template<>
	class TUniformBufferTypeInfo<FMatrix>
	{
	public:
		enum { BaseType = UBMT_FLOAT32 };
		enum { NumRows = 4 };
		enum { NumColumns = 4 };
		enum { NumElements = 0 };
		enum { Alignment = 16 };
		enum { IsResource = 0 };
		typedef TAlignedTypedef<FMatrix,Alignment>::TAlignedType TAlignedType;
		static const FUniformBufferStruct* GetStruct() { return NULL; }
	};

	template<typename T,size_t InNumElements>
	class TUniformBufferTypeInfo<T[InNumElements]>
	{
	public:
		enum { BaseType = TUniformBufferTypeInfo<T>::BaseType };
		enum { NumRows = TUniformBufferTypeInfo<T>::NumRows };
		enum { NumColumns = TUniformBufferTypeInfo<T>::NumColumns };
		enum { NumElements = InNumElements };
		enum { Alignment = TUniformBufferTypeInfo<T>::Alignment };
		enum { IsResource = TUniformBufferTypeInfo<T>::IsResource };
		typedef TStaticArray<T,InNumElements,16> TAlignedType;
		static const FUniformBufferStruct* GetStruct() { return TUniformBufferTypeInfo<T>::GetStruct(); }
	};

	template<typename T,size_t InNumElements,uint32 IgnoredAlignment>
	class TUniformBufferTypeInfo<TStaticArray<T,InNumElements,IgnoredAlignment> >
	{
	public:
		enum { BaseType = TUniformBufferTypeInfo<T>::BaseType };
		enum { NumRows = TUniformBufferTypeInfo<T>::NumRows };
		enum { NumColumns = TUniformBufferTypeInfo<T>::NumColumns };
		enum { NumElements = InNumElements };
		enum { Alignment = TUniformBufferTypeInfo<T>::Alignment };
		enum { IsResource = TUniformBufferTypeInfo<T>::IsResource };
		typedef TStaticArray<T,InNumElements,16> TAlignedType;
		static const FUniformBufferStruct* GetStruct() { return TUniformBufferTypeInfo<T>::GetStruct(); }
	};

	template<>
	class TUniformBufferTypeInfo<FShaderResourceViewRHIParamRef>
	{
	public:
		enum { BaseType = UBMT_SRV };
		enum { NumRows = 1 };
		enum { NumColumns = 1 };
		enum { NumElements = 0 };
		enum { Alignment = sizeof(void*) };
		enum { IsResource = 1 };
		typedef TAlignedTypedef<FShaderResourceViewRHIParamRef,Alignment>::TAlignedType TAlignedType;
		static const FUniformBufferStruct* GetStruct() { return NULL; }
	};
	static_assert(sizeof(FShaderResourceViewRHIParamRef) == sizeof(void*), "FShaderResourceViewRHIParamRef should have size of a pointer.");
	static_assert(sizeof(TUniformBufferTypeInfo<FShaderResourceViewRHIParamRef>::TAlignedType) == sizeof(void*), "SRV UniformBufferParam is not aligned to pointer type");

	template<>
	class TUniformBufferTypeInfo<FUnorderedAccessViewRHIParamRef>
	{
	public:
		enum { BaseType = UBMT_UAV };
		enum { NumRows = 1 };
		enum { NumColumns = 1 };
		enum { NumElements = 0 };
		enum { Alignment = sizeof(void*) };
		enum { IsResource = 1 };
		typedef TAlignedTypedef<FUnorderedAccessViewRHIParamRef,Alignment>::TAlignedType TAlignedType;
		static const FUniformBufferStruct* GetStruct() { return NULL; }
	};
	static_assert(sizeof(FUnorderedAccessViewRHIParamRef) == sizeof(void*), "FUnorderedAccessViewRHIParamRef should have size of a pointer.");
	static_assert(sizeof(TUniformBufferTypeInfo<FUnorderedAccessViewRHIParamRef>::TAlignedType) == sizeof(void*), "UAV UniformBufferParam is not aligned to pointer type");

	template<>
	class TUniformBufferTypeInfo<FSamplerStateRHIParamRef>
	{
	public:
		enum { BaseType = UBMT_SAMPLER };
		enum { NumRows = 1 };
		enum { NumColumns = 1 };
		enum { NumElements = 0 };
		enum { Alignment = sizeof(void*) };
		enum { IsResource = 1 };
		typedef TAlignedTypedef<FSamplerStateRHIParamRef,Alignment>::TAlignedType TAlignedType;
		static const FUniformBufferStruct* GetStruct() { return NULL; }
	};
	static_assert(sizeof(FSamplerStateRHIParamRef) == sizeof(void*), "FSamplerStateRHIParamRef should have size of a pointer.");
	static_assert(sizeof(TUniformBufferTypeInfo<FSamplerStateRHIParamRef>::TAlignedType) == sizeof(void*), "SamplerState UniformBufferParam is not aligned to pointer type");

	template<>
	class TUniformBufferTypeInfo<FTextureRHIParamRef>
	{
	public:
		enum { BaseType = UBMT_TEXTURE };
		enum { NumRows = 1 };
		enum { NumColumns = 1 };
		enum { NumElements = 0 };
		enum { Alignment = sizeof(void*) };
		enum { IsResource = 1 };
		typedef TAlignedTypedef<FTextureRHIParamRef,Alignment>::TAlignedType TAlignedType;
		static const FUniformBufferStruct* GetStruct() { return NULL; }
	};
	static_assert(sizeof(FTextureRHIParamRef) == sizeof(void*), "FTextureRHIParamRef should have size of a pointer.");
	static_assert(sizeof(TUniformBufferTypeInfo<FTextureRHIParamRef>::TAlignedType) == sizeof(void*), "Texture UniformBufferParam is not aligned to pointer type");

//
// Macros for declaring uniform buffer structures.
//

#define IMPLEMENT_UNIFORM_BUFFER_STRUCT(StructTypeName,ShaderVariableName) \
	FUniformBufferStruct StructTypeName::StaticStruct( \
	TEXT(#StructTypeName), \
	ShaderVariableName, \
	StructTypeName::ConstructUniformBufferParameter, \
	sizeof(StructTypeName), \
	StructTypeName::zzGetMembers(), \
	true);

/** Begins a uniform buffer struct declaration. */
#define BEGIN_UNIFORM_BUFFER_STRUCT_EX(StructTypeName,PrefixKeywords,ConstructorSuffix) \
	MS_ALIGN(UNIFORM_BUFFER_STRUCT_ALIGNMENT) class PrefixKeywords StructTypeName \
	{ \
	public: \
		StructTypeName () ConstructorSuffix \
		static FUniformBufferStruct StaticStruct; \
		static FShaderUniformBufferParameter* ConstructUniformBufferParameter() { return new TShaderUniformBufferParameter<StructTypeName>(); } \
		static FUniformBufferRHIRef CreateUniformBuffer(const StructTypeName& InContents, EUniformBufferUsage InUsage) \
		{ \
			return RHICreateUniformBuffer(&InContents,StaticStruct.GetLayout(),InUsage); \
		} \
	private: \
		typedef StructTypeName zzTThisStruct; \
		struct zzFirstMemberId { enum { HasDeclaredResource = 0 }; }; \
		static TArray<FUniformBufferStruct::FMember> zzGetMembersBefore(zzFirstMemberId) \
		{ \
			return TArray<FUniformBufferStruct::FMember>(); \
		} \
		typedef zzFirstMemberId

/** Declares a member of a uniform buffer struct. */
#define DECLARE_UNIFORM_BUFFER_STRUCT_MEMBER_EXPLICIT(MemberType,MemberName,ArrayDecl,Precision,OptionalShaderType) \
		zzMemberId##MemberName; \
	public: \
		typedef MemberType zzA##MemberName ArrayDecl; \
		typedef TUniformBufferTypeInfo<zzA##MemberName>::TAlignedType zzT##MemberName; \
		zzT##MemberName MemberName; \
		static_assert(TUniformBufferTypeInfo<zzA##MemberName>::BaseType != UBMT_INVALID, "Invalid type " #MemberType " of member " #MemberName "."); \
		static_assert(TUniformBufferTypeInfo<zzA##MemberName>::BaseType != UBMT_UAV, "UAV is not yet supported in resource tables for " #MemberName " of type " #MemberType "."); \
	private: \
		struct zzNextMemberId##MemberName { enum { HasDeclaredResource = zzMemberId##MemberName::HasDeclaredResource || TUniformBufferTypeInfo<zzT##MemberName>::IsResource }; }; \
		static TArray<FUniformBufferStruct::FMember> zzGetMembersBefore(zzNextMemberId##MemberName) \
		{ \
			static_assert(TUniformBufferTypeInfo<zzT##MemberName>::IsResource == 1 || zzMemberId##MemberName::HasDeclaredResource == 0, "All resources must be declared last for " #MemberName "."); \
			static_assert(TUniformBufferTypeInfo<zzT##MemberName>::IsResource == 0 || IS_TCHAR_ARRAY(OptionalShaderType), "No shader type for " #MemberName "."); \
			/* Route the member enumeration on to the function for the member following this. */ \
			TArray<FUniformBufferStruct::FMember> OutMembers = zzGetMembersBefore(zzMemberId##MemberName()); \
			/* Add this member. */ \
			OutMembers.Add(FUniformBufferStruct::FMember( \
				TEXT(#MemberName), \
				OptionalShaderType, \
				STRUCT_OFFSET(zzTThisStruct,MemberName), \
				(EUniformBufferBaseType)TUniformBufferTypeInfo<zzA##MemberName>::BaseType, \
				Precision, \
				TUniformBufferTypeInfo<zzA##MemberName>::NumRows, \
				TUniformBufferTypeInfo<zzA##MemberName>::NumColumns, \
				TUniformBufferTypeInfo<zzA##MemberName>::NumElements, \
				TUniformBufferTypeInfo<zzA##MemberName>::GetStruct() \
				)); \
			static_assert( \
				(STRUCT_OFFSET(zzTThisStruct,MemberName) & (TUniformBufferTypeInfo<zzA##MemberName>::Alignment - 1)) == 0, \
				"Misaligned uniform buffer struct member " #MemberName "."); \
			return OutMembers; \
		} \
		typedef zzNextMemberId##MemberName

#define DECLARE_UNIFORM_BUFFER_STRUCT_MEMBER_ARRAY_EX(MemberType,MemberName,ArrayDecl,Precision) DECLARE_UNIFORM_BUFFER_STRUCT_MEMBER_EXPLICIT(MemberType,MemberName,ArrayDecl,Precision,TEXT(""))

#define DECLARE_UNIFORM_BUFFER_STRUCT_MEMBER_ARRAY(MemberType,MemberName,ArrayDecl) DECLARE_UNIFORM_BUFFER_STRUCT_MEMBER_EXPLICIT(MemberType,MemberName,ArrayDecl,EShaderPrecisionModifier::Float,TEXT(""))

#define DECLARE_UNIFORM_BUFFER_STRUCT_MEMBER(MemberType,MemberName) DECLARE_UNIFORM_BUFFER_STRUCT_MEMBER_EXPLICIT(MemberType,MemberName,,EShaderPrecisionModifier::Float,TEXT(""))

#define DECLARE_UNIFORM_BUFFER_STRUCT_MEMBER_EX(MemberType,MemberName,Precision) DECLARE_UNIFORM_BUFFER_STRUCT_MEMBER_EXPLICIT(MemberType,MemberName,,Precision,TEXT(""))

#define DECLARE_UNIFORM_BUFFER_STRUCT_MEMBER_SRV(ShaderType,MemberName) DECLARE_UNIFORM_BUFFER_STRUCT_MEMBER_EXPLICIT(FShaderResourceViewRHIParamRef,MemberName,,EShaderPrecisionModifier::Float,TEXT(#ShaderType))

// NOT SUPPORTED YET
//#define DECLARE_UNIFORM_BUFFER_STRUCT_MEMBER_UAV(ShaderType,MemberName) DECLARE_UNIFORM_BUFFER_STRUCT_MEMBER_EXPLICIT(FUnorderedAccessViewRHIParamRef,MemberName,,EShaderPrecisionModifier::Float,TEXT(#ShaderType))

#define DECLARE_UNIFORM_BUFFER_STRUCT_MEMBER_SAMPLER(ShaderType,MemberName) DECLARE_UNIFORM_BUFFER_STRUCT_MEMBER_EXPLICIT(FSamplerStateRHIParamRef,MemberName,,EShaderPrecisionModifier::Float,TEXT(#ShaderType))

#define DECLARE_UNIFORM_BUFFER_STRUCT_MEMBER_TEXTURE(ShaderType,MemberName) DECLARE_UNIFORM_BUFFER_STRUCT_MEMBER_EXPLICIT(FTextureRHIParamRef,MemberName,,EShaderPrecisionModifier::Float,TEXT(#ShaderType))

/** Ends a uniform buffer struct declaration. */
#define END_UNIFORM_BUFFER_STRUCT(Name) \
			zzLastMemberId; \
		static TArray<FUniformBufferStruct::FMember> zzGetMembers() { return zzGetMembersBefore(zzLastMemberId()); } \
	} GCC_ALIGN(UNIFORM_BUFFER_STRUCT_ALIGNMENT); \
	template<> class TUniformBufferTypeInfo<Name> \
	{ \
	public: \
		enum { BaseType = UBMT_STRUCT }; \
		enum { NumRows = 1 }; \
		enum { NumColumns = 1 }; \
		enum { Alignment = UNIFORM_BUFFER_STRUCT_ALIGNMENT }; \
		static const FUniformBufferStruct* GetStruct() { return &Name::StaticStruct; } \
	};

#define BEGIN_UNIFORM_BUFFER_STRUCT(StructTypeName,PrefixKeywords) BEGIN_UNIFORM_BUFFER_STRUCT_EX(StructTypeName,PrefixKeywords,{})
#define BEGIN_UNIFORM_BUFFER_STRUCT_WITH_CONSTRUCTOR(StructTypeName,PrefixKeywords) BEGIN_UNIFORM_BUFFER_STRUCT_EX(StructTypeName,PrefixKeywords,;)

/** Finds the FUniformBufferStruct corresponding to the given name, or NULL if not found. */
extern RENDERCORE_API FUniformBufferStruct* FindUniformBufferStructByName(const TCHAR* StructName);

redpajama_set_name: RedPajamaGithub


text:
require 'json'
require 'faraday'
require 'slim'
require 'sinatra'

class MyApp < Sinatra::Base
  def request_yesno(answer = :maybe, forced = true)
    unless %w(yes no maybe).map(&:to_sym).include?(answer)
      fail ArgumentError, 'it should contains a "yes", "no" or "maybe"'
    end

    # forced = false if answer.eql(:maybe)

    base_url = 'http://yesno.wtf'
    faraday = Faraday::Connection.new(url: base_url)

    response = faraday.get('/api', answer: answer.to_s, forced: forced)
    JSON.parse(response.body)
  end

  helpers do
    def img_tag_for(src_url = '')
      img_tag = ''
      img_tag << '<img src="'
      img_tag << src_url
      img_tag << '" />'
      img_tag
    end
  end

  get '/?' do
    response = request_yesno
    @answer = response['answer'].upcase
    @yesno_img = response['image']
    slim :index
  end
end


text:
package io.rsocket.integration;

import io.rsocket.Payload;
import io.rsocket.RSocket;
import io.rsocket.SocketAcceptor;
import io.rsocket.core.RSocketConnector;
import io.rsocket.core.RSocketServer;
import io.rsocket.test.SlowTest;
import io.rsocket.transport.netty.client.TcpClientTransport;
import io.rsocket.transport.netty.server.CloseableChannel;
import io.rsocket.transport.netty.server.TcpServerTransport;
import io.rsocket.util.DefaultPayload;
import java.time.Duration;
import java.util.function.Supplier;
import org.junit.jupiter.api.Test;
import org.reactivestreams.Publisher;
import reactor.core.publisher.Flux;

public class InteractionsLoadTest {

  @Test
  @SlowTest
  public void channel() {
    CloseableChannel server =
        RSocketServer.create(SocketAcceptor.with(new EchoRSocket()))
            .bind(TcpServerTransport.create("localhost", 0))
            .block(Duration.ofSeconds(10));

    RSocket clientRSocket =
        RSocketConnector.connectWith(TcpClientTransport.create(server.address()))
            .block(Duration.ofSeconds(10));

    int concurrency = 16;
    Flux.range(1, concurrency)
        .flatMap(
            v ->
                clientRSocket
                    .requestChannel(
                        input().onBackpressureDrop().map(iv -> DefaultPayload.create("foo")))
                    .limitRate(10000),
            concurrency)
        .timeout(Duration.ofSeconds(5))
        .doOnNext(
            p -> {
              String data = p.getDataUtf8();
              if (!data.equals("bar")) {
                throw new IllegalStateException("Channel Client Bad message: " + data);
              }
            })
        .window(Duration.ofSeconds(1))
        .flatMap(Flux::count)
        .doOnNext(d -> System.out.println("Got: " + d))
        .take(Duration.ofMinutes(1))
        .doOnTerminate(server::dispose)
        .subscribe();

    server.onClose().block();
  }

  private static Flux<Long> input() {
    Flux<Long> interval = Flux.interval(Duration.ofMillis(1)).onBackpressureDrop();
    for (int i = 0; i < 10; i++) {
      interval = interval.mergeWith(interval);
    }
    return interval;
  }

  private static class EchoRSocket implements RSocket {

    @Override
    public Flux<Payload> requestChannel(Publisher<Payload> payloads) {
      return Flux.from(payloads)
          .map(
              p -> {
                String data = p.getDataUtf8();
                if (!data.equals("foo")) {
                  throw new IllegalStateException("Channel Server Bad message: " + data);
                }
                return DefaultPayload.create("bar");
              });
    }

    @Override
    public Flux<Payload> requestStream(Payload payload) {
      return Flux.just(payload)
          .map(
              p -> {
                String data = p.getDataUtf8();
                return data;
              })
          .doOnNext(
              (data) -> {
                if (!data.equals("foo")) {
                  throw new IllegalStateException("Stream Server Bad message: " + data);
                }
              })
          .flatMap(
              data -> {
                Supplier<Payload> p = () -> DefaultPayload.create("bar");
                return Flux.range(1, 100).map(v -> p.get());
              });
    }
  }
}


text:
package com.networknt.tram.todolist.handler;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.networknt.body.BodyHandler;
import com.networknt.config.Config;
import com.networknt.service.SingletonServiceFactory;
import com.networknt.tram.todolist.command.Todo;
import com.networknt.tram.todolist.command.TodoCommandService;
import com.networknt.tram.todolist.command.TodoNotFoundException;
import com.networknt.tram.todolist.command.UpdateTodoRequest;
import io.undertow.server.HttpHandler;
import io.undertow.server.HttpServerExchange;
import io.undertow.util.HttpString;

import java.util.Map;

public class TodosIdPutHandler implements HttpHandler {
    private TodoCommandService todoCommandService = (TodoCommandService) SingletonServiceFactory.getBean(TodoCommandService.class);
    @Override
    public void handleRequest(HttpServerExchange exchange) throws Exception {

        String id = exchange.getQueryParameters().get("id").getFirst();

        ObjectMapper mapper = new ObjectMapper();

        // add a new object
        Map s = (Map)exchange.getAttachment(BodyHandler.REQUEST_BODY);
        String json = mapper.writeValueAsString(s);
        UpdateTodoRequest updateTodoRequest = mapper.readValue(json, UpdateTodoRequest.class);

        try {
            Todo todo = todoCommandService.update(id, updateTodoRequest);
            exchange.getResponseHeaders().add(new HttpString("Content-Type"), "application/json");
            exchange.getResponseSender().send(Config.getInstance().getMapper().writeValueAsString(todo));
        } catch ( TodoNotFoundException e) {
            exchange.getResponseHeaders().add(new HttpString("Content-Type"), "application/json");
            exchange.getResponseSender().send("No record been updated");
        }

    }
}


text:
import os, glob
from distutils.core import setup
from core.constants import COREDPY_VERSION

# optionally pass CORE_CONF_DIR using environment variable
confdir = os.environ.get('CORE_CONF_DIR')
if confdir is None:
    confdir="/etc/core"

setup(name = "core-python",
      version = COREDPY_VERSION,
      packages = [
        "core",
        "core.addons",
        "core.api",
        "core.emane",
        "core.misc",
        "core.bsd",
        "core.netns",
        "core.phys",
        "core.xen",
        "core.services",
        ],
      data_files = [("sbin", glob.glob("sbin/core*")),
                    (confdir, ["data/core.conf"]),
                    (confdir, ["data/xen.conf"]),
                    ("share/core/examples", ["examples/controlnet_updown"]),
                    ("share/core/examples",
                     glob.glob("examples/*.py")),
                    ("share/core/examples/netns",
                     glob.glob("examples/netns/*[py,sh]")),
                    ("share/core/examples/services",
                     glob.glob("examples/services/*")),
                    ("share/core/examples/myservices",
                     glob.glob("examples/myservices/*")),
                    ],
      description = "Python components of CORE",
      url = "http://www.nrl.navy.mil/itd/ncs/products/core",
      author = "Boeing Research & Technology",
      author_email = "core-dev@pf.itd.nrl.navy.mil",
      license = "BSD",
      long_description="Python scripts and modules for building virtual " \
          "emulated networks.")


text:
#include "config.h"
#include "HTMLEmbedElement.h"

#include "Attribute.h"
#include "CSSPropertyNames.h"
#include "DocumentLoader.h"
#include "Frame.h"
#include "HTMLDocument.h"
#include "HTMLImageLoader.h"
#include "HTMLNames.h"
#include "HTMLObjectElement.h"
#include "HTMLParserIdioms.h"
#include "MainResourceLoader.h"
#include "PluginDocument.h"
#include "RenderEmbeddedObject.h"
#include "RenderImage.h"
#include "RenderWidget.h"
#include "ScriptController.h"
#include "Settings.h"

namespace WebCore {

using namespace HTMLNames;

inline HTMLEmbedElement::HTMLEmbedElement(const QualifiedName& tagName, Document* document, bool createdByParser)
    : HTMLPlugInImageElement(tagName, document, createdByParser, ShouldPreferPlugInsForImages)
{
    ASSERT(hasTagName(embedTag));
    setIeForbidsInsertHTML();
}

PassRefPtr<HTMLEmbedElement> HTMLEmbedElement::create(const QualifiedName& tagName, Document* document, bool createdByParser)
{
    return adoptRef(new HTMLEmbedElement(tagName, document, createdByParser));
}

static inline RenderWidget* findWidgetRenderer(const Node* n)
{
    if (!n->renderer())
        do
            n = n->parentNode();
        while (n && !n->hasTagName(objectTag));

    if (n && n->renderer() && n->renderer()->isWidget())
        return toRenderWidget(n->renderer());

    return 0;
}

RenderWidget* HTMLEmbedElement::renderWidgetForJSBindings() const
{
    document()->updateLayoutIgnorePendingStylesheets();
    return findWidgetRenderer(this);
}

bool HTMLEmbedElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const
{
    if (attrName == hiddenAttr) {
        result = eUniversal;
        return false;
    }

    return HTMLPlugInImageElement::mapToEntry(attrName, result);
}

void HTMLEmbedElement::parseMappedAttribute(Attribute* attr)
{
    const AtomicString& value = attr->value();

    if (attr->name() == typeAttr) {
        m_serviceType = value.string().lower();
        size_t pos = m_serviceType.find(";");
        if (pos != notFound)
            m_serviceType = m_serviceType.left(pos);
        if (!isImageType() && m_imageLoader)
            m_imageLoader.clear();
    } else if (attr->name() == codeAttr)
        m_url = stripLeadingAndTrailingHTMLSpaces(value.string());
    else if (attr->name() == srcAttr) {
        m_url = stripLeadingAndTrailingHTMLSpaces(value.string());
        if (renderer() && isImageType()) {
            if (!m_imageLoader)
                m_imageLoader = adoptPtr(new HTMLImageLoader(this));
            m_imageLoader->updateFromElementIgnoringPreviousError();
        }
    } else if (attr->name() == hiddenAttr) {
        if (equalIgnoringCase(value.string(), "yes") || equalIgnoringCase(value.string(), "true")) {
            // FIXME: Not dynamic, since we add this but don't remove it, but it may be OK for now
            // that this rarely-used attribute won't work properly if you remove it.
            addCSSLength(attr, CSSPropertyWidth, "0");
            addCSSLength(attr, CSSPropertyHeight, "0");
        }
    } else if (attr->name() == nameAttr) {
        if (inDocument() && document()->isHTMLDocument()) {
            HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
            document->removeNamedItem(m_name);
            document->addNamedItem(value);
        }
        m_name = value;
    } else
        HTMLPlugInImageElement::parseMappedAttribute(attr);
}

void HTMLEmbedElement::parametersForPlugin(Vector<String>& paramNames, Vector<String>& paramValues)
{
    NamedNodeMap* attributes = this->attributes(true);
    if (!attributes)
        return;

    for (unsigned i = 0; i < attributes->length(); ++i) {
        Attribute* it = attributes->attributeItem(i);
        paramNames.append(it->localName().string());
        paramValues.append(it->value().string());
    }
}

// FIXME: This should be unified with HTMLObjectElement::updateWidget and
// moved down into HTMLPluginImageElement.cpp
void HTMLEmbedElement::updateWidget(PluginCreationOption pluginCreationOption)
{
    ASSERT(!renderEmbeddedObject()->pluginCrashedOrWasMissing());
    // FIXME: We should ASSERT(needsWidgetUpdate()), but currently
    // FrameView::updateWidget() calls updateWidget(false) without checking if
    // the widget actually needs updating!
    setNeedsWidgetUpdate(false);

    if (m_url.isEmpty() && m_serviceType.isEmpty())
        return;

    // Note these pass m_url and m_serviceType to allow better code sharing with
    // <object> which modifies url and serviceType before calling these.
    if (!allowedToLoadFrameURL(m_url))
        return;
    // FIXME: It's sadness that we have this special case here.
    //        See http://trac.webkit.org/changeset/25128 and
    //        plugins/netscape-plugin-setwindow-size.html
    if (pluginCreationOption == CreateOnlyNonNetscapePlugins && wouldLoadAsNetscapePlugin(m_url, m_serviceType))
        return;

    // FIXME: These should be joined into a PluginParameters class.
    Vector<String> paramNames;
    Vector<String> paramValues;
    parametersForPlugin(paramNames, paramValues);

    ASSERT(!m_inBeforeLoadEventHandler);
    m_inBeforeLoadEventHandler = true;
    bool beforeLoadAllowedLoad = dispatchBeforeLoadEvent(m_url);
    m_inBeforeLoadEventHandler = false;

    if (!beforeLoadAllowedLoad) {
        if (document()->isPluginDocument()) {
            // Plugins inside plugin documents load differently than other plugins. By the time
            // we are here in a plugin document, the load of the plugin (which is the plugin document's
            // main resource) has already started. We need to explicitly cancel the main resource load here.
            toPluginDocument(document())->cancelManualPluginLoad();
        }
        return;
    }

    SubframeLoader* loader = document()->frame()->loader()->subframeLoader();
    // FIXME: beforeLoad could have detached the renderer!  Just like in the <object> case above.
    loader->requestObject(this, m_url, getAttribute(nameAttr), m_serviceType, paramNames, paramValues);
}

bool HTMLEmbedElement::rendererIsNeeded(RenderStyle* style)
{
    if (isImageType())
        return HTMLPlugInImageElement::rendererIsNeeded(style);

    Frame* frame = document()->frame();
    if (!frame)
        return false;

    // If my parent is an <object> and is not set to use fallback content, I
    // should be ignored and not get a renderer.
    ContainerNode* p = parentNode();
    if (p && p->hasTagName(objectTag)) {
        ASSERT(p->renderer());
        if (!static_cast<HTMLObjectElement*>(p)->useFallbackContent()) {
            ASSERT(!p->renderer()->isEmbeddedObject());
            return false;
        }
    }

#if ENABLE(DASHBOARD_SUPPORT)
    // Workaround for <rdar://problem/6642221>.
    if (Settings* settings = frame->settings()) {
        if (settings->usesDashboardBackwardCompatibilityMode())
            return true;
    }
#endif

    return HTMLPlugInImageElement::rendererIsNeeded(style);
}

void HTMLEmbedElement::insertedIntoDocument()
{
    HTMLPlugInImageElement::insertedIntoDocument();
    if (!inDocument())
        return;

    if (document()->isHTMLDocument())
        static_cast<HTMLDocument*>(document())->addNamedItem(m_name);

    String width = getAttribute(widthAttr);
    String height = getAttribute(heightAttr);
    if (!width.isEmpty() || !height.isEmpty()) {
        Node* n = parentNode();
        while (n && !n->hasTagName(objectTag))
            n = n->parentNode();
        if (n) {
            if (!width.isEmpty())
                static_cast<HTMLObjectElement*>(n)->setAttribute(widthAttr, width);
            if (!height.isEmpty())
                static_cast<HTMLObjectElement*>(n)->setAttribute(heightAttr, height);
        }
    }
}

void HTMLEmbedElement::removedFromDocument()
{
    if (document()->isHTMLDocument())
        static_cast<HTMLDocument*>(document())->removeNamedItem(m_name);

    HTMLPlugInImageElement::removedFromDocument();
}

void HTMLEmbedElement::attributeChanged(Attribute* attr, bool preserveDecls)
{
    HTMLPlugInImageElement::attributeChanged(attr, preserveDecls);

    if ((attr->name() == widthAttr || attr->name() == heightAttr) && !attr->isEmpty()) {
        ContainerNode* n = parentNode();
        while (n && !n->hasTagName(objectTag))
            n = n->parentNode();
        if (n)
            static_cast<HTMLObjectElement*>(n)->setAttribute(attr->name(), attr->value());
    }
}

bool HTMLEmbedElement::isURLAttribute(Attribute* attr) const
{
    return attr->name() == srcAttr;
}

const QualifiedName& HTMLEmbedElement::imageSourceAttributeName() const
{
    return srcAttr;
}

void HTMLEmbedElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const
{
    HTMLPlugInImageElement::addSubresourceAttributeURLs(urls);

    addSubresourceURL(urls, document()->completeURL(getAttribute(srcAttr)));
}

}


text:
package com.pureperfect.purview.validators.numeric;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import com.pureperfect.purview.ValidationProblem;

/**
 * A whole number that is greater than zero.
 *
 *

 * E.G:
 *

 *
 *

 *
 * public class MyClass
 * {
 *  //When validating fields
 *  @Id
 *  private Integer value;
 *
 *  ...//or
 *
 *  //When validating method return values
 *  @Id
 *  public Integer getSeconds() {
 *    ...
 *  };
 *
 *  ...//or
 *
 *  //When validating method parameters
 *  public static void foo(@Id Integer bar) {
 *    ...
 *  }
 * }
 *

 *
 * @author J. Chris Folsom
 * @version 1.1
 * @since 1.0
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(
{ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER })
public @interface Id
{
	/**
	 * Indicates that the value was not a valid identifier.
	 *
	 * @author J. Chris Folsom
	 * @version 1.1
	 * @since 1.0
	 */
	public class Problem extends ValidationProblem<Object, Id, Object, Number>
	{
		Problem(final Object instance, final Id annotation,
				final Object target, final Number value)
		{
			super(instance, annotation, target, value);
		}
	}

	/**
	 * A whole number that is greater than zero.
	 *
	 * @author J. Chris Folsom
	 * @version 1.1
	 * @since 1.0
	 */
	public class Validator
			implements
			com.pureperfect.purview.Validator<Problem, Object, Id, Object, Number>
	{
        /**
         * {@inheritDoc}
         */
		public Problem validate(final Object instance, final Id annotation,
				final Object target, final Number id)
		{
			if (id == null)
			{
				if (annotation.required())
				{
					return new Problem(instance, annotation, target, id);
				}
			}
			else if (id.longValue() < 0)
			{
				return new Problem(instance, annotation, target, id);
			}

			return null;
		}
	}

	/**
	 * Optional message key to use to define an i18n message.
	 *
	 * @return Optional message key to use to define an i18n message.
	 */
	String messageKey() default "";

	/**
	 * Whether or not the field is required. If it is not required, null values
	 * will be allowed.
	 *
	 * @return whether or not the field is required.
	 */
	boolean required() default false;

	/**
	 * The {@link Id.Validator Validator} for this annotation.
	 *
	 * @return The {@link Id.Validator} class
	 */
	Class<?> validator() default Validator.class;
}


text:
package org.apache.oodt.cas.pushpull.daemon;

/**
 *
 * @author bfoster
 * @version $Revision$
 *
 *
Describe your class here
.
 */
public interface DaemonLauncherMBean {

    public void killAllDaemons();

    public void refreshDaemons();

    public void quit();

    public String[] viewDaemonWaitingList();

}


text:
<meta charset='utf-8'/>
<meta name="viewport" content="width=device-width, initial-scale=0.6">

		<title>abstract - Plange</title>
		<link rel=StyleSheet href='../../css/general.css' type='text/css' />

		<?php require('../../header.php') ?>

a function object that can be cast to any function type, and throws when invoked

Notes

The abstract keyword is used to declare interfaces that will be implemented by derived types. This information is also used by the compiler to detect attempts to instantiate types with abstract members.

Example

//Base type
Animal := type {
	<Void → Void> speak ← abstract; //there is no default implementation
};

//Derived type
Cat := type inheriting Animal {
	speak ← { Meow(); }; //override the inherited speak method
};

<List<Animal> → Void> choir := (animals) {
	for (animal in animals) {
		animal.speak();
	}
};

<Cat> bernard;
<Cat> russel;
List<Cat> kittehs := [ bernard, russel ];
choir(kittehs); //covariant argument

		<?php require('../../footer.php') ?>


text:
disable_cloudinit(){
	$SUDO mkdir -p /etc/cloud/cloud.cfg.d/ || true
	echo "datasource_list: [ NoCloud, None ]" | $SUDO tee /etc/cloud/cloud.cfg.d/90_dpkg.cfg
	return $?
}


text:
function strcpy(a, b)
    assert(length(b)<length(a))
    unsafe_copy!(
        pointer(convert(Vector{Uint8}, a)),
        pointer(vcat(convert(Vector{Uint8}, b), [convert(Uint8,0)])),
        length(b)
    )
end
@deprecate strcpy :nothing


text:
package org.apache.cloudstack.framework.jobs;

import java.util.Random;

import javax.inject.Inject;

import org.apache.log4j.Logger;

import org.apache.cloudstack.jobs.JobInfo.Status;

import com.cloud.utils.component.AdapterBase;

public class AsyncJobTestDispatcher extends AdapterBase implements AsyncJobDispatcher {
    private static final Logger s_logger =
            Logger.getLogger(AsyncJobTestDispatcher.class);

    @Inject
    private AsyncJobManager _asyncJobMgr;

    @Inject
    private AsyncJobTestDashboard _testDashboard;

    Random _random = new Random();

    public AsyncJobTestDispatcher() {
    }

    @Override
    public void runJob(final AsyncJob job) {
        _testDashboard.increaseConcurrency();

        s_logger.info("Execute job " + job.getId() + ", current concurrency " + _testDashboard.getConcurrencyCount());

        int interval = 3000;

        try {
            Thread.sleep(interval);
        } catch (InterruptedException e) {
            s_logger.debug("[ignored] .");
        }

        _asyncJobMgr.completeAsyncJob(job.getId(), Status.SUCCEEDED, 0, null);

        _testDashboard.decreaseConcurrency();
        _testDashboard.jobCompleted();
    }
}


text:
class ContactsController < ApplicationController
  include CsvHelper

  before_action :set_lead, only: [:index, :new, :create, :new_import, :import]
  before_action :set_contact, only: [:edit, :update, :destroy]

  # GET /leads/1/contacts.csv
  def index
    respond_to do |format|
      format.csv  { SendCSV.new(@lead.contacts, self, @lead) }
    end
  end

  # GET /leads/1/contacts/new
  def new
    @contact = @lead.contacts.new(date_on: Time.zone.today)
  end

  # GET /contacts/1/edit
  def edit
  end

  # POST /leads/1/contacts
  # POST /leads/1/contacts.json
  def create
    @contact = @lead.contacts.new(contact_params)

    respond_to do |format|
      if @contact.save
        flash[:notice] = success_message(controller_name, action_name)
        format.html { redirect_to @contact.lead }
        format.json { render json: @contact, status: :ok }
      else
        format.html { render :new }
        format.json { render json: @contact.errors, status: :unprocessable_entity }
      end
    end
  end

  # PATCH/PUT /contacts/1
  # PATCH/PUT /contacts/1.json
  def update
    respond_to do |format|
      if @contact.update(contact_params)
        flash[:notice] = success_message(controller_name, action_name)
        format.html { redirect_to @contact.lead }
        format.json { render json: @contact, status: :ok }
      else
        format.html { render :edit }
        format.json { render json: @contact.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /contacts/1
  # DELETE /contacts/1.json
  def destroy
    lead = @contact.lead
    @contact.destroy
    respond_to do |format|
      flash[:notice] = success_message(controller_name, action_name)
      format.html { redirect_to lead }
      format.json { head :no_content }
    end
  end

  # GET /leads/1/contacts/new_import
  def new_import
    @data_import = DataImport.new
  end

  # POST /leads/1/contacts/import
  def import
    @data_import = DataImport.new(params[:data_import])
    @data_import.init(Contact, @lead)
    if @data_import.save
      flash[:notice] = success_message(controller_name, action_name)
      redirect_to @lead
    else
      render :new_import
    end
  end

  private
    # Use callbacks to share common setup or constraints between actions.
    def set_lead
      @lead = Lead.find(params[:lead_id])
    end
    def set_contact
      @contact = Contact.find(params[:id])
    end

    # Never trust parameters from the scary internet, only allow the white list through.
    def contact_params
      params.require(:contact).permit(:date_on, :content, :means, :owner, :lead_id)
    end
end


text:
<?php

namespace AlexanderC\Bundle\UngaBungaBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

use AlexanderC\Bundle\UngaBungaBundle\Entity\Faq;

/**
 * Faq controller.
 *
 */
class FaqController extends Controller
{

}


text:
package org.olat.lms.search.indexer;

import java.io.IOException;

import org.olat.lms.search.SearchResourceContext;
import org.olat.lms.search.document.file.DocumentException;

/**
 * Initial Date: 04.04.2013 <br>
 *
 * @author oliver.buehler@agility-informatik.ch
 */
public abstract class SubLevelIndexer<T> extends Indexer {

    /**
     * Do index the part of an indexer.
     *
     * @param searchResourceContext
     *            Current search-resource-context is used to build resouceUrl of an index-element.
     * @param indexerObject
     *            Index parent object. Each indexer must cast to the known type e.g. BusinessGroup.
     * @param indexer
     *            Callback object to add documents to the index.
     * @throws IOException
     *             Can not write index file.
     */
    public abstract void doIndex(SearchResourceContext searchResourceContext, T parentObject, OlatFullIndexer indexWriter) throws IOException, DocumentException,
            FolderIndexerTimeoutException;

}


text:
layout: kanji
v4: 1916
v6: 2065
kanji: 宅
keyword: home
elements: home, house, lock of hair
strokes: 6
image: E5AE85
on-yomi: タク
permalink: /rtk/宅/
prev: 尾
next: 託
---

1) [naniwa] 18-3-2007(277): This kanji is, of course, pronounced "taku", and it seems the owner of this home is a little bit otaku himself. He has hung up locks of hair suruptitiously obtained from various females all over his house. A veritable hair fetishist, and certainly someone whose home you wouldn't want to visit.

2) [Terhorst] 13-2-2008(61): "Home is where the hair is".

3) [Copycatken] 29-6-2006(43): At home, all the drains in my house are clogged up with locks of hair.

4) [nest0r] 16-4-2008(20): I'm very paranoid when I finally call my house a home, so whenever I leave, I cut a lock of hair, divide it into strands, and place it at all the entrances. If one is displaced, then I know someone has been there! Saw that in a James Bond movie.

5) [thegeezer3] 1-7-2007(16): House and locks of hair (goldilocks) = goldilocks broke into the bears house and treat it like her own home the selfish bitch.