text:
extern ICoreSystem* g_pCoreSystem;

INNO_PRIVATE_SCOPE VKRenderingSystemNS
{
	ObjectStatus m_objectStatus = ObjectStatus::SHUTDOWN;

	bool checkValidationLayerSupport()
	{
		uint32_t l_layerCount;
		vkEnumerateInstanceLayerProperties(&l_layerCount, nullptr);

		std::vector<VkLayerProperties> l_availableLayers(l_layerCount);
		vkEnumerateInstanceLayerProperties(&l_layerCount, l_availableLayers.data());

		for (const char* layerName : VKRenderingSystemComponent::get().m_validationLayers)
		{
			bool layerFound = false;

			for (const auto& layerProperties : l_availableLayers)
			{
				if (strcmp(layerName, layerProperties.layerName) == 0)
				{
					layerFound = true;
					break;
				}
			}

			if (!layerFound)
			{
				return false;
			}
		}

		return true;
	}

	VkResult createDebugUtilsMessengerEXT(VkInstance instance, const VkDebugUtilsMessengerCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDebugUtilsMessengerEXT* pCallback)
	{
		auto func = (PFN_vkCreateDebugUtilsMessengerEXT)vkGetInstanceProcAddr(instance, "vkCreateDebugUtilsMessengerEXT");
		if (func != nullptr) {
			return func(instance, pCreateInfo, pAllocator, pCallback);
		}
		else {
			return VK_ERROR_EXTENSION_NOT_PRESENT;
		}
	}

	void destroyDebugUtilsMessengerEXT(VkInstance instance, VkDebugUtilsMessengerEXT callback, const VkAllocationCallbacks* pAllocator)
	{
		auto func = (PFN_vkDestroyDebugUtilsMessengerEXT)vkGetInstanceProcAddr(instance, "vkDestroyDebugUtilsMessengerEXT");
		if (func != nullptr) {
			func(instance, callback, pAllocator);
		}
	}

	std::vector<const char*> getRequiredExtensions()
	{
		uint32_t glfwExtensionCount = 0;
		const char** glfwExtensions;
		glfwExtensions = glfwGetRequiredInstanceExtensions(&glfwExtensionCount);

		std::vector<const char*> extensions(glfwExtensions, glfwExtensions + glfwExtensionCount);

		if (VKRenderingSystemComponent::get().m_enableValidationLayers)
		{
			extensions.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
		}

		return extensions;
	}

	static VKAPI_ATTR VkBool32 VKAPI_CALL debugCallback(VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, VkDebugUtilsMessageTypeFlagsEXT messageType, const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData, void* pUserData)
	{
		g_pCoreSystem->getLogSystem()->printLog(LogType::INNO_ERROR, "VKRenderingSystem: Validation Layer: " + std::string(pCallbackData->pMessage));
		return VK_FALSE;
	}

	bool checkDeviceExtensionSupport(VkPhysicalDevice device)
	{
		uint32_t extensionCount;
		vkEnumerateDeviceExtensionProperties(device, nullptr, &extensionCount, nullptr);

		std::vector<VkExtensionProperties> availableExtensions(extensionCount);
		vkEnumerateDeviceExtensionProperties(device, nullptr, &extensionCount, availableExtensions.data());

		std::set<std::string> requiredExtensions(VKRenderingSystemComponent::get().m_deviceExtensions.begin(), VKRenderingSystemComponent::get().m_deviceExtensions.end());

		for (const auto& extension : availableExtensions)
		{
			requiredExtensions.erase(extension.extensionName);
		}

		return requiredExtensions.empty();
	}

	QueueFamilyIndices findQueueFamilies(VkPhysicalDevice device)
	{
		QueueFamilyIndices indices;

		uint32_t queueFamilyCount = 0;
		vkGetPhysicalDeviceQueueFamilyProperties(device, &queueFamilyCount, nullptr);

		std::vector<VkQueueFamilyProperties> queueFamilies(queueFamilyCount);
		vkGetPhysicalDeviceQueueFamilyProperties(device, &queueFamilyCount, queueFamilies.data());

		int i = 0;
		for (const auto& queueFamily : queueFamilies)
		{
			if (queueFamily.queueCount > 0 && queueFamily.queueFlags & VK_QUEUE_GRAPHICS_BIT)
			{
				indices.m_graphicsFamily = i;
			}

			VkBool32 l_presentSupport = false;
			vkGetPhysicalDeviceSurfaceSupportKHR(device, i, VKRenderingSystemComponent::get().m_windowSurface, &l_presentSupport);

			if (queueFamily.queueCount > 0 && l_presentSupport)
			{
				indices.m_presentFamily = i;
			}

			if (indices.isComplete())
			{
				break;
			}

			i++;
		}

		return indices;
	}

	VkSurfaceFormatKHR chooseSwapSurfaceFormat(const std::vector<VkSurfaceFormatKHR>& availableFormats)
	{
		if (availableFormats.size() == 1 && availableFormats[0].format == VK_FORMAT_UNDEFINED)
		{
			return { VK_FORMAT_B8G8R8A8_UNORM, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR };
		}

		for (const auto& availableFormat : availableFormats)
		{
			if (availableFormat.format == VK_FORMAT_B8G8R8A8_UNORM && availableFormat.colorSpace == VK_COLOR_SPACE_SRGB_NONLINEAR_KHR)
			{
				return availableFormat;
			}
		}

		return availableFormats[0];
	}

	VkPresentModeKHR chooseSwapPresentMode(const std::vector<VkPresentModeKHR> availablePresentModes)
	{
		VkPresentModeKHR l_bestMode = VK_PRESENT_MODE_FIFO_KHR;

		for (const auto& availablePresentMode : availablePresentModes)
		{
			if (availablePresentMode == VK_PRESENT_MODE_MAILBOX_KHR)
			{
				return availablePresentMode;
			}
			else if (availablePresentMode == VK_PRESENT_MODE_IMMEDIATE_KHR)
			{
				l_bestMode = availablePresentMode;
			}
		}

		return l_bestMode;
	}

	VkExtent2D chooseSwapExtent(const VkSurfaceCapabilitiesKHR& capabilities)
	{
		if (capabilities.currentExtent.width != std::numeric_limits<uint32_t>::max())
		{
			return capabilities.currentExtent;
		}
		else
		{
			VkExtent2D l_actualExtent = { WindowSystemComponent::get().m_windowResolution.x,  WindowSystemComponent::get().m_windowResolution.y };

			l_actualExtent.width = std::max(capabilities.minImageExtent.width, std::min(capabilities.maxImageExtent.width, l_actualExtent.width));
			l_actualExtent.height = std::max(capabilities.minImageExtent.height, std::min(capabilities.maxImageExtent.height, l_actualExtent.height));

			return l_actualExtent;
		}
	}

	SwapChainSupportDetails querySwapChainSupport(VkPhysicalDevice device)
	{
		SwapChainSupportDetails l_details;

		vkGetPhysicalDeviceSurfaceCapabilitiesKHR(device, VKRenderingSystemComponent::get().m_windowSurface, &l_details.m_capabilities);

		uint32_t formatCount;
		vkGetPhysicalDeviceSurfaceFormatsKHR(device, VKRenderingSystemComponent::get().m_windowSurface, &formatCount, nullptr);

		if (formatCount != 0)
		{
			l_details.m_formats.resize(formatCount);
			vkGetPhysicalDeviceSurfaceFormatsKHR(device, VKRenderingSystemComponent::get().m_windowSurface, &formatCount, l_details.m_formats.data());
		}

		uint32_t presentModeCount;
		vkGetPhysicalDeviceSurfacePresentModesKHR(device, VKRenderingSystemComponent::get().m_windowSurface, &presentModeCount, nullptr);

		if (presentModeCount != 0)
		{
			l_details.m_presentModes.resize(presentModeCount);
			vkGetPhysicalDeviceSurfacePresentModesKHR(device, VKRenderingSystemComponent::get().m_windowSurface, &presentModeCount, l_details.m_presentModes.data());
		}

		return l_details;
	}

	bool isDeviceSuitable(VkPhysicalDevice device)
	{
		QueueFamilyIndices indices = findQueueFamilies(device);

		bool extensionsSupported = checkDeviceExtensionSupport(device);

		bool swapChainAdequate = false;
		if (extensionsSupported)
		{
			SwapChainSupportDetails swapChainSupport = querySwapChainSupport(device);
			swapChainAdequate = !swapChainSupport.m_formats.empty() && !swapChainSupport.m_presentModes.empty();
		}

		return indices.isComplete() && extensionsSupported && swapChainAdequate;
	}

	bool setup(IRenderingFrontendSystem* renderingFrontend);

	bool createVkInstance();
	bool createDebugCallback();
	bool createWindowSurface();
	bool createPysicalDevice();
	bool createLogicalDevice();
	bool createSwapChain();
	bool createImageViews();

	bool createGraphicsPipeline();

	bool terminate();

	IRenderingFrontendSystem* m_renderingFrontendSystem;
}

bool VKRenderingSystemNS::createVkInstance()
{
	// check support for validation layer
	if (VKRenderingSystemComponent::get().m_enableValidationLayers && !checkValidationLayerSupport()) {
		m_objectStatus = ObjectStatus::STANDBY;
		g_pCoreSystem->getLogSystem()->printLog(LogType::INNO_ERROR, "VKRenderingSystem: validation layers requested, but not available!");
		return false;
	}

	// set Vulkan app info
	VkApplicationInfo l_appInfo = {};
	l_appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
	l_appInfo.pApplicationName = WindowSystemComponent::get().m_windowName.c_str();
	l_appInfo.applicationVersion = VK_MAKE_VERSION(0, 0, 7);
	l_appInfo.pEngineName = "Innocence Engine";
	l_appInfo.engineVersion = VK_MAKE_VERSION(0, 0, 7);
	l_appInfo.apiVersion = VK_API_VERSION_1_0;

	// set Vulkan instance create info with app info
	VkInstanceCreateInfo l_createInfo = {};
	l_createInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
	l_createInfo.pApplicationInfo = &l_appInfo;

	// set window extension info
	auto extensions = getRequiredExtensions();
	l_createInfo.enabledExtensionCount = static_cast<uint32_t>(extensions.size());
	l_createInfo.ppEnabledExtensionNames = extensions.data();

	if (VKRenderingSystemComponent::get().m_enableValidationLayers)
	{
		l_createInfo.enabledLayerCount = static_cast<uint32_t>(VKRenderingSystemComponent::get().m_validationLayers.size());
		l_createInfo.ppEnabledLayerNames = VKRenderingSystemComponent::get().m_validationLayers.data();
	}
	else
	{
		l_createInfo.enabledLayerCount = 0;
	}

	// create Vulkan instance
	if (vkCreateInstance(&l_createInfo, nullptr, &VKRenderingSystemComponent::get().m_instance) != VK_SUCCESS)
	{
		m_objectStatus = ObjectStatus::STANDBY;
		g_pCoreSystem->getLogSystem()->printLog(LogType::INNO_ERROR, "VKRenderingSystem: Failed to create VkInstance!");
		return false;
	}

	g_pCoreSystem->getLogSystem()->printLog(LogType::INNO_DEV_SUCCESS, "VKRenderingSystem: VkInstance has been created.");
	return true;
}

