text:
namespace
{
	static const int	kScreenWidth = 1280;
	static const int	kScreenHeight = 720;
	static const int	MaxSample = 2048;

	static LPCWSTR		kRayGenName = L"RayGenerator";
	static LPCWSTR		kClosestHitName = L"ClosestHitProcessor";
	static LPCWSTR		kClosestHitShadowName = L"ClosestHitShadowProcessor";
	static LPCWSTR		kAnyHitName = L"AnyHitProcessor";
	static LPCWSTR		kMissName = L"MissProcessor";
	static LPCWSTR		kMissShadowName = L"MissShadowProcessor";
	static LPCWSTR		kHitGroupName = L"HitGroup";
	static LPCWSTR		kHitGroupShadowName = L"HitGroupShadow";
}

class SampleApplication
	: public sl12::Application
{
	struct SceneCB
	{
		DirectX::XMFLOAT4X4	mtxProjToWorld;
		DirectX::XMFLOAT4	camPos;
		DirectX::XMFLOAT4	lightDir;
		DirectX::XMFLOAT4	lightColor;
		float				skyPower;
		uint32_t			loopCount;
		uint32_t			maxBounces;
	};

	struct Sphere
	{
		DirectX::XMFLOAT3	center;
		float				radius;
		DirectX::XMFLOAT4	color;
		uint32_t			material;

		Sphere()
			: center(0.0f, 0.0f, 0.0f), radius(1.0f), color(1.0f, 1.0f, 1.0f, 1.0f), material(0)
		{}
		Sphere(const DirectX::XMFLOAT3& c, float r, const DirectX::XMFLOAT4& col, uint32_t mat)
			: center(c), radius(r), color(col), material(mat)
		{}
		Sphere(float cx, float cy, float cz, float r, const DirectX::XMFLOAT4& col, uint32_t mat)
			: center(cx, cy, cz), radius(r), color(col), material(mat)
		{}
	};

	struct Instance
	{
		DirectX::XMFLOAT4X4	mtxLocalToWorld;
		DirectX::XMFLOAT4	color;
		uint32_t			material;
	};

public:
	SampleApplication(HINSTANCE hInstance, int nCmdShow, int screenWidth, int screenHeight)
		: Application(hInstance, nCmdShow, screenWidth, screenHeight)
	{}

	bool Initialize() override
	{
		// ƒRƒ}ƒ"ƒhƒŠƒXƒg'̏‰Šú‰»
		auto&& gqueue = device_.GetGraphicsQueue();
		for (auto&& v : cmdLists_)
		{
			if (!v.Initialize(&device_, &gqueue, true))
			{
				return false;
			}
		}

		cmdLists_[0].Reset();

		// ƒTƒ"ƒvƒ‰[ì¬
		{
			D3D12_SAMPLER_DESC samDesc{};
			samDesc.AddressU = samDesc.AddressV = samDesc.AddressW = D3D12_TEXTURE_ADDRESS_MODE_WRAP;
			samDesc.Filter = D3D12_FILTER_MIN_MAG_MIP_LINEAR;
			if (!imageSampler_.Initialize(&device_, samDesc))
			{
				return false;
			}
		}

		// ƒ‹[ƒgƒVƒOƒlƒ`ƒƒ'̏‰Šú‰»
		if (!sl12::CreateRaytracingRootSignature(&device_, 1, 1, 1, 2, 0, &rtGlobalRootSig_, &rtLocalRootSig_))
		{
			return false;
		}
		if (!copyRootSig_.Initialize(&device_, &copyVS_, &copyPS_, nullptr, nullptr, nullptr))
		{
			return false;
		}

		// ƒpƒCƒvƒ‰ƒCƒ"ƒXƒe[ƒgƒIƒuƒWƒFƒNƒg'̏‰Šú‰»
		if (!CreatePipelineState())
		{
			return false;
		}
		{
			if (!copyVS_.Initialize(&device_, sl12::ShaderType::Vertex, g_pCopyVS, sizeof(g_pCopyVS)))
			{
				return false;
			}
			if (!copyPS_.Initialize(&device_, sl12::ShaderType::Pixel, g_pCopyPS, sizeof(g_pCopyPS)))
			{
				return false;
			}

			sl12::GraphicsPipelineStateDesc desc;
			desc.pRootSignature = &copyRootSig_;
			desc.pVS = &copyVS_;
			desc.pPS = &copyPS_;

			desc.blend.sampleMask = UINT_MAX;
			desc.blend.rtDesc[0].isBlendEnable = false;
			desc.blend.rtDesc[0].writeMask = D3D12_COLOR_WRITE_ENABLE_ALL;

			desc.rasterizer.cullMode = D3D12_CULL_MODE_NONE;
			desc.rasterizer.fillMode = D3D12_FILL_MODE_SOLID;
			desc.rasterizer.isDepthClipEnable = false;
			desc.rasterizer.isFrontCCW = true;

			desc.depthStencil.isDepthEnable = false;
			desc.depthStencil.isDepthWriteEnable = false;
			desc.depthStencil.depthFunc = D3D12_COMPARISON_FUNC_LESS_EQUAL;

			desc.inputLayout.numElements = 0;
			desc.inputLayout.pElements = nullptr;

			desc.primTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
			desc.numRTVs = 0;
			desc.rtvFormats[desc.numRTVs++] = DXGI_FORMAT_R8G8B8A8_UNORM;
			desc.dsvFormat = DXGI_FORMAT_UNKNOWN;
			desc.multisampleCount = 1;

			if (!copyPso_.Initialize(&device_, desc))
			{
				return false;
			}
		}

		// o—͐æ'̃eƒNƒXƒ`ƒƒ'𐶐¬
		{
			sl12::TextureDesc desc;
			desc.dimension = sl12::TextureDimension::Texture2D;
			desc.width = kScreenWidth;
			desc.height = kScreenHeight;
			desc.mipLevels = 1;
			desc.format = DXGI_FORMAT_R32G32B32A32_FLOAT;
			//desc.format = DXGI_FORMAT_R16G16B16A16_FLOAT;
			desc.initialState = D3D12_RESOURCE_STATE_UNORDERED_ACCESS;
			desc.sampleCount = 1;
			desc.clearColor[4] = { 0.0f };
			desc.clearDepth = 1.0f;
			desc.clearStencil = 0;
			desc.isRenderTarget = true;
			desc.isDepthBuffer = false;
			desc.isUav = true;
			if (!resultTexture_.Initialize(&device_, desc))
			{
				return false;
			}

			if (!resultTextureSRV_.Initialize(&device_, &resultTexture_))
			{
				return false;
			}

			if (!resultTextureRTV_.Initialize(&device_, &resultTexture_))
			{
				return false;
			}

			if (!resultTextureUAV_.Initialize(&device_, &resultTexture_))
			{
				return false;
			}
		}

		// —"—p'̃oƒbƒtƒ@'𐶐¬
		{
			if (!randomBuffer_.Initialize(&device_, sizeof(float) * 65536, sizeof(float), sl12::BufferUsage::ShaderResource, true, false))
			{
				return false;
			}
			if (!randomBufferSRV_.Initialize(&device_, &randomBuffer_, 0, 0, sizeof(float)))
			{
				return false;
			}
			if (!seedBuffer_.Initialize(&device_, sizeof(uint32_t), 1, sl12::BufferUsage::ShaderResource, false, true))
			{
				return false;
			}
			if (!seedBufferUAV_.Initialize(&device_, &seedBuffer_, 0, 0, 0, 0))
			{
				return false;
			}

			auto p = reinterpret_cast<float*>(randomBuffer_.Map(nullptr));
			std::random_device rd;
			std::mt19937 mt(rd());
			std::uniform_real_distribution<float> randGen01(0.0f, 1.0f);
			for (int i = 0; i < 65536; i++)
			{
				p[i] = randGen01(mt);
			}
			randomBuffer_.Unmap();
		}

		// GUI'̏‰Šú‰»
		if (!gui_.Initialize(&device_, DXGI_FORMAT_R8G8B8A8_UNORM))
		{
			return false;
		}
		if (!gui_.CreateFontImage(&device_, cmdLists_[0]))
		{
			return false;
		}

		// ƒWƒIƒƒgƒŠ'𐶐¬'·'é
		if (!CreateGeometry())
		{
			return false;
		}

		cmdLists_[0].Close();
		cmdLists_[0].Execute();
		device_.WaitDrawDone();

		// Raytracing—pDescriptorHeap'̏‰Šú‰»
		if (!rtDescMan_.Initialize(&device_, 1, 1, 1, 1, 2, 0, glbMesh_.GetSubmeshCount()))
		{
			return false;
		}

		// AS'𐶐¬'·'é
		if (!CreateAccelerationStructure())
		{
			return false;
		}

		// ƒV[ƒ"'萔ƒoƒbƒtƒ@'𐶐¬'·'é
		if (!CreateSceneCB())
		{
			return false;
		}

		// ƒVƒF[ƒ_ƒe[ƒuƒ‹'𐶐¬'·'é
		if (!CreateShaderTable())
		{
			return false;
		}

		// ƒ^ƒCƒ€ƒXƒ^ƒ"ƒvƒNƒGƒŠ'ƃoƒbƒtƒ@
		for (int i = 0; i < ARRAYSIZE(gpuTimestamp_); ++i)
		{
			if (!gpuTimestamp_[i].Initialize(&device_, 5))
			{
				return false;
			}
		}

		return true;
	}

	bool Execute() override
	{
		device_.WaitPresent();
		device_.SyncKillObjects();

		auto frameIndex = (device_.GetSwapchain().GetFrameIndex() + sl12::Swapchain::kMaxBuffer - 1) % sl12::Swapchain::kMaxBuffer;
		auto prevFrameIndex = (device_.GetSwapchain().GetFrameIndex() + sl12::Swapchain::kMaxBuffer - 2) % sl12::Swapchain::kMaxBuffer;
		auto&& cmdList = cmdLists_[frameIndex];
		auto&& d3dCmdList = cmdList.GetCommandList();
		auto&& dxrCmdList = cmdList.GetDxrCommandList();

		UpdateSceneCB(frameIndex);

		cmdList.Reset();

		gui_.BeginNewFrame(&cmdList, kScreenWidth, kScreenHeight, inputData_);

		// GUI
		{
			if (ImGui::SliderAngle("Camera Angle", &camRotAngle_))
			{
				isClearTarget_ = true;
				loopCount_ = 0;
			}
			if (ImGui::SliderFloat("Sky Power", &skyPower_, 0.0f, 100.0f))
			{
				isClearTarget_ = true;
				loopCount_ = 0;
			}
			if (ImGui::SliderFloat("Light Intensity", &lightPower_, 0.0f, 10.0f))
			{
				isClearTarget_ = true;
				loopCount_ = 0;
			}
			if (ImGui::ColorEdit3("Light Color", lightColor_))
			{
				isClearTarget_ = true;
				loopCount_ = 0;
			}
			if (ImGui::SliderInt("Max Bounces", &maxBounces_, 1, 8))
			{
				isClearTarget_ = true;
				loopCount_ = 0;
			}

			uint64_t timestamp[5];
			gpuTimestamp_[prevFrameIndex].GetTimestamp(0, 5, timestamp);
			uint64_t all_time = timestamp[3] - timestamp[0];
			uint64_t ray_time = timestamp[2] - timestamp[1];
			uint64_t freq = device_.GetGraphicsQueue().GetTimestampFrequency();
			float all_ms = (float)all_time / ((float)freq / 1000.0f);
			float ray_ms = (float)ray_time / ((float)freq / 1000.0f);

			ImGui::Text("All GPU: %f (ms)", all_ms);
			ImGui::Text("RayTracing: %f (ms)", ray_ms);
		}

		gpuTimestamp_[frameIndex].Reset();
		gpuTimestamp_[frameIndex].Query(&cmdList);

		auto&& swapchain = device_.GetSwapchain();
		cmdList.TransitionBarrier(swapchain.GetCurrentTexture(), D3D12_RESOURCE_STATE_PRESENT, D3D12_RESOURCE_STATE_RENDER_TARGET);
		{
			float color[4] = { 0.0f, 0.0f, 1.0f, 0.0f };
			d3dCmdList->ClearRenderTargetView(swapchain.GetCurrentRenderTargetView()->GetDescInfo().cpuHandle, color, 0, nullptr);
		}

		if (isClearTarget_)
		{
			isClearTarget_ = false;
			float color[4] = { 0.0f };
			cmdList.TransitionBarrier(&resultTexture_, D3D12_RESOURCE_STATE_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_RENDER_TARGET);
			d3dCmdList->ClearRenderTargetView(resultTextureRTV_.GetDescInfo().cpuHandle, color, 0, nullptr);
			cmdList.TransitionBarrier(&resultTexture_, D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
		}

		// ƒfƒXƒNƒŠƒvƒ^ƒq[ƒv'ðÝ'è
		//ID3D12DescriptorHeap* pDescHeaps[] = {
		//	device_.GetDescriptorHeap(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV).GetHeap(),
		//	device_.GetDescriptorHeap(D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER).GetHeap()
		//};
		//d3dCmdList->SetDescriptorHeaps(ARRAYSIZE(pDescHeaps), pDescHeaps);

		gpuTimestamp_[frameIndex].Query(&cmdList);

		if (loopCount_ < MaxSample)
		{
			// ƒfƒXƒNƒŠƒvƒ^'ðÝ'è
			rtGlobalDescSet_.Reset();
			rtGlobalDescSet_.SetCsCbv(0, sceneCBVs_[frameIndex].GetDescInfo().cpuHandle);
			rtGlobalDescSet_.SetCsSrv(1, randomBufferSRV_.GetDescInfo().cpuHandle);
			rtGlobalDescSet_.SetCsUav(0, resultTextureUAV_.GetDescInfo().cpuHandle);
			rtGlobalDescSet_.SetCsUav(1, seedBufferUAV_.GetDescInfo().cpuHandle);

			// ƒRƒs['µ''ƒRƒ}ƒ"ƒhƒŠƒXƒg'ɐςÞ
			D3D12_GPU_VIRTUAL_ADDRESS as_address[] = {
				topAS_.GetDxrBuffer().GetResourceDep()->GetGPUVirtualAddress(),
			};
			cmdList.SetRaytracingGlobalRootSignatureAndDescriptorSet(&rtGlobalRootSig_, &rtGlobalDescSet_, &rtDescMan_, as_address, ARRAYSIZE(as_address));

			// ƒŒƒCƒgƒŒ[ƒX'ðŽÀs
			D3D12_DISPATCH_RAYS_DESC desc{};
			desc.HitGroupTable.StartAddress = hitGroupTable_.GetResourceDep()->GetGPUVirtualAddress();
			desc.HitGroupTable.SizeInBytes = hitGroupTable_.GetSize();
			desc.HitGroupTable.StrideInBytes = shaderRecordSize_;
			desc.MissShaderTable.StartAddress = missTable_.GetResourceDep()->GetGPUVirtualAddress();
			desc.MissShaderTable.SizeInBytes = missTable_.GetSize();
			desc.MissShaderTable.StrideInBytes = shaderRecordSize_;
			desc.RayGenerationShaderRecord.StartAddress = rayGenTable_.GetResourceDep()->GetGPUVirtualAddress();
			desc.RayGenerationShaderRecord.SizeInBytes = rayGenTable_.GetSize();
			desc.Width = kScreenWidth;
			desc.Height = kScreenHeight;
			desc.Depth = 1;
			dxrCmdList->SetPipelineState1(stateObject_.GetPSO());
			dxrCmdList->DispatchRays(&desc);

			cmdList.UAVBarrier(&resultTexture_);
		}

		gpuTimestamp_[frameIndex].Query(&cmdList);

		// ƒŠƒ\[ƒXƒoƒŠƒA
		cmdList.TransitionBarrier(&resultTexture_, D3D12_RESOURCE_STATE_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE);

		{
			// ƒŒƒ"ƒ_[ƒ^[ƒQƒbƒgÝ'è
			auto&& rtv = swapchain.GetCurrentRenderTargetView()->GetDescInfo().cpuHandle;
			d3dCmdList->OMSetRenderTargets(1, &rtv, false, nullptr);

			D3D12_VIEWPORT vp;
			vp.TopLeftX = vp.TopLeftY = 0.0f;
			vp.Width = kScreenWidth;
			vp.Height = kScreenHeight;
			vp.MinDepth = 0.0f;
			vp.MaxDepth = 1.0f;
			d3dCmdList->RSSetViewports(1, &vp);

			D3D12_RECT rect;
			rect.left = rect.top = 0;
			rect.right = kScreenWidth;
			rect.bottom = kScreenHeight;
			d3dCmdList->RSSetScissorRects(1, &rect);

			// PSOÝ'è
			d3dCmdList->SetPipelineState(copyPso_.GetPSO());

			// RootSignature'ÆDescriptorÝ'è
			descSet_.Reset();
			descSet_.SetPsSrv(0, resultTextureSRV_.GetDescInfo().cpuHandle);
			descSet_.SetPsSampler(0, linearClampSampler_.GetDescInfo().cpuHandle);
			cmdList.SetGraphicsRootSignatureAndDescriptorSet(&copyRootSig_, &descSet_);

			// DrawCall
			d3dCmdList->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
			d3dCmdList->IASetVertexBuffers(0, 0, nullptr);
			d3dCmdList->IASetIndexBuffer(nullptr);
			d3dCmdList->DrawInstanced(3, 1, 0, 0);
		}

		ImGui::Render();

		cmdList.TransitionBarrier(swapchain.GetCurrentTexture(), D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_PRESENT);
		cmdList.TransitionBarrier(&resultTexture_, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, D3D12_RESOURCE_STATE_UNORDERED_ACCESS);

		gpuTimestamp_[frameIndex].Query(&cmdList);
		gpuTimestamp_[frameIndex].Resolve(&cmdList);

		// ƒRƒ}ƒ"ƒhI—¹'ÆŽÀs
		cmdList.Close();
		cmdList.Execute();
		device_.WaitDrawDone();

		// ŽŸ'̃tƒŒ[ƒ€'Ö
		device_.Present(1);

		return true;
	}

	void Finalize() override
	{
		rayGenTable_.Destroy();
		missTable_.Destroy();
		hitGroupTable_.Destroy();

		for (auto&& v : sceneCBVs_) v.Destroy();
		for (auto&& v : sceneCBs_) v.Destroy();

		for (auto&& v : gpuTimestamp_) v.Destroy();

		gui_.Destroy();

		topAS_.Destroy();
		bottomAS_.Destroy();

		instanceSBV_.Destroy();
		instanceSB_.Destroy();
		spheresAABB_.Destroy();

		randomBufferSRV_.Destroy();
		randomBuffer_.Destroy();
		seedBufferUAV_.Destroy();
		seedBuffer_.Destroy();

		resultTextureUAV_.Destroy();
		resultTextureRTV_.Destroy();
		resultTextureSRV_.Destroy();
		resultTexture_.Destroy();

		copyPso_.Destroy();
		copyVS_.Destroy();
		copyPS_.Destroy();
		stateObject_.Destroy();

		rtDescMan_.Destroy();
		copyRootSig_.Destroy();
		rtLocalRootSig_.Destroy();
		rtGlobalRootSig_.Destroy();

		for (auto&& v : cmdLists_) v.Destroy();
	}

	int Input(UINT message, WPARAM wParam, LPARAM lParam)
	{
		switch (message)
		{
		case WM_LBUTTONDOWN:
			inputData_.mouseButton |= sl12::MouseButton::Left;
			return 0;
		case WM_RBUTTONDOWN:
			inputData_.mouseButton |= sl12::MouseButton::Right;
			return 0;
		case WM_MBUTTONDOWN:
			inputData_.mouseButton |= sl12::MouseButton::Middle;
			return 0;
		case WM_LBUTTONUP:
			inputData_.mouseButton &= ~sl12::MouseButton::Left;
			return 0;
		case WM_RBUTTONUP:
			inputData_.mouseButton &= ~sl12::MouseButton::Right;
			return 0;
		case WM_MBUTTONUP:
			inputData_.mouseButton &= ~sl12::MouseButton::Middle;
			return 0;
		case WM_MOUSEMOVE:
			inputData_.mouseX = GET_X_LPARAM(lParam);
			inputData_.mouseY = GET_Y_LPARAM(lParam);
			return 0;
		}

		return 0;
	}

private:
	bool CreateRootSig(const D3D12_ROOT_SIGNATURE_DESC& desc, ID3D12RootSignature** ppSig)
	{
		ID3DBlob* blob = nullptr;
		ID3DBlob* error = nullptr;
		bool ret = true;

		auto hr = D3D12SerializeRootSignature(&desc, D3D_ROOT_SIGNATURE_VERSION_1, &blob, &error);
		if (FAILED(hr))
		{
			ret = false;
			goto D3D_ERROR;
		}

		hr = device_.GetDeviceDep()->CreateRootSignature(1, blob->GetBufferPointer(), blob->GetBufferSize(), IID_PPV_ARGS(ppSig));
		if (FAILED(hr))
		{
			ret = false;
			goto D3D_ERROR;
		}

	D3D_ERROR:
		sl12::SafeRelease(blob);
		sl12::SafeRelease(error);
		return ret;
	}

	bool CreatePipelineState()
	{
		// DXR—p'̃pƒCƒvƒ‰ƒCƒ"ƒXƒe[ƒg'𐶐¬'µ'Ü'·.
		// Graphics—pACompute—p'̃pƒCƒvƒ‰ƒCƒ"ƒXƒe[ƒg'͐¶¬Žž'ɌŒèƒTƒCƒY'Ì‹LqŽq'ð—pˆÓ'µ'Ü'·.
		// '±'ê'ɑ΂µ'āADXR—p'̃pƒCƒvƒ‰ƒCƒ"ƒXƒe[ƒg'͉•ό'̃TƒuƒIƒuƒWƒFƒNƒg'ð•K—v'Æ'µ'Ü'·.
		// 'Ü'½AƒTƒuƒIƒuƒWƒFƒNƒg'Ì'†'É'Í'¼'̃TƒuƒIƒuƒWƒFƒNƒg'ւ̃|ƒCƒ"ƒ^'ð•K—v'Æ'·'é'à'Ì'à' '邽'߁AƒTƒuƒIƒuƒWƒFƒNƒg"z—ñ'̐¶¬'É'Í'ˆÓ'ª•K—v'Å'·.

		sl12::DxrPipelineStateDesc dxrDesc;

		// DXILƒ‰ƒCƒuƒ‰ƒŠƒTƒuƒIƒuƒWƒFƒNƒg
		// 1''̃VƒF[ƒ_ƒ‰ƒCƒuƒ‰ƒŠ'ƁA'»'±'É"o˜^'³'ê'Ä'¢'éƒVƒF[ƒ_'̃Gƒ"ƒgƒŠ[ƒ|ƒCƒ"ƒg'ðƒGƒNƒXƒ|[ƒg'·'邽'߂̃TƒuƒIƒuƒWƒFƒNƒg'Å'·.
		D3D12_EXPORT_DESC libExport[] = {
			{ kRayGenName,				nullptr, D3D12_EXPORT_FLAG_NONE },
			{ kClosestHitName,			nullptr, D3D12_EXPORT_FLAG_NONE },
			{ kAnyHitName,				nullptr, D3D12_EXPORT_FLAG_NONE },
			{ kMissName,				nullptr, D3D12_EXPORT_FLAG_NONE },
			{ kMissShadowName,			nullptr, D3D12_EXPORT_FLAG_NONE },
		};
		dxrDesc.AddDxilLibrary(g_pTestLib, sizeof(g_pTestLib), libExport, ARRAYSIZE(libExport));

		// ƒqƒbƒgƒOƒ‹[ƒvƒTƒuƒIƒuƒWƒFƒNƒg
		// Intersection, AnyHit, ClosestHit'Ì'g'ݍ‡'킹'ð'è‹`'µAƒqƒbƒgƒOƒ‹[ƒv–¼'Å'Ü'Æ'ß'éƒTƒuƒIƒuƒWƒFƒNƒg'Å'·.
		// ƒ}ƒeƒŠƒAƒ‹'²'Æ'â—p"r'²'Æ(ƒ}ƒeƒŠƒAƒ‹AƒVƒƒƒhƒE'È'Ç)'ɃTƒuƒIƒuƒWƒFƒNƒg'ð—pˆÓ'µ'Ü'·.
		dxrDesc.AddHitGroup(kHitGroupName, true, kAnyHitName, kClosestHitName, nullptr);
		dxrDesc.AddHitGroup(kHitGroupShadowName, true, kAnyHitName, nullptr, nullptr);

		// ƒVƒF[ƒ_ƒRƒ"ƒtƒBƒOƒTƒuƒIƒuƒWƒFƒNƒg
		// ƒqƒbƒgƒVƒF[ƒ_Aƒ~ƒXƒVƒF[ƒ_'̈ø"'Æ'È'éPayload, IntersectionAttributes'̍őåƒTƒCƒY'ðÝ'肵'Ü'·.
#if 0
		dxrDesc.AddShaderConfig(sizeof(float) * 4 + sizeof(sl12::u32) + sizeof(float), sizeof(float) * 2);
#else
		dxrDesc.AddShaderConfig(sizeof(float) * 4 + sizeof(float) * 3 * 3 + sizeof(sl12::u32), sizeof(float) * 2);
#endif

		// ƒ[ƒJƒ‹ƒ‹[ƒgƒVƒOƒlƒ`ƒƒƒTƒuƒIƒuƒWƒFƒNƒg
		// ƒVƒF[ƒ_ƒŒƒR[ƒh'²'Ƃɐݒ肳'ê'郋[ƒgƒVƒOƒlƒ`ƒƒ'ðÝ'肵'Ü'·.

		// Exports Assosiation ƒTƒuƒIƒuƒWƒFƒNƒg
		// ƒVƒF[ƒ_ƒŒƒR[ƒh'ƃ[ƒJƒ‹ƒ‹[ƒgƒVƒOƒlƒ`ƒƒ'̃oƒCƒ"ƒh'ðs'¤ƒTƒuƒIƒuƒWƒFƒNƒg'Å'·.
		LPCWSTR kExports[] = {
			kRayGenName,
			kMissName,
			kMissShadowName,
			kHitGroupName,
			kHitGroupShadowName,
		};
		dxrDesc.AddLocalRootSignatureAndExportAssociation(rtLocalRootSig_, kExports, ARRAYSIZE(kExports));

		// ƒOƒ[ƒoƒ‹ƒ‹[ƒgƒVƒOƒlƒ`ƒƒƒTƒuƒIƒuƒWƒFƒNƒg
		// '·'ׂẴVƒF[ƒ_ƒe[ƒuƒ‹'ÅŽQÆ'³'ê'éƒOƒ[ƒoƒ‹'ȃ‹[ƒgƒVƒOƒlƒ`ƒƒ'ðÝ'肵'Ü'·.
		dxrDesc.AddGlobalRootSignature(rtGlobalRootSig_);

		// ƒŒƒCƒgƒŒ[ƒXƒRƒ"ƒtƒBƒOƒTƒuƒIƒuƒWƒFƒNƒg
		// TraceRay()'ðs'¤'±'Æ'ª'Å'«'éÅ'å["x'ðŽw'è'·'éƒTƒuƒIƒuƒWƒFƒNƒg'Å'·.
		dxrDesc.AddRaytracinConfig(2);

		// PSO¶¬
		if (!stateObject_.Initialize(&device_, dxrDesc))
		{
			return false;
		}

		return true;
	}

	bool CreateGeometry()
	{
#if !defined(USE_MEET_MAT)
		if (!glbMesh_.Initialize(&device_, &cmdLists_[0], "data/", "sponza.glb"))
#else
		if (!glbMesh_.Initialize(&device_, &cmdLists_[0], "data/", "MeetMat.glb"))
#endif
		{
			return false;
		}

		return true;
	}

	bool CreateAccelerationStructure()
	{
		// AS'̐¶¬'ÍGPU'ōs'¤'½'߁AƒRƒ}ƒ"ƒh'ðÏ'ÝGPU'𓮍삳'¹'é•K—v'ª' 'è'Ü'·.
		auto&& cmdList = cmdLists_[0];
		cmdList.Reset();

		// Bottom AS'̐¶¬€"õ
		std::vector< sl12::GeometryStructureDesc> geoDescs(glbMesh_.GetSubmeshCount());
		for (int i = 0; i < glbMesh_.GetSubmeshCount(); i++)
		{
			auto submesh = glbMesh_.GetSubmesh(i);
			geoDescs[i].InitializeAsTriangle(
				D3D12_RAYTRACING_GEOMETRY_FLAG_NONE,
				&submesh->GetPositionB(),
				&submesh->GetIndexB(),
				nullptr,
				(UINT64)submesh->GetPositionB().GetStride(),
				static_cast<UINT>(submesh->GetPositionB().GetSize() / submesh->GetPositionB().GetStride()),
				DXGI_FORMAT_R32G32B32_FLOAT,
				static_cast<UINT>(submesh->GetIndexB().GetSize() / submesh->GetIndexB().GetStride()),
				DXGI_FORMAT_R32_UINT);
		}

		sl12::StructureInputDesc bottomInput{};
		if (!bottomInput.InitializeAsBottom(&device_, geoDescs.data(), glbMesh_.GetSubmeshCount(), D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_PREFER_FAST_TRACE))
		{
			return false;
		}

		if (!bottomAS_.CreateBuffer(&device_, bottomInput.prebuildInfo.ResultDataMaxSizeInBytes, bottomInput.prebuildInfo.ScratchDataSizeInBytes))
		{
			return false;
		}

		// ƒRƒ}ƒ"ƒh"s
		if (!bottomAS_.Build(&device_, &cmdList, bottomInput))
		{
			return false;
		}

		// Top AS'̐¶¬€"õ
		sl12::StructureInputDesc topInput{};
		if (!topInput.InitializeAsTop(&device_, 1, D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_PREFER_FAST_TRACE))
		{
			return false;
		}

		sl12::TopInstanceDesc topInstance{};
		DirectX::XMFLOAT4X4 mtx;
#if !defined(USE_MEET_MAT)
		DirectX::XMMATRIX scale = DirectX::XMMatrixScaling(20.0f, 20.0f, 20.0f);
#else
		DirectX::XMMATRIX scale = DirectX::XMMatrixScaling(3.0f, 3.0f, 3.0f);
#endif
		DirectX::XMStoreFloat4x4(&mtx, scale);
		topInstance.Initialize(mtx, &bottomAS_);

		if (!topAS_.CreateBuffer(&device_, topInput.prebuildInfo.ResultDataMaxSizeInBytes, topInput.prebuildInfo.ScratchDataSizeInBytes))
		{
			return false;
		}
		if (!topAS_.CreateInstanceBuffer(&device_, &topInstance, 1))
		{
			return false;
		}

		// ƒRƒ}ƒ"ƒh"s
		if (!topAS_.Build(&cmdList, topInput, false))
		{
			return false;
		}

		// ƒRƒ}ƒ"ƒhŽÀs'ƏI—¹'Ò'¿
		cmdList.Close();
		cmdList.Execute();
		device_.WaitDrawDone();

		bottomAS_.DestroyScratchBuffer();
		topAS_.DestroyScratchBuffer();
		topAS_.DestroyInstanceBuffer();

		return true;
	}

	bool CreateSceneCB()
	{
		// ƒŒƒC¶¬ƒVƒF[ƒ_'ÅŽg—p'·'é'萔ƒoƒbƒtƒ@'𐶐¬'·'é
		auto mtxWorldToView = DirectX::XMMatrixLookAtLH(
			DirectX::XMLoadFloat4(&camPos_),
			DirectX::XMLoadFloat4(&tgtPos_),
			DirectX::XMLoadFloat4(&upVec_));
		auto mtxViewToClip = DirectX::XMMatrixPerspectiveFovLH(DirectX::XMConvertToRadians(60.0f), (float)kScreenWidth / (float)kScreenHeight, 0.01f, 100.0f);
		auto mtxWorldToClip = mtxWorldToView * mtxViewToClip;
		auto mtxClipToWorld = DirectX::XMMatrixInverse(nullptr, mtxWorldToClip);

		DirectX::XMFLOAT4 lightDir = { 0.0f, -1.0f, 0.0f, 0.0f };
		DirectX::XMStoreFloat4(&lightDir, DirectX::XMVector3Normalize(DirectX::XMLoadFloat4(&lightDir)));

		DirectX::XMFLOAT4 lightColor = { 1.0f, 1.0f, 1.0f, 1.0f };

		for (int i = 0; i < kBufferCount; i++)
		{
			if (!sceneCBs_[i].Initialize(&device_, sizeof(SceneCB), 0, sl12::BufferUsage::ConstantBuffer, true, false))
			{
				return false;
			}
			else
			{
				auto cb = reinterpret_cast<SceneCB*>(sceneCBs_[i].Map(nullptr));
				DirectX::XMStoreFloat4x4(&cb->mtxProjToWorld, mtxClipToWorld);
				cb->camPos = camPos_;
				cb->lightDir = lightDir;
				cb->lightColor = lightColor;
				cb->skyPower = skyPower_;
				cb->loopCount = 0;
				cb->maxBounces = maxBounces_;
				sceneCBs_[i].Unmap();

				if (!sceneCBVs_[i].Initialize(&device_, &sceneCBs_[i]))
				{
					return false;
				}
			}
		}

		return true;
	}

	bool CreateShaderTable()
	{
		// LocalRS—p'̃}ƒeƒŠƒAƒ‹Descriptor'ð—pˆÓ'·'é
		std::vector<D3D12_GPU_DESCRIPTOR_HANDLE> gpu_handles;
		auto view_desc_size = rtDescMan_.GetViewDescSize();
		auto sampler_desc_size = rtDescMan_.GetSamplerDescSize();
		auto local_handle_start = rtDescMan_.IncrementLocalHandleStart();

		for (int i = 0; i < glbMesh_.GetSubmeshCount(); i++)
		{
			auto submesh = glbMesh_.GetSubmesh(i);
			auto material = glbMesh_.GetMaterial(submesh->GetMaterialIndex());
			auto texView = glbMesh_.GetTextureView(material->GetTexBaseColorIndex());
			auto texNView = glbMesh_.GetTextureView(material->GetTexNormalIndex());

			// CBV'Í'È'µ
			gpu_handles.push_back(local_handle_start.viewGpuHandle);

			// SRV'Í6'Â
			D3D12_CPU_DESCRIPTOR_HANDLE srv[] = {
				submesh->GetIndexBV().GetDescInfo().cpuHandle,
				submesh->GetPositionBV().GetDescInfo().cpuHandle,
				submesh->GetNormalBV().GetDescInfo().cpuHandle,
				submesh->GetTexcoordBV().GetDescInfo().cpuHandle,
				texView->GetDescInfo().cpuHandle,
				texNView->GetDescInfo().cpuHandle
			};
			sl12::u32 srv_cnt = ARRAYSIZE(srv);
			device_.GetDeviceDep()->CopyDescriptors(
				1, &local_handle_start.viewCpuHandle, &srv_cnt,
				srv_cnt, srv, nullptr, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
			gpu_handles.push_back(local_handle_start.viewGpuHandle);
			local_handle_start.viewCpuHandle.ptr += view_desc_size * srv_cnt;
			local_handle_start.viewGpuHandle.ptr += view_desc_size * srv_cnt;

			// UAV'Í'È'µ
			gpu_handles.push_back(local_handle_start.viewGpuHandle);

			// Sampler'Í1'Â
			D3D12_CPU_DESCRIPTOR_HANDLE sampler[] = {
				imageSampler_.GetDescInfo().cpuHandle,
			};
			sl12::u32 sampler_cnt = ARRAYSIZE(sampler);
			device_.GetDeviceDep()->CopyDescriptors(
				1, &local_handle_start.samplerCpuHandle, &sampler_cnt,
				sampler_cnt, sampler, nullptr, D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER);
			gpu_handles.push_back(local_handle_start.samplerGpuHandle);
			local_handle_start.samplerCpuHandle.ptr += sampler_desc_size * sampler_cnt;
			local_handle_start.samplerGpuHandle.ptr += sampler_desc_size * sampler_cnt;
		}

		// ƒŒƒC¶¬ƒVƒF[ƒ_Aƒ~ƒXƒVƒF[ƒ_AƒqƒbƒgƒOƒ‹[ƒv'ÌID'ðŽæ"¾'µ'Ü'·.
		// ŠeƒVƒF[ƒ_Ží•Ê'²'ƂɃVƒF[ƒ_ƒe[ƒuƒ‹'ðì¬'µ'Ü'·'ªA'±'̃Tƒ"ƒvƒ‹'Å'ÍŠeƒVƒF[ƒ_Ží•Ê'Í'»'ꂼ'ê1''̃VƒF[ƒ_'ðŽ'Â'±'Æ'É'È'è'Ü'·.
		void* rayGenShaderIdentifier;
		void* missShaderIdentifier[2];
		void* hitGroupShaderIdentifier[2];
		{
			ID3D12StateObjectProperties* prop;
			stateObject_.GetPSO()->QueryInterface(IID_PPV_ARGS(&prop));
			rayGenShaderIdentifier = prop->GetShaderIdentifier(kRayGenName);
			missShaderIdentifier[0] = prop->GetShaderIdentifier(kMissName);
			missShaderIdentifier[1] = prop->GetShaderIdentifier(kMissShadowName);
			hitGroupShaderIdentifier[0] = prop->GetShaderIdentifier(kHitGroupName);
			hitGroupShaderIdentifier[1] = prop->GetShaderIdentifier(kHitGroupShadowName);
			prop->Release();
		}

		UINT shaderIdentifierSize = D3D12_SHADER_IDENTIFIER_SIZE_IN_BYTES;

		auto Align = [](UINT size, UINT align)
		{
			return ((size + align - 1) / align) * align;
		};

		// ƒVƒF[ƒ_ƒŒƒR[ƒhƒTƒCƒY
		// ƒVƒF[ƒ_ƒŒƒR[ƒh'̓VƒF[ƒ_ƒe[ƒuƒ‹'Ì—v'f1''ł·.
		// '±'ê'̓VƒF[ƒ_ID'ƃ[ƒJƒ‹ƒ‹[ƒgƒVƒOƒlƒ`ƒƒ'ɐݒ肳'ê'é•Ï"'Ì'g'ݍ‡'킹'ō\¬'³'ê'Ä'¢'Ü'·.
		// ƒVƒF[ƒ_ƒŒƒR[ƒh'̃TƒCƒY'̓VƒF[ƒ_ƒe[ƒuƒ‹"à'Å"¯ˆê'Å'È'¯'ê'΂Ȃç'È'¢'½'߁A"¯ˆêƒVƒF[ƒ_ƒe[ƒuƒ‹"à'ōőå'̃ŒƒR[ƒhƒTƒCƒY'ðŽw'è'·'ׂ«'Å'·.
		// –{ƒTƒ"ƒvƒ‹'Å'Í'·'ׂẴVƒF[ƒ_ƒŒƒR[ƒh'ɂ'¢'ăTƒCƒY'ª"¯ˆê'Æ'È'è'Ü'·.
		UINT descHandleOffset = Align(shaderIdentifierSize, sizeof(D3D12_GPU_DESCRIPTOR_HANDLE));
		UINT shaderRecordSize = Align(descHandleOffset + sizeof(D3D12_GPU_DESCRIPTOR_HANDLE) * 4, D3D12_RAYTRACING_SHADER_RECORD_BYTE_ALIGNMENT);
		shaderRecordSize_ = shaderRecordSize;

		auto GenShaderTable = [&](void** shaderIds, int shaderIdsCount, sl12::Buffer& buffer, int count = 1)
		{
			if (!buffer.Initialize(&device_, shaderRecordSize * count * shaderIdsCount, 0, sl12::BufferUsage::ShaderResource, D3D12_RESOURCE_STATE_GENERIC_READ, true, false))
			{
				return false;
			}

			auto p = reinterpret_cast<char*>(buffer.Map(nullptr));

			for (int i = 0; i < count; ++i)
			{
				for (int id = 0; id < shaderIdsCount; ++id)
				{
					auto start = p;

					memcpy(p, shaderIds[id], shaderIdentifierSize);
					p += descHandleOffset;

					memcpy(p, gpu_handles.data() + i * 4, sizeof(D3D12_GPU_DESCRIPTOR_HANDLE) * 4);

					p = start + shaderRecordSize;
				}
			}
			buffer.Unmap();

			return true;
		};

		if (!GenShaderTable(&rayGenShaderIdentifier, 1, rayGenTable_))
		{
			return false;
		}
		if (!GenShaderTable(missShaderIdentifier, 2, missTable_))
		{
			return false;
		}
		if (!GenShaderTable(hitGroupShaderIdentifier, 2, hitGroupTable_, glbMesh_.GetSubmeshCount()))
		{
			return false;
		}

		return true;
	}

	void UpdateSceneCB(int frameIndex)
	{
		auto mtxRot = DirectX::XMMatrixRotationY(camRotAngle_);
		auto cp = DirectX::XMLoadFloat4(&camPos_);
		cp = DirectX::XMVector4Transform(cp, mtxRot);

		auto mtxWorldToView = DirectX::XMMatrixLookAtLH(
			cp,
			DirectX::XMLoadFloat4(&tgtPos_),
			DirectX::XMLoadFloat4(&upVec_));
		auto mtxViewToClip = DirectX::XMMatrixPerspectiveFovLH(DirectX::XMConvertToRadians(60.0f), (float)kScreenWidth / (float)kScreenHeight, 0.01f, 100.0f);
		auto mtxWorldToClip = mtxWorldToView * mtxViewToClip;
		auto mtxClipToWorld = DirectX::XMMatrixInverse(nullptr, mtxWorldToClip);

		DirectX::XMFLOAT4 lightDir = { 0.0f, -1.0f, 0.0f, 0.0f };
		DirectX::XMStoreFloat4(&lightDir, DirectX::XMVector3Normalize(DirectX::XMLoadFloat4(&lightDir)));

		DirectX::XMFLOAT4 lightColor = { lightColor_[0] * lightPower_, lightColor_[1] * lightPower_, lightColor_[2] * lightPower_, 1.0f };

		auto cb = reinterpret_cast<SceneCB*>(sceneCBs_[frameIndex].Map(nullptr));
		DirectX::XMStoreFloat4x4(&cb->mtxProjToWorld, mtxClipToWorld);
		DirectX::XMStoreFloat4(&cb->camPos, cp);
		cb->lightDir = lightDir;
		cb->lightColor = lightColor;
		cb->skyPower = skyPower_;
		cb->loopCount = loopCount_++;
		cb->maxBounces = maxBounces_;
		sceneCBs_[frameIndex].Unmap();
	}

private:
	static const int kBufferCount = sl12::Swapchain::kMaxBuffer;

	sl12::CommandList		cmdLists_[kBufferCount];
	sl12::RootSignature		rtGlobalRootSig_, rtLocalRootSig_;
	sl12::RaytracingDescriptorManager	rtDescMan_;
	sl12::DescriptorSet					rtGlobalDescSet_;

	sl12::DxrPipelineState		stateObject_;
	sl12::Texture				resultTexture_;
	sl12::TextureView			resultTextureSRV_;
	sl12::RenderTargetView		resultTextureRTV_;
	sl12::UnorderedAccessView	resultTextureUAV_;

	sl12::Buffer				randomBuffer_;
	sl12::BufferView			randomBufferSRV_;
	sl12::Buffer				seedBuffer_;
	sl12::UnorderedAccessView	seedBufferUAV_;

	sl12::GlbMesh			glbMesh_;
	sl12::Sampler			imageSampler_;

	sl12::BottomAccelerationStructure	bottomAS_;
	sl12::TopAccelerationStructure		topAS_;

	sl12::Buffer				sceneCBs_[kBufferCount];
	sl12::ConstantBufferView	sceneCBVs_[kBufferCount];

	sl12::Buffer			rayGenTable_, missTable_, hitGroupTable_;
	sl12::u64				shaderRecordSize_;

	std::vector<Sphere>		spheres_;
	sl12::Buffer			spheresAABB_;
	sl12::Buffer			instanceSB_;
	sl12::BufferView		instanceSBV_;

	sl12::Shader				copyVS_, copyPS_;
	sl12::RootSignature			copyRootSig_;
	sl12::GraphicsPipelineState	copyPso_;
	sl12::DescriptorSet			descSet_;

	sl12::Gui				gui_;
	sl12::InputData			inputData_{};

	sl12::Timestamp			gpuTimestamp_[sl12::Swapchain::kMaxBuffer];

#if !defined(USE_MEET_MAT)
	DirectX::XMFLOAT4		camPos_ = { -5.0f, -5.0f, 0.0f, 1.0f };
	DirectX::XMFLOAT4		tgtPos_ = { 0.0f, -5.0f, 0.0f, 1.0f };
#else
	DirectX::XMFLOAT4		camPos_ = { -5.0f, 3.0f, 0.0f, 1.0f };
	DirectX::XMFLOAT4		tgtPos_ = { 0.0f, 0.0f, 0.0f, 1.0f };
#endif
	DirectX::XMFLOAT4		upVec_ = { 0.0f, 1.0f, 0.0f, 0.0f };
	float					skyPower_ = 1.0f;
	float					lightColor_[3] = { 1.0f, 1.0f, 1.0f };
	float					lightPower_ = 1.0f;
	uint32_t				loopCount_ = 0;
	int						maxBounces_ = 4;
	float					camRotAngle_ = 0.0f;
	bool					isClearTarget_ = true;

	int		frameIndex_ = 0;
};	// class SampleApplication

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow)
{
	SampleApplication app(hInstance, nCmdShow, kScreenWidth, kScreenHeight);

	return app.Run();
}

//	EOF


text:
  <dropdown-menu-btn
    label="'Post to ' + vm.publishDestination()"
    on-click="vm.onSave(); vm.moveToNext()"
    on-toggle-dropdown="vm.showDropdown = !vm.showDropdown"
    title="Publish this annotation to {{vm.publishDestination()}}"
    dropdown-menu-label="Change annotation sharing setting"
    is-disabled="!vm.canPost">
  </dropdown-menu-btn>

<button class="publish-annotation-cancel-btn btn-clean"
        ng-click="vm.onCancel()"
        title="Cancel changes to this annotation"
        >
   Cancel
</button>

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>H+ 后台主题UI框架 - css动画</title>
    <meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
    <meta name="description" content="H+是一个完全响应式,基于Bootstrap3最新版本开发的扁平化主题,她采用了主流的左右两栏式布局,使用了Html5+CSS3等现代技术">

    <link rel="shortcut icon" href="favicon.ico"> <link href="css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="css/animate.min.css" rel="stylesheet">
    <link href="css/style.min862f.css?v=4.1.0" rel="stylesheet">

CSS动画 http://daneden.github.io/animate.css/

选项1

选项2

                            Animation.css

                            Animation.css是一个迷人的动画库,它提供了一堆很酷的,有趣的,跨浏览器的动画,你可以在项目中调用它们。

                                    动画效果示例框

48%

市场销售额

                                    点击下面按钮,可以从"动画效果示例框"中预览效果

                                bounce
                                flash
                                pulse
                                rubberBand
                                shake
                                swing
                                tada
                                wobble

                                bounceIn
                                bounceInDown
                                bounceInLeft
                                bounceInRight
                                bounceInUp

                                bounceOut
                                bounceOutDown
                                bounceOutLeft
                                bounceOutRight
                                bounceOutUp

                                fadeIn
                                fadeInDown
                                fadeInDownBig
                                fadeInLeft
                                fadeInLeftBig
                                fadeInRight
                                fadeInRightBig
                                fadeInUp
                                fadeInUpBig

                                fadeOut
                                fadeOutDown
                                fadeOutDownBig
                                fadeOutLeft
                                fadeOutLeftBig
                                fadeOutRight
                                fadeOutRightBig
                                fadeOutUp
                                fadeOutUpBig

                                flip
                                flipInX
                                flipInY
                                flipOutX
                                flipOutY

                                lightSpeedIn
                                lightSpeedOut

                                rotateIn
                                rotateInDownLeft
                                rotateInDownRight
                                rotateInUpLeft
                                rotateInUpRight

                                rotateOut
                                rotateOutDownLeft
                                rotateOutDownRight
                                rotateOutUpLeft
                                rotateOutUpRight

                                slideInDown
                                slideInLeft
                                slideInRight
                                slideOutLeft
                                slideOutRight
                                slideOutUp

                                hinge
                                rollIn
                                rollOut


text:
<!DOCTYPE html>

    <title>jQuery WeUI</title>
    <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">

<meta name="description" content="Write an awesome description for your new site here. You can edit this line in _config.yml. It will appear in your document head meta (for Google search results) and in your feed.xml site description.
">

<link rel="stylesheet" href="../lib/weui.min.css">
<link rel="stylesheet" href="../css/jquery-weui.css">
<link rel="stylesheet" href="css/demos.css">

Toptip

      显示成功
      显示失败
      显示警告


text:
from django.contrib import admin
from points.models import Place

admin.site.register(Place)


text:
function [funcHs, hyperParams] = multipleGPRegressionML(Xtrs, Ytrs, hyperParams)
% A function which learns the same kernel for multiple Gaussian processes using
% data from all GPs.
% We will use a Gaussian kernel of the form  scale * exp(-||x-x'||^2/2*bw^2)
% Inputs
%   Xtrs: a numGPs x 1 cell array where each element is the X matrix for that GP.
%   Ytrs: a numGPs x 1 cell array where each element is the Y vector for that GP.
%   hyperParams: a struct which (optionally) has the following fields.
%     meanFuncs: a numGPs x 1 cell array of function handles for the prior GP mean.
%                If just a single function, we will use it for all GPs.
%     noisVars: a numGPs x 1 vector of positive scalars for the GP noise. If just a
%             single value, we will use it for all GPs.
%     bwRange: The range (lower and upper limits) for optimising the bandwidth via GP
%              marginal likelihood maximisation.
%     scaleRange: The range for choosing the scale for the kernel.
% Outputs
%   funcHs: a numGPs x 1 of function handles which output the posterior mean and
%     variance of the estimated GPs.
%   hyperParams: a struct which contains the optimal hyper parameters.

  % Check if we have only one dataset
  if isa(Xtrs, 'double'), Xtrs = {Xtrs}; end
  if isa(Ytrs, 'double'), Ytrs = {Ytrs}; end

  numGPs = numel(Xtrs);
  numDims = size(Xtrs{1}, 1);

  % Book-keeping Hyper-parameters
  % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%   DEFAULT_SAFE = true;
  DEFAULT_SAFE = false; % I missed some bugs due 2 default values. Disabling for now.
  if DEFAULT_SAFE
%     fprintf('**** Checking for Default values !!\n');
    if ~exist('hyperParams', 'var') | isempty(hyperParams)
      hyperParams = struct;
    end

    % Mean functions --------------------------------------------------------
    if ~isfield(hyperParams, 'meanFuncs')
      fprintf('** Using Default Mean Functions. ***');
      meanY = mean(cell2mat(Ytrs));
      hyperParams.meanFuncs = @(t) meanY * ones( size(t, 1), 1);
    end
    if size(hyperParams.meanFuncs, 1) == 1,
      meanFuncs = cell(numGPs, 1);
      for i = 1:numGPs, meanFuncs{i} = hyperParams.meanFuncs;
        end
      hyperParams.meanFuncs = meanFuncs;
    end

    % Noise parameters ------------------------------------------------------
    if ~isfield(hyperParams, 'noiseVars')
      fprintf('** Using Default Noise variances. ***');
      stdY = std(cell2mat(Ytrs));
      hyperParams.noiseVars = (0.05 * stdY)^2;
    end
    if size(hyperParams.noiseVars, 1) == 1
      hyperParams.noiseVars = hyperParams.noiseVars * ones(numGPs, 1);
    end

    % Range for the bandwidth -----------------------------------------------
    if ~isfield(hyperParams, 'bwRange') | isempty(hyperParams.bwRange)
      fprintf('** Using Default BW ranges. ***');
      stdX = norm(std( cell2mat(Xtrs) ));
      hyperParams.bwRange = [0.01 100] * stdX;
    end

    % Range for the scale ---------------------------------------------------
    if ~isfield(hyperParams, 'scaleRange') | isempty(hyperParams.scaleRange)
      fprintf('** Using Default scale ranges. ***');
      if ~exist('stdY', 'var'), stdY = std(cell2mat(Ytrs));
      end
      hyperParams.scaleRange = [0.01 100] * stdY;
    end

    if ~isfield(hyperParams, 'diRectOpts') | isempty(hyperParams.diRectOpts)
      fprintf('** Using Default DiRect Opt params. ***');
      diRectOpts.maxevals = 200;
      hyperParams.diRectOpts = diRectOpts;
    end

    if ~isfield(hyperParams, 'multGPLearnStrategy') | ...
      isempty(hyperParams.multGPLearnStrategy),
      fprintf('** Using Default Multiple GP Learn Strategy. ***');
      hyperParams.multGPLearnStrategy = 'usePrevious';
    end
  end
  % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

  % Bring all hyperparameters to workspace --------------------------------
  meanFuncs = hyperParams.meanFuncs;
  noiseVars = hyperParams.noiseVars;
  bwRange = hyperParams.bwRange;
  scaleRange = hyperParams.scaleRange;
  diRectOpts = hyperParams.diRectOpts;
  multGPLearnStrategy = hyperParams.multGPLearnStrategy;

  % Book-keeping Hyper-parameters ends here. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

  % Optimise for bw and scale using DiRect.
  % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  diRectBounds = [log(bwRange); log(scaleRange)];

  switch multGPLearnStrategy

    case {'usePrevious', 'jointLearn'}

      % if usePrevious ---------------------------------------------------------
      if strcmp(hyperParams.multGPLearnStrategy, 'usePrevious')
        % Use the previous GPs to initialise the mean of the following GP.
        prelimFuncHs = cell(numGPs, 1);
        bwOpt = zeros(numGPs, 1);
        scaleOpt = zeros(numGPs, 1);
        for i = 1:(numGPs-1)
          nlmlF = @(t) normMargLikelihood( exp(t(1)), exp(t(2)), Xtrs{i}, Ytrs{i}, ...
                        meanFuncs{i}, noiseVars(i));
          [~, optParams] = diRectWrap(nlmlF, diRectBounds, diRectOpts);
          bwOpt(i) = exp(optParams(1));
          scaleOpt(i) = exp(optParams(2));
          [~, ~, ~, currFuncH] = GPRegression([], Xtrs{i}, Ytrs{i}, ...
            bwOpt(i), scaleOpt(i), meanFuncs{i}, noiseVars(i));
          prelimFuncHs{i} = currFuncH;
          if i < numGPs
            meanFuncs{i+1} = prelimFuncHs{i};
          end
        end
      end
      % end if usePrevious ---------------------------------------------------

      anlmlF = @(t) allNormMargLikelihood( exp(t(1)), exp(t(2)), Xtrs, Ytrs, ...
        meanFuncs, noiseVars);
      [~, optParams] = diRectWrap(anlmlF, diRectBounds, diRectOpts);
      bwOpt = exp(optParams(1)) * ones(numGPs, 1);
      scaleOpt = exp(optParams(2)) * ones(numGPs, 1);
%       fprintf('Picked bw/scale = %0.5f (%0.3f, %0.3f), %0.5f (%0.3f, %0.3f)\n', ...
%         bwOpt(1), bwRange(1), bwRange(2), ...
%         scaleOpt(1), scaleRange(1), scaleRange(2) );

    case 'sepLearn'
      % Learn each GP Separately
      bwOpt = zeros(numGPs, 1);
      scaleOpt = zeros(numGPs, 1);
      for i = 1:numGPs
        if i==1 | (size(Ytrs{i},1) >= min(10, size(Ytrs{i-1},1)))
          nlmlF = @(t) normMargLikelihood( exp(t(1)), exp(t(2)), Xtrs{i}, Ytrs{i}, ...
                        meanFuncs{i}, noiseVars(i));
          [~, optParams] = diRectWrap(nlmlF, diRectBounds, diRectOpts);
          bwOpt(i) = exp(optParams(1));
          scaleOpt(i) = exp(optParams(2));
        else
          bwOpt(i) = bwOpt(i-1);
          scaleOpt(i) = scaleOpt(i-1);
        end
      end

    otherwise
      error('Unknown Multiple GP Learning strategy');
  end
  % Optimising for hyper-parameters ends here. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

  % Finally fit the GPs and get the Function Handles.
  funcHs = cell(numGPs, 1);
  for i = 1:numGPs
    [~, ~, ~, currFuncH] = GPRegression([], Xtrs{i}, Ytrs{i}, ...
      bwOpt(i), scaleOpt(i), meanFuncs{i}, noiseVars(i));
    funcHs{i} = currFuncH;
  end

  fprintf('Picked BWs: %s, (%0.4f,%.4f) Scales: %s, (%0.4f,%.4f).\n', ...
    mat2str(round(1e4*bwOpt)/1e4), bwRange(1), bwRange(2), ...
    mat2str(round(1e4*scaleOpt)/1e4), scaleRange(1), scaleRange(2));
  hyperParams.bw = bwOpt;
  hyperParams.scale = scaleOpt;

end

% This iterates through normMargLikelihood to obtain the totla marginal likelihood of
% all data.
function allNlml = allNormMargLikelihood(bw, scale, Xs, Ys, meanFuncs, noiseVars)
  numGPs = numel(Xs);
  allNlml = 0;
  for i = 1:numGPs
    if size(Xs{i}, 1) > 2
      currNlml = normMargLikelihood(bw, scale, Xs{i}, Ys{i}, meanFuncs{i}, ...
                                    noiseVars(i));
      allNlml = allNlml + currNlml;
    end
  end
end


text:
    <input type=submit value="Search">
</form>


text:
package com.laynemobile.proxy.cache;

import com.laynemobile.proxy.model.Alias;

import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;

public abstract class TypeElementCache<K extends TypeElement, V extends Alias<?>>
        extends AliasCache<K, V, Element> {

}


text:
import Controller from './Controller';
import dom from '../dom/dom';
import common from '../utils/common';

/**
 * @class Provides a select input to alter the property of an object, using a
 * list of accepted values.
 *
 * @extends dat.controllers.Controller
 *
 * @param {Object} object The object to be manipulated
 * @param {string} property The name of the property to be manipulated
 * @param {Object|string[]} options A map of labels to acceptable values, or
 * a list of acceptable string values.
 */
class OptionController extends Controller {
  constructor(object, property, opts) {
    super(object, property);

    let options = opts;

    const _this = this;

    /**
     * The drop down menu
     * @ignore
     */
    this.__select = document.createElement('select');

    if (common.isArray(options)) {
      const map = {};
      common.each(options, function(element) {
        map[element] = element;
      });
      options = map;
    }

    common.each(options, function(value, key) {
      const opt = document.createElement('option');
      opt.innerHTML = key;
      opt.setAttribute('value', value);
      _this.__select.appendChild(opt);
    });

    // Acknowledge original value
    this.updateDisplay();

    dom.bind(this.__select, 'change', function() {
      const desiredValue = this.options[this.selectedIndex].value;
      _this.setValue(desiredValue);
    });

    this.domElement.appendChild(this.__select);
  }

  setValue(v) {
    const toReturn = super.setValue(v);

    if (this.__onFinishChange) {
      this.__onFinishChange.call(this, this.getValue());
    }
    return toReturn;
  }

  updateDisplay() {
    if (dom.isActive(this.__select)) return this; // prevent number from updating if user is trying to manually update
    this.__select.value = this.getValue();
    return super.updateDisplay();
  }
}

export default OptionController;


text:
// An example configuration file.
exports.config = {
    // Do not start a Selenium Standalone sever - only run this using chrome.
    directConnect: true,
    //chromeDriver: './node_modules/protractor/selenium/chromedriver',
    // seleniumAddress: 'http://0.0.0.0:4444/wd/hub',
    // Capabilities to be passed to the webdriver instance.
    capabilities: {
        'browserName': 'chrome'
    },

   baseUrl: 'http://localhost:8000',

   allScriptsTimeout: 30000,

    // Spec patterns are relative to the current working directly when
    // protractor is called.
    specs: [
    'src/tests/e2e/**/*.js'
    ],

    // Options to be passed to Jasmine-node.
    jasmineNodeOpts: {
        showColors: true,
        defaultTimeoutInterval: 30000
    }
};


text:
import React from 'react';
import { shallow, mount } from 'enzyme';
import Forecast from '../lib/components/Forecast';
import DayWeather from '../lib/components/DayWeather.js';

import stubAPI from './stubAPI.json';
import objectCleanerForecast from '../lib/helpers/objectCleanerForecast';

describe('Forecast', () => {
  it('should run a data scrubber', () => {
    const cleanAPI = objectCleanerForecast(stubAPI);

    expect(cleanAPI[0].weekday).toEqual('Monday');
    expect(cleanAPI[0].conciseCondition).toEqual('Chance of Rain');
  });

  it('should not return unwanted data', () => {
    const cleanAPI = objectCleanerForecast(stubAPI);

    expect(cleanAPI[0].epoch).toBeFalsy();
    expect(cleanAPI[0].icon).toBeFalsy();
  });

  it('should render ten <scroll-item/> ', () => {
    const cleanAPI = objectCleanerForecast(stubAPI);
    const forecast = shallow(<DayWeather weather = {cleanAPI} />);
    const dayWeatherCount = forecast.find('.hourly-forecast-scroll');

    expect(dayWeatherCount).toHaveLength(10);
  });

  it('should render data from the API', () => {
    const cleanAPI = objectCleanerForecast(stubAPI);
    const forecast = shallow(<DayWeather weather = {cleanAPI} />);

    expect(forecast.containsAnyMatchingElements([
Chance of Rain
])).toEqual(true);
  });
});


text:
<?php

class Controller_Support_Chat extends Crunchbutton_Controller_Account {

	public function init() {

		if (!c::admin()->permission()->check(['global', 'support-all', 'support-view', 'support-crud' ])) {
			return ;
		}

		$support = Support::o( c::getPagePiece( 2 ) );
		$action = c::getPagePiece( 3 );
		switch ( $action ) {
			case 'history':
				c::view()->support = $support;
				c::view()->layout('layout/ajax');
				c::view()->display('support/chat-history');
				break;
			default:
				c::view()->support = $support;
				c::view()->layout('layout/ajax');
				c::view()->display('support/chat');
				break;
		}
	}
}


text:
<?php
return array(
    'doctrine' => array(
        'connection' => array(
            'odm_default' => array(
                'server'           => 'ds063150.mongolab.com',
                'port'             => '63150',
                'connectionString' => null,
                'user'             => 'root',
                'password'         => 'root',
                'dbname'           => 'mapquest',
                'options'          => array()
            ),
        ),

        'configuration' => array(
            'odm_default' => array(
                'metadata_cache'     => 'array',

                'driver'             => 'odm_default',

                'generate_proxies'   => true,
                'proxy_dir'          => 'data/DoctrineMongoODMModule/Proxy',
                'proxy_namespace'    => 'DoctrineMongoODMModule\Proxy',

                'generate_hydrators' => true,
                'hydrator_dir'       => 'data/DoctrineMongoODMModule/Hydrator',
                'hydrator_namespace' => 'DoctrineMongoODMModule\Hydrator',
//
               'default_db'         => 'mapquest'
//
//                'filters'            => array(),  // array('filterName' => 'BSON\Filter\Class'),
//
//                'logger'             => null // 'DoctrineMongoODMModule\Logging\DebugStack'
            )
        ),

        'driver' => array(
            'odm_default' => array(
//                'drivers' => array()
            )
        ),

        'documentmanager' => array(
            'odm_default' => array(
                'connection'    => 'odm_default',
               'configuration' => 'odm_default',
                'eventmanager' => 'odm_default'
            )
        ),

        'eventmanager' => array(
            'odm_default' => array(
                'subscribers' => array()
            )
        ),

        'authentication'    => array(
            'odm_default'   => array(
                'object_manager'        => 'doctrine.documentmanager.odm_default',
                'identity_class'        => 'Application\Document\User',
                'identity_property'     => 'username',
                'credential_property'   => 'password',
            ),
        ),

        'odm_driver' => array(
            'class' => 'Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver',
            'paths' => array(__DIR__ . '/../src/' . __NAMESPACE__ . '/Document')
        ),
        'odm_default' => array(
            'drivers' => array(
                __NAMESPACE__ . '\Document' => 'odm_driver'
            )
        ),

    ),

);


text:
package com.xiongyingqi.captcha.filter.library;

public abstract class AbstractTransformImageOp extends AbstractImageOp {

    protected abstract void transform(int x, int y, double[] t);

    protected void init() {
    }

    private boolean initialized;

    public AbstractTransformImageOp() {
        setEdgeMode(EDGE_CLAMP);
    }

    @Override
    protected void filter(int[] inPixels, int[] outPixels, int width, int height) {
        if (!initialized) {
            init();
            initialized = true;
        }
        long time1 = System.currentTimeMillis();
        double[] t = new double[2];
        for (int y = 0; y < height; y++) {
            for (int x = 0; x < width; x++) {
                transform(x, y, t);
                int pixel = getPixelBilinear(inPixels, t[0], t[1], width, height, getEdgeMode());
                outPixels[x + y * width] = pixel;
            }
        }
        long time2 = System.currentTimeMillis() - time1;
        //System.out.println("AbstractTransformImageOp " + time2);
    }

}


text:
package org.apache.camel.component.file;

import java.io.File;

import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.support.processor.idempotent.MemoryIdempotentRepository;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

/**
 * Unit test for the idempotent=true option.
 */
public class FileConsumerIdempotentTest extends ContextTestSupport {

    private String uri = "file://target/data/idempotent/?idempotent=true&move=done/${file:name}&initialDelay=0&delay=10";

    @Override
    @BeforeEach
    public void setUp() throws Exception {
        deleteDirectory("target/data/idempotent");
        super.setUp();
        template.sendBodyAndHeader("file://target/data/idempotent", "Hello World", Exchange.FILE_NAME, "report.txt");
    }

    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            public void configure() throws Exception {
                from(uri).convertBodyTo(String.class).to("mock:result");
            }
        };
    }

    @Test
    public void testIdempotent() throws Exception {
        // consume the file the first time
        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedBodiesReceived("Hello World");

        assertMockEndpointsSatisfied();

        oneExchangeDone.matchesWaitTime();

        // reset mock and set new expectations
        mock.reset();
        mock.expectedMessageCount(0);

        // move file back
        File file = new File("target/data/idempotent/done/report.txt");
        File renamed = new File("target/data/idempotent/report.txt");
        file.renameTo(renamed);

        // should NOT consume the file again, let a bit time pass to let the
        // consumer try to consume it but it should not
        Thread.sleep(100);
        assertMockEndpointsSatisfied();

        FileEndpoint fe = context.getEndpoint(uri, FileEndpoint.class);
        assertNotNull(fe);

        MemoryIdempotentRepository repo = (MemoryIdempotentRepository) fe.getInProgressRepository();
        assertEquals(0, repo.getCacheSize(), "Should be no in-progress files");
    }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<Schema name="cube6" measuresCaption="%{measures}">
    <Cube name="cube6">

        <Dimension name="mondian_Table6.etos" caption="%{year}">
            <Hierarchy name="mondian_Table6.etos" hasAll="true" allMemberName="All mondian_Table6.etos" allMemberCaption="%{all_years}">

                <Level name="mondian_Table6.etos" table="mondian_Table6" column="etos" uniqueMembers="false"/>
            </Hierarchy>
        </Dimension>
        <Dimension name="mondian_Table6.nomos" caption="%{nomos}">
            <Hierarchy name="mondian_Table6.nomos" hasAll="true" allMemberName="All mondian_Table6.nomos" allMemberCaption="%{all_nomoi}">

                <Level name="mondian_Table6.nomos" table="mondian_Table6" column="nomos" uniqueMembers="false"/>
            </Hierarchy>
        </Dimension>
        <Dimension name="mondian_Table6.eidos">
            <Hierarchy name="mondian_Table6.eidos" hasAll="true" allMemberName="All mondian_Table6.eidos">

                <Level name="mondian_Table6.eidos" table="mondian_Table6" column="eidos" uniqueMembers="false"/>
            </Hierarchy>
        </Dimension>
        <Dimension name="mondian_Table6.deiktis" caption="%{deiktis}">
            <Hierarchy name="mondian_Table6.deiktis" hasAll="true" allMemberName="All mondian_Table6.deiktis" allMemberCaption="%{all_deiktes}">

                <Level name="mondian_Table6.deiktis" table="mondian_Table6" column="deiktis" uniqueMembers="false"/>
            </Hierarchy>
        </Dimension>
        <Measure name="SUM of mondian_Table6.timi" column="timi" aggregator="avg" datatype="Numeric" formatString="###,###" caption="%{timi}"/>
    </Cube>
</Schema>


text:
(function(app, Backbone){
    "use strict";

    app.ScoredList = Backbone.Collection.extend({
        comparator: function(member){
            return -member.get('score');
        }
    });
}(app, Backbone));


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>quarkus-rest-client-parent</artifactId>
        <groupId>io.quarkus</groupId>
        <version>999-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>quarkus-rest-client</artifactId>
    <name>Quarkus - REST Client - Runtime</name>
    <description>Call REST services</description>

    <dependencies>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-core</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-arc</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-resteasy-common</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-apache-httpclient</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-rest-client-config</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-client-microprofile</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.jboss.spec.javax.interceptor</groupId>
                    <artifactId>
                        jboss-interceptors-api_1.2_spec
                    </artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.jboss.weld</groupId>
                    <artifactId>weld-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.jboss.spec.javax.ws.rs</groupId>
                    <artifactId>jboss-jaxrs-api_3.0_spec</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>jakarta.interceptor</groupId>
            <artifactId>jakarta.interceptor-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpasyncclient</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.jboss.logging</groupId>
            <artifactId>commons-logging-jboss-logging</artifactId>
        </dependency>
        <dependency>
            <groupId>org.graalvm.nativeimage</groupId>
            <artifactId>svm</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-junit5-internal</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>io.quarkus</groupId>
                <artifactId>quarkus-extension-maven-plugin</artifactId>
                <configuration>
                    <capabilities>
                        <provides>io.quarkus.rest.client</provides>
                    </capabilities>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <annotationProcessorPaths>
                        <path>
                            <groupId>io.quarkus</groupId>
                            <artifactId>quarkus-extension-processor</artifactId>
                            <version>${project.version}</version>
                        </path>
                    </annotationProcessorPaths>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>jakarta-rewrite</id>
            <activation>
                <property>
                    <name>jakarta-rewrite</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.openrewrite.maven</groupId>
                        <artifactId>rewrite-maven-plugin</artifactId>
                        <configuration>
                            <activeRecipes>
                                <recipe>io.quarkus.rest-client</recipe>
                            </activeRecipes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>


text:
package es.udc.fic.acs.infmsb01.atm.bank;

import java.io.IOException;

import es.udc.fic.acs.infmsb01.atm.bank.controller.BankViewController;
import es.udc.fic.acs.infmsb01.atm.bank.model.gateway.BankControllerModelGateway;
import es.udc.fic.acs.infmsb01.atm.bank.model.message.processor.BankMessageProcessor;
import es.udc.fic.acs.infmsb01.atm.bank.net.transport.BankTransportProcessor;
import es.udc.fic.acs.infmsb01.atm.bank.net.transport.BankTransportProcessorRunnable;
import es.udc.fic.acs.infmsb01.atm.common.model.agentinfo.BankInfo;
import es.udc.fic.acs.infmsb01.atm.common.model.agentinfo.ConsortiumInfo;
import es.udc.fic.acs.infmsb01.atm.common.model.agentinfo.RecipientInfo;
import es.udc.fic.acs.infmsb01.atm.common.model.util.ConfigurationParametersManager;

public final class BankLauncher {

	private static final String BANK_SOCKET_PORT_CONFIGURATION_PARAMETER = "BankLauncher/bankSocketPort";
	private static final String BANK_SOCKET_IP_CONFIGURATION_PARAMETER = "BankLauncher/bankSocketIP";
	private static final String BANK_ID_CONFIGURATION_PARAMETER = "BankLauncher/bankID";

	private static final String CONSORTIUM_PORT_CONFIGURATION_PARAMETER = "BankLauncher/consortiumPort";
	private static final String CONSORTIUM_IP_CONFIGURATION_PARAMETER = "BankLauncher/consortiumIP";
	private static final String CONSORTIUM_ID_CONFIGURATION_PARAMETER = "BankLauncher/consortiumID";

	public static void main(String[] args) {

		try {

			BankInfo bi = new BankInfo();
			bi.setId(getParameter(BANK_ID_CONFIGURATION_PARAMETER));
			bi.setIp(getParameter(BANK_SOCKET_IP_CONFIGURATION_PARAMETER));
			bi.setPort(Integer
					.parseInt(getParameter(BANK_SOCKET_PORT_CONFIGURATION_PARAMETER)));

			ConsortiumInfo ci = new ConsortiumInfo();
			ci.setId(getParameter(CONSORTIUM_ID_CONFIGURATION_PARAMETER));
			ci.setIp(getParameter(CONSORTIUM_IP_CONFIGURATION_PARAMETER));
			ci.setPort(Integer.parseInt(getParameter(CONSORTIUM_PORT_CONFIGURATION_PARAMETER)));

			BankTransportProcessor btp = new BankTransportProcessor(bi, ci);

			BankViewController bvc = new BankViewController(bi.getId());

			BankMessageProcessor bmp = new BankMessageProcessor(
					new RecipientInfo(bi.getId()),
					new RecipientInfo(ci.getId()), btp);

			new BankControllerModelGateway(bmp, bvc);

			Thread consortiumNETThread = new Thread(new BankTransportProcessorRunnable(bmp));

			consortiumNETThread.start();

		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	private static final String getParameter(String param) throws IOException {
		return ConfigurationParametersManager.getParameter(param);
	}
}


text:
<?php

abstract class Controller{
    const   AUTO_SHOWVIEW_OFF = 1;
    public  $_config;
    public  $_request;
    public  $_model;
    public  $_view;

    public  $_defaultViewName;

    protected $_viewname;
    protected $_controllerName;
    /**
     * URI Parameter
     * @var array
     */
    protected $_parameter = array();
    /**
     * Output data
     * Output data to View
     * @var array
     */
    public  $_opdata = array();

    public function __construct(){}

    public function index(){}

    public final function setConfig($config){
        $this->_config = $config;
    }
    public final function setRequest($request){
        $this->_request = $request;
    }
    public final function setParameter($para){
        $this->_parameter = $para;
    }
    public final function setModel($modelname){
        $this->_model = new $modelname($this->_config);
    }
    public final function setView($controller , $action){
        $this->_view = new lib_view($this->_config);
        $this->_defaultViewName = $controller . "/" . $action;
        $this->_controllerName = $controller;
    }
    public final function _action($actionname){
        if(!$this->$actionname() == self::AUTO_SHOWVIEW_OFF ){
            $this->showView();
        }else{
            Log::write("--no View");
        }
    }

    public final function setCustomView($action , $controller = null ){
        if(empty($controller)){
            $this->_viewname = $this->_controllerName . "/" . $action;
        }else{
            $this->_viewname = $controller . "/" . $action;
        }
    }

    public final function showView($viewname = NULL , $controllerName = NULL){
        if(empty($controllerName)){
            if(empty($viewname)){
                if($this->_viewname != ""){
                    $viewname = $this->_viewname;
                }else{
                    $viewname = $this->_defaultViewName;
                }
            }else{
                $viewname = $this->_controllerName . '/' . $viewname;
            }
        }else{
            $viewname = $controllerName . '/' . $viewname;
        }
        $viewpath = ROOT . '/app/View/' . $viewname;
        if(file_exists($viewpath . '.php')){
            $this->_view->init( $viewpath . '.php' , $this->_opdata);
        }else if(file_exists($viewpath . '.html')){
            $this->_view->init( $viewpath .'.html' , $this->_opdata);
        }else if(file_exists($viewpath . '.htm')){
            $this->_view->init( $viewpath .'.htm' , $this->_opdata);
        }else {
            Log::write("View " . $viewpath . "Not found." , 3);
            throw new Exception("View " . $viewpath . " Not found.");
        }
        $this->_view->render();
    }

}

?>


text:
import { PermissionStatus, UnavailabilityError } from 'expo-modules-core';
import { Platform, Share } from 'react-native';
import { v4 as uuidv4 } from 'uuid';
import ExpoContacts from './ExpoContacts';
export { PermissionStatus };
/**
 * Returns whether the Contacts API is enabled on the current device. This does not check the app permissions.
 *
 * @returns Async `boolean`, indicating whether the Contacts API is available on the current device. Currently this resolves to `true` on iOS and Android only.
 */
export async function isAvailableAsync() {
    return !!ExpoContacts.getContactsAsync;
}
export async function shareContactAsync(contactId, message, shareOptions = {}) {
    if (Platform.OS === 'ios') {
        const url = await writeContactToFileAsync({
            id: contactId,
        });
        return await Share.share({
            url,
            message,
        }, shareOptions);
    }
    else if (!ExpoContacts.shareContactAsync) {
        throw new UnavailabilityError('Contacts', 'shareContactAsync');
    }
    return await ExpoContacts.shareContactAsync(contactId, message);
}
export async function getContactsAsync(contactQuery = {}) {
    if (!ExpoContacts.getContactsAsync) {
        throw new UnavailabilityError('Contacts', 'getContactsAsync');
    }
    return await ExpoContacts.getContactsAsync(contactQuery);
}
export async function getPagedContactsAsync(contactQuery = {}) {
    const { pageSize, ...nOptions } = contactQuery;
    if (pageSize && pageSize <= 0) {
        throw new Error('Error: Contacts.getPagedContactsAsync: `pageSize` must be greater than 0');
    }
    return await getContactsAsync({
        ...nOptions,
        pageSize,
    });
}
export async function getContactByIdAsync(id, fields) {
    if (!ExpoContacts.getContactsAsync) {
        throw new UnavailabilityError('Contacts', 'getContactsAsync');
    }
    if (id == null) {
        throw new Error('Error: Contacts.getContactByIdAsync: Please pass an ID as a parameter');
    }
    else {
        const results = await ExpoContacts.getContactsAsync({
            pageSize: 1,
            pageOffset: 0,
            fields,
            id,
        });
        if (results && results.data && results.data.length > 0) {
            return results.data[0];
        }
    }
    return undefined;
}
export async function addContactAsync(contact, containerId) {
    if (!ExpoContacts.addContactAsync) {
        throw new UnavailabilityError('Contacts', 'addContactAsync');
    }
    return await ExpoContacts.addContactAsync(contact, containerId);
}
export async function updateContactAsync(contact) {
    if (!ExpoContacts.updateContactAsync) {
        throw new UnavailabilityError('Contacts', 'updateContactAsync');
    }
    return await ExpoContacts.updateContactAsync(contact);
}
export async function removeContactAsync(contactId) {
    if (!ExpoContacts.removeContactAsync) {
        throw new UnavailabilityError('Contacts', 'removeContactAsync');
    }
    return await ExpoContacts.removeContactAsync(contactId);
}
export async function writeContactToFileAsync(contactQuery = {}) {
    if (!ExpoContacts.writeContactToFileAsync) {
        throw new UnavailabilityError('Contacts', 'writeContactToFileAsync');
    }
    return await ExpoContacts.writeContactToFileAsync(contactQuery);
}
export async function presentFormAsync(contactId, contact, formOptions = {}) {
    if (!ExpoContacts.presentFormAsync) {
        throw new UnavailabilityError('Contacts', 'presentFormAsync');
    }
    if (Platform.OS === 'ios') {
        const adjustedOptions = formOptions;
        if (contactId) {
            if (contact) {
                contact = undefined;
                console.log('Expo.Contacts.presentFormAsync: You should define either a `contact` or a `contactId` but not both.');
            }
            if (adjustedOptions.isNew !== undefined) {
                console.log('Expo.Contacts.presentFormAsync: formOptions.isNew is not supported with `contactId`');
            }
        }
        return await ExpoContacts.presentFormAsync(contactId, contact, adjustedOptions);
    }
    else {
        return await ExpoContacts.presentFormAsync(contactId, contact, formOptions);
    }
}
// iOS Only
export async function addExistingGroupToContainerAsync(groupId, containerId) {
    if (!ExpoContacts.addExistingGroupToContainerAsync) {
        throw new UnavailabilityError('Contacts', 'addExistingGroupToContainerAsync');
    }
    return await ExpoContacts.addExistingGroupToContainerAsync(groupId, containerId);
}
export async function createGroupAsync(name, containerId) {
    if (!ExpoContacts.createGroupAsync) {
        throw new UnavailabilityError('Contacts', 'createGroupAsync');
    }
    name = name || uuidv4();
    if (!containerId) {
        containerId = await getDefaultContainerIdAsync();
    }
    return await ExpoContacts.createGroupAsync(name, containerId);
}
export async function updateGroupNameAsync(groupName, groupId) {
    if (!ExpoContacts.updateGroupNameAsync) {
        throw new UnavailabilityError('Contacts', 'updateGroupNameAsync');
    }
    return await ExpoContacts.updateGroupNameAsync(groupName, groupId);
}
export async function removeGroupAsync(groupId) {
    if (!ExpoContacts.removeGroupAsync) {
        throw new UnavailabilityError('Contacts', 'removeGroupAsync');
    }
    return await ExpoContacts.removeGroupAsync(groupId);
}
export async function addExistingContactToGroupAsync(contactId, groupId) {
    if (!ExpoContacts.addExistingContactToGroupAsync) {
        throw new UnavailabilityError('Contacts', 'addExistingContactToGroupAsync');
    }
    return await ExpoContacts.addExistingContactToGroupAsync(contactId, groupId);
}
export async function removeContactFromGroupAsync(contactId, groupId) {
    if (!ExpoContacts.removeContactFromGroupAsync) {
        throw new UnavailabilityError('Contacts', 'removeContactFromGroupAsync');
    }
    return await ExpoContacts.removeContactFromGroupAsync(contactId, groupId);
}
export async function getGroupsAsync(groupQuery) {
    if (!ExpoContacts.getGroupsAsync) {
        throw new UnavailabilityError('Contacts', 'getGroupsAsync');
    }
    return await ExpoContacts.getGroupsAsync(groupQuery);
}
export async function getDefaultContainerIdAsync() {
    if (!ExpoContacts.getDefaultContainerIdentifierAsync) {
        throw new UnavailabilityError('Contacts', 'getDefaultContainerIdentifierAsync');
    }
    return await ExpoContacts.getDefaultContainerIdentifierAsync();
}
export async function getContainersAsync(containerQuery) {
    if (!ExpoContacts.getContainersAsync) {
        throw new UnavailabilityError('Contacts', 'getContainersAsync');
    }
    return await ExpoContacts.getContainersAsync(containerQuery);
}
export async function getPermissionsAsync() {
    if (!ExpoContacts.getPermissionsAsync) {
        throw new UnavailabilityError('Contacts', 'getPermissionsAsync');
    }
    return await ExpoContacts.getPermissionsAsync();
}
export async function requestPermissionsAsync() {
    if (!ExpoContacts.requestPermissionsAsync) {
        throw new UnavailabilityError('Contacts', 'requestPermissionsAsync');
    }
    return await ExpoContacts.requestPermissionsAsync();
}
// Legacy
export const PHONE_NUMBERS = 'phoneNumbers';
export const EMAILS = 'emails';
export const ADDRESSES = 'addresses';
export const IMAGE = 'image';
export const RAW_IMAGE = 'rawImage';
export const NOTE = 'note';
export const BIRTHDAY = 'birthday';
export const NON_GREGORIAN_BIRTHDAY = 'nonGregorianBirthday';
export const NAME_PREFIX = 'namePrefix';
export const NAME_SUFFIX = 'nameSuffix';
export const PHONETIC_FIRST_NAME = 'phoneticFirstName';
export const PHONETIC_MIDDLE_NAME = 'phoneticMiddleName';
export const PHONETIC_LAST_NAME = 'phoneticLastName';
export const SOCIAL_PROFILES = 'socialProfiles';
export const IM_ADDRESSES = 'instantMessageAddresses';
export const URLS = 'urlAddresses';
export const DATES = 'dates';
export const RAW_DATES = 'rawDates';
export const RELATIONSHIPS = 'relationships';
export const Fields = {
    ID: 'id',
    ContactType: 'contactType',
    Name: 'name',
    FirstName: 'firstName',
    MiddleName: 'middleName',
    LastName: 'lastName',
    MaidenName: 'maidenName',
    NamePrefix: 'namePrefix',
    NameSuffix: 'nameSuffix',
    Nickname: 'nickname',
    PhoneticFirstName: 'phoneticFirstName',
    PhoneticMiddleName: 'phoneticMiddleName',
    PhoneticLastName: 'phoneticLastName',
    Birthday: 'birthday',
    NonGregorianBirthday: 'nonGregorianBirthday',
    Emails: 'emails',
    PhoneNumbers: 'phoneNumbers',
    Addresses: 'addresses',
    SocialProfiles: 'socialProfiles',
    InstantMessageAddresses: 'instantMessageAddresses',
    UrlAddresses: 'urlAddresses',
    Company: 'company',
    JobTitle: 'jobTitle',
    Department: 'department',
    ImageAvailable: 'imageAvailable',
    Image: 'image',
    RawImage: 'rawImage',
    ExtraNames: 'extraNames',
    Note: 'note',
    Dates: 'dates',
    Relationships: 'relationships',
};
export const CalendarFormats = {
    Gregorian: 'gregorian',
    Buddhist: 'buddhist',
    Chinese: 'chinese',
    Coptic: 'coptic',
    EthiopicAmeteMihret: 'ethiopicAmeteMihret',
    EthiopicAmeteAlem: 'ethiopicAmeteAlem',
    Hebrew: 'hebrew',
    ISO8601: 'iso8601',
    Indian: 'indian',
    Islamic: 'islamic',
    IslamicCivil: 'islamicCivil',
    Japanese: 'japanese',
    Persian: 'persian',
    RepublicOfChina: 'republicOfChina',
    IslamicTabular: 'islamicTabular',
    IslamicUmmAlQura: 'islamicUmmAlQura',
};
export const ContainerTypes = {
    Local: 'local',
    Exchange: 'exchange',
    CardDAV: 'cardDAV',
    Unassigned: 'unassigned',
};
export const SortTypes = {
    UserDefault: 'userDefault',
    FirstName: 'firstName',
    LastName: 'lastName',
    None: 'none',
};
export const ContactTypes = {
    Person: 'person',
    Company: 'company',
};
//# sourceMappingURL=Contacts.js.map


text:
using UnityEngine;
using System.Collections;

public class Effect : MonoBehaviour
{
	public static int bonusLighting = 0;
    public static int SetCount = 0;

	public static void SpawnNumber (Vector2 pos, GameObject obj, Sprite[] s, float time)
	{

			EffectTimer.isResetCombo = false;
			GameObject tmp = Instantiate (obj) as GameObject;
			int idx = EffectTimer.Combo / 3;
			if (idx > 12)
						idx = 12;
            if(!Menu.IsLose && !Menu.IsWin)
			    MapLoader.score += (idx+1) * 10;

            if (MapLoader.Mode ==0)
                 GameObject.Find("top").GetComponent<Menu>().scoreinc((idx + 1) * 5);
			tmp.transform.Find ("Render").GetComponent<SpriteRenderer> ().sprite = s[idx];
            tmp.transform.localPosition = new Vector3(pos.x, pos.y, -1.2f);

            GameObject.Find("Screen").GetComponent<MapLoader>().Scoreupdate();

			EffectTimer.Combo++;
			bonusLighting++;
            SetCount++;

			if (bonusLighting == 21) {
						Editor.LightingRandomPoint ();
						bonusLighting=0;
				}
            if (SetCount == 30)
            {
                SetCount = 0;
                Editor.addLighting();
            }

			Destroy (tmp, time);
	}

	public static void SpawnSet(GameObject obj ,GameObject SetPref,int power)
	{
        for (int i = 0; i < obj.transform.Find("Render").transform.childCount; i++)
            if (obj.transform.Find("Render").transform.GetChild(i) != null)
                Destroy(obj.transform.Find("Render").transform.GetChild(i).gameObject);

		GameObject tmp = Instantiate (SetPref) as GameObject;
		tmp.transform.parent = obj.transform.Find ("Render");
		tmp.transform.localPosition = new Vector3 (0,0, -1.2f);
		if (power == 2)
						tmp.transform.Rotate (0, 0, 110);
        else
                          tmp.transform.Rotate(0, 0, 20);
	}

	public static void SpawnStarWin(GameObject obj ,GameObject StarPref,bool isshow )
	{
        for (int i = 0; i < obj.transform.Find("Render").transform.childCount; i++)
            if (obj.transform.Find("Render").transform.GetChild(i) != null)
                Destroy(obj.transform.Find("Render").transform.GetChild(i).gameObject);

        if (isshow)
            StarPref.transform.GetChild(0).GetComponent<Animator>().enabled = true;
        else
            StarPref.transform.GetChild(0).GetComponent<Animator>().enabled = false;
		GameObject tmp = Instantiate (StarPref) as GameObject;
		//obj.transform.Find ("Render").GetComponent<SpriteRenderer> ().sprite = null;
		tmp.transform.parent = obj.transform.Find ("Render");
		tmp.transform.localPosition = new Vector3 (0,0, -1.2f);
	}

	public static void SpawnBoom (Vector2 pos ,GameObject obj , float time)
	{
		Sound.sound.boom ();
		GameObject tmp = Instantiate (obj) as GameObject;
		//tmp.transform.Find ("Render").GetComponent<SpriteRenderer> ().sprite = s;
		tmp.transform.localPosition = new Vector3 (pos.x, pos.y, -1.2f);
		Destroy (tmp, time);

	}

	public static void RowLighting(float y ,GameObject obj) {

		Sound.sound.elec ();
		GameObject tmp = Instantiate (obj) as GameObject;
		tmp.transform.localPosition = new Vector3 (0, y, -1.2f);
		Destroy (tmp, 0.4f);
	}
	public static void ColumnLighting(float x ,GameObject obj) {

		Sound.sound.elec ();
		GameObject tmp = Instantiate (obj) as GameObject;
		tmp.transform.localPosition = new Vector3 (x, 0, -1.2f);
		Destroy (tmp, 0.4f);
	}
	public static void LightingPoint(Vector3 pos ,GameObject obj) {
		Sound.sound.bliz ();
		GameObject tmp = Instantiate (obj) as GameObject;
		tmp.transform.localPosition = new Vector3 (pos.x,pos.y, -1.2f);
		Destroy (tmp, 0.5f);
	}

		public static void SpawnEnchan(GameObject obj, GameObject parent){
            for (int i = 0; i < parent.transform.Find("Render").transform.childCount; i++)
                if (parent.transform.Find("Render").transform.GetChild(i) != null)
                    Destroy(parent.transform.Find("Render").transform.GetChild(i).gameObject);

		GameObject tmp = Instantiate (obj) as GameObject;
        tmp.transform.parent = parent.transform.Find("Render");
		tmp.transform.localPosition = new Vector3 (0.13f, 0.13f, -1.1f);
		tmp.transform.localScale = new Vector3 (2, 2, 1);
		}
	public static void SpawnType9(GameObject obj, GameObject parent){
        for (int i = 0; i < parent.transform.Find("Render").transform.childCount; i++)
            if (parent.transform.Find("Render").transform.GetChild(i) != null)
                Destroy(parent.transform.Find("Render").transform.GetChild(i).gameObject);

		GameObject tmp = Instantiate (obj) as GameObject;
		tmp.transform.parent = parent.transform.Find ("Render");
		tmp.transform.localPosition = new Vector3 (0, 0, -1.1f);
		tmp.transform.localScale = new Vector3 (1.44f, 1.44f, 1);
	}
	public static  void SpawnClock (GameObject obj, GameObject parent, Vector3 q)
	{
        for (int i = 0; i < parent.transform.Find("Render").transform.childCount; i++)
            if (parent.transform.Find("Render").transform.GetChild(i) != null)
                Destroy(parent.transform.Find("Render").transform.GetChild(i).gameObject);

		GameObject tmp = Instantiate (obj) as GameObject;
        tmp.transform.parent = parent.transform.Find("Render");
		tmp.transform.Rotate (q);
		tmp.transform.localPosition = new Vector3 (0, 0, -1.1f);
		tmp.transform.localScale = new Vector3 (1, 1, 1);
	}

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
    jcr:primaryType="cq:ContentSyncConfig"
    jcr:title="Conference Webview App - Shell"
    sling:resourceType="contentsync/config"
    authorizable="everyone"
    updateUser="admin"/>


text:
import Button from '@material-ui/core/Button';
import Divider from '@material-ui/core/Divider';
import MenuItem from '@material-ui/core/MenuItem';
import PropTypes from 'prop-types';
import React from 'react';
import { connect } from 'react-redux';
import { Field, reduxForm } from 'redux-form';
import actions from 'redux-form/es/actions';
import SelectField from '../../formHelpers/selectField';
import TextField from '../../formHelpers/textField';
import { SupplierPropType } from '../../propTypes';
import { createLoadSuppliers } from '../adminActions';
import SupplierService from './supplierService';

const { initialize } = actions;
const formName = 'supplier';

const styles = {
  container: {
    padding: '24px',
  },
};

const SupplierForm = ({
  handleSubmit,
  onSubmit,
  suppliers,
  selectSupplier,
}) => (
  <form
    style={styles.container}
    name={formName}
    onSubmit={handleSubmit(onSubmit)}
  >
    <Field
      component={SelectField}
      name="_id"
      onChange={(event, value) => selectSupplier(
        suppliers.find(supplier => supplier._id === value)
      )}
      label="Create new"
    >
      <MenuItem value="">
        Create new
      </MenuItem>
      <Divider />
      {suppliers.map(({ _id, name }) => (
        <MenuItem
          key={_id}
          value={_id}
        >
          {name}
        </MenuItem>
      ))}
    </Field>

    <Field
      component={TextField}
      name="name"
      label="Name"
      type="text"
    />

    <Field
      component={TextField}
      name="vatNumber"
      label="VAT Number"
      type="text"
    />

    <Field
      component={TextField}
      name="customerNumber"
      label="Customer Number"
      type="text"
    />

Address

    <Field
      component={TextField}
      name="address.streetAddress"
      label="Street address"
      type="text"
    />

    <Field
      component={TextField}
      name="address.zip"
      label="Zip"
      type="number"
    />

    <Field
      component={TextField}
      name="address.city"
      label="City"
      type="text"
    />

    <Field
      component={TextField}
      name="address.country"
      label="Country"
      type="text"
    />

Bank

    <Field
      component={TextField}
      name="bank"
      label="Bank"
      type="text"
    />

    <Field
      component={TextField}
      name="iban"
      label="IBAN"
      type="text"
    />

    <Field
      component={TextField}
      name="bic"
      label="BIC"
      type="text"
    />

    <Field
      component={TextField}
      name="bankRemarks"
      label="Remarks"
      type="text"
      multiline
    />

Contact

    <Field
      component={TextField}
      name="contactName"
      label="Contact Name"
      type="text"
    />

    <Field
      component={TextField}
      name="contactEmail"
      label="Contact Email"
      type="email"
    />

    <Field
      component={TextField}
      name="contactPhone"
      label="Contact Phone"
      type="tel"
    />

    <Field
      component={TextField}
      name="remarks"
      label="Remarks"
      type="text"
      multiline
    />

    <Button variant="contained" color="primary" type="submit">
      Save
    </Button>
  </form>
);

SupplierForm.propTypes = {
  handleSubmit: PropTypes.func.isRequired,
  onSubmit: PropTypes.func.isRequired,
  selectSupplier: PropTypes.func.isRequired,
  suppliers: PropTypes.arrayOf(SupplierPropType).isRequired,
};

export default connect(
  state => state.forms,
  (dispatch) => {
    function clearForm() {
      dispatch(initialize(formName));
    }

    function loadSuppliers() {
      dispatch(createLoadSuppliers());
    }

    return {
      selectSupplier(supplier) {
        dispatch(initialize(formName, supplier));
      },
      onSubmit(supplier) {
        SupplierService.saveSupplier(supplier)
          .then(loadSuppliers)
          .then(clearForm);
      },
    };
  }
)(reduxForm({
  form: formName,
  destroyOnUnmount: false,
})(SupplierForm));


text:
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.util;

import com.intellij.injected.editor.VirtualFileWindow;
import com.intellij.openapi.diagnostic.Attachment;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.ThrowableComputable;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiFile;
import com.intellij.util.containers.ContainerUtil;
import gnu.trove.THashSet;
import org.jetbrains.annotations.NotNull;

import java.util.Set;
import java.util.function.Supplier;

/**
 * Enforces tree loading policies.
 *

 * For example it's very slow to load AST for all shown files when updating Project View nodes,
 * or loading other files when current file is being highlighted.
 *

 * To prevent loading in the current thread {@link #disableTreeLoading} should be used.

 * In this case the exception will be thrown when some code unexpectedly tries to load the tree,
 * and then there are two options:
 *

 *
examine the stack trace, fix the code, so tree loading won't occur anymore,
 * e.g. data will be taken from stubs, and cover it with a test.
 * It is highly preferable to fix the code, which gains a speed up.
 *

 *
force enable tree loading by wrapping troublesome operation into {@link #forceEnableTreeLoading}.
 * In this case there are no performance gains, but later it will be possible to examine all bottlenecks
 * by finding usages of {@link #forceEnableTreeLoading}

 *

 * Example:
 *

 * disableTreeLoading {
 *   // some deep trace
 *   ...
 *   doSomeOperation {
 *     // access file tree, exception is thrown
 *   }
 *   forceEnableTreeLoading(file) {
 *     doSomeOperation {
 *       // access file tree, no exception is thrown
 *     }
 *     doAnotherOperation {
 *       // access another file tree, exception is thrown
 *     }
 *   }
 *   forceEnableTreeLoading(file) {
 *     disableTreeLoading {
 *       doSomeOperation {
 *         // nested disabling has no effect in any case
 *         // access file tree, no exception is thrown, access is still enabled for file
 *       }
 *     }
 *   }
 * }
 *

 *

 * Note that tree access won't result in an exception when the tree was already loaded.
 */
public class AstLoadingFilter {

  private static final Logger LOG = Logger.getInstance(AstLoadingFilter.class);
  private static final Set<String> ourReportedTraces = ContainerUtil.newConcurrentSet();
  /**
   * Holds not-null value if loading was disabled in current thread.
   * Initial value is {@code null} meaning loading is enabled by default.
   */
  private static final ThreadLocal<Supplier<String>> myDisabledInfo = new ThreadLocal<>();
  @SuppressWarnings("SSBasedInspection")
  private static final ThreadLocal<Set<VirtualFile>> myForcedEnabledFiles = ThreadLocal.withInitial(() -> new THashSet<>());

  private AstLoadingFilter() {}

  public static void assertTreeLoadingEnabled(@NotNull VirtualFile file) {
    if (!Registry.is("ast.loading.filter")) return;
    if (file instanceof VirtualFileWindow) return;
    Supplier<String> disabledInfo = myDisabledInfo.get();
    if (disabledInfo == null) {
      // loading was not disabled in current thread
    }
    else if (myForcedEnabledFiles.get().contains(file)) {
      // loading was disabled but then re-enabled for file
    }
    else {
      AstLoadingException throwable = new AstLoadingException();
      if (ourReportedTraces.add(ExceptionUtil.getThrowableText(throwable))) {
        LOG.error("Tree access disabled", throwable, new Attachment("debugInfo", buildDebugInfo(file, disabledInfo)));
      }
    }
  }

  @NotNull
  private static String buildDebugInfo(@NotNull VirtualFile file, @NotNull Supplier<String> disabledInfo) {
    StringBuilder debugInfo = new StringBuilder();
    debugInfo.append("Accessed file path: ").append(file.getPath());
    String additionalInfo = disabledInfo.get();
    if (additionalInfo != null) {
      debugInfo.append('\n').append("Additional info: \n").append(additionalInfo);
    }
    return debugInfo.toString();
  }

  public static <E extends Throwable>
  void disableTreeLoading(@NotNull ThrowableRunnable<E> runnable) throws E {
    disableTreeLoading(toComputable(runnable));
  }

  public static <T, E extends Throwable>
  T disableTreeLoading(@NotNull ThrowableComputable<? extends T, E> computable) throws E {
    return disableTreeLoading(computable, () -> null);
  }

  public static <T, E extends Throwable>
  T disableTreeLoading(@NotNull ThrowableComputable<? extends T, E> computable, @NotNull Supplier<String> debugInfo) throws E {
    if (myDisabledInfo.get() != null) {
      return computable.compute();
    }
    else {
      try {
        myDisabledInfo.set(debugInfo);
        return computable.compute();
      }
      finally {
        myDisabledInfo.set(null);
      }
    }
  }

  public static <E extends Throwable>
  void forceEnableTreeLoading(@NotNull PsiFile psiFile, @NotNull ThrowableRunnable<E> runnable) throws E {
    forceEnableTreeLoading(psiFile, toComputable(runnable));
  }

  public static <E extends Throwable>
  void forceEnableTreeLoading(@NotNull VirtualFile virtualFile, @NotNull ThrowableRunnable<E> runnable) throws E {
    forceEnableTreeLoading(virtualFile, toComputable(runnable));
  }

  public static <T, E extends Throwable>
  T forceEnableTreeLoading(@NotNull PsiFile psiFile, @NotNull ThrowableComputable<? extends T, E> computable) throws E {
    VirtualFile virtualFile = psiFile.getVirtualFile();
    return virtualFile == null ? computable.compute() : forceEnableTreeLoading(virtualFile, computable);
  }

  public static <T, E extends Throwable>
  T forceEnableTreeLoading(@NotNull VirtualFile virtualFile, @NotNull ThrowableComputable<? extends T, E> computable) throws E {
    Set<VirtualFile> enabledFiles = myForcedEnabledFiles.get();
    if (enabledFiles.add(virtualFile)) {
      try {
        return computable.compute();
      }
      finally {
        enabledFiles.remove(virtualFile);
      }
    }
    else {
      return computable.compute();
    }
  }

  private static <E extends Throwable> ThrowableComputable<?, E> toComputable(ThrowableRunnable<E> runnable) {
    return () -> {
      runnable.run();
      return null;
    };
  }
}


text:
/**
 *  MENU.H
 *
 *  Librería de control de menús
 *
 *  Autor: Jardón Fonseca Bruno
 *  https://github.com/bjardon
 *
 */

#ifndef PRACTICA01_MANEJOCADENAS_MENU_H
#define PRACTICA01_MANEJOCADENAS_MENU_H

    /** DEPENDENCIAS **/

// Requerido para la impresión a stdout
#include <stdio.h>
// Requerido por el alias de string
#include "strings.h"

    /** PROTOTIPOS **/

// Impresión de las opciones de un menu
void menu_printoptions(string[], string, int);
// Obtiene la respuesta de un menú
int menu_getanswer();
// Función de control de menú pricipal
int menu_main();
// Función de control de menú de concatenación
int menu_concat();
// Función de control de menú del prefijo
int menu_prefix();
// Función de control de menú del sufijo
int menu_suffix();
// Función de control de menú de subcadena
int menu_substring();
// Función de control de menú de susecuencia
int menu_subseq();
// Función de control de menú de inversión
int menu_invert();
// Función de control de menú de potencia
int menu_power();

    /** DEFINICIÓN DE FUNCIONES **/

/**
 * Impresión de las opciones de un menú
 *
 * Recibe:
 *  options [strings]:
 *   Arreglo de los nombres de las opciones que se imprimen
 *
 * Retorna:
 *  [void]
 */
void menu_printoptions(string options[], string title, int opt_len) {
    printf("\nMENU %s:", title);
    for (int i = 0; i < opt_len; ++i) {
        printf("\n%0d: %s", (i + 1), options[i]);
    }
}

/**
 * Obtiene la respuesta de un menú
 *
 * Recibe:
 *  [void]
 *
 * Retorna:
 *  [int]:
 *   Número de la respuesta que se introdujo
 */
int menu_getanswer() {
    string ans;
    str(&ans);
    fflush(stdin);
    printf("\nSu respuesta: >  ");
    scanf("%[^\n]s", ans);
    return atoi(ans);
}

/**
 * Valida la respuesta obtenida
 *
 * Recibe:
 *  ans [int]:
 *   Respuesta obtenida
 *  max [int]:
 *   Valor máximo permitido
 *
 * Retorna:
 *  [int]:
 *   1 si es válido, 0 de otra forma
 */
int menu_validateanswer(int ans, int max) {
    if(ans > 0 && ans <= max)
        return 1;
    printf("\n>> ERROR: Respuesta invalida!");
    return 0;
}

/**
 * Función de control de menú pricipal
 *
 * Recibe:
 *  [void]
 *
 * Retorna:
 *  [int]:
 *   Número de la respuesta que se introdujo
 */
int menu_main() {
    int ans;
    string options[] = {
            "Leer cadenas de nuevo",
            "Ver cadenas actuales",
            "Concatenar de cadenas",
            "Obtener un prefijo",
            "Obtener un sufijo",
            "Obtener una subcadena",
            "Obtener una subsecuencia",
            "Obtener la inversa",
            "Obtener la potencia",
            "Salir"
    };
    do {
        menu_printoptions(options, "PRINCIPAL", 10);
        ans = menu_getanswer();
    } while (!menu_validateanswer(ans, 10));
    return ans;
}

/**
 * Función de control de menú de concatenación
 *
 * Recibe:
 *  [void]
 *
 * Retorna:
 *  [int]:
 *   Número de la respuesta que se introdujo
 */
int menu_concat() {
    int ans;
    string options[] = {
            "Concatenar AMBAS",
            "Concatenar UV",
            "Concatenar VU",
            "Regresar"
    };
    do {
        menu_printoptions(options, "CONCATENACION", 4);
        ans = menu_getanswer();
    } while (!menu_validateanswer(ans, 4));
    return ans;
}

/**
 * Función de control de menú del prefijo
 *
 * Recibe:
 *  [void]
 *
 * Retorna:
 *  [int]:
 *   Número de la respuesta que se introdujo
 */
int menu_prefix() {
    int ans;
    string options[] = {
            "Prefijo de AMBAS",
            "Prefijo de U",
            "Prefijo de V",
            "Volver"
    };
    do {
        menu_printoptions(options, "PREFIJO", 4);
        ans = menu_getanswer();
    } while (!menu_validateanswer(ans, 4));
    return ans;
}

/**
 * Función de control de menú del sufijo
 *
 * Recibe:
 *  [void]
 *
 * Retorna:
 *  [int]:
 *   Número de la respuesta que se introdujo
 */
int menu_suffix() {
    int ans;
    string options[] = {
            "Sufijo de AMBAS",
            "Sufijo de U",
            "Sufijo de V",
            "Volver"
    };
    do {
        menu_printoptions(options, "SUFIJO", 4);
        ans = menu_getanswer();
    } while (!menu_validateanswer(ans, 4));
    return ans;
}

/**
 * Función de control de menú de subcadena
 *
 * Recibe:
 *  [void]
 *
 * Retorna:
 *  [int]:
 *   Número de la respuesta que se introdujo
 */
int menu_substring() {
    int ans;
    string options[] = {
            "Subcadena de AMBAS",
            "Subcadena de U",
            "Subcadena de V",
            "Volver"
    };
    do {
        menu_printoptions(options, "SUBCADENA", 4);
        ans = menu_getanswer();
    } while (!menu_validateanswer(ans, 4));
    return ans;
}

/**
 * Función de control de menú de subsecuencia
 *
 * Recibe:
 *  [void]
 *
 * Retorna:
 *  [int]:
 *   Número de la respuesta que se introdujo
 */
int menu_subseq() {
    int ans;
    string options[] = {
            "Quitar caracteres a AMBAS",
            "Quitar caracteres a U",
            "Quitar caracteres a V",
            "Volver"
    };
    do {
        menu_printoptions(options, "SUBSECUENCIA", 4);
        ans = menu_getanswer();
    } while (!menu_validateanswer(ans, 7));
    return ans;
}

/**
 * Función de control de menú de inversión
 *
 * Recibe:
 *  [void]
 *
 * Retorna:
 *  [int]:
 *   Número de la respuesta que se introdujo
 */
int menu_invert() {
    int ans;
    string options[] = {
            "Invertir AMBAS",
            "Invertir U",
            "Invertir V",
            "Volver"
    };
    do {
        menu_printoptions(options, "INVERSION", 4);
        ans = menu_getanswer();
    } while (!menu_validateanswer(ans, 4));
    return ans;
}

/**
 * Función de control de menú de potencia
 *
 * Recibe:
 *  [void]
 *
 * Retorna:
 *  [int]:
 *   Número de la respuesta que se introdujo
 */
int menu_power() {
    int ans;
    string options[] = {
            "Elevar AMBAS^n",
            "Elevar U^n",
            "Elevar V^n",
            "Volver"
    };
    do {
        menu_printoptions(options, "POTENCIA", 4);
        ans = menu_getanswer();
    } while (!menu_validateanswer(ans, 4));
    return ans;
}

#endif //PRACTICA01_MANEJOCADENAS_MENU_H


text:
<?php
    namespace common\modules\ResponseManager\components\responses;

    use yii\web\ResponseFormatterInterface;

    class TextCssResponse implements ResponseFormatterInterface
    {
        public function format($response)
        {
            $response->getHeaders()->set('Content-Type', 'text/css');
            if ($response->data !== null) {
                $response->content = $response->data;
            }
        }
    }