bool VKRenderingSystemNS::createDebugCallback()
{
	if (VKRenderingSystemComponent::get().m_enableValidationLayers)
	{
		VkDebugUtilsMessengerCreateInfoEXT l_createInfo = {};
		l_createInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT;
		l_createInfo.messageSeverity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT;
		l_createInfo.messageType = VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT;
		l_createInfo.pfnUserCallback = debugCallback;

		if (createDebugUtilsMessengerEXT(VKRenderingSystemComponent::get().m_instance, &l_createInfo, nullptr, &VKRenderingSystemComponent::get().m_messengerCallback) != VK_SUCCESS)
		{
			m_objectStatus = ObjectStatus::STANDBY;
			g_pCoreSystem->getLogSystem()->printLog(LogType::INNO_ERROR, "VKRenderingSystem: Failed to create DebugUtilsMessenger!");
			return false;
		}

		g_pCoreSystem->getLogSystem()->printLog(LogType::INNO_DEV_SUCCESS, "VKRenderingSystem: validation layer has been created.");
		return true;
	}
	else
	{
		return true;
	}
}

bool VKRenderingSystemNS::createWindowSurface()
{
	if (glfwCreateWindowSurface(VKRenderingSystemComponent::get().m_instance, VKWindowSystemComponent::get().m_window, nullptr, &VKRenderingSystemComponent::get().m_windowSurface) != VK_SUCCESS)
	{
		m_objectStatus = ObjectStatus::STANDBY;
		g_pCoreSystem->getLogSystem()->printLog(LogType::INNO_ERROR, "VKRenderingSystem: Failed to create window surface!");
		return false;
	}

	g_pCoreSystem->getLogSystem()->printLog(LogType::INNO_DEV_SUCCESS, "VKRenderingSystem: window surface has been created.");
	return true;
}

bool VKRenderingSystemNS::createPysicalDevice()
{
	// check if there is any suitable physical GPU
	uint32_t l_deviceCount = 0;
	vkEnumeratePhysicalDevices(VKRenderingSystemComponent::get().m_instance, &l_deviceCount, nullptr);

	if (l_deviceCount == 0) {
		m_objectStatus = ObjectStatus::STANDBY;
		g_pCoreSystem->getLogSystem()->printLog(LogType::INNO_ERROR, "VKRenderingSystem: Failed to find GPUs with Vulkan support!");
		return false;
	}

	// assign the handle
	std::vector<VkPhysicalDevice> l_devices(l_deviceCount);
	vkEnumeratePhysicalDevices(VKRenderingSystemComponent::get().m_instance, &l_deviceCount, l_devices.data());

	for (const auto& device : l_devices)
	{
		if (isDeviceSuitable(device))
		{
			VKRenderingSystemComponent::get().m_physicalDevice = device;
			break;
		}
	}

	if (VKRenderingSystemComponent::get().m_physicalDevice == VK_NULL_HANDLE)
	{
		m_objectStatus = ObjectStatus::STANDBY;
		g_pCoreSystem->getLogSystem()->printLog(LogType::INNO_ERROR, "VKRenderingSystem: Failed to find a suitable GPU!");
		return false;
	}

	g_pCoreSystem->getLogSystem()->printLog(LogType::INNO_DEV_SUCCESS, "VKRenderingSystem: physical device has been created.");
	return true;
}

bool VKRenderingSystemNS::createLogicalDevice()
{
	QueueFamilyIndices l_indices = findQueueFamilies(VKRenderingSystemComponent::get().m_physicalDevice);

	std::vector<VkDeviceQueueCreateInfo> l_queueCreateInfos;
	std::set<uint32_t> l_uniqueQueueFamilies = { l_indices.m_graphicsFamily.value(), l_indices.m_presentFamily.value() };

	float l_queuePriority = 1.0f;
	for (uint32_t queueFamily : l_uniqueQueueFamilies)
	{
		VkDeviceQueueCreateInfo l_queueCreateInfo = {};
		l_queueCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
		l_queueCreateInfo.queueFamilyIndex = queueFamily;
		l_queueCreateInfo.queueCount = 1;
		l_queueCreateInfo.pQueuePriorities = &l_queuePriority;
		l_queueCreateInfos.push_back(l_queueCreateInfo);
	}

	VkPhysicalDeviceFeatures l_deviceFeatures = {};

	VkDeviceCreateInfo l_createInfo = {};
	l_createInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;

	l_createInfo.queueCreateInfoCount = static_cast<uint32_t>(l_queueCreateInfos.size());
	l_createInfo.pQueueCreateInfos = l_queueCreateInfos.data();

	l_createInfo.pEnabledFeatures = &l_deviceFeatures;

	l_createInfo.enabledExtensionCount = static_cast<uint32_t>(VKRenderingSystemComponent::get().m_deviceExtensions.size());
	l_createInfo.ppEnabledExtensionNames = VKRenderingSystemComponent::get().m_deviceExtensions.data();

	if (VKRenderingSystemComponent::get().m_enableValidationLayers)
	{
		l_createInfo.enabledLayerCount = static_cast<uint32_t>(VKRenderingSystemComponent::get().m_validationLayers.size());
		l_createInfo.ppEnabledLayerNames = VKRenderingSystemComponent::get().m_validationLayers.data();
	}
	else
	{
		l_createInfo.enabledLayerCount = 0;
	}

	if (vkCreateDevice(VKRenderingSystemComponent::get().m_physicalDevice, &l_createInfo, nullptr, &VKRenderingSystemComponent::get().m_device) != VK_SUCCESS)
	{
		m_objectStatus = ObjectStatus::STANDBY;
		g_pCoreSystem->getLogSystem()->printLog(LogType::INNO_ERROR, "VKRenderingSystem: Failed to create logical device!");
		return false;
	}

	vkGetDeviceQueue(VKRenderingSystemComponent::get().m_device, l_indices.m_graphicsFamily.value(), 0, &VKRenderingSystemComponent::get().m_graphicsQueue);
	vkGetDeviceQueue(VKRenderingSystemComponent::get().m_device, l_indices.m_presentFamily.value(), 0, &VKRenderingSystemComponent::get().m_presentQueue);

	g_pCoreSystem->getLogSystem()->printLog(LogType::INNO_DEV_SUCCESS, "VKRenderingSystem: logical device has been created.");
	return true;
}

bool VKRenderingSystemNS::createSwapChain()
{
	SwapChainSupportDetails l_swapChainSupport = querySwapChainSupport(VKRenderingSystemComponent::get().m_physicalDevice);

	VkSurfaceFormatKHR l_surfaceFormat = chooseSwapSurfaceFormat(l_swapChainSupport.m_formats);
	VkPresentModeKHR l_presentMode = chooseSwapPresentMode(l_swapChainSupport.m_presentModes);
	VkExtent2D l_extent = chooseSwapExtent(l_swapChainSupport.m_capabilities);

	uint32_t l_imageCount = l_swapChainSupport.m_capabilities.minImageCount + 1;
	if (l_swapChainSupport.m_capabilities.maxImageCount > 0 && l_imageCount > l_swapChainSupport.m_capabilities.maxImageCount)
	{
		l_imageCount = l_swapChainSupport.m_capabilities.maxImageCount;
	}

	VkSwapchainCreateInfoKHR l_createInfo = {};
	l_createInfo.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR;
	l_createInfo.surface = VKRenderingSystemComponent::get().m_windowSurface;

	l_createInfo.minImageCount = l_imageCount;
	l_createInfo.imageFormat = l_surfaceFormat.format;
	l_createInfo.imageColorSpace = l_surfaceFormat.colorSpace;
	l_createInfo.imageExtent = l_extent;
	l_createInfo.imageArrayLayers = 1;
	l_createInfo.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;

	QueueFamilyIndices l_indices = findQueueFamilies(VKRenderingSystemComponent::get().m_physicalDevice);
	uint32_t l_queueFamilyIndices[] = { l_indices.m_graphicsFamily.value(), l_indices.m_presentFamily.value() };

	if (l_indices.m_graphicsFamily.value() != l_indices.m_presentFamily.value())
	{
		l_createInfo.imageSharingMode = VK_SHARING_MODE_CONCURRENT;
		l_createInfo.queueFamilyIndexCount = 2;
		l_createInfo.pQueueFamilyIndices = l_queueFamilyIndices;
	}
	else
	{
		l_createInfo.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;
	}

	l_createInfo.preTransform = l_swapChainSupport.m_capabilities.currentTransform;
	l_createInfo.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
	l_createInfo.presentMode = l_presentMode;
	l_createInfo.clipped = VK_TRUE;

	l_createInfo.oldSwapchain = VK_NULL_HANDLE;

	if (vkCreateSwapchainKHR(VKRenderingSystemComponent::get().m_device, &l_createInfo, nullptr, &VKRenderingSystemComponent::get().m_swapChain) != VK_SUCCESS)
	{
		m_objectStatus = ObjectStatus::STANDBY;
		g_pCoreSystem->getLogSystem()->printLog(LogType::INNO_ERROR, "VKRenderingSystem: Failed to create swap chain!");
		return false;
	}

	vkGetSwapchainImagesKHR(VKRenderingSystemComponent::get().m_device, VKRenderingSystemComponent::get().m_swapChain, &l_imageCount, nullptr);
	VKRenderingSystemComponent::get().m_swapChainImages.resize(l_imageCount);

	vkGetSwapchainImagesKHR(VKRenderingSystemComponent::get().m_device, VKRenderingSystemComponent::get().m_swapChain, &l_imageCount, VKRenderingSystemComponent::get().m_swapChainImages.data());

	VKRenderingSystemComponent::get().m_swapChainImageFormat = l_surfaceFormat.format;
	VKRenderingSystemComponent::get().m_swapChainExtent = l_extent;

	g_pCoreSystem->getLogSystem()->printLog(LogType::INNO_DEV_SUCCESS, "VKRenderingSystem: swap chain has been created.");
	return true;
}

bool VKRenderingSystemNS::createImageViews()
{
	VKRenderingSystemComponent::get().m_swapChainImageViews.resize(VKRenderingSystemComponent::get().m_swapChainImages.size());

	for (size_t i = 0; i < VKRenderingSystemComponent::get().m_swapChainImages.size(); i++) {
		VkImageViewCreateInfo l_createInfo = {};
		l_createInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
		l_createInfo.image = VKRenderingSystemComponent::get().m_swapChainImages[i];
		l_createInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
		l_createInfo.format = VKRenderingSystemComponent::get().m_swapChainImageFormat;
		l_createInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
		l_createInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
		l_createInfo.components.b = VK_COMPONENT_SWIZZLE_IDENTITY;
		l_createInfo.components.a = VK_COMPONENT_SWIZZLE_IDENTITY;
		l_createInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
		l_createInfo.subresourceRange.baseMipLevel = 0;
		l_createInfo.subresourceRange.levelCount = 1;
		l_createInfo.subresourceRange.baseArrayLayer = 0;
		l_createInfo.subresourceRange.layerCount = 1;

		if (vkCreateImageView(VKRenderingSystemComponent::get().m_device, &l_createInfo, nullptr, &VKRenderingSystemComponent::get().m_swapChainImageViews[i]) != VK_SUCCESS)
		{
			m_objectStatus = ObjectStatus::STANDBY;
			g_pCoreSystem->getLogSystem()->printLog(LogType::INNO_ERROR, "VKRenderingSystem: Failed to create image views!");
			return false;
		}
	}

	g_pCoreSystem->getLogSystem()->printLog(LogType::INNO_DEV_SUCCESS, "VKRenderingSystem: swap chain image views has been created.");
	return true;
}

bool VKRenderingSystemNS::createGraphicsPipeline()
{
	auto l_VKSPC = g_pCoreSystem->getMemorySystem()->spawn<VKShaderProgramComponent>();

	ShaderFilePaths l_shaderFilePaths;
	l_shaderFilePaths.m_VSPath = "..//res//shaders//VK//finalBlendPass.vert.spv";
	l_shaderFilePaths.m_FSPath = "..//res//shaders//VK//finalBlendPass.frag.spv";

	auto l_result = initializeVKShaderProgramComponent(l_VKSPC, l_shaderFilePaths);

	auto l_VKRPC = addVKRenderPassComponent(1, TextureDataDesc(), l_VKSPC);

	g_pCoreSystem->getLogSystem()->printLog(LogType::INNO_DEV_SUCCESS, "VKRenderingSystem: graphics pipeline has been created.");
	return true;
}

bool VKRenderingSystemNS::setup(IRenderingFrontendSystem* renderingFrontend)
{
	m_renderingFrontendSystem = renderingFrontend;

	bool result = true;
	result = result && createVkInstance();
	result = result && createDebugCallback();
	result = result && createWindowSurface();
	result = result && createPysicalDevice();
	result = result && createLogicalDevice();
	result = result && createSwapChain();
	result = result && createImageViews();
	result = result && createGraphicsPipeline();

	m_objectStatus = ObjectStatus::ALIVE;
	return result;
}

bool VKRenderingSystemNS::terminate()
{
	//vkDestroyPipeline(VKRenderingSystemComponent::get().m_device, m_graphicsPipeline, nullptr);
	//vkDestroyPipelineLayout(VKRenderingSystemComponent::get().m_device, m_pipelineLayout, nullptr);
	//vkDestroyRenderPass(VKRenderingSystemComponent::get().m_device, m_renderPass, nullptr);

	for (auto imageView : VKRenderingSystemComponent::get().m_swapChainImageViews)
	{
		vkDestroyImageView(VKRenderingSystemComponent::get().m_device, imageView, nullptr);
	}

	vkDestroySwapchainKHR(VKRenderingSystemComponent::get().m_device, VKRenderingSystemComponent::get().m_swapChain, nullptr);

	vkDestroyDevice(VKRenderingSystemComponent::get().m_device, nullptr);

	if (VKRenderingSystemComponent::get().m_enableValidationLayers)
	{
		destroyDebugUtilsMessengerEXT(VKRenderingSystemComponent::get().m_instance, VKRenderingSystemComponent::get().m_messengerCallback, nullptr);
	}

	vkDestroySurfaceKHR(VKRenderingSystemComponent::get().m_instance, VKRenderingSystemComponent::get().m_windowSurface, nullptr);

	vkDestroyInstance(VKRenderingSystemComponent::get().m_instance, nullptr);

	VKRenderingSystemNS::m_objectStatus = ObjectStatus::SHUTDOWN;
	return true;
}

INNO_SYSTEM_EXPORT bool VKRenderingSystem::setup(IRenderingFrontendSystem* renderingFrontend)
{
	return VKRenderingSystemNS::setup(renderingFrontend);
}

INNO_SYSTEM_EXPORT bool VKRenderingSystem::initialize()
{
	g_pCoreSystem->getLogSystem()->printLog(LogType::INNO_DEV_SUCCESS, "VKRenderingSystem has been initialized.");
	return true;
}

INNO_SYSTEM_EXPORT bool VKRenderingSystem::update()
{
	return true;
}

INNO_SYSTEM_EXPORT bool VKRenderingSystem::terminate()
{
	return VKRenderingSystemNS::terminate();
}

INNO_SYSTEM_EXPORT ObjectStatus VKRenderingSystem::getStatus()
{
	return VKRenderingSystemNS::m_objectStatus;
}

INNO_SYSTEM_EXPORT bool VKRenderingSystem::resize()
{
	return true;
}


text:
import expect from 'expect.js';

import { connect } from '../../../src';
import { init, beforeEachFn } from '../utils/hooks';

describe('[UNIT] Stream client (Heroku)', function () {
  init.call(this);
  beforeEach(beforeEachFn);

  describe('#Heroku', function () {
    it('heroku (stream-io-api.com)', function (done) {
      const url = 'https://thierry:pass@stream-io-api.com/?app_id=1';
      process.env.STREAM_URL = url;
      this.client = connect();
      expect(this.client.apiKey).to.eql('thierry');
      expect(this.client.apiSecret).to.eql('pass');
      expect(this.client.appId).to.eql('1');
      expect(this.client.baseUrl).to.eql('https://api.stream-io-api.com/api/');
      delete process.env.STREAM_URL;
      done();
    });

    it('heroku (getstream.io)', function (done) {
      const url = 'https://thierry:pass@getstream.io/?app_id=1';
      process.env.STREAM_URL = url;
      process.env.STREAM_BASE_URL = 'https://api.getstream.io/api/';
      this.client = connect();
      expect(this.client.apiKey).to.eql('thierry');
      expect(this.client.apiSecret).to.eql('pass');
      expect(this.client.appId).to.eql('1');
      expect(this.client.baseUrl).to.eql('https://api.getstream.io/api/');
      delete process.env.STREAM_URL;
      delete process.env.STREAM_BASE_URL;
      done();
    });

    it('heroku legacy (stream-io-api.com)', function (done) {
      const url =
        'https://bvt88g4kvc63:twc5ywfste5bm2ngqkzs7ukxk3pn96yweghjrxcmcrarnt3j4dqj3tucbhym5wfd@stream-io-api.com/?app_id=669';
      process.env.STREAM_URL = url;
      this.client = connect();
      expect(this.client.apiKey).to.eql('bvt88g4kvc63');
      expect(this.client.apiSecret).to.eql('twc5ywfste5bm2ngqkzs7ukxk3pn96yweghjrxcmcrarnt3j4dqj3tucbhym5wfd');
      expect(this.client.appId).to.eql('669');
      expect(this.client.baseUrl).to.eql('https://api.stream-io-api.com/api/');
      delete process.env.STREAM_URL;
      done();
    });

    it('heroku legacy (getstream.io)', function (done) {
      const url =
        'https://bvt88g4kvc63:twc5ywfste5bm2ngqkzs7ukxk3pn96yweghjrxcmcrarnt3j4dqj3tucbhym5wfd@getstream.io/?app_id=669';
      process.env.STREAM_URL = url;
      process.env.STREAM_BASE_URL = 'https://api.getstream.io/api/';
      this.client = connect();
      expect(this.client.apiKey).to.eql('bvt88g4kvc63');
      expect(this.client.apiSecret).to.eql('twc5ywfste5bm2ngqkzs7ukxk3pn96yweghjrxcmcrarnt3j4dqj3tucbhym5wfd');
      expect(this.client.appId).to.eql('669');
      expect(this.client.baseUrl).to.eql('https://api.getstream.io/api/');
      delete process.env.STREAM_URL;
      delete process.env.STREAM_BASE_URL;
      done();
    });

    it('heroku with location (stream-io-api.com)', function (done) {
      const url =
        'https://ahj2ndz7gsan:gthc2t9gh7pzq52f6cky8w4r4up9dr6rju9w3fjgmkv6cdvvav2ufe5fv7e2r9qy@us-east.stream-io-api.com/?app_id=1';
      process.env.STREAM_URL = url;
      this.client = connect();
      expect(this.client.apiKey).to.eql('ahj2ndz7gsan');
      expect(this.client.apiSecret).to.eql('gthc2t9gh7pzq52f6cky8w4r4up9dr6rju9w3fjgmkv6cdvvav2ufe5fv7e2r9qy');
      expect(this.client.appId).to.eql('1');
      expect(this.client.baseUrl).to.eql('https://us-east-api.stream-io-api.com/api/');
      delete process.env.STREAM_URL;
      done();
    });

    it('heroku with location (getstream.io)', function (done) {
      const url =
        'https://ahj2ndz7gsan:gthc2t9gh7pzq52f6cky8w4r4up9dr6rju9w3fjgmkv6cdvvav2ufe5fv7e2r9qy@us-east.getstream.io/?app_id=1';
      process.env.STREAM_URL = url;
      process.env.STREAM_BASE_URL = 'https://us-east-api.getstream.io/api/';
      this.client = connect();
      expect(this.client.apiKey).to.eql('ahj2ndz7gsan');
      expect(this.client.apiSecret).to.eql('gthc2t9gh7pzq52f6cky8w4r4up9dr6rju9w3fjgmkv6cdvvav2ufe5fv7e2r9qy');
      expect(this.client.appId).to.eql('1');
      expect(this.client.baseUrl).to.eql('https://us-east-api.getstream.io/api/');
      delete process.env.STREAM_URL;
      delete process.env.STREAM_BASE_URL;
      done();
    });

    it('heroku_overwrite (stream-io-api.com)', function (done) {
      const url = 'https://thierry:pass@stream-io-api.com/?app_id=1';
      process.env.STREAM_URL = url;
      this.client = connect('a', 'b', 'c');
      expect(this.client.apiKey).to.eql('a');
      expect(this.client.apiSecret).to.eql('b');
      expect(this.client.appId).to.eql('c');
      delete process.env.STREAM_URL;
      done();
    });

    it('heroku_overwrite (getstream.io)', function (done) {
      const url = 'https://thierry:pass@getstream.io/?app_id=1';
      process.env.STREAM_URL = url;
      this.client = connect('a', 'b', 'c');
      expect(this.client.apiKey).to.eql('a');
      expect(this.client.apiSecret).to.eql('b');
      expect(this.client.appId).to.eql('c');
      delete process.env.STREAM_URL;
      done();
    });
  });
});

redpajama_set_name: RedPajamaGithub


text:
using OpenProtocolInterpreter.Converters;
using System.Collections.Generic;

namespace OpenProtocolInterpreter.IOInterface
{
    /// <summary>
    /// Status externally monitored inputs
    /// <para>
    ///    Status for the eight externally monitored digital inputs. This message is sent to the subscriber every
    ///    time the status of at least one of the inputs has changed.
    /// </para>
    /// <para>Message sent by: Controller</para>
    /// <para>Answer: <see cref="Mid0212"/> Status externally monitored inputs acknowledge</para>
    /// </summary>
    public class Mid0211 : Mid, IIOInterface, IController
    {
        private readonly IValueConverter<bool> _boolConverter;
        private const int LAST_REVISION = 1;
        public const int MID = 211;

        public bool StatusDigInOne
        {
            get => GetField(1,(int)DataFields.STATUS_DIG_IN_1).GetValue(_boolConverter.Convert);
            set => GetField(1,(int)DataFields.STATUS_DIG_IN_1).SetValue(_boolConverter.Convert, value);
        }
        public bool StatusDigInTwo
        {
            get => GetField(1,(int)DataFields.STATUS_DIG_IN_2).GetValue(_boolConverter.Convert);
            set => GetField(1,(int)DataFields.STATUS_DIG_IN_2).SetValue(_boolConverter.Convert, value);
        }
        public bool StatusDigInThree
        {
            get => GetField(1,(int)DataFields.STATUS_DIG_IN_3).GetValue(_boolConverter.Convert);
            set => GetField(1,(int)DataFields.STATUS_DIG_IN_3).SetValue(_boolConverter.Convert, value);
        }
        public bool StatusDigInFour
        {
            get => GetField(1,(int)DataFields.STATUS_DIG_IN_4).GetValue(_boolConverter.Convert);
            set => GetField(1,(int)DataFields.STATUS_DIG_IN_4).SetValue(_boolConverter.Convert, value);
        }
        public bool StatusDigInFive
        {
            get => GetField(1,(int)DataFields.STATUS_DIG_IN_5).GetValue(_boolConverter.Convert);
            set => GetField(1,(int)DataFields.STATUS_DIG_IN_5).SetValue(_boolConverter.Convert, value);
        }
        public bool StatusDigInSix
        {
            get => GetField(1,(int)DataFields.STATUS_DIG_IN_6).GetValue(_boolConverter.Convert);
            set => GetField(1,(int)DataFields.STATUS_DIG_IN_6).SetValue(_boolConverter.Convert, value);
        }
        public bool StatusDigInSeven
        {
            get => GetField(1,(int)DataFields.STATUS_DIG_IN_7).GetValue(_boolConverter.Convert);
            set => GetField(1,(int)DataFields.STATUS_DIG_IN_7).SetValue(_boolConverter.Convert, value);
        }
        public bool StatusDigInEight
        {
            get => GetField(1,(int)DataFields.STATUS_DIG_IN_8).GetValue(_boolConverter.Convert);
            set => GetField(1,(int)DataFields.STATUS_DIG_IN_8).SetValue(_boolConverter.Convert, value);
        }

        public Mid0211() : this(0)
        {

        }

        public Mid0211(int? noAckFlag = 0) : base(MID, LAST_REVISION, noAckFlag)
        {
            _boolConverter = new BoolConverter();
        }

        protected override Dictionary<int, List<DataField>> RegisterDatafields()
        {
            return new Dictionary<int, List<DataField>>()
            {
                {
                    1, new List<DataField>()
                    {
                        new DataField((int)DataFields.STATUS_DIG_IN_1, 20, 1, false),
                        new DataField((int)DataFields.STATUS_DIG_IN_2, 21, 1, false),
                        new DataField((int)DataFields.STATUS_DIG_IN_3, 22, 1, false),
                        new DataField((int)DataFields.STATUS_DIG_IN_4, 23, 1, false),
                        new DataField((int)DataFields.STATUS_DIG_IN_5, 24, 1, false),
                        new DataField((int)DataFields.STATUS_DIG_IN_6, 25, 1, false),
                        new DataField((int)DataFields.STATUS_DIG_IN_7, 26, 1, false),
                        new DataField((int)DataFields.STATUS_DIG_IN_8, 27, 1, false)
                    }
                }
            };
        }

        public enum DataFields
        {
            STATUS_DIG_IN_1,
            STATUS_DIG_IN_2,
            STATUS_DIG_IN_3,
            STATUS_DIG_IN_4,
            STATUS_DIG_IN_5,
            STATUS_DIG_IN_6,
            STATUS_DIG_IN_7,
            STATUS_DIG_IN_8
        }
    }
}


text:
// This file is a part of the IncludeOS unikernel - www.includeos.org
//
// Copyright 2015-2017 Oslo and Akershus University College of Applied Sciences
// and Alfred Bratterud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#pragma once
#ifndef HW_BLOCK_DEVICE_HPP
#define HW_BLOCK_DEVICE_HPP

#include <cstdint>
#include <delegate>
#include <memory>
#include <vector>

namespace hw {

/**
 * This class is an abstract interface for block devices
 */
class Block_device {
public:
  using block_t       = uint64_t;
  using buffer_t      = std::shared_ptr<std::vector<uint8_t>>;
  using on_read_func  = delegate<void(buffer_t)>;
  using on_write_func = delegate<void(bool error)>;

  /**
   * Method to get the type of device
   *
   * @return The type of device as a C-String
   */
  static const char* device_type() noexcept
  { return "Block device"; }

  /**
   * Method to get the name of the device
   *
   * @return The name of the device as a std::string
   */
  virtual std::string device_name() const = 0;

  /**
   * Method to get the device's identifier
   *
   * @return The device's identifier
   */
  int id() const noexcept
  { return id_; }

  /**
   * Get the human-readable name of this device's controller
   *
   * @return The human-readable name of this device's controller
   */
  virtual const char* driver_name() const noexcept = 0;

  /**
   * Get the size of the device as total number of blocks
   *
   * @return The size of the device as total number of blocks
   */
  virtual block_t size() const noexcept = 0;

  /**
   * Get the optimal block size for this device
   *
   * @return The optimal block size for this device
   */
  virtual block_t block_size() const noexcept = 0;

  /**
   * Read a block of data asynchronously from the device
   *
   * @param blk
   *   The block of data to read from the device
   *
   * @param reader
   *   An operation to perform asynchronously
   *
   * @note A nullptr is passed to the reader if an error occurred
   * @note Validate the reader's input
   *
   * @example
   *   if (buffer == nullptr) {
   *     error("Device failed to read sector");
   *   }
   */
  virtual void read(block_t blk, on_read_func reader) = 0;

  /**
   * Read blocks of data asynchronously from the device
   *
   * @param blk
   *   The starting block of data to read from the device
   *
   * @param count
   *   The number of blocks to read from the device
   *
   * @param reader
   *   An operation to perform asynchronously
   *
   * @note A nullptr is passed to the reader if an error occurred
   * @note Validate the reader's input
   *
   * @example
   *   if (buffer == nullptr) {
   *     error("Device failed to read sector");
   *   }
   */
  virtual void read(block_t blk, size_t count, on_read_func reader) = 0;

  /**
   * Read a block of data synchronously from the device
   *
   * @param blk
   *   The block of data to read from the device
   *
   * @return A buffer containing the data or nullptr if an error occurred
   */
  virtual buffer_t read_sync(block_t blk) = 0;

  /**
   * Read blocks of data synchronously from the device
   *
   * @param blk
   *   The starting block of data to read from the device
   *
   * @param count
   *   The number of blocks to read from the device
   *
   * @return A buffer containing the data or nullptr if an error occurred
   */
  virtual buffer_t read_sync(block_t blk, size_t count) = 0;

  /**
   * Write blocks of data to device, IF specially supported
   * This functionality is not enabled by default, nor always supported
  **/
  virtual void write(block_t blk, buffer_t, on_write_func) = 0;

  virtual bool write_sync(block_t blk, buffer_t) = 0;

  /**
   * Method to deactivate the block device
   */
  virtual void deactivate() = 0;

  virtual ~Block_device() noexcept = default;
protected:
  Block_device() noexcept
  {
    static int counter = 0;
    id_ = counter++;
  }
private:
  int id_;
}; //< class Block_device

} //< namespace hw

#endif //< HW_BLOCK_DEVICE_HPP


text:
package org.polyglotted.attributerepo.stash;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.polyglotted.attributerepo.spring.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@ContextConfiguration(locations = { "classpath:/spring-test/basic-test-context.xml" })
@RunWith(SpringJUnit4ClassRunner.class)
public class StashSpringAppTest {

    @Autowired
    Person person;

    @BeforeClass
    public static void setUpBeforeClass() {
        System.setProperty("attributerepo.properties.file.location", "classpath:/files/stash-integration.properties");
    }

    @AfterClass
    public static void tearUpAfterClass() {
        System.clearProperty("attributerepo.properties.file.location");
    }

    @Test
    @Ignore
    public void testIntegration() {
        assertNotNull(person);
        assertEquals("adrian tester", person.getName());
        assertEquals(28, person.getAge());
    }
}


text:
package com.asakusafw.windgate.hadoopfs.ssh;

import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;

/**
 * Represents information of transferring files in {@link FileList}.
 * @since 0.7.4
 */
public class FileInfo {

    private static final byte[] HEADER = {
        (byte) 0xf1,
        (byte) 0x1e,
    };

    static final Charset PATH_ENCODING = StandardCharsets.UTF_8;

    private final String uri;

    FileInfo(String uri) {
        this.uri = uri;
    }

    /**
     * Returns the URI of the target file.
     * @return the file URI
     */
    public String getUri() {
        return uri;
    }

    /**
     * Returns a serialized bytes.
     * @return bytes
     */
    byte[] toBytes() {
        byte[] path = uri.getBytes(PATH_ENCODING);
        byte[] results = new byte[HEADER.length + path.length];
        System.arraycopy(HEADER, 0, results, 0, HEADER.length);
        System.arraycopy(path, 0, results, HEADER.length, path.length);
        return results;
    }

    static FileInfo fromBytes(byte[] bytes) throws IOException {
        if (bytes == null || bytes.length <= HEADER.length) {
            throw new IOException("invalid file info in file list"); //$NON-NLS-1$
        }
        for (int i = 0; i < HEADER.length; i++) {
            if (HEADER[i] != bytes[i]) {
                throw new IOException("invalid file info in file list"); //$NON-NLS-1$
            }
        }
        byte[] pathBytes = Arrays.copyOfRange(bytes, HEADER.length, bytes.length);
        String path = new String(pathBytes, PATH_ENCODING);
        return new FileInfo(path);
    }
}


text:
<?php

if (!defined('CORE'))
	exit();

function template_login_main()
{
	global $user;

	echo '
		<form class="form-horizontal" action="', build_url('login'), '" method="post">
			<fieldset>
				<legend>User Login</legend>

					Username:

						<input type="text" class="input-xlarge" id="username" name="username" />

					Password:

						<input type="password" class="input-xlarge" id="password" name="password" />

					<input type="submit" class="btn btn-primary" name="submit" value="Submit" />

			</fieldset>
			<input type="hidden" name="session_id" value="', $user['session_id'], '" />
		</form>';
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center_horizontal"
    android:orientation="vertical"
    tools:context="com.ztiany.clfix.demo.MainActivity">

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:onClick="fix"
        android:text="fix"
        android:textAllCaps="false"/>

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:onClick="testBug"
        android:text="test bug"
        android:textAllCaps="false"/>

</LinearLayout>


text:
<?php
/**
 * Data Storage Object for Schools Data Points.
 *
 * @package HRQLS/Controllers
 */

namespace HRQLS\Controllers\Schools;

use HRQLS\Bootstrap;
use Silex\Application;

/**
 * Defines Schools DataPoint Class.
 * The purpose of this class is to standardize School Data from any city.
 */
final class DataPoint
{
    /**
     * The name of the school.
     *
     * @var string
     */
    private $name;

    /**
     * The type of school. Either Private or Public.
     *
     * @var string
     */
    private $type;

    /**
     * The range of grades available at this schoool.
     *
     * @var string
     */
    private $gradeRange;

    /**
     * The rating for this school as given by parents of children who attend the school.
     *
     * @var integer
     */
    private $rating;

    /**
     * Location of this school as described by latitude and longitude.
     *
     * @var array like [ 'lat' => (float), 'lon' => (float)].
     */
    private $location;
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="280dp"
    android:layout_gravity="bottom"
    android:orientation="vertical"
    android:weightSum="10">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="@dimen/dimen0"
        android:layout_gravity="bottom"
        android:layout_weight="2"
        android:background="#80ffffff"
        android:orientation="horizontal">

        <Button
            android:id="@+id/signin"
            android:layout_width="@dimen/dimen0"
            android:layout_height="@dimen/dimen60"
            android:layout_marginLeft="-5dp"
            android:layout_marginStart="-5dp"
            android:layout_weight="1"
            android:background="#80ffffff"
            android:text="@string/sign_in"
            android:textAllCaps="false"
            android:textSize="@dimen/textsize16" />

        <Button
            android:id="@+id/signup"
            android:layout_width="@dimen/dimen0"
            android:layout_height="@dimen/dimen60"
            android:layout_marginEnd="-5dp"
            android:layout_marginRight="-5dp"
            android:layout_weight="1"
            android:background="#80ffffff"
            android:text="@string/sign_up"
            android:textAllCaps="false"
            android:textSize="@dimen/textsize16" />

    </LinearLayout>

    <ListView
        android:id="@+id/lists"
        android:layout_width="match_parent"
        android:layout_height="@dimen/dimen0"
        android:layout_gravity="bottom"
        android:layout_weight="6.75"
        android:background="#F5FFFA">

    </ListView>

    <ProgressBar
        android:id="@+id/prbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:background="#F5FFFA"
        android:gravity="center"
        android:visibility="gone" />

    <Button
        android:layout_width="match_parent"
        android:layout_height="@dimen/dimen0"
        android:layout_weight="1.25"
        android:background="#FFDAB9"
        android:gravity="top|center_horizontal"
        android:text="@string/address"
        android:textAllCaps="false" />

</LinearLayout>


text:
<!DOCTYPE html>
<title>Canvas test: toDataURL.lowercase.ascii</title>

<link rel="stylesheet" href="../tests.css">

Pass

Fail

These images should be identical:

<canvas id="c" class="output" width="100" height="50">
FAIL (fallback content)
</canvas>


text:
package org.nnsoft.commons.miyamoto;

import java.util.Arrays;

/**
 * Describes an annotation property.
 *
 * @version $Id$
 */
final class AnnotationProperty {

    /**
     * The property name.
     */
    private final String name;

    /**
     * The property type.
     */
    private final Class<?> type;

    /**
     * The property value. This field can be mutable.
     */
    private Object value;

    /**
     * Creates a new annotation property instance.
     *
     * @param name the property name.
     * @param type the property type.
     */
    public AnnotationProperty(String name, Class<?> type) {
        this.name = name;
        this.type = type;
    }

    /**
     * Returns the property name.
     *
     * @return the property name.
     */
    public String getName() {
        return this.name;
    }

    /**
     * Returns the property type.
     *
     * @return the property type.
     */
    public Class<?> getType() {
        return this.type;
    }

    /**
     * Returns the property value.
     *
     * @return the property value.
     */
    public Object getValue() {
        return this.value;
    }

    /**
     * Sets the property value.
     *
     * @param value the property value.
     */
    public void setValue(Object value) {
        if (value != null && !(this.type.isAssignableFrom(value.getClass())
                || (this.type == Boolean.TYPE && value.getClass() == Boolean.class)
                || (this.type == Byte.TYPE && value.getClass() == Byte.class)
                || (this.type == Character.TYPE && value.getClass() == Character.class)
                || (this.type == Double.TYPE && value.getClass() == Double.class)
                || (this.type == Float.TYPE && value.getClass() == Float.class)
                || (this.type == Integer.TYPE && value.getClass() == Integer.class)
                || (this.type == Long.TYPE && value.getClass() == Long.class)
                || (this.type == Short.TYPE && value.getClass() == Short.class))) {
            throw new IllegalArgumentException("Cannot assign value of type '"
                    + value.getClass().getName()
                    + "' to property '"
                    + this.name
                    + "' of type '"
                    + this.type.getName()
                    + "'");
        }
        this.value = value;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + this.name.hashCode();
        result = prime * result + this.type.hashCode();
        result = prime * result + this.getValueHashCode();
        return result;
    }

    /**
     * Calculates this annotation value hash code.
     *
     * @return this annotation value hash code.
     */
    protected int getValueHashCode() {
        if (this.value == null) {
            return 0;
        }

        if (!this.type.isArray()) {
            return this.value.hashCode();
        }

        if (this.type == byte[].class) {
            return Arrays.hashCode((byte[]) this.value);
        }
        if (this.type == char[].class) {
            return Arrays.hashCode((char[]) this.value);
        }
        if (this.type == double[].class) {
            return Arrays.hashCode((double[]) this.value);
        }
        if (this.type == float[].class) {
            return Arrays.hashCode((float[]) this.value);
        }
        if (this.type == int[].class) {
            return Arrays.hashCode((int[]) this.value);
        }
        if (this.type == long[].class) {
            return Arrays.hashCode((long[]) this.value);
        }
        if (this.type == short[].class) {
            return Arrays.hashCode((short[]) this.value);
        }
        if (this.type == boolean[].class) {
            return Arrays.hashCode((boolean[]) this.value);
        }
        return Arrays.hashCode((Object[]) this.value);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }

        if (obj == null) {
            return false;
        }

        if (this.getClass() != obj.getClass()) {
            return false;
        }

        AnnotationProperty other = (AnnotationProperty) obj;

        if (this.name == null) {
            if (other.getName() != null) {
                return false;
            }
        } else if (!this.name.equals(other.getName())) {
            return false;
        }

        if (this.type == null) {
            if (other.getType() != null) {
                return false;
            }
        } else if (!this.type.equals(other.getType())) {
            return false;
        }

        if (this.value == null) {
            if (other.getValue() != null) {
                return false;
            }
        } else {
            // Check for primitive, string, class, enum const, annotation
            if (!this.type.isArray()) {
                return this.value.equals(other.getValue());
            }

            // Check for array of string, class, enum const, annotation
            if (this.value instanceof Object[] && other.getValue() instanceof Object[]) {
                Arrays.equals((Object[]) this.value, (Object[]) other.getValue());
            }

            // Deal with array of primitives
            if (this.type == byte[].class) {
                return Arrays.equals((byte[]) this.value, (byte[]) other.getValue());
            }
            if (this.type == char[].class) {
                return Arrays.equals((char[]) this.value, (char[]) other.getValue());
            }
            if (this.type == double[].class) {
                return Arrays.equals((double[]) this.value, (double[]) other.getValue());
            }
            if (this.type == float[].class) {
                return Arrays.equals((float[]) this.value, (float[]) other.getValue());
            }
            if (this.type == int[].class) {
                return Arrays.equals((int[]) this.value, (int[]) other.getValue());
            }
            if (this.type == long[].class) {
                return Arrays.equals((long[]) this.value, (long[]) other.getValue());
            }
            if (this.type == short[].class) {
                return Arrays.equals((short[]) this.value, (short[]) other.getValue());
            }
            if (this.type == boolean[].class) {
                return Arrays.equals((boolean[]) this.value, (boolean[]) other.getValue());
            }
        }

        return false;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String toString() {
        return "(name="
                + this.name
                + ", type="
                + (this.type.isArray() ? (this.type.getComponentType().getName() + "[]") : this.type.getName())
                + ", value="
                + this.valueToString()
                + ")";
    }

    /**
     * Calculates the {@code toString} of the property value.
     *
     * @return the {@code toString} of the property value.
     */
    protected String valueToString() {
        if (!this.type.isArray()) {
            return String.valueOf(this.value);
        }

        Class<?> arrayType = this.type.getComponentType();
        if (arrayType == Boolean.TYPE) {
            return Arrays.toString((boolean[]) this.value);
        } else if (arrayType == Byte.TYPE) {
            return Arrays.toString((byte[]) this.value);
        } else if (arrayType == Character.TYPE) {
            return Arrays.toString((char[]) this.value);
        } else if (arrayType == Double.TYPE) {
            return Arrays.toString((double[]) this.value);
        } else if (arrayType == Float.TYPE) {
            return Arrays.toString((float[]) this.value);
        } else if (arrayType == Integer.TYPE) {
            return Arrays.toString((int[]) this.value);
        } else if (arrayType == Long.TYPE) {
            return Arrays.toString((long[]) this.value);
        } else if (arrayType == Short.TYPE) {
            return Arrays.toString((short[]) this.value);
        }

        return Arrays.toString((Object[]) this.value);
    }

}


text:
define(['picoModal','sugar-web/datastore','sugar-web/graphics/icon','mustache'], function(picoModal,datastore,icon,mustache) {

	var chooser = {};

	// Load settings
	var userSettings = datastore.localStorage.getValue('sugar_settings');
	var activities = [];
	for (var i = 0 ; i < userSettings.activities.length ; i++) {
		var activity = userSettings.activities[i];
		activities[activity.id] = activity;
	}

	// Localize content
	var l10n = {
		titleJournal: 'Local journal',
		titleClose: 'Cancel',
		titleChoose: 'Choose an object',
		holderSearch: 'Search in Journal',
		noMatchingEntries: 'No matching entries',
		SecondsAgo: 'Seconds ago',
		Ago: ' ago',
		Minutes_one: 'minute',
		Minutes_other: 'minutes',
		Hours_one: 'hour',
		Hours_other: 'hours',
		Days_one: 'day',
		Days_other: 'days',
		Weeks_one: 'week',
		Weeks_other: 'weeks',
		Months_one: 'month',
		Months_other: 'months',
		Years_one: 'year',
		Years_other: 'years'
	};
	function doLocalize(str) {
		var out = str;
		for(var current in l10n) {
			out = out.replace('$'+current, l10n[current]);
		}
		return out;
	}

	// Favorite
	var isFavorite = false;

	// Display object chooser dialog with journal content
	// Each filter has the form = {title: "%hysics", creation_time: "<12222", activity: ["org.olpcfrance.Paint","org.olpcfrance.Record"]}
	// When more than one filter is provided, an entry is valid if it match one filter or more. Usage examples:
	// 		chooser.show();
	// 		chooser.show({title: 'Paint Activity', creation_time: '>'+now.getTime()});
	// 		chooser.show({title: ['Paint Activity', '%hysics']});
	// 		chooser.show({keep: 1});
	// 		chooser.show({activity: 'org.olpcfrance.PaintActivity'}, {mimetype: 'image/png'})
	var modal;
	var result;
	chooser.show = function(callback, filter1, orFilter2, orFilter3, orFilter4) {
		result = null;
		modal = picoModal({
			content: doLocalize("\

\
					<button class='toolbutton active' id='journal-button' title='$titleJournal' style='background-image: url(lib/sugar-web/graphics/icons/actions/activity-journal.svg)'></button>\
					<button class='toolbutton pull-right' id='close-button' title='$titleClose' style='background-image: url(lib/sugar-web/graphics/icons/actions/dialog-cancel.svg)'></button>\

$titleChoose
\

\

\
					\
					<input id='search-text' type='text' placeholder='$holderSearch' style='width: 200px; font-size: 10pt'/>\
					<button id='cancel-search' class='cancel right'></button>\
					\
					<button class='toolbutton' id='favorite-button' title='$titleFavorite' style='background-image: url(lib/sugar-web/graphics/icons/emblems/favorite.svg)'></button>\

\

\

\

$noMatchingEntries
\

\

"),
			closeButton: false,
			modalStyles: {
				backgroundColor: "white",
				height: "400px",
				width: "600px",
				maxWidth: "90%"
			}
		})
		.afterShow(function(modal) {
			var color = userSettings.colorvalue;
			icon.colorize(document.getElementById('journal-button'), color, function() {});

			var targetHeight = document.getElementById("pictotoolbar").parentNode.offsetHeight - 55*2;
			document.getElementById('journal-container').style.height = targetHeight + "px";

			var favorite = document.getElementById('favorite-button');
			favorite.addEventListener('click', function() {
				if (!isFavorite) {
					icon.colorize(favorite, color, function() {});
				} else {
					favorite.style.backgroundImage = "url(lib/sugar-web/graphics/icons/emblems/favorite.svg)";
				}
				isFavorite = !isFavorite;
				fillJournal(filter1, orFilter2, orFilter3, orFilter4);
			});

			document.getElementById('search-text').addEventListener('keyup', function() {
				fillJournal(filter1, orFilter2, orFilter3, orFilter4);
			});

			document.getElementById('cancel-search').addEventListener('click', function() {
				document.getElementById('search-text').value = '';
				fillJournal(filter1, orFilter2, orFilter3, orFilter4);
			});
			document.getElementById('close-button').addEventListener('click', function() {
				result = null;
				modal.close();
			});

			fillJournal(filter1, orFilter2, orFilter3, orFilter4);
		})
		.afterClose(function(modal) {
			modal.destroy();
			if (callback) {
				callback(result);
			}
		})
		.show();
	}

	// Get journal entries and fill dialog with entries
	function fillJournal(filter1, orFilter2, orFilter3, orFilter4) {
		// Get filters
		var filters = [];
		if (filter1) { filters.push(filter1); }
		if (orFilter2) { filters.push(orFilter2); }
		if (orFilter3) { filters.push(orFilter3); }
		if (orFilter4) { filters.push(orFilter4); }

		// Compute filtering
		var journal = datastore.find();
		var rawJournal = [];
		for (var i = 0 ; i < journal.length ; i++) {
			var entry = journal[i];
			var match = true;
			if (isFavorite) {
				match = match && entry.metadata.keep;
			}
			var title = document.getElementById('search-text').value;
			if (title && title.length > 0) {
				match = match && (entry.metadata.title && (entry.metadata.title.indexOf(title) != -1));
			}
			if (match) {
				rawJournal.push(entry)
			}
		}
		var length = filters.length;
		var filteredJournal = rawJournal;
		if (length > 0) {
			filteredJournal = [];
			for(var i = 0 ; i < rawJournal.length ; i++) {
				var entry = rawJournal[i];
				var match = false;
				for (var j = 0 ; j < length ; j++) {
					match = match || filterMatch(entry, filters[j]);
				}
				if (match) {
					filteredJournal.push(entry);
				}
			}
		}

		// Get entries
		var journal = {entries: filteredJournal.sort(function(e0, e1) {
			return parseInt(e1.metadata.timestamp) - parseInt(e0.metadata.timestamp);
		})};

		// Add style properties
		for (var i = 0 ; i < journal.entries.length ; i++) {
			var entry = journal.entries[i];
			var activity = activities[entry.metadata.activity];
			entry.imageUrl = "../../" + activity.directory + "/" + activity.icon;
			entry.index = i;
			entry.ago = timestampToElapsedString(entry.metadata.creation_time);
		}

		// Draw it
		var template = "\
			{{#entries}}\

\

\

{{metadata.title}}
\

{{ago}}
\

\
			{{/entries}}\
		";
		var render = mustache.render(template, journal);
		document.getElementById('journal-container').innerHTML = render;

		// Handle click
		for (var i = 0 ; i < journal.entries.length ; i++) {
			var entry = document.getElementById('entry_'+i);
			entry.addEventListener('click', function(e) {
				var id = e.target.id;
				id = id.substr(id.indexOf("_")+1);
				var line = document.getElementById('entry_'+id);
				line.style.backgroundColor = "#808080";
				result = journal.entries[id];
				delete result['ago'];
				delete result['index'];
				delete result['imageUrl'];
				window.setTimeout(function() {
					modal.close(result);
				}, 200);
			});
		}
		document.getElementById('journal-empty').style.visibility = (journal.entries.length != 0 ? 'hidden' : 'visible');
	}

	// Util: compute elapsed time as a string
	function timestampToElapsedString(timestamp) {
		var l10n = {
			SecondsAgo: 'Seconds ago',
			Ago: ' ago',
			Minutes_one: 'minute',
			Minutes_other: 'minutes',
			Hours_one: 'hour',
			Hours_other: 'hours',
			Days_one: 'day',
			Days_other: 'days',
			Weeks_one: 'week',
			Weeks_other: 'weeks',
			Months_one: 'month',
			Months_other: 'months',
			Years_one: 'year',
			Years_other: 'years'
		};
		var units = [{name:'Years', factor:356 * 24 * 60 * 60},
					 {name:'Months', factor:30 * 24 * 60 * 60},
					 {name:'Weeks', factor:7 * 24 * 60 * 60},
					 {name:'Days', factor:24 * 60 * 60},
					 {name:'Hours', factor:60 * 60},
					 {name:'Minutes', factor:60}];
		var maxlevel = 1;
		var levels = 0;
		var time_period = '';
		var time_stamp = (new Date(timestamp).getTime());
		var elapsed_seconds = ((new Date().getTime()) - time_stamp)/1000;
		for (var i = 0; i < units.length ; i++) {
			var factor = units[i].factor;

			var elapsed_units = Math.floor(elapsed_seconds / factor);
			if (elapsed_units > 0) {
				if (levels > 0)
					time_period += ',';

				time_period += ' '+elapsed_units+" "+(elapsed_units==1?l10n[units[i].name+"_one"]:l10n[units[i].name+"_other"]);

				elapsed_seconds -= elapsed_units * factor;
			}

			if (time_period != '')
				levels += 1;

			if (levels == maxlevel)
				break;
		}

		if (levels == 0) {
			return l10n["SecondsAgo"];
		}

		return time_period+l10n["Ago"];
	}

	// Test if an entry match a value
	function entryMatch(entry, name, value) {
		var fieldValue = entry[name];
		if (!fieldValue) { return false; }
		var firstChar = value[0];
		if (firstChar == '%') {
			return fieldValue.indexOf(value.substr(1)) != -1;
		} else if (firstChar == '>') {
			return parseInt(fieldValue) > parseInt(value.substr(1));
		} else if (firstChar == '<') {
			return parseInt(fieldValue) < parseInt(value.substr(1));
		} else {
			return fieldValue == value;
		}
	}

	// Test if an entry match a filter
	function filterMatch(entry, filter) {
		var metadata = entry.metadata;
		var keys = Object.keys(filter);
		var match = true;
		for (var j = 0 ; j < keys.length ; j++) {
			var field = keys[j];
			var value = filter[field];
			if (value instanceof Array) {
				var or = false;
				for (var k = 0 ; k < value.length ; k++) {
					or = or || entryMatch(metadata, field, value[k]);
				}
				match = match && or;
			} else {
				match = match && entryMatch(metadata, field, value);
			}
		}
		return match;
	}

	return chooser;
});


text:
include_recipe "bcpc::packages-openstack"

if platform?("debian", "ubuntu")
    include_recipe "bcpc::networking"
end

cookbook_file "/usr/local/bin/apt-pkg-check-version" do
    source "apt-pkg-check-version"
    owner "root"
    mode 00755
end

bash "check-ceph-version" do
    code <<-EOH
        /usr/local/bin/apt-pkg-check-version ceph 0.80
        exit $?
	EOH
end

%w{librados2 librbd1 libcephfs1 python-ceph ceph-common ceph}.each do |pkg|
    package pkg do
        action :install
        version node['bcpc']['ceph']['version']
    end
end

ruby_block "initialize-ceph-common-config" do
    block do
        make_config('ceph-fs-uuid', %x[uuidgen -r].strip)
        make_config('ceph-mon-key', ceph_keygen)
    end
end

ruby_block 'write-ceph-mon-key' do
    block do
        %x[ ceph-authtool "/etc/ceph/ceph.mon.keyring" \
                --create-keyring \
                --name=mon. \
                --add-key="#{get_config('ceph-mon-key')}" \
                --cap mon 'allow *'
        ]
    end
    not_if "test -f /etc/ceph/ceph.mon.keyring"
end

template '/etc/ceph/ceph.conf' do
    source 'ceph.conf.erb'
    mode '0644'
    variables(:servers => get_head_nodes)
end

bcpc_cephconfig 'paxos_propose_interval' do
  value node["bcpc"]["ceph"]["rebalance"] ? "60" : "1"
  target "ceph-*"
end

bcpc_cephconfig 'osd_recovery_max_active' do
  value node["bcpc"]["ceph"]["rebalance"] ? "1" : "15"
  target "ceph-*"
end

bcpc_cephconfig 'osd_max_backfills' do
  value node["bcpc"]["ceph"]["rebalance"] ? "1" : "10"
  target "ceph-*"
end

bcpc_cephconfig 'osd_op_threads' do
  value node["bcpc"]["ceph"]["rebalance"] ? "10" : "2"
  target "ceph-*"
end

bcpc_cephconfig 'osd_recovery_op_priority' do
  value node["bcpc"]["ceph"]["rebalance"] ? "1" : "10"
  target "ceph-*"
end

bcpc_cephconfig 'osd_mon_report_interval_min' do
  value node["bcpc"]["ceph"]["rebalance"] ? "30" : "5"
  target "ceph-*"
end

bash "wait-for-pgs-creating" do
    action :nothing
    user "root"
    code "sleep 1; while ceph -s | grep -v mdsmap | grep creating >/dev/null 2>&1; do echo Waiting for new pgs to create...; sleep 1; done"
end


text:
'use strict';
var util = require('util');
var path = require('path');
var yeoman = require('yeoman-generator');
var yosay = require('yosay');

var NodsemGenerator = yeoman.generators.Base.extend({
  initializing: function () {
    this.pkg = require('../package.json');
  },

  prompting: function () {
    var done = this.async();

    // Have Yeoman greet the user.
    this.log(yosay(
      'Welcome to the Nodsem generator!'
    ));

var prompts = [{
    type: 'list',
    name: 'uiselect',
    message: 'which ui framework do you like to use?',
    choices: [{
      name: 'angulurjs',
      value: 2
    }, {
      name: 'emberjs',
      value: 1
    }]
  },
   {
    type: 'list',
    name: 'ui',
    message: 'which css framework do you like to use?',
    choices: [{
      name: 'semanticui',
      value: 2
    }, {
      name: 'twitterbootstrap',
      value: 1
    }]
  },
  {
    type: 'list',
    name: 'taskrunner',
    message: 'which taskrunner do you like to use?',
    choices: [{
      name: 'grunt',
      value: 2
    }, {
      name: 'gulp',
      value: 1
    }]
  },
  {
    type: 'list',
    name: 'dbselect',
    message: 'which database do you like to use?',
    choices: [{
      name: 'mysql',
      value: 3
    }, {
      name: 'sqlite',
      value: 2
    }, {
      name: 'mongodb',
      value: 1
    }]
  }
    ];

  this.prompt(prompts, function (answers) {
    this.angulurjs = (answers.uiselect === 2);
    this.emberjs = (answers.uiselect === 1);
    this.semanticui = (answers.ui === 2);
    this.twitterbootstrap = (answers.ui === 1);
    this.grunt = (answers.taskrunner === 2);
    this.gulp =  (answers.taskrunner === 1);
    this.mysql = (answers.dbselect === 3);
    this.sqlite = (answers.dbselect === 2);
    this.mongodb = (answers.dbselect === 1);
    this.mochaOption = answers.mochaOption;
    this.gruntOption = answers.gruntOption;

    done();
  }.bind(this));
},

  writing: {
    app: function () {

        if(this.emberjs && this.semanticui)
      {

      this.copy('html/semanticlogin.html', 'public/login.html');
      this.copy('css/libs/normalize.css', 'public/css/libs/normalize.css');
      this.copy('js/libs/handlebars-1.1.2.js', 'public/js/libs/handlebars-1.1.2.js');
      this.copy('js/libs/ember-1.5.1.js', 'public/js/libs/ember-1.5.1.js');
      this.copy('js/app.js', 'public/js/app.js');
      this.copy('js/model/routes.js', 'public/js/model/routes.js');
      this.copy('js/controller/logincontroller.js', 'public/js/controller/logincontroller.js');
      this.copy('tests/runner.css', 'public/tests/runner.css');
      this.copy('tests/runner.js', 'public/tests/runner.js');
      this.copy('tests/semantictests.js', 'public/tests/tests.js');
      this.copy('tests/vendor/qunit-1.12.0.css', 'public/tests/vendor/qunit-1.12.0.css');
      this.copy('tests/vendor/qunit-1.12.0.js', 'public/tests/vendor/qunit-1.12.0.js');
      }

        if(this.emberjs && this.twitterbootstrap)
      {

      this.copy('html/bootstraplogin.html', 'public/login.html');
      this.copy('css/libs/normalize.css', 'public/css/libs/normalize.css');
      this.copy('css/libs/style.css', 'public/css/libs/style.css');
      this.copy('js/libs/handlebars-1.1.2.js', 'public/js/libs/handlebars-1.1.2.js');
      this.copy('js/libs/ember-1.5.1.js', 'public/js/libs/ember-1.5.1.js');
      this.copy('js/app.js', 'public/js/app.js');
      this.copy('js/model/routes.js', 'public/js/model/routes.js');
      this.copy('js/controller/logincontroller.js', 'public/js/controller/logincontroller.js');
      this.copy('tests/runner.css', 'public/tests/runner.css');
      this.copy('tests/runner.js', 'public/tests/runner.js');
      this.copy('tests/bootstraptests.js', 'public/tests/tests.js');
      this.copy('tests/vendor/qunit-1.12.0.css', 'public/tests/vendor/qunit-1.12.0.css');
      this.copy('tests/vendor/qunit-1.12.0.js', 'public/tests/vendor/qunit-1.12.0.js');
      this.copy('img/avatar.png', 'public/img/avatar.png');

      }

       if(this.angulurjs && this.semanticui)
      {

      this.copy('html/angularsemantic.html', 'public/login.html');
      this.copy('js/angularapp.js', 'public/js/app.js');
      this.copy('js/controller/angulurlogincontroller.js', 'public/js/controller/logincontroller.js');
      this.copy('js/libs/angular.js', 'public/js/libs/angular.js');
      this.copy('js/libs/angular-route.js', 'public/js/libs/angular-route.js');
      this.copy('html/angularmain.html', 'public/js/view/main.html');
      this.copy('html/dashboard.html', 'public/js/view/dashboard.html');
      this.copy('html/angularsignup.html', 'public/js/view/signup.html');
      this.copy('html/semanticforgotpassword.html', 'public/js/view/forgotpassword.html');
      this.copy('html/semanticchangepassword.html', 'public/js/view/changepassword.html');

      }

       if(this.angulurjs && this.twitterbootstrap)
      {

      this.copy('html/angularbootstrap.html', 'public/login.html');
      this.copy('css/libs/style.css', 'public/css/libs/style.css');
      this.copy('js/angularapp.js', 'public/js/app.js');
      this.copy('js/controller/angulurlogincontroller.js', 'public/js/controller/logincontroller.js');
      this.copy('js/libs/angular.js', 'public/js/libs/angular.js');
      this.copy('js/libs/angular-route.js', 'public/js/libs/angular-route.js');
      this.copy('html/main.html', 'public/js/view/main.html');
      this.copy('html/bootstrapdashboard.html', 'public/js/view/dashboard.html');
      this.copy('html/signup.html', 'public/js/view/signup.html');
      this.copy('html/bootstrapforgotpassword.html', 'public/js/view/forgotpassword.html');
      this.copy('html/bootstrapchangepassword.html', 'public/js/view/changepassword.html');
      this.copy('img/avatar.png', 'public/img/avatar.png');

      }

      if (this.mysql)
      {
          this.copy('routes/mysqlservices.js', 'routes/services.js');

      }
      if (this.sqlite)
      {
          this.copy('routes/sqliteservices.js', 'routes/services.js');

      }
      if (this.mongodb)
      {
          this.copy('routes/mongodbservices.js', 'routes/services.js');
          this.copy('routes/databaseoperations.js', 'routes/databaseoperations.js');

      }
     if (this.semanticui)
      {

          this.copy('css/libs/semantic.min.css', 'public/css/libs/semantic.min.css');
          this.copy('js/libs/semantic.min.js', 'public/js/libs/semantic.min.js');
     }

     if (this.twitterbootstrap)
     {
          this.copy('css/libs/bootstrap.min.css', 'public/css/libs/bootstrap.min.css');
          this.copy('css/libs/signin.css', 'public/css/libs/signin.css');
          this.copy('js/libs/bootstrap.min.js', 'public/js/libs/bootstrap.min.js');
     }

     if (this.emberjs && this.grunt)
     {
      this.copy('Gruntfile.js', 'Gruntfile.js');
      this.copy('test.js', 'test/test.js');
      this.copy('require_helper.js', 'test/require_helper.js');
      this.copy('app.js', 'app.js');
     }

     if (this.angulurjs && this.grunt)
     {
      this.copy('AngularGruntfile.js', 'Gruntfile.js');
      this.copy('test.js', 'test/test.js');
      this.copy('require_helper.js', 'test/require_helper.js');
      this.copy('app.js', 'app.js');
     }

     if (this.emberjs && this.gulp)
     {
      this.copy('Embergulpfile.js', 'gulpfile.js');
      this.copy('gulptest.js', 'gulp/test.js');
      this.copy('gulpapp.js', 'app.js');
     }

     if (this.angulurjs && this.gulp)
     {
      this.copy('Angulurgulpfile.js', 'gulpfile.js');
      this.copy('gulptest.js', 'gulp/test.js');
      this.copy('gulpapp.js', 'app.js');
     }

      this.dest.mkdir('routes');
      this.copy('package.json', 'package.json');
      this.installDependencies();

    }
  },
  end: function () {

  }
});

module.exports = NodsemGenerator;


text:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<LookupCache async="false" continueOnError="false" enabled="true" name="Cache-GetAccessToken">
    <FaultRules/>
    <Properties/>
    <CacheKey>
        <KeyFragment>google.access_token</KeyFragment>
    </CacheKey>
    <Scope>Global</Scope>
    <AssignTo>google.access_token</AssignTo>
</LookupCache>


text:
from firmwire.hw.peripheral import *

from .uart import UARTPeripheral, MotoUARTPeripheral
from .shannoncp import SHMPeripheral
from .shannonsoc import ShannonSOCPeripheral
from .Unknown2Peripheral import Unknown2Peripheral
from .sipc import SIPCPeripheral
from .ClkPeripheral import *
from .PMICPeripheral import PMICPeripheral
from .DSPPeripheral import DSPPeripheral, S355DSPBufferPeripheral, MarconiPeripheral
from .shannon_timer import ShannonTimer, ShannonTCU, ShannonUptimer
from .abox import ShannonAbox
from .s3xxap import S3xxAPBoot


text:
package com.capitalone.dashboard.model;

import java.util.List;

/**
 * Base class to represent the details of a change in a source code management
 * system.
 */
public class SCM {
    protected String scmUrl;
    protected String scmBranch; // For SCM that don't have branch in the url
	protected String scmRevisionNumber;
    protected String scmCommitLog;
    protected String scmAuthor;
    protected String scmAuthorLogin;
    protected List<String> scmParentRevisionNumbers;
    protected long scmCommitTimestamp;
    protected long numberOfChanges;
    protected CommitType type;
    protected String pullNumber;

    public SCM(){

    }

    public SCM(SCM scm) {
        this.scmUrl = scm.scmUrl;
        this.scmBranch = scm.scmBranch;
        this.scmRevisionNumber = scm.scmRevisionNumber;
        this.scmCommitLog = scm.scmCommitLog;
        this.scmAuthor = scm.scmAuthor;
        this.scmAuthorLogin = scm.scmAuthorLogin;
        this.scmParentRevisionNumbers = scm.scmParentRevisionNumbers;
        this.scmCommitTimestamp = scm.scmCommitTimestamp;
        this.numberOfChanges = scm.numberOfChanges;
        this.type = scm.type;
    }

    @SuppressWarnings({"PMD.ExcessiveParameterList"})
    public SCM(String scmUrl, String scmBranch, String scmRevisionNumber, String scmCommitLog, String scmAuthor, String scmAuthorLogin, List<String> scmParentRevisionNumbers, long scmCommitTimestamp, long numberOfChanges, CommitType type) {
        this.scmUrl = scmUrl;
        this.scmBranch = scmBranch;
        this.scmRevisionNumber = scmRevisionNumber;
        this.scmCommitLog = scmCommitLog;
        this.scmAuthor = scmAuthor;
        this.scmAuthorLogin = scmAuthorLogin;
        this.scmParentRevisionNumbers = scmParentRevisionNumbers;
        this.scmCommitTimestamp = scmCommitTimestamp;
        this.numberOfChanges = numberOfChanges;
        this.type = type;
    }

    public String getScmUrl() {
        return scmUrl;
    }

    public void setScmUrl(String scmUrl) {
        this.scmUrl = scmUrl;
    }

    public String getScmBranch() {
		return scmBranch;
	}

	public void setScmBranch(String scmBranch) {
		this.scmBranch = scmBranch;
	}

    public String getScmRevisionNumber() {
        return scmRevisionNumber;
    }

    public void setScmRevisionNumber(String scmRevisionNumber) {
        this.scmRevisionNumber = scmRevisionNumber;
    }

    public String getScmCommitLog() {
        return scmCommitLog;
    }

    public void setScmCommitLog(String scmCommitLog) {
        this.scmCommitLog = scmCommitLog;
    }

    public String getScmAuthor() {
        return scmAuthor;
    }

    public void setScmAuthor(String scmAuthor) {
        this.scmAuthor = scmAuthor;
    }

    public String getScmAuthorLogin() {
        return scmAuthorLogin;
    }

    public void setScmAuthorLogin(String scmAuthorLogin) {
        this.scmAuthorLogin = scmAuthorLogin;
    }

    // can return null
    public List<String> getScmParentRevisionNumbers() {
    	return scmParentRevisionNumbers;
    }

    public void setScmParentRevisionNumbers(List<String> scmParentRevisionNumbers) {
    	this.scmParentRevisionNumbers = scmParentRevisionNumbers;
    }

    public long getScmCommitTimestamp() {
        return scmCommitTimestamp;
    }

    public void setScmCommitTimestamp(long scmCommitTimestamp) {
        this.scmCommitTimestamp = scmCommitTimestamp;
    }

    public long getNumberOfChanges() {
        return numberOfChanges;
    }

    public void setNumberOfChanges(long numberOfChanges) {
        this.numberOfChanges = numberOfChanges;
    }

    public CommitType getType() {
        return type;
    }

    public void setType(CommitType type) {
        this.type = type;
    }

    public String getPullNumber() {
        return pullNumber;
    }

    public void setPullNumber(String pullNumber) {
        this.pullNumber = pullNumber;
    }
}


text:
describe('Array', function() {
    it('has push method', function() {
        var array = [];

        expect(array.push).to.exist;
    });
});


text:
require "rainbow"

Before('@ansi') do
  ENV["FORCE_COLORS"] = "TRUE"
end


text:
using System.Text.Json;
using Azure.Core;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Sql.Models;

namespace Azure.ResourceManager.Sql
{
    public partial class DataMaskingPolicyData : IUtf8JsonSerializable
    {
        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
        {
            writer.WriteStartObject();
            writer.WritePropertyName("properties");
            writer.WriteStartObject();
            if (Optional.IsDefined(DataMaskingState))
            {
                writer.WritePropertyName("dataMaskingState");
                writer.WriteStringValue(DataMaskingState.Value.ToSerialString());
            }
            if (Optional.IsDefined(ExemptPrincipals))
            {
                writer.WritePropertyName("exemptPrincipals");
                writer.WriteStringValue(ExemptPrincipals);
            }
            writer.WriteEndObject();
            writer.WriteEndObject();
        }

        internal static DataMaskingPolicyData DeserializeDataMaskingPolicyData(JsonElement element)
        {
            Optional<AzureLocation> location = default;
            Optional<string> kind = default;
            ResourceIdentifier id = default;
            string name = default;
            ResourceType type = default;
            Optional<SystemData> systemData = default;
            Optional<DataMaskingState> dataMaskingState = default;
            Optional<string> exemptPrincipals = default;
            Optional<string> applicationPrincipals = default;
            Optional<string> maskingLevel = default;
            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("location"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    location = new AzureLocation(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("kind"))
                {
                    kind = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = new ResourceType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("systemData"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    systemData = JsonSerializer.Deserialize<SystemData>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("dataMaskingState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            dataMaskingState = property0.Value.GetString().ToDataMaskingState();
                            continue;
                        }
                        if (property0.NameEquals("exemptPrincipals"))
                        {
                            exemptPrincipals = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("applicationPrincipals"))
                        {
                            applicationPrincipals = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("maskingLevel"))
                        {
                            maskingLevel = property0.Value.GetString();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return new DataMaskingPolicyData(id, name, type, systemData.Value, Optional.ToNullable(location), kind.Value, Optional.ToNullable(dataMaskingState), exemptPrincipals.Value, applicationPrincipals.Value, maskingLevel.Value);
        }
    }
}


text:
/*
Script: SimpleEditor.Spanish.js
	SimpleEditor messages in Spanish. Thanks Marco Cervellin.

License:
	http://www.clientcide.com/wiki/cnet-libraries#license
*/
MooTools.lang.set('it', 'SimpleEditor', {
       woops:'Oops!',
       linkURL:'La URL del link',
       linkText:'Il testo del link',
       imgURL:'La URL dell\'immagine',
       imgAlt:'Il titolo (alt) dell\'immagine'
});