text:
using System;
using System.Runtime.InteropServices;

namespace Vanara.PInvoke
{
	/// Methods and data types found in Crypt32.dll.
	public static partial class Crypt32
	{
		/// Flags for CryptProtectData.
		[PInvokeData("dpapi.h", MSDNShortId = "765a68fd-f105-49fc-a738-4a8129eb0770")]
		[Flags]
		public enum CryptProtectFlags
		{
			///
			/// This flag is used for remote situations where presenting a user interface (UI) is not an option. When this flag is set and a
			/// UI is specified for either the protect or unprotect operation, the operation fails and GetLastError returns the
			/// ERROR_PASSWORD_RESTRICTION code.
			///
			CRYPTPROTECT_UI_FORBIDDEN = 0x1,

			///
			/// When this flag is set, it associates the data encrypted with the current computer instead of with an individual user. Any
			/// user on the computer on which CryptProtectData is called can use CryptUnprotectData to decrypt the data.
			///
			CRYPTPROTECT_LOCAL_MACHINE = 0x4,

			///
			/// Force credential synchronize during CryptProtectData(). Synchronize is the only operation that occurs during this operation.
			///
			CRYPTPROTECT_CRED_SYNC = 0x8,

			/// Generate an Audit on protect and unprotect operations.
			CRYPTPROTECT_AUDIT = 0x10,

			/// Protect data with a non-recoverable key.
			CRYPTPROTECT_NO_RECOVERY = 0x20,

			/// Verify the protection of a protected blob.
			CRYPTPROTECT_VERIFY_PROTECTION = 0x40,

			/// Regenerate the local machine protection.
			CRYPTPROTECT_CRED_REGENERATE = 0x80
		}

		/// Flags for CryptProtectMemory and CryptUnprotectMemory
		[PInvokeData("dpapi.h", MSDNShortId = "6b372552-87d4-4047-afa5-0d1113348289")]
		[Flags]
		public enum CryptProtectMemoryFlags
		{
			///
			/// Encrypt and decrypt memory in the same process. An application running in a different process will not be able to decrypt
			/// the data.
			///
			CRYPTPROTECTMEMORY_SAME_PROCESS = 0x00,

			///
			/// Encrypt and decrypt memory in different processes. An application running in a different process will be able to decrypt the data.
			///
			CRYPTPROTECTMEMORY_CROSS_PROCESS = 0x01,

			///
			/// Use the same logon credentials to encrypt and decrypt memory in different processes. An application running in a different
			/// process will be able to decrypt the data. However, the process must run as the same user that encrypted the data and in the
			/// same logon session.
			///
			CRYPTPROTECTMEMORY_SAME_LOGON = 0x02,
		}

		/// Flags that indicate when prompts to the user are to be displayed.
		[PInvokeData("dpapi.h", MSDNShortId = "412ce598-a7c9-446d-bd98-6583a20d6cd7")]
		[Flags]
		public enum CryptProtectPrompt : uint
		{
			///
			/// This flag can be combined with CRYPTPROTECT_PROMPT_ON_PROTECT to enforce the UI (user interface) policy of the caller. When
			/// CryptUnprotectData is called, the dwPromptFlags specified in the CryptProtectData call are enforced.
			///
			CRYPTPROTECT_PROMPT_ON_UNPROTECT = 0x1,

			/// This flag is used to provide the prompt for the protect phase.
			CRYPTPROTECT_PROMPT_ON_PROTECT = 0x2,

			/// Reserved.
			CRYPTPROTECT_PROMPT_RESERVED = 0x04,

			/// Default to strong variant UI protection (user supplied password currently).
			CRYPTPROTECT_PROMPT_STRONG = 0x08,

			/// Require strong variant UI protection (user supplied password currently).
			CRYPTPROTECT_PROMPT_REQUIRE_STRONG = 0x10,
		}

		///
		/// The <c>CryptProtectData</c> function performs encryption on the data in a DATA_BLOB structure. Typically, only a user with the
		/// same logon credential as the user who encrypted the data can decrypt the data. In addition, the encryption and decryption
		/// usually must be done on the same computer. For information about exceptions, see Remarks.
		///
		/// <param name="pDataIn">A pointer to a DATA_BLOB structure that contains the plaintext to be encrypted.</param>
		/// <param name="szDataDescr">
		/// A string with a readable description of the data to be encrypted. This description string is included with the encrypted data.
		/// This parameter is optional and can be set to <c>NULL</c>.
		/// </param>
		/// <param name="pOptionalEntropy">
		/// A pointer to a DATA_BLOB structure that contains a password or other additional entropy used to encrypt the data. The
		/// <c>DATA_BLOB</c> structure used in the encryption phase must also be used in the decryption phase. This parameter can be set to
		/// <c>NULL</c> for no additional entropy. For information about protecting passwords, see Handling Passwords.
		/// </param>
		/// <param name="pvReserved">Reserved for future use and must be set to <c>NULL</c>.</param>
		/// <param name="pPromptStruct">
		/// A pointer to a CRYPTPROTECT_PROMPTSTRUCT structure that provides information about where and when prompts are to be displayed
		/// and what the content of those prompts should be. This parameter can be set to <c>NULL</c> in both the encryption and decryption phases.
		/// </param>
		/// <param name="dwFlags">
		/// <para>This parameter can be one of the following flags.</para>
		/// <list type="table">
		/// <listheader>
		/// <term>Value</term>
		/// <term>Meaning</term>
		/// </listheader>
		/// <item>
		/// <term>CRYPTPROTECT_LOCAL_MACHINE</term>
		/// <term>
		/// When this flag is set, it associates the data encrypted with the current computer instead of with an individual user. Any user
		/// on the computer on which CryptProtectData is called can use CryptUnprotectData to decrypt the data.
		/// </term>
		/// </item>
		/// <item>
		/// <term>CRYPTPROTECT_UI_FORBIDDEN</term>
		/// <term>
		/// This flag is used for remote situations where presenting a user interface (UI) is not an option. When this flag is set and a UI
		/// is specified for either the protect or unprotect operation, the operation fails and GetLastError returns the
		/// ERROR_PASSWORD_RESTRICTION code.
		/// </term>
		/// </item>
		/// <item>
		/// <term>CRYPTPROTECT_AUDIT</term>
		/// <term>This flag generates an audit on protect and unprotect operations.</term>
		/// </item>
		/// </list>
		/// </param>
		/// <param name="pDataOut">
		/// A pointer to a DATA_BLOB structure that receives the encrypted data. When you have finished using the <c>DATA_BLOB</c>
		/// structure, free its <c>pbData</c> member by calling the LocalFree function.
		/// </param>
		/// <returns>
		/// <para>If the function succeeds, the function returns <c>TRUE</c>.</para>
		/// <para>If the function fails, it returns <c>FALSE</c>. For extended error information, call GetLastError.</para>
		/// </returns>
		/// <remarks>
		/// <para>
		/// Typically, only a user with logon credentials that match those of the user who encrypted the data can decrypt the data. In
		/// addition, decryption usually can only be done on the computer where the data was encrypted. However, a user with a roaming
		/// profile can decrypt the data from another computer on the network.
		/// </para>
		/// <para>
		/// If the CRYPTPROTECT_LOCAL_MACHINE flag is set when the data is encrypted, any user on the computer where the encryption was done
		/// can decrypt the data.
		/// </para>
		/// <para>
		/// The function creates a session key to perform the encryption. The session key is derived again when the data is to be decrypted.
		/// </para>
		/// <para>
		/// The function also adds a Message Authentication Code (MAC) (keyed integrity check) to the encrypted data to guard against data tampering.
		/// </para>
		/// <para>To encrypt memory for temporary use in the same process or across processes, call the CryptProtectMemory function.</para>
		/// <para>Examples</para>
		/// <para>
		/// The following example shows encryption of the data in a DATA_BLOB structure. The <c>CryptProtectData</c> function does the
		/// encryption by using a session key that the function creates by using the user's logon credentials. For another example that uses
		/// this function, see Example C Program: Using CryptProtectData.
		/// </para>
		/// </remarks>
		// https://docs.microsoft.com/en-us/windows/win32/api/dpapi/nf-dpapi-cryptprotectdata DPAPI_IMP BOOL CryptProtectData( DATA_BLOB
		// *pDataIn, LPCWSTR szDataDescr, DATA_BLOB *pOptionalEntropy, PVOID pvReserved, CRYPTPROTECT_PROMPTSTRUCT *pPromptStruct, DWORD
		// dwFlags, DATA_BLOB *pDataOut );
		[DllImport(Lib.Crypt32, SetLastError = true, ExactSpelling = true)]
		[PInvokeData("dpapi.h", MSDNShortId = "765a68fd-f105-49fc-a738-4a8129eb0770")]
		[return: MarshalAs(UnmanagedType.Bool)]
		public static extern bool CryptProtectData(in CRYPTOAPI_BLOB pDataIn, [Optional, MarshalAs(UnmanagedType.LPWStr)] string szDataDescr, in CRYPTOAPI_BLOB pOptionalEntropy,
			[Optional] IntPtr pvReserved, in CRYPTPROTECT_PROMPTSTRUCT pPromptStruct, CryptProtectFlags dwFlags, IntPtr pDataOut);

		///
		/// The <c>CryptProtectData</c> function performs encryption on the data in a DATA_BLOB structure. Typically, only a user with the
		/// same logon credential as the user who encrypted the data can decrypt the data. In addition, the encryption and decryption
		/// usually must be done on the same computer. For information about exceptions, see Remarks.
		///
		/// <param name="pDataIn">A pointer to a DATA_BLOB structure that contains the plaintext to be encrypted.</param>
		/// <param name="szDataDescr">
		/// A string with a readable description of the data to be encrypted. This description string is included with the encrypted data.
		/// This parameter is optional and can be set to <c>NULL</c>.
		/// </param>
		/// <param name="pOptionalEntropy">
		/// A pointer to a DATA_BLOB structure that contains a password or other additional entropy used to encrypt the data. The
		/// <c>DATA_BLOB</c> structure used in the encryption phase must also be used in the decryption phase. This parameter can be set to
		/// <c>NULL</c> for no additional entropy. For information about protecting passwords, see Handling Passwords.
		/// </param>
		/// <param name="pvReserved">Reserved for future use and must be set to <c>NULL</c>.</param>
		/// <param name="pPromptStruct">
		/// A pointer to a CRYPTPROTECT_PROMPTSTRUCT structure that provides information about where and when prompts are to be displayed
		/// and what the content of those prompts should be. This parameter can be set to <c>NULL</c> in both the encryption and decryption phases.
		/// </param>
		/// <param name="dwFlags">
		/// <para>This parameter can be one of the following flags.</para>
		/// <list type="table">
		/// <listheader>
		/// <term>Value</term>
		/// <term>Meaning</term>
		/// </listheader>
		/// <item>
		/// <term>CRYPTPROTECT_LOCAL_MACHINE</term>
		/// <term>
		/// When this flag is set, it associates the data encrypted with the current computer instead of with an individual user. Any user
		/// on the computer on which CryptProtectData is called can use CryptUnprotectData to decrypt the data.
		/// </term>
		/// </item>
		/// <item>
		/// <term>CRYPTPROTECT_UI_FORBIDDEN</term>
		/// <term>
		/// This flag is used for remote situations where presenting a user interface (UI) is not an option. When this flag is set and a UI
		/// is specified for either the protect or unprotect operation, the operation fails and GetLastError returns the
		/// ERROR_PASSWORD_RESTRICTION code.
		/// </term>
		/// </item>
		/// <item>
		/// <term>CRYPTPROTECT_AUDIT</term>
		/// <term>This flag generates an audit on protect and unprotect operations.</term>
		/// </item>
		/// </list>
		/// </param>
		/// <param name="pDataOut">
		/// A pointer to a DATA_BLOB structure that receives the encrypted data. When you have finished using the <c>DATA_BLOB</c>
		/// structure, free its <c>pbData</c> member by calling the LocalFree function.
		/// </param>
		/// <returns>
		/// <para>If the function succeeds, the function returns <c>TRUE</c>.</para>
		/// <para>If the function fails, it returns <c>FALSE</c>. For extended error information, call GetLastError.</para>
		/// </returns>
		/// <remarks>
		/// <para>
		/// Typically, only a user with logon credentials that match those of the user who encrypted the data can decrypt the data. In
		/// addition, decryption usually can only be done on the computer where the data was encrypted. However, a user with a roaming
		/// profile can decrypt the data from another computer on the network.
		/// </para>
		/// <para>
		/// If the CRYPTPROTECT_LOCAL_MACHINE flag is set when the data is encrypted, any user on the computer where the encryption was done
		/// can decrypt the data.
		/// </para>
		/// <para>
		/// The function creates a session key to perform the encryption. The session key is derived again when the data is to be decrypted.
		/// </para>
		/// <para>
		/// The function also adds a Message Authentication Code (MAC) (keyed integrity check) to the encrypted data to guard against data tampering.
		/// </para>
		/// <para>To encrypt memory for temporary use in the same process or across processes, call the CryptProtectMemory function.</para>
		/// <para>Examples</para>
		/// <para>
		/// The following example shows encryption of the data in a DATA_BLOB structure. The <c>CryptProtectData</c> function does the
		/// encryption by using a session key that the function creates by using the user's logon credentials. For another example that uses
		/// this function, see Example C Program: Using CryptProtectData.
		/// </para>
		/// </remarks>
		// https://docs.microsoft.com/en-us/windows/win32/api/dpapi/nf-dpapi-cryptprotectdata DPAPI_IMP BOOL CryptProtectData( DATA_BLOB
		// *pDataIn, LPCWSTR szDataDescr, DATA_BLOB *pOptionalEntropy, PVOID pvReserved, CRYPTPROTECT_PROMPTSTRUCT *pPromptStruct, DWORD
		// dwFlags, DATA_BLOB *pDataOut );
		[DllImport(Lib.Crypt32, SetLastError = true, ExactSpelling = true)]
		[PInvokeData("dpapi.h", MSDNShortId = "765a68fd-f105-49fc-a738-4a8129eb0770")]
		[return: MarshalAs(UnmanagedType.Bool)]
		public static extern bool CryptProtectData(in CRYPTOAPI_BLOB pDataIn, [Optional, MarshalAs(UnmanagedType.LPWStr)] string szDataDescr, [Optional] IntPtr pOptionalEntropy,
			[Optional] IntPtr pvReserved, [Optional] IntPtr pPromptStruct, CryptProtectFlags dwFlags, IntPtr pDataOut);

		///
		/// The <c>CryptProtectMemory</c> function encrypts memory to prevent others from viewing sensitive information in your process. For
		/// example, use the <c>CryptProtectMemory</c> function to encrypt memory that contains a password. Encrypting the password prevents
		/// others from viewing it when the process is paged out to the swap file. Otherwise, the password is in plaintext and viewable by others.
		///
		/// <param name="pDataIn">
		/// A pointer to the block of memory to encrypt. The cbData parameter specifies the number of bytes that will be encrypted. If the
		/// data contained in the memory space is smaller than the number of bytes specified, data outside of the intended block will be
		/// encrypted. If it is larger than cbData bytes, then only the first cbData bytes will be encrypted.
		/// </param>
		/// <param name="cbDataIn">
		/// Number of bytes of memory pointed to by the pData parameter to encrypt. The number of bytes must be a multiple of the
		/// <c>CRYPTPROTECTMEMORY_BLOCK_SIZE</c> constant defined in Wincrypt.h.
		/// </param>
		/// <param name="dwFlags">
		/// <para>This parameter can be one of the following flags. You must specify the same flag when encrypting and decrypting the memory.</para>
		/// <list type="table">
		/// <listheader>
		/// <term>Value</term>
		/// <term>Meaning</term>
		/// </listheader>
		/// <item>
		/// <term>CRYPTPROTECTMEMORY_SAME_PROCESS</term>
		/// <term>
		/// Encrypt and decrypt memory in the same process. An application running in a different process will not be able to decrypt the data.
		/// </term>
		/// </item>
		/// <item>
		/// <term>CRYPTPROTECTMEMORY_CROSS_PROCESS</term>
		/// <term>
		/// Encrypt and decrypt memory in different processes. An application running in a different process will be able to decrypt the data.
		/// </term>
		/// </item>
		/// <item>
		/// <term>CRYPTPROTECTMEMORY_SAME_LOGON</term>
		/// <term>
		/// Use the same logon credentials to encrypt and decrypt memory in different processes. An application running in a different
		/// process will be able to decrypt the data. However, the process must run as the same user that encrypted the data and in the same
		/// logon session.
		/// </term>
		/// </item>
		/// </list>
		/// </param>
		/// <returns>
		/// <para>If the function succeeds, the function returns <c>TRUE</c>.</para>
		/// <para>If the function fails, it returns <c>FALSE</c>. For extended error information, call GetLastError.</para>
		/// </returns>
		/// <remarks>
		/// <para>
		/// Using CryptProtectMemory and CryptUnprotectMemory for password encryption is not secure because the data exists as plaintext in
		/// memory before it is encrypted and at any time the caller decrypts it for use.
		/// </para>
		/// <para>
		/// Typically, you use the <c>CryptProtectMemory</c> function to encrypt sensitive information that you are going to decrypt while
		/// your process is running. Do not use this function to save data that you want to decrypt later; you will not be able to decrypt
		/// the data if the computer is restarted. To save encrypted data to a file to decrypt later, use the CryptProtectData function.
		/// </para>
		/// <para>
		/// Call the CryptUnprotectMemory function to decrypt memory encrypted with the <c>CryptProtectMemory</c> function. When you have
		/// finished using the sensitive information, clear it from memory by calling the SecureZeroMemory function.
		/// </para>
		/// <para>
		/// Use the CRYPTPROTECTMEMORY_CROSS_PROCESS or CRYPTPROTECTMEMORY_SAME_LOGON flag if you use RPC or LRPC to pass encrypted data to
		/// another process. The receiving process must specify the same flag to decrypt the data. Also, use these flags if you use shared memory.
		/// </para>
		/// <para>
		/// If the client uses the CRYPTPROTECTMEMORY_SAME_LOGON flag, the server must impersonate the client (RpcImpersonateClient) before
		/// decrypting the memory.
		/// </para>
		/// <para>Examples</para>
		/// <para>The following example calls the <c>CryptProtectMemory</c> function to encrypt data that is in memory.</para>
		/// </remarks>
		// https://docs.microsoft.com/en-us/windows/win32/api/dpapi/nf-dpapi-cryptprotectmemory DPAPI_IMP BOOL CryptProtectMemory( LPVOID
		// pDataIn, DWORD cbDataIn, DWORD dwFlags );
		[DllImport(Lib.Crypt32, SetLastError = true, ExactSpelling = true)]
		[PInvokeData("dpapi.h", MSDNShortId = "6b372552-87d4-4047-afa5-0d1113348289")]
		[return: MarshalAs(UnmanagedType.Bool)]
		public static extern bool CryptProtectMemory(IntPtr pDataIn, uint cbDataIn, CryptProtectMemoryFlags dwFlags);

		///
		/// The <c>CryptUnprotectData</c> function decrypts and does an integrity check of the data in a DATA_BLOB structure. Usually, the
		/// only user who can decrypt the data is a user with the same logon credentials as the user who encrypted the data. In addition,
		/// the encryption and decryption must be done on the same computer. For information about exceptions, see the Remarks section of CryptProtectData.
		///
		/// <param name="pDataIn">
		/// A pointer to a DATA_BLOB structure that holds the encrypted data. The <c>DATA_BLOB</c> structure's <c>cbData</c> member holds
		/// the length of the <c>pbData</c> member's byte string that contains the text to be encrypted.
		/// </param>
		/// <param name="ppszDataDescr">
		/// A pointer to a string-readable description of the encrypted data included with the encrypted data. This parameter can be set to
		/// <c>NULL</c>. When you have finished using ppszDataDescr, free it by calling the LocalFree function.
		/// </param>
		/// <param name="pOptionalEntropy">
		/// A pointer to a DATA_BLOB structure that contains a password or other additional entropy used when the data was encrypted. This
		/// parameter can be set to <c>NULL</c>; however, if an optional entropy <c>DATA_BLOB</c> structure was used in the encryption
		/// phase, that same <c>DATA_BLOB</c> structure must be used for the decryption phase. For information about protecting passwords,
		/// see Handling Passwords.
		/// </param>
		/// <param name="pvReserved">This parameter is reserved for future use and must be set to <c>NULL</c>.</param>
		/// <param name="pPromptStruct">
		/// A pointer to a CRYPTPROTECT_PROMPTSTRUCT structure that provides information about where and when prompts are to be displayed
		/// and what the content of those prompts should be. This parameter can be set to <c>NULL</c>.
		/// </param>
		/// <param name="dwFlags">
		/// <para>
		/// A <c>DWORD</c> value that specifies options for this function. This parameter can be zero, in which case no option is set, or
		/// the following flag.
		/// </para>
		/// <list type="table">
		/// <listheader>
		/// <term>Value</term>
		/// <term>Meaning</term>
		/// </listheader>
		/// <item>
		/// <term>CRYPTPROTECT_UI_FORBIDDEN</term>
		/// <term>
		/// This flag is used for remote situations where the user interface (UI) is not an option. When this flag is set and UI is
		/// specified for either the protect or unprotect operation, the operation fails and GetLastError returns the
		/// ERROR_PASSWORD_RESTRICTION code.
		/// </term>
		/// </item>
		/// <item>
		/// <term>CRYPTPROTECT_VERIFY_PROTECTION</term>
		/// <term>
		/// This flag verifies the protection of a protected BLOB. If the default protection level configured of the host is higher than the
		/// current protection level for the BLOB, the function returns CRYPT_I_NEW_PROTECTION_REQUIRED to advise the caller to again
		/// protect the plaintext contained in the BLOB.
		/// </term>
		/// </item>
		/// </list>
		/// </param>
		/// <param name="pDataOut">
		/// A pointer to a DATA_BLOB structure where the function stores the decrypted data. When you have finished using the
		/// <c>DATA_BLOB</c> structure, free its <c>pbData</c> member by calling the LocalFree function.
		/// </param>
		/// <returns>
		/// <para>If the function succeeds, the function returns <c>TRUE</c>.</para>
		/// <para>If the function fails, it returns <c>FALSE</c>.</para>
		/// </returns>
		/// <remarks>
		/// <para>
		/// The CryptProtectData function creates a session key when the data is encrypted. That key is derived again and used to decrypt
		/// the data BLOB.
		/// </para>
		/// <para>
		/// The Message Authentication Code (MAC) hash added to the encrypted data can be used to determine whether the encrypted data was
		/// altered in any way. Any tampering results in the return of the ERROR_INVALID_DATA code.
		/// </para>
		/// <para>
		/// When you have finished using the DATA_BLOB structure, free its <c>pbData</c> member by calling the LocalFree function. Any
		/// ppszDataDescr that is not <c>NULL</c> must also be freed by using <c>LocalFree</c>.
		/// </para>
		/// <para>When you have finished using sensitive information, clear it from memory by calling the SecureZeroMemory function.</para>
		/// <para>Examples</para>
		/// <para>
		/// The following example shows decrypting encrypted data in a DATA_BLOB structure. This function does the decryption by using a
		/// session key that the function creates by using the user's logon credentials. For another example that uses this function, see
		/// Example C Program: Using CryptProtectData.
		/// </para>
		/// </remarks>
		// https://docs.microsoft.com/en-us/windows/win32/api/dpapi/nf-dpapi-cryptunprotectdata DPAPI_IMP BOOL CryptUnprotectData( DATA_BLOB
		// *pDataIn, LPWSTR *ppszDataDescr, DATA_BLOB *pOptionalEntropy, PVOID pvReserved, CRYPTPROTECT_PROMPTSTRUCT *pPromptStruct, DWORD
		// dwFlags, DATA_BLOB *pDataOut );
		[DllImport(Lib.Crypt32, SetLastError = true, ExactSpelling = true)]
		[PInvokeData("dpapi.h", MSDNShortId = "54eab3b0-d341-47c6-9c32-79328d7a7155")]
		[return: MarshalAs(UnmanagedType.Bool)]
		public static extern bool CryptUnprotectData(in CRYPTOAPI_BLOB pDataIn, [MarshalAs(UnmanagedType.LPWStr)] out IntPtr ppszDataDescr,
			in CRYPTOAPI_BLOB pOptionalEntropy, [Optional] IntPtr pvReserved, in CRYPTPROTECT_PROMPTSTRUCT pPromptStruct, CryptProtectFlags dwFlags, [Out] IntPtr pDataOut);

		///
		/// The <c>CryptUnprotectData</c> function decrypts and does an integrity check of the data in a DATA_BLOB structure. Usually, the
		/// only user who can decrypt the data is a user with the same logon credentials as the user who encrypted the data. In addition,
		/// the encryption and decryption must be done on the same computer. For information about exceptions, see the Remarks section of CryptProtectData.
		///
		/// <param name="pDataIn">
		/// A pointer to a DATA_BLOB structure that holds the encrypted data. The <c>DATA_BLOB</c> structure's <c>cbData</c> member holds
		/// the length of the <c>pbData</c> member's byte string that contains the text to be encrypted.
		/// </param>
		/// <param name="ppszDataDescr">
		/// A pointer to a string-readable description of the encrypted data included with the encrypted data. This parameter can be set to
		/// <c>NULL</c>. When you have finished using ppszDataDescr, free it by calling the LocalFree function.
		/// </param>
		/// <param name="pOptionalEntropy">
		/// A pointer to a DATA_BLOB structure that contains a password or other additional entropy used when the data was encrypted. This
		/// parameter can be set to <c>NULL</c>; however, if an optional entropy <c>DATA_BLOB</c> structure was used in the encryption
		/// phase, that same <c>DATA_BLOB</c> structure must be used for the decryption phase. For information about protecting passwords,
		/// see Handling Passwords.
		/// </param>
		/// <param name="pvReserved">This parameter is reserved for future use and must be set to <c>NULL</c>.</param>
		/// <param name="pPromptStruct">
		/// A pointer to a CRYPTPROTECT_PROMPTSTRUCT structure that provides information about where and when prompts are to be displayed
		/// and what the content of those prompts should be. This parameter can be set to <c>NULL</c>.
		/// </param>
		/// <param name="dwFlags">
		/// <para>
		/// A <c>DWORD</c> value that specifies options for this function. This parameter can be zero, in which case no option is set, or
		/// the following flag.
		/// </para>
		/// <list type="table">
		/// <listheader>
		/// <term>Value</term>
		/// <term>Meaning</term>
		/// </listheader>
		/// <item>
		/// <term>CRYPTPROTECT_UI_FORBIDDEN</term>
		/// <term>
		/// This flag is used for remote situations where the user interface (UI) is not an option. When this flag is set and UI is
		/// specified for either the protect or unprotect operation, the operation fails and GetLastError returns the
		/// ERROR_PASSWORD_RESTRICTION code.
		/// </term>
		/// </item>
		/// <item>
		/// <term>CRYPTPROTECT_VERIFY_PROTECTION</term>
		/// <term>
		/// This flag verifies the protection of a protected BLOB. If the default protection level configured of the host is higher than the
		/// current protection level for the BLOB, the function returns CRYPT_I_NEW_PROTECTION_REQUIRED to advise the caller to again
		/// protect the plaintext contained in the BLOB.
		/// </term>
		/// </item>
		/// </list>
		/// </param>
		/// <param name="pDataOut">
		/// A pointer to a DATA_BLOB structure where the function stores the decrypted data. When you have finished using the
		/// <c>DATA_BLOB</c> structure, free its <c>pbData</c> member by calling the LocalFree function.
		/// </param>
		/// <returns>
		/// <para>If the function succeeds, the function returns <c>TRUE</c>.</para>
		/// <para>If the function fails, it returns <c>FALSE</c>.</para>
		/// </returns>
		/// <remarks>
		/// <para>
		/// The CryptProtectData function creates a session key when the data is encrypted. That key is derived again and used to decrypt
		/// the data BLOB.
		/// </para>
		/// <para>
		/// The Message Authentication Code (MAC) hash added to the encrypted data can be used to determine whether the encrypted data was
		/// altered in any way. Any tampering results in the return of the ERROR_INVALID_DATA code.
		/// </para>
		/// <para>
		/// When you have finished using the DATA_BLOB structure, free its <c>pbData</c> member by calling the LocalFree function. Any
		/// ppszDataDescr that is not <c>NULL</c> must also be freed by using <c>LocalFree</c>.
		/// </para>
		/// <para>When you have finished using sensitive information, clear it from memory by calling the SecureZeroMemory function.</para>
		/// <para>Examples</para>
		/// <para>
		/// The following example shows decrypting encrypted data in a DATA_BLOB structure. This function does the decryption by using a
		/// session key that the function creates by using the user's logon credentials. For another example that uses this function, see
		/// Example C Program: Using CryptProtectData.
		/// </para>
		/// </remarks>
		// https://docs.microsoft.com/en-us/windows/win32/api/dpapi/nf-dpapi-cryptunprotectdata DPAPI_IMP BOOL CryptUnprotectData( DATA_BLOB
		// *pDataIn, LPWSTR *ppszDataDescr, DATA_BLOB *pOptionalEntropy, PVOID pvReserved, CRYPTPROTECT_PROMPTSTRUCT *pPromptStruct, DWORD
		// dwFlags, DATA_BLOB *pDataOut );
		[DllImport(Lib.Crypt32, SetLastError = true, ExactSpelling = true)]
		[PInvokeData("dpapi.h", MSDNShortId = "54eab3b0-d341-47c6-9c32-79328d7a7155")]
		[return: MarshalAs(UnmanagedType.Bool)]
		public static extern bool CryptUnprotectData(in CRYPTOAPI_BLOB pDataIn, [Optional] IntPtr ppszDataDescr,
			[Optional] IntPtr pOptionalEntropy, [Optional] IntPtr pvReserved, [Optional] IntPtr pPromptStruct, CryptProtectFlags dwFlags, [Out] IntPtr pDataOut);

		/// The <c>CryptUnprotectMemory</c> function decrypts memory that was encrypted using the CryptProtectMemory function.
		/// <param name="pDataIn">
		/// A pointer to the block of memory to decrypt. The cbData parameter specifies the number of bytes that the function will attempt
		/// to decrypt. If the data contained in the memory space is smaller than the number of bytes specified, the function will attempt
		/// to decrypt data outside of the intended block. If it is larger than cbData bytes, then only the first cbData bytes will be decrypted.
		/// </param>
		/// <param name="cbDataIn">
		/// Number of bytes of memory pointed to by the pData parameter to decrypt. The number of bytes must be a multiple of the
		/// <c>CRYPTPROTECTMEMORY_BLOCK_SIZE</c> constant defined in Wincrypt.h.
		/// </param>
		/// <param name="dwFlags">
		/// <para>This parameter can be one of the following flags. You must specify the same flag when encrypting and decrypting the memory.</para>
		/// <list type="table">
		/// <listheader>
		/// <term>Value</term>
		/// <term>Meaning</term>
		/// </listheader>
		/// <item>
		/// <term>CRYPTPROTECTMEMORY_SAME_PROCESS</term>
		/// <term>
		/// Encrypt and decrypt memory in the same process. An application running in a different process will not be able to decrypt the data.
		/// </term>
		/// </item>
		/// <item>
		/// <term>CRYPTPROTECTMEMORY_CROSS_PROCESS</term>
		/// <term>
		/// Encrypt and decrypt memory in different processes. An application running in a different process will be able to decrypt the data.
		/// </term>
		/// </item>
		/// <item>
		/// <term>CRYPTPROTECTMEMORY_SAME_LOGON</term>
		/// <term>
		/// Use the same logon credentials to encrypt and decrypt memory in different processes. An application running in a different
		/// process will be able to decrypt the data. However, the process must run as the same user that encrypted the data and in the same
		/// logon session.
		/// </term>
		/// </item>
		/// </list>
		/// </param>
		/// <returns>
		/// <para>If the function succeeds, the function returns <c>TRUE</c>.</para>
		/// <para>If the function fails, it returns <c>FALSE</c>. For extended error information, call GetLastError.</para>
		/// </returns>
		/// <remarks>
		/// <para>
		/// Using CryptProtectMemory and CryptUnprotectMemory for password encryption is not secure because the data exists as plaintext in
		/// memory before it is encrypted and at any time the caller decrypts it for use.
		/// </para>
		/// <para>
		/// You must encrypt and decrypt the memory during the same boot session. If the computer is restarted before you call the
		/// <c>CryptUnprotectMemory</c> function, you will not be able to decrypt the data.
		/// </para>
		/// <para>
		/// You must pass the same flag to <c>CryptUnprotectMemory</c> and CryptProtectMemory. If you pass different flags, the
		/// <c>CryptUnprotectMemory</c> function succeeds; however, the result is unpredictable.
		/// </para>
		/// <para>When you have finished using the sensitive information, clear it from memory by calling the SecureZeroMemory function.</para>
		/// <para>Examples</para>
		/// <para>
		/// The following example calls the <c>CryptUnprotectMemory</c> function to decrypt data that is in memory. The example assumes the
		/// variable pEncryptedText points to a string that has been encrypted using the CryptProtectMemory function.
		/// </para>
		/// </remarks>
		// https://docs.microsoft.com/en-us/windows/win32/api/dpapi/nf-dpapi-cryptunprotectmemory DPAPI_IMP BOOL CryptUnprotectMemory(
		// LPVOID pDataIn, DWORD cbDataIn, DWORD dwFlags );
		[DllImport(Lib.Crypt32, SetLastError = true, ExactSpelling = true)]
		[PInvokeData("dpapi.h", MSDNShortId = "1c7980ac-4e9e-43fd-b6d7-c0d0a69c8040")]
		[return: MarshalAs(UnmanagedType.Bool)]
		public static extern bool CryptUnprotectMemory(IntPtr pDataIn, uint cbDataIn, CryptProtectMemoryFlags dwFlags);

		///
		/// The <c>CryptUpdateProtectedState</c> function migrates the current user's master keys after the user's security identifier (SID)
		/// has changed. This function can be used to preserve encrypted data after a user has been moved from one domain to another.
		///
		/// <param name="pOldSid">
		/// <para>
		/// The address of a SID structure that contains the user's previous SID. This SID is used to locate the old master keys. If this
		/// parameter is <c>NULL</c>, the master keys for the current user SID are migrated.
		/// </para>
		/// <para>Either this parameter or the pwszOldPassword parameter may be <c>NULL</c>, but not both.</para>
		/// </param>
		/// <param name="pwszOldPassword">
		/// <para>
		/// A pointer to a null-terminated Unicode string that contains the user's password before the SID was changed. This password is
		/// used to decrypt the old master keys. If this parameter is <c>NULL</c>, the password of the current user will be used.
		/// </para>
		/// <para>Either this parameter or the pOldSid parameter may be <c>NULL</c>, but not both.</para>
		/// </param>
		/// <param name="dwFlags">Not used. Must be zero.</param>
		/// <param name="pdwSuccessCount">
		/// The address of a <c>DWORD</c> variable that receives the number of master keys that were successfully migrated.
		/// </param>
		/// <param name="pdwFailureCount">
		/// <para>The address of a <c>DWORD</c> variable that receives the number of master keys that could not be decrypted.</para>
		/// <para>
		/// It is not necessarily an error if one or more master keys cannot be decrypted. Some users may possess master keys that are
		/// stagnant and could not have been decrypted for a long time. One way that this can happen is when the password of a local user
		/// has been administratively reset.
		/// </para>
		/// </param>
		/// <returns>
		/// <para>If the function succeeds, the return value is <c>TRUE</c>.</para>
		/// <para>
		/// If the function fails, the return value is <c>FALSE</c>. For extended error information, call GetLastError. Some possible error
		/// codes include the following.
		/// </para>
		/// <list type="table">
		/// <listheader>
		/// <term>Return code</term>
		/// <term>Description</term>
		/// </listheader>
		/// <item>
		/// <term>ERROR_INVALID_PARAMETER</term>
		/// <term>One of the parameters contains a value that is not valid.</term>
		/// </item>
		/// <item>
		/// <term>ERROR_OUTOFMEMORY</term>
		/// <term>A memory allocation failure occurred.</term>
		/// </item>
		/// <item>
		/// <term>ERROR_ENCRYPTION_FAILED</term>
		/// <term>The old password could not be encrypted.</term>
		/// </item>
		/// </list>
		/// </returns>
		/// <remarks>
		/// <para>
		/// This function decrypts all of the user's master keys in the old master key directory, using the previous password, and stores
		/// them in the user's current master key directory, encrypted with the user's current password.
		/// </para>
		/// <para>This function must be called from the user account that the keys are being migrated to.</para>
		/// <para>
		/// If this function is able to successfully migrate an old master key, it will automatically delete the old master key. Master keys
		/// that cannot be decrypted are not deleted.
		/// </para>
		/// </remarks>
		// https://docs.microsoft.com/en-us/windows/win32/api/dpapi/nf-dpapi-cryptupdateprotectedstate DPAPI_IMP BOOL
		// CryptUpdateProtectedState( PSID pOldSid, LPCWSTR pwszOldPassword, DWORD dwFlags, DWORD *pdwSuccessCount, DWORD *pdwFailureCount );
		[DllImport(Lib.Crypt32, SetLastError = true, ExactSpelling = true)]
		[PInvokeData("dpapi.h", MSDNShortId = "f32e8fcd-6b5b-4a43-b3f9-77e17c84deca")]
		[return: MarshalAs(UnmanagedType.Bool)]
		public static extern bool CryptUpdateProtectedState([Optional] PSID pOldSid, [Optional, MarshalAs(UnmanagedType.LPWStr)] string pwszOldPassword, [Optional] uint dwFlags, out uint pdwSuccessCount, out uint pdwFailureCount);

		///
		/// The <c>CRYPTPROTECT_PROMPTSTRUCT</c> structure provides the text of a prompt and information about when and where that prompt is
		/// to be displayed when using the CryptProtectData and CryptUnprotectData functions.
		///
		// https://docs.microsoft.com/en-us/windows/win32/api/dpapi/ns-dpapi-cryptprotect_promptstruct typedef struct
		// _CRYPTPROTECT_PROMPTSTRUCT { DWORD cbSize; DWORD dwPromptFlags; HWND hwndApp; LPCWSTR szPrompt; } CRYPTPROTECT_PROMPTSTRUCT, *PCRYPTPROTECT_PROMPTSTRUCT;
		[PInvokeData("dpapi.h", MSDNShortId = "412ce598-a7c9-446d-bd98-6583a20d6cd7")]
		[StructLayout(LayoutKind.Sequential)]
		public struct CRYPTPROTECT_PROMPTSTRUCT
		{
			/// The size, in bytes, of this structure.
			public uint cbSize;

			///
			/// <para>
			/// <c>DWORD</c> flags that indicate when prompts to the user are to be displayed. Current <c>dwPromptFlags</c> values are as follows.
			/// </para>
			/// <list type="table">
			/// <listheader>
			/// <term>Value</term>
			/// <term>Meaning</term>
			/// </listheader>
			/// <item>
			/// <term>CRYPTPROTECT_PROMPT_ON_PROTECT</term>
			/// <term>This flag is used to provide the prompt for the protect phase.</term>
			/// </item>
			/// <item>
			/// <term>CRYPTPROTECT_PROMPT_ON_UNPROTECT</term>
			/// <term>
			/// This flag can be combined with CRYPTPROTECT_PROMPT_ON_PROTECT to enforce the UI (user interface) policy of the caller. When
			/// CryptUnprotectData is called, the dwPromptFlags specified in the CryptProtectData call are enforced.
			/// </term>
			/// </item>
			/// </list>
			///
			public CryptProtectPrompt dwPromptFlags;

			/// Window handle to the parent window.
			public HWND hwndApp;

			/// A string containing the text of a prompt to be displayed.
			[MarshalAs(UnmanagedType.LPWStr)] public string szPrompt;
		}
	}
}


text:
module.exports = function($scope, $resource){

}

redpajama_set_name: RedPajamaGithub


text:
package com.physphil.android.androidutils;

import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.widget.Toast;

/**
 * Basic utility methods
 * Created by pshadlyn on 6/2/2014.
 */
public class BaseUtils {

    /**
     * Drafts an email to the given email address, with the given subject line and message
     * @param context
     * @param emailAddress
     * @param subject
     * @param message
     */
    public static void emailDeveloper(Context context, String emailAddress, String subject, String message){

        Intent i = new Intent(Intent.ACTION_SEND);
        i.setType("message/rfc822");
        i.putExtra(Intent.EXTRA_EMAIL, new String[] {emailAddress});
        i.putExtra(Intent.EXTRA_SUBJECT, subject);
        i.putExtra(Intent.EXTRA_TEXT, message);

        context.startActivity(i);
    }

    /**
     * Try to open app's listing in Google Play store
     * @param context context
     * @param packageName package name of app to open.  Typically found by return value of context.getPackageName() in calling application
     */
    public static void openInPlayStore(Context context, String packageName){

        Uri uri = Uri.parse("market://details?id=" + packageName);
        Intent i = new Intent(Intent.ACTION_VIEW, uri);

        try{
            context.startActivity(i);
        }
        catch(ActivityNotFoundException e){
            Toast.makeText(context, R.string.toast_google_play_error, Toast.LENGTH_LONG).show();
        }
    }

}


text:
var timer = function () {
    var button = document.querySelector('#timedButton');
    var startTime = new Date().getTime();
    //Set the date of the conference
    var endTime = new Date("April 12, 2013");
    var videoReady = false;
    //Set the exact time to enable
    //(hours, minutes, seconds, ms)
    //hours 0-23, minutes 0-59, seconds 0-59, ms 0-999
    endTime.setUTCHours(19, 48, 0, 0);
    //Set the new date with hours seconds etc.
    endTime.setTime(endTime.getTime());
    //Get the time in milliseconds since January 1, 1970 midnight
    endTime = endTime.getTime();

    //Recursive function runs ever 5 seconds
    var interval = setInterval(function () {
        //Gets current time in milliseconds since January 1, 1970 midnight
        var currTime = new Date().getTime();
        //If current time is equal or past conf date
        //Stop the recursive function, change var to true call button function
        if ( currTime >= endTime ) {
            clearInterval(interval);
            videoReady = true;
            activateButton();
        }
    }, 5000);

    function activateButton () {
        //Generate a random number between 0 and 599,999
        var randomTime = Math.floor(Math.random() * 600000);
        //Spit it out on the screen just for dev purposes
        document.getElementById('inform').innerHTML = 'Button will show in ' + randomTime / 1000 + ' seconds.';
        //Enable button after random amount of time to prevent all users from refreshing page at the same time.
        setTimeout(function () {
            button.className = 'enabled';
            button.innerHTML = 'I do something';
        }, randomTime);
    };
}();


text:
<template class="task-template">

          <svg class="section-icon"><use xlink:href="assets/img/icons.svg#icon-native-ui"></use></svg>
          Open external links and the file manager

The shell module in Electron allows you to access certain native elements like the file manager and default web browser.

This module works in both the main and renderer process.

Open the full API documentation(opens in new window) in your browser.

        <button id="open-file-manager-demo-toggle" class="js-container-target demo-toggle-button">Open Path in File Manager

Supports: Win, OS X, Linux | Process: Both

        </button>

            <button class="demo-button" id="open-file-manager">View Demo</button>

This demonstrates using the shell module to open the system file manager at a particular location.

Clicking the demo button will open your file manager at the root.

Renderer Process

        <button id="open-ex-links-demo-toggle" class="js-container-target demo-toggle-button">Open External Links

Supports: Win, OS X, Linux | Process: Both

        </button>

            <button class="demo-button" id="open-ex-links">View Demo</button>

If you do not want your app to open website links within the app, you can use the shell module to open them externally. When clicked, the links will open outside of your app and in the user's default web browser.

When the demo button is clicked, the electron website will open in your browser.

Renderer Process

ProTip

            Open all outbound links externally.

You may want to open all http and https links outside of your app. To do this, query the document and loop through each link and add a listener. This app uses the code below which is located in assets/ex-links.js.

Renderer Process

</template>


text:
package eu.lestard.assertj.javafx.internal;

import javafx.beans.property.SimpleStringProperty;
import javafx.beans.value.ObservableValue;
import org.junit.Test;

import static org.assertj.core.api.Assertions.*;

public class ObservableValueAssertions_hasNullValue_Test {

    @Test
    public void should_pass_if_actual_has_a_value_of_null(){
        ObservableValue<String> actual = new SimpleStringProperty(null);

        new ObservableValueAssertions<>(actual).hasNullValue();
    }

    @Test
    public void should_fail_if_actual_has_not_a_value_of_null(){
        try{
            ObservableValue<String> actual = new SimpleStringProperty("test");

            new ObservableValueAssertions<>(actual).hasNullValue();
            fail("Should throw an AssertionError");
        }catch(AssertionError error){
            assertThat(error).hasMessageContaining("value of null but was <test>");
        }
    }

    @Test(expected = AssertionError.class)
    public void should_fail_if_actual_is_null(){
        new ObservableValueAssertions<>(null).hasNullValue();
    }

}


text:
Тестирование по предпочтениям цветов

= testData.questions.length">

				Начать тест

Вопрос {{$index+1}} из {{testData.questions.length}}

{{question.text}}

					{{answer.text}}

= testData.questions.length">

Вы ответили на все вопросы тестов.

			<button class="btn btn-default" ng-click="saveResults()"> Назад к списку тестов</button>


text:
#ifndef LIGHTING_TECHNIQUE_H
#define	LIGHTING_TECHNIQUE_H

#include "technique.h"
#include "ogldev_math_3d.h"

struct BaseLight
{
    Vector3f Color;
    float AmbientIntensity;
    float DiffuseIntensity;

    BaseLight()
    {
        Color = Vector3f(0.0f, 0.0f, 0.0f);
        AmbientIntensity = 0.0f;
        DiffuseIntensity = 0.0f;
    }
};

struct DirectionalLight : public BaseLight
{
    Vector3f Direction;

    DirectionalLight()
    {
        Direction = Vector3f(0.0f, 0.0f, 0.0f);
    }
};

struct PointLight : public BaseLight
{
    Vector3f Position;

    struct
    {
        float Constant;
        float Linear;
        float Exp;
    } Attenuation;

    PointLight()
    {
        Position = Vector3f(0.0f, 0.0f, 0.0f);
        Attenuation.Constant = 1.0f;
        Attenuation.Linear = 0.0f;
        Attenuation.Exp = 0.0f;
    }
};

struct SpotLight : public PointLight
{
    Vector3f Direction;
    float Cutoff;

    SpotLight()
    {
        Direction = Vector3f(0.0f, 0.0f, 0.0f);
        Cutoff = 0.0f;
    }
};

class LightingTechnique : public Technique
{
public:

    static const unsigned int MAX_POINT_LIGHTS = 2;
    static const unsigned int MAX_SPOT_LIGHTS = 2;

    LightingTechnique();

    virtual bool Init();

    void SetWVP(const Matrix4f& WVP);
    void SetLightWVP(const Matrix4f& LightWVP);
    void SetWorldMatrix(const Matrix4f& WVP);
    void SetColorTextureUnit(unsigned int TextureUnit);
    void SetShadowMapTextureUnit(unsigned int TextureUnit);
    void SetNormalMapTextureUnit(unsigned int TextureUnit);
    void SetDirectionalLight(const DirectionalLight& Light);
    void SetPointLights(unsigned int NumLights, const PointLight* pLights);
    void SetSpotLights(unsigned int NumLights, const SpotLight* pLights);
    void SetEyeWorldPos(const Vector3f& EyeWorldPos);
    void SetMatSpecularIntensity(float Intensity);
    void SetMatSpecularPower(float Power);

private:

    GLuint m_WVPLocation;
    GLuint m_LightWVPLocation;
    GLuint m_WorldMatrixLocation;
    GLuint m_colorMapLocation;
    GLuint m_shadowMapLocation;
    GLuint m_normalMapLocation;
    GLuint m_eyeWorldPosLocation;
    GLuint m_matSpecularIntensityLocation;
    GLuint m_matSpecularPowerLocation;
    GLuint m_numPointLightsLocation;
    GLuint m_numSpotLightsLocation;

    struct {
        GLuint Color;
        GLuint AmbientIntensity;
        GLuint DiffuseIntensity;
        GLuint Direction;
    } m_dirLightLocation;

    struct {
        GLuint Color;
        GLuint AmbientIntensity;
        GLuint DiffuseIntensity;
        GLuint Position;
        struct {
            GLuint Constant;
            GLuint Linear;
            GLuint Exp;
        } Atten;
    } m_pointLightsLocation[MAX_POINT_LIGHTS];

    struct {
        GLuint Color;
        GLuint AmbientIntensity;
        GLuint DiffuseIntensity;
        GLuint Position;
        GLuint Direction;
        GLuint Cutoff;
        struct {
            GLuint Constant;
            GLuint Linear;
            GLuint Exp;
        } Atten;
    } m_spotLightsLocation[MAX_SPOT_LIGHTS];
};

#endif	/* LIGHTING_TECHNIQUE_H */


text:
package com.github.ksoichiro.androidcolorfulicons.demo;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ListView;

public class MainActivity extends ActionBarActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ((ListView) findViewById(R.id.list)).setAdapter(new IconAdapter(this));
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.main, menu);
        return super.onCreateOptionsMenu(menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:
                finish();
                return true;
            case R.id.action_about:
                startActivity(new Intent(this, AboutActivity.class));
                break;
        }
        return super.onOptionsItemSelected(item);
    }
}


text:
// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;

namespace Microsoft.CodeAnalysis.Semantics
{
    internal class Expression
    {
        public static ConstantValue SynthesizeNumeric(ITypeSymbol type, int value)
        {
            switch (type.SpecialType)
            {
                case SpecialType.System_Int32:
                    return ConstantValue.Create(value);
                case SpecialType.System_Int64:
                    return ConstantValue.Create((long)value);
                case SpecialType.System_UInt32:
                    return ConstantValue.Create((uint)value);
                case SpecialType.System_UInt64:
                    return ConstantValue.Create((ulong)value);
                case SpecialType.System_UInt16:
                    return ConstantValue.Create((ushort)value);
                case SpecialType.System_Int16:
                    return ConstantValue.Create((short)value);
                case SpecialType.System_SByte:
                    return ConstantValue.Create((sbyte)value);
                case SpecialType.System_Byte:
                    return ConstantValue.Create((byte)value);
                case SpecialType.System_Char:
                    return ConstantValue.Create((char)value);
                case SpecialType.System_Boolean:
                    return ConstantValue.Create(value != 0);
                case SpecialType.System_Single:
                    return ConstantValue.Create((float)value);
                case SpecialType.System_Double:
                    return ConstantValue.Create((double)value);
                case SpecialType.System_Object:
                    return ConstantValue.Create(1, ConstantValueTypeDiscriminator.Int32);
            }

            if (type.TypeKind == TypeKind.Enum)
            {
                return SynthesizeNumeric(((INamedTypeSymbol)type).EnumUnderlyingType, value);
            }

            return null;
        }

        public static BinaryOperationKind DeriveAdditionKind(ITypeSymbol type)
        {
            switch (type.SpecialType)
            {
                case SpecialType.System_Int32:
                case SpecialType.System_Int64:
                case SpecialType.System_Int16:
                case SpecialType.System_SByte:
                    return BinaryOperationKind.IntegerAdd;
                case SpecialType.System_UInt32:
                case SpecialType.System_UInt64:
                case SpecialType.System_UInt16:
                case SpecialType.System_Byte:
                case SpecialType.System_Char:
                case SpecialType.System_Boolean:
                    return BinaryOperationKind.UnsignedAdd;
                case SpecialType.System_Single:
                case SpecialType.System_Double:
                    return BinaryOperationKind.FloatingAdd;
                case SpecialType.System_Object:
                    return BinaryOperationKind.ObjectAdd;
            }

            if (type.TypeKind == TypeKind.Enum)
            {
                return Semantics.BinaryOperationKind.EnumAdd;
            }

            return Semantics.BinaryOperationKind.None;
        }
    }

    internal sealed class ConditionalChoice : IConditionalChoiceExpression
    {
        public ConditionalChoice(IExpression condition, IExpression ifTrue, IExpression ifFalse, ITypeSymbol resultType, SyntaxNode syntax)
        {
            this.Condition = condition;
            this.IfTrue = ifTrue;
            this.IfFalse = ifFalse;
            this.ResultType = resultType;
            this.Syntax = syntax;
        }

        public IExpression Condition { get; }

        public IExpression IfTrue { get; }

        public IExpression IfFalse { get; }

        public ITypeSymbol ResultType { get; }

        public SyntaxNode Syntax { get; }

        public OperationKind Kind => OperationKind.ConditionalChoiceExpression;

        public bool IsInvalid => Condition == null || Condition.IsInvalid || IfTrue == null || IfTrue.IsInvalid || IfFalse == null || IfFalse.IsInvalid;

        public Optional<object> ConstantValue => default(Optional<object>);

        public void Accept(OperationVisitor visitor)
        {
            visitor.VisitConditionalChoiceExpression(this);
        }

        public TResult Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument)
        {
            return visitor.VisitConditionalChoiceExpression(this, argument);
        }
    }

    internal sealed class Assignment : IExpressionStatement
    {
        private readonly AssignmentExpression _assignment;

        public Assignment(IReferenceExpression target, IExpression value, SyntaxNode syntax)
        {
            _assignment = new AssignmentExpression(target, value, syntax);
            this.Syntax = syntax;
        }

        public SyntaxNode Syntax { get; }

        public OperationKind Kind => OperationKind.ExpressionStatement;

        public bool IsInvalid => _assignment.IsInvalid;

        public IExpression Expression => _assignment;

        public void Accept(OperationVisitor visitor)
        {
            visitor.VisitExpressionStatement(this);
        }

        public TResult Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument)
        {
            return visitor.VisitExpressionStatement(this, argument);
        }

        private sealed class AssignmentExpression : IAssignmentExpression
        {
            public AssignmentExpression(IReferenceExpression target, IExpression value, SyntaxNode syntax)
            {
                this.Value = value;
                this.Target = target;
                this.Syntax = syntax;
            }

            public IReferenceExpression Target { get; }

            public IExpression Value { get; }

            public SyntaxNode Syntax { get; }

            public ITypeSymbol ResultType => this.Target.ResultType;

            public OperationKind Kind => OperationKind.AssignmentExpression;

            public bool IsInvalid => Target == null || Target.IsInvalid || Value == null || Value.IsInvalid;

            public Optional<object> ConstantValue => default(Optional<object>);

            public void Accept(OperationVisitor visitor)
            {
                visitor.VisitAssignmentExpression(this);
            }

            public TResult Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument)
            {
                return visitor.VisitAssignmentExpression(this, argument);
            }
        }
    }

    internal sealed class CompoundAssignment : IExpressionStatement
    {
        private readonly CompoundAssignmentExpression _compoundAssignment;

        public CompoundAssignment(IReferenceExpression target, IExpression value, BinaryOperationKind binaryKind, IMethodSymbol operatorMethod, SyntaxNode syntax)
        {
            _compoundAssignment = new CompoundAssignmentExpression(target, value, binaryKind, operatorMethod, syntax);
            this.Syntax = syntax;
        }

        public SyntaxNode Syntax { get; }

        public OperationKind Kind => OperationKind.ExpressionStatement;

        public bool IsInvalid => _compoundAssignment.IsInvalid;

        public IExpression Expression => _compoundAssignment;

        public void Accept(OperationVisitor visitor)
        {
            visitor.VisitExpressionStatement(this);
        }

        public TResult Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument)
        {
            return visitor.VisitExpressionStatement(this, argument);
        }

        private sealed class CompoundAssignmentExpression : ICompoundAssignmentExpression
        {
            public CompoundAssignmentExpression(IReferenceExpression target, IExpression value, BinaryOperationKind binaryKind, IMethodSymbol operatorMethod, SyntaxNode syntax)
            {
                this.Target = target;
                this.Value = value;
                this.BinaryKind = binaryKind;
                this.Operator = operatorMethod;
                this.Syntax = syntax;
            }

            public IReferenceExpression Target { get; }

            public IExpression Value { get; }

            public BinaryOperationKind BinaryKind { get; }

            public IMethodSymbol Operator { get; }

            public SyntaxNode Syntax { get; }

            public ITypeSymbol ResultType => this.Target.ResultType;

            public OperationKind Kind => OperationKind.CompoundAssignmentExpression;

            public bool IsInvalid => Target == null || Target.IsInvalid || Value == null || Value.IsInvalid;

            public Optional<object> ConstantValue => default(Optional<object>);

            public bool UsesOperatorMethod => this.Operator != null;

            public void Accept(OperationVisitor visitor)
            {
                visitor.VisitCompoundAssignmentExpression(this);
            }

            public TResult Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument)
            {
                return visitor.VisitCompoundAssignmentExpression(this, argument);
            }
        }
    }

    internal sealed class IntegerLiteral : ILiteralExpression
    {
        private readonly long _value;

        public IntegerLiteral(long value, ITypeSymbol resultType, SyntaxNode syntax)
        {
            _value = value;
            this.ResultType = resultType;
            this.Syntax = syntax;
        }

        public string Spelling =>_value.ToString();

        public ITypeSymbol ResultType { get; }

        public OperationKind Kind => OperationKind.LiteralExpression;

        public bool IsInvalid => false;

        public Optional<object> ConstantValue => new Optional<object>(_value);

        public SyntaxNode Syntax { get; }

        public void Accept(OperationVisitor visitor)
        {
            visitor.VisitLiteralExpression(this);
        }

        public TResult Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument)
        {
            return visitor.VisitLiteralExpression(this, argument);
        }
    }

    internal class Literal : ILiteralExpression
    {
        private readonly ConstantValue _value;

        public Literal(ConstantValue value, ITypeSymbol resultType, SyntaxNode syntax)
        {
            _value = value;
            this.ResultType = resultType;
            this.Syntax = syntax;
        }

        public string Spelling => _value.Value.ToString();

        public ITypeSymbol ResultType { get; }

        public OperationKind Kind => OperationKind.LiteralExpression;

        public bool IsInvalid => false;

        public Optional<object> ConstantValue => new Optional<object>(_value.Value);

        public SyntaxNode Syntax { get; }

        public void Accept(OperationVisitor visitor)
        {
            visitor.VisitLiteralExpression(this);
        }

        public TResult Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument)
        {
            return visitor.VisitLiteralExpression(this, argument);
        }
    }

    internal sealed class Binary : IBinaryOperatorExpression
    {
        public Binary(BinaryOperationKind binaryKind, IExpression left, IExpression right, ITypeSymbol resultType, SyntaxNode syntax)
        {
            this.BinaryOperationKind = binaryKind;
            this.Left = left;
            this.Right = right;
            this.ResultType = resultType;
            this.Syntax = syntax;
        }

        public BinaryOperationKind BinaryOperationKind { get; }

        public IExpression Left { get; }

        public IExpression Right { get; }

        public bool UsesOperatorMethod => false;

        public IMethodSymbol Operator => null;

        public ITypeSymbol ResultType { get; }

        public OperationKind Kind => OperationKind.BinaryOperatorExpression;

        public bool IsInvalid => Left == null || Left.IsInvalid || Right == null || Right.IsInvalid;

        public Optional<object> ConstantValue => default(Optional<object>);

        public SyntaxNode Syntax { get; }

        public void Accept(OperationVisitor visitor)
        {
            visitor.VisitBinaryOperatorExpression(this);
        }

        public TResult Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument)
        {
            return visitor.VisitBinaryOperatorExpression(this, argument);
        }
    }

    internal sealed class ArrayCreation: IArrayCreationExpression
    {
        private readonly IArrayTypeSymbol _arrayType;

        public ArrayCreation(IArrayTypeSymbol arrayType, ImmutableArray<IExpression> elementValues, SyntaxNode syntax)
        {
            _arrayType = arrayType;
            this.DimensionSizes = ImmutableArray.Create<IExpression>(new IntegerLiteral(elementValues.Count(), null, syntax));
            this.Initializer = new ArrayInitializer(elementValues, syntax, arrayType);
            this.Syntax = syntax;
        }

        public ITypeSymbol ResultType => _arrayType;

        public ImmutableArray<IExpression> DimensionSizes { get; }

        public ITypeSymbol ElementType => _arrayType.ElementType;

        public IArrayInitializer Initializer { get; }

        public SyntaxNode Syntax { get; }

        public OperationKind Kind => OperationKind.ArrayCreationExpression;

        public bool IsInvalid => IsInvalidInitializer(Initializer);

        static bool IsInvalidInitializer(IArrayInitializer initializer) => initializer.IsInvalid;

        public void Accept(OperationVisitor visitor)
        {
            visitor.VisitArrayCreationExpression(this);
        }

        public TResult Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument)
        {
            return visitor.VisitArrayCreationExpression(this, argument);
        }

        public Optional<object> ConstantValue => default(Optional<object>);

        private sealed class ArrayInitializer : IArrayInitializer
        {
            public ArrayInitializer(ImmutableArray<IExpression> elementValues, SyntaxNode syntax, ITypeSymbol arrayType)
            {
                ElementValues = elementValues;
                Syntax = syntax;
                ResultType = arrayType;
            }

            public ImmutableArray<IExpression> ElementValues { get; }

            public bool IsInvalid => ElementValues.Any(v => v.IsInvalid);

            public OperationKind Kind => OperationKind.ArrayInitializer;

            public ITypeSymbol ResultType { get; }

            public SyntaxNode Syntax { get; }

            public Optional<object> ConstantValue => default(Optional<object>);

            public void Accept(OperationVisitor visitor)
            {
                visitor.VisitArrayInitializer(this);
            }

            public TResult Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument)
            {
                return visitor.VisitArrayInitializer(this, argument);
            }
        }
    }

}


text:
using System;
using System.Collections.Generic;
using Azuria.Api.v1.Converter;

namespace Azuria.Requests.Builder
{
    /// <summary>
    /// </summary>
    public class RequestBuilder : RequestBuilderBase, IRequestBuilder
    {
        /// <summary>
        /// </summary>
        /// <param name="baseUri"></param>
        /// <param name="client"></param>
        public RequestBuilder(Uri baseUri, IProxerClient client) : base(baseUri, client)
        {
        }

        /// <inheritdoc />
        public IRequestBuilder WithGetParameter(string key, string value)
        {
            this.AddGetParameter(key, value);
            return this;
        }

        /// <inheritdoc />
        public IRequestBuilder WithGetParameter(IDictionary<string, string> parameter)
        {
            this.AddGetParameter(parameter);
            return this;
        }

        /// <inheritdoc />
        public IRequestBuilder WithHeader(string key, string value)
        {
            this.AddHeader(key, value);
            return this;
        }

        /// <inheritdoc />
        public IRequestBuilder WithHeader(IDictionary<string, string> header)
        {
            this.AddHeader(header);
            return this;
        }

        /// <inheritdoc />
        public IRequestBuilder WithLoginCheck(bool check = true)
        {
            this.AddLoginCheck(check);
            return this;
        }

        /// <inheritdoc />
        public IRequestBuilder WithPostParameter(string key, string value)
        {
            this.AddPostArgument(key, value);
            return this;
        }

        /// <inheritdoc />
        public IRequestBuilder WithPostParameter(IEnumerable<KeyValuePair<string, string>> args)
        {
            this.AddPostArgument(args);
            return this;
        }

        /// <inheritdoc />
        public IRequestBuilderWithResult<T> WithResult<T>()
        {
            return new RequestBuilder<T>(this);
        }
    }

    /// <summary>
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class RequestBuilder<T> : RequestBuilderBase, IRequestBuilderWithResult<T>
    {
        /// <summary>
        /// </summary>
        /// <param name="baseUri"></param>
        /// <param name="client"></param>
        public RequestBuilder(Uri baseUri, IProxerClient client) : base(baseUri, client)
        {
        }

        /// <summary>
        /// </summary>
        /// <param name="builder"></param>
        public RequestBuilder(RequestBuilderBase builder) : base(builder)
        {
        }

        /// <inheritdoc />
        public DataConverter<T> CustomDataConverter { get; private set; }

        /// <inheritdoc />
        public IRequestBuilderWithResult<T> WithCustomDataConverter(DataConverter<T> converter)
        {
            this.CustomDataConverter = converter;
            return this;
        }

        /// <inheritdoc />
        public IRequestBuilderWithResult<T> WithGetParameter(string key, string value)
        {
            this.AddGetParameter(key, value);
            return this;
        }

        /// <inheritdoc />
        public IRequestBuilderWithResult<T> WithGetParameter(IDictionary<string, string> parameter)
        {
            this.AddGetParameter(parameter);
            return this;
        }

        /// <inheritdoc />
        public IRequestBuilderWithResult<T> WithHeader(string key, string value)
        {
            this.AddHeader(key, value);
            return this;
        }

        /// <inheritdoc />
        public IRequestBuilderWithResult<T> WithHeader(IDictionary<string, string> header)
        {
            this.AddHeader(header);
            return this;
        }

        /// <inheritdoc />
        public IRequestBuilderWithResult<T> WithLoginCheck(bool check = true)
        {
            this.AddLoginCheck(check);
            return this;
        }

        /// <inheritdoc />
        public IRequestBuilderWithResult<T> WithPostParameter(string key, string value)
        {
            this.AddPostArgument(key, value);
            return this;
        }

        /// <inheritdoc />
        public IRequestBuilderWithResult<T> WithPostParameter(IEnumerable<KeyValuePair<string, string>> args)
        {
            this.AddPostArgument(args);
            return this;
        }
    }
}


text:
var common = require('../common');
var assert = require('assert');
var net = require('net');
var gotError = false;

var server = net.createServer(function(socket) {
});
server.listen(common.PORT, function() {
  assert(false);
});
server.on('error', function(error) {
  common.debug(error);
  assert(false);
});
server.close();


text:
var app = (function() {

    var t = {};

    var schema = null;
    var query_editor_id = "output";
    var languages_wrapper_id = "languages";
    var langsWrapper = null;
    var query_editor = null;
    var $validate = null;

    /**
    *   Load a file
    *   TODO: make it ajax based
    */
    var loadScript = function(url, callback){
        // Adding the script tag to the head as suggested before
        var head = document.getElementsByTagName('head')[0];
        var script = document.createElement('script');
        script.type = 'text/javascript';
        script.src = url;

        // Then bind the event to the callback function.
        // There are several events for cross browser compatibility.
        script.onreadystatechange = callback;
        script.onload = callback;

        // Fire the loading
        head.appendChild(script);
    };

    /**
    *   Load schema
    */
    var loadSchema = function(callback){
        loadScript("jsoneditor/dist/query.js", function(){
            callback(query_schema);
        });
    };

    /**
    *   Helper functions
    */

    var validate = function(){
        var validation_errors = jsoneditor.validate();
        // Show validation errors if there are any
        if(validation_errors.length) {
            setValidationErrors(validation_errors);
        }
        else {
            $validate.value = 'valid';
        }
    };

    var setValidationErrors = function(errors){
        $validate.value = JSON.stringify(errors,null,2);
    };

    var getActiveLanguages = function(){
        var activeLangs = [];
        var checkboxes = langsWrapper.getElementsByTagName('input');
        for(i in checkboxes){
            var checkbox = checkboxes[i];
            if(checkbox.checked){
                activeLangs.push(checkbox.value);
            }
        }
        return activeLangs;
    }

    /**
    *   String manipulation
    */
    function nth_occurrence (string, char, nth) {
        var first_index = string.indexOf(char);
        var length_up_to_first_index = first_index + 1;

        if (nth == 1) {
            return first_index;
        } else {
            var string_after_first_occurrence = string.slice(length_up_to_first_index);
            var next_occurrence = nth_occurrence(string_after_first_occurrence, char, nth - 1);

            if (next_occurrence === -1) {
                return -1;
            } else {
                return length_up_to_first_index + next_occurrence;
            }
        }
    }

    var removeAttributesWithKey = function(txt, key){
        var lookfor = '"' + key + '"';
        var startIndex = null;

        while((startIndex = txt.indexOf(lookfor)) > -1){
            var temp = txt.substring(startIndex, txt.length);
            var endIndex = nth_occurrence(temp, '"', 4);

            var beforeCommaRemove = false;

            if(txt.substring(startIndex-1, startIndex) === ","){
                beforeCommaRemove = true;
            }

            if(txt.substring(startIndex+endIndex+1, startIndex+endIndex+2) === ","){
                var toRemove = txt.substring(startIndex, startIndex+endIndex+2);
            }else{
                var toRemove = txt.substring(startIndex + (beforeCommaRemove ? -1 : 0), startIndex+endIndex+1);
            }
            txt = txt.replace(toRemove, "");
        }
        return txt;
    }

    var addTranslationWithKey = function(txt, key){
        var lookfor = "{";
        var startIndex = null;
        var temp = txt;
        var charsFromBeginning = 0;

        var replacements = [];

        while((startIndex = temp.indexOf(lookfor)) > -1){
            charsFromBeginning += startIndex + 1;

            var temp = temp.substring(startIndex + 1, temp.length);

            var endIndex = temp.indexOf("}");
            var newObj = temp.substring(0, endIndex + 1);

            // Analyze if language obj
            if(newObj.indexOf("{") > -1)
                continue;

            newObj = "{" + newObj;
            var parsed = JSON.parse(newObj);
            if(parsed.hasOwnProperty("EN") || parsed.hasOwnProperty("FI") ||
                parsed.hasOwnProperty("RU") || parsed.hasOwnProperty("SV") || parsed.hasOwnProperty("NO") || objectIsEmpty(parsed)){
                if(!parsed.hasOwnProperty(key)){
                    parsed[key] = "";
                }
                newObj = JSON.stringify(parsed);

                var real = txt.substring(charsFromBeginning - 1, charsFromBeginning + endIndex + 1);

                replacements.push({
                    "new" : newObj,
                    "old" : real
                });
            }
        }
        for(i in replacements){
            var obj = replacements[i];
            txt = txt.replace(obj["old"], obj["new"]);
        }
        return txt;
    }

    function objectIsEmpty(map) {
       for(var key in map) {
          if (map.hasOwnProperty(key)) {
             return false;
          }
       }
       return true;
    }

    /**
    *   Setup locales, format ["NO", "RU", "FI"]
    */
    t.setupLocales = function(arr){
        for(i in arr){
            var lang = arr[i];
            var label = document.createElement('label');
            label.innerHTML = lang + " ";
            langsWrapper.appendChild(label);

            var checkbox = document.createElement('input');
            checkbox.type = "checkbox";
            checkbox.value = lang;
            langsWrapper.appendChild(checkbox);

            checkbox.addEventListener('click', function(){
                var json = jsoneditor.getValue();
                var txt = JSON.stringify(json);
                if(this.checked){
                    txt = addTranslationWithKey(txt, this.value);
                }else{
                    txt = removeAttributesWithKey(txt, this.value);
                }
                t.setValue(txt);
            });
        }
    };

    /**
    *   Update languages
    */
    var help_wascalled = false;
    t.updateLanguages = function(){
        var langs = getActiveLanguages();
        var json = jsoneditor.getValue();
        var txt = JSON.stringify(json);
        for(i in langs){
            var lang = langs[i];
            txt = addTranslationWithKey(txt, lang);
        }
        if(!help_wascalled){
            help_wascalled = true;
            t.setValue(txt);

            // var to avoid stack overflow
            setTimeout(function(){
                help_wascalled = false;
            }, 500);
        }
    }

    /**
    *   Set value to editor, argument as object or string
    */
    t.setValue = function(obj, updateLangs){
        if(typeof obj !== 'object'){
            obj = JSON.parse(obj);
        }

        query_editor.setValue(JSON.stringify(obj, null, 2));

        jsoneditor.setValue(obj);
        var verdict = jsoneditor.validate(obj);
        if(!verdict.length || verdict == true){
//            jsoneditor.setValue(obj);
        }else{
            setValidationErrors(verdict);
        }
    };

    t.isValid = function(){
        return jsoneditor.validate().length ? false : true;
    };

    t.getValue = function(){
        if(t.isValid()){
            return query_editor.getValue();
        }else{
            return null;
        }
    };

    /**
    *   Main
    */
    t.init = function(readyCallback){

        var jsoneditor;

        /**
        *   DOM elements
        */
        var $editor = document.getElementById('editor');
        $validate = document.getElementById('validate');
        langsWrapper = document.getElementById(languages_wrapper_id);

        /**
        *   Buttons
        */
        var $set_value_button = document.getElementById('setvalue');

        var reload = function(keep_value) {
            window.startval = undefined;

            if(jsoneditor) jsoneditor.destroy();
            jsoneditor = new JSONEditor($editor,{
                schema: schema,
                startval: startval,
                children_expanded: false,
                expanded_exceptions : ["root"],//, "sections"],
                no_collapse_expand_button : ["root"],
                no_additional_fields_added_from_properties_list : false,
                ajax: true
            }, function(){
                if(typeof readyCallback !== 'undefined'){
                    readyCallback();
                }
            });
            window.jsoneditor = jsoneditor;

            // When the value of the editor changes, update the JSON output and validation message
            jsoneditor.on('change',function() {
                var json = jsoneditor.getValue();
                query_editor.setValue(JSON.stringify(json,null,2));
                validate();
            });
        };

        /**
        *   Setup ACE editor
        */

        query_editor = ace.edit(query_editor_id);
        query_editor.setTheme("ace/theme/monokai");
        query_editor.getSession().setMode("ace/mode/javascript");
        query_editor.setOptions({
            maxLines: Infinity
        });
        query_editor.setValue("");

        /**
        *   Event listeners
        */
        $set_value_button.addEventListener('click',function() {
            var currentVal = query_editor.getValue();
            t.setValue(currentVal);
        });

        /**
        *   Theme loading, styling
        */
        var setTheme = function(no_reload) {
            JSONEditor.defaults.options.theme = 'bootstrap3';
            document.getElementById('theme_stylesheet').href = 'jsoneditor/css/bootstrap.min.css';
            if(!no_reload) reload(true);
        };
        setTheme(true);

        var setIconlib = function(no_reload) {
            JSONEditor.defaults.options.iconlib = 'fontawesome4';
            document.getElementById('icon_stylesheet').href = 'jsoneditor/css/font-awesome.css';
            if(!no_reload) reload(true);
        };
        setIconlib(true);

        /**
        *   Load schema callback
        */
        loadSchema(function(res){
            schema = res;
            reload();
        });
    };

    return t;

})();


text:
package com.ctrip.zeus.model.model;

public class ConfSlbName {
    private String m_slbname;

    public ConfSlbName() {
    }

    protected boolean equals(Object o1, Object o2) {
        if (o1 == null) {
            return o2 == null;
        } else if (o2 == null) {
            return false;
        } else {
            return o1.equals(o2);
        }
    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof ConfSlbName) {
            ConfSlbName _o = (ConfSlbName) obj;

            if (!equals(m_slbname, _o.getSlbname())) {
                return false;
            }

            return true;
        }

        return false;
    }

    public String getSlbname() {
        return m_slbname;
    }

    @Override
    public int hashCode() {
        int hash = 0;

        hash = hash * 31 + (m_slbname == null ? 0 : m_slbname.hashCode());

        return hash;
    }

    public ConfSlbName setSlbname(String slbname) {
        m_slbname = slbname;
        return this;
    }

}


text:
var finder = {
	findClusters: function (matr) {
		var matrix = util.copy(matr);

		var k = 0;
		var watched = [];

		for (var i = 0; i < matrix.length; i++) {
			for (var j = 0; j < matrix.length; j++) {
				var elm = matrix[i][j];

				if (elm.color !== 'white') {
					watched.push(elm);

					var left = util.getMatrixElement(i, j - 1, matrix);
					var top = util.getMatrixElement(i - 1, j, matrix);

					if (left && left.color == 'white') left = null;
					if (top && top.color == 'white') top = null;

					if (!left && !top) {
						elm.cluster = k++;
						elm.color = this.getRandomColor();

					} else if (left && top) {
						if (left.cluster < top.cluster) {

							elm.cluster = left.cluster;
							this.mergeClusters(left.cluster, top.cluster, watched);

						} else {
							elm.cluster = top.cluster;
							this.mergeClusters(top.cluster, left.cluster, watched);
						}

					} else if (left) {
						elm.cluster = left.cluster;
						elm.color = left.color;

					} else if (top) {
						elm.cluster = top.cluster;
						elm.color = top.color;
					}

				} else {
					elm.cluster = -1;
				}
			}
		}

		return matrix;
	},

	mergeClusters: function (less, more, watched) {
		var color = this.getRandomColor();

		watched.forEach(function (elm) {
			if (elm.cluster == less || elm.cluster == more) {
				elm.cluster = less;
				elm.color = color;
			}
		});
	},

	getRandomColor: function () {
		var letters = '0123456789ABCDEF';
		var color = '#';
		for (var i = 0; i < 6; i++) {
			color += letters[Math.floor(Math.random() * 16)];
		}
		return color;
	}
};


text:
include Makefile.config

.PHONY: all
all:
	make -C util all
	make -C rpc all
	make -C blockstore all

.PHONY: clean
clean:
	make -C util clean
	make -C rpc clean
	make -C blockstore clean

.PHONY: test
test:
	make -C util test
	make -C rpc test
	make -C blockstore test


text:
package io.joynr.capabilities;

import com.google.inject.Inject;
import joynr.infrastructure.GlobalDomainAccessController;

public class GlobalDomainAccessControllerDiscoveryEntryProvider extends AbstractGlobalDiscoveryEntryProvider {

    @Inject
    public GlobalDomainAccessControllerDiscoveryEntryProvider(CapabilitiesProvisioning capabilitiesProvisioning) {
        super(capabilitiesProvisioning, GlobalDomainAccessController.INTERFACE_NAME);
    }

}


text:
namespace Causality
{
	extern bool		g_DebugView;
	extern bool		g_ShowCharacterMesh;
	extern float	g_DebugArmatureThinkness;
	extern bool		g_MirrowInputX;

	class KeyboardMouseFirstPersonControl : public SceneObject, public IAppComponent, public IKeybordInteractive, public ICursorInteractive
	{
	public:
		KeyboardMouseFirstPersonControl(IRigid* pTarget = nullptr);

		void SetTarget(IRigid* pTarget);

		// Inherited via ITimeAnimatable
		virtual void Update(time_seconds const& time_delta) override;

		// Inherited via IKeybordInteractive
		virtual void OnKeyDown(const KeyboardEventArgs & e) override;
		virtual void OnKeyUp(const KeyboardEventArgs & e) override;

		// Inherited via ICursorInteractive
		virtual void OnMouseButtonDown(const CursorButtonEvent & e) override;
		virtual void OnMouseButtonUp(const CursorButtonEvent & e) override;
		virtual void OnMouseMove(const CursorMoveEventArgs & e) override;

		bool isLeftButtonDown() const { return leftButtonDown;  }
		bool isRightButtonDown() const { return rightButtonDown; }
	public:
		float											Speed;
		float											AngularSpeed;

		DirectX::Quaternion								InitialOrientation;

		float											AddationalYaw = 0;
		float											AddationalPitch = 0;
		float											AddationalRoll = 0;

	private:
		IRigid*											m_pTarget = nullptr;

		bool											IsTrackingCursor = false;
		bool											leftButtonDown = false;
		bool											rightButtonDown = false;
		DirectX::Vector3								CameraVeclocity;
		DirectX::Vector3								CameraAngularVeclocity;
		DirectX::Vector3								AngularDisplacement; // Eular Angle
	};
}


text:
/*globals describe beforeEach it expect Thing MyWorldService Person */
describe("MyWorldService", function() {
  var rock, paper, scissors;
  var moe, larry, curly, shep;
  var service;

  beforeEach(function() {
    rock = new Thing({
      name: "Rock",
      numberInStock: 2,
      numberOwned: 1
    });
    paper = new Thing({
      name: "Paper",
      numberInStock: 3
    });
    scissors = new Thing({
      name: "Scissors",
      numberInStock: 3
    });

    moe = new Person({
      name: "Moe",
      active: true,
    });
    larry = new Person({
      name: "Larry",
      active: true
    });
    curly = new Person({
      name: "Curly",
      active: true,
      things: ["Rock"]
    });
    shep = new Person({
      name: "Shep"
    });

    var people = [moe, larry, curly, shep];
    var things = [rock, paper, scissors];
    service = new MyWorldService(people, things);
  });

  describe("rock", function() {
    it("name is rock", function() {
      expect(rock.name).toEqual("Rock");
    });
  });

  describe("paper", function() {
    it("name is paper", function() {
      expect(paper.name).toEqual("Paper");
    });
  });
  describe("moe", function() {
    it("name is moe", function() {
      expect(moe.name).toEqual("Moe");
    });
  });
  describe("curly", function() {
    it("name is curly", function() {
      expect(curly.name).toEqual("Curly");
    });
  });

  describe("#getPeople", function() {
    var allPeople, activePeople;
    beforeEach(function() {
      allPeople = service.getPeople();
      activePeople = service.getPeople(true);
    });
    it("returns people in alpha order", function() {
      expect(allPeople).toEqual([curly, larry, moe, shep]);
    });
    describe("passing in true for active", function() {
      it("returns only active people", function() {
        expect(activePeople).toEqual([curly, larry, moe]);
      });
    });
  });

  describe("#getPerson", function() {
    var _moe, _shep;
    beforeEach(function() {
      _moe = service.getPerson("Moe");
      _shep = service.getPerson("Shep");
    });
    describe("when passing in Moe", function() {
      it("returns Moe", function() {
        expect(_moe).toEqual(moe);
      });
    });
    describe("when passing in Shep", function() {
      it("returns Shep", function() {
        expect(_shep).toEqual(shep);
      });
    });
  });

  describe("#getThings", function() {
    var _things;
    beforeEach(function() {
      _things = service.getThings();
    });
    it("returns Paper, Rock, Scissors", function() {
      expect(_things).toEqual([paper, rock, scissors]);
    });
  });

  describe("#getThing", function() {
    var _rock;
    beforeEach(function() {
      _rock = service.getThing("Rock");
    });
    describe("with 'Rock'", function() {
      it("returns a Rock", function() {
        expect(_rock).toEqual(rock);
      });
    });
  });

  describe("things", function() {
    var _things;
    beforeEach(function() {
      var moe = service.getPerson("Moe");
      _things = moe.things;
    });
    it("Moe has no things", function() {
      expect(_things).toEqual([]);
    });
  });

  describe("#acquireThing()", function() {
    describe("Giving Moe a Rock", function() {
      var numberOfRocksOwnedBefore,
        numberOfRocksInStockBefore,
        numberOfThingsMoeHasBefore,
        numberOfThingsMoeHasAfter,
        returnValue,
        numberOfRocksInStockAfter,
        moeHasARock,
        numberOfRocksOwnedAfter;

      beforeEach(function() {
        var rock = service.getThing("Rock");
        var moe = service.getPerson("Moe");
        numberOfRocksOwnedBefore = rock.numberOwned;
        numberOfRocksInStockBefore = rock.numberInStock;
        numberOfThingsMoeHasBefore = moe.things.length;

        returnValue = service.acquireThing("Moe", "Rock");
        numberOfThingsMoeHasAfter = moe.things.length;
        numberOfRocksInStockAfter = rock.numberInStock;
        moeHasARock = moe.hasThing("Rock");
        numberOfRocksOwnedAfter = rock.numberOwned;
      });
      it("returns true", function() {
        expect(returnValue).toEqual(true);
      });
      it("there is one less Rock in Stock", function() {
        expect(numberOfRocksInStockAfter).toEqual(numberOfRocksInStockBefore - 1);
      });
      it("Moe has one more thing", function() {
        expect(numberOfThingsMoeHasAfter).toEqual(numberOfThingsMoeHasBefore + 1);
      });
      it("Moe has a rock", function() {
        expect(moeHasARock).toEqual(true);
      });
      it("There is one more rocked owned", function() {
        expect(numberOfRocksOwnedAfter).toEqual(numberOfRocksOwnedBefore + 1);
      });
    });

    describe("Giving Moe too many Rocks", function() {
      beforeEach(function() {
        service.acquireThing("Moe", "Rock");
        service.acquireThing("Moe", "Rock");
      });
      it("there are no more Rocks available", function() {
        expect(service.getThing("Rock").available()).toEqual(false);
      });
      it("throws an exception", function() {
        expect(function() {
          service.acquireThing("Moe", "Rock");
        }).toThrow();
      });
    });
  });

  describe("#returnThing()", function() {
    describe("Moe returns a Rock", function() {
      var numberOfRocksOwnedBefore,
        numberOfRocksOwnedAfter,
        numberOfRocksInStockBefore,
        numberOfRocksInStockAfter,
        returnValue,
        moeHasARockBefore,
        moeHasARockAfter;

      beforeEach(function() {
        var rock = service.getThing("Rock");
        var moe = service.getPerson("Moe");
        service.acquireThing("Moe", "Rock");
        moeHasARockBefore = moe.hasThing("Rock");
        numberOfRocksOwnedBefore = rock.numberOwned;
        numberOfRocksInStockBefore = rock.numberInStock;

        returnValue = service.returnThing("Moe", "Rock");
        numberOfRocksOwnedAfter = rock.numberOwned;
        numberOfRocksInStockAfter = rock.numberInStock;
        moeHasARockAfter = moe.hasThing("Rock");
      });
      it("moe can give back a rock", function() {
        expect(returnValue).toEqual(true);
      });
      it("numberOfRocksOwnedBefore is 1", function() {
        expect(numberOfRocksOwnedBefore).toEqual(2);
      });
      it("numberOfRocksInStockBefore is 2", function() {
        expect(numberOfRocksInStockBefore).toEqual(1);
      });
      it("numberOfRocksOwnedAfter is 0", function() {
        expect(numberOfRocksOwnedAfter).toEqual(1);
      });
      it("numberOfRocksInStockAfter is 3", function() {
        expect(numberOfRocksInStockAfter).toEqual(2);
      });
      it("Moe has a rock before is true", function() {
        expect(moeHasARockBefore).toEqual(true);
      });
      it("Moe has a rock after is false", function() {
        expect(moeHasARockAfter).toEqual(false);
      });

      describe("returning a thing you do not own", function() {
        it("throws an exception", function() {
          expect(function() {
            service.returnThing("Moe", "Rock")
          }).toThrow();
        });
      });
    });

    describe("No more rocks in stock", function() {
      var rockAvailable;
      beforeEach(function() {
        service.acquireThing("Moe", "Rock");
        service.acquireThing("Moe", "Rock");
        var rock = service.getThing("Rock");
        rockAvailable = rock.available();
      });
      it("there are no more Rocks available", function() {
        expect(rockAvailable).toEqual(false);
      });
      it("throws an exception", function() {
        expect(function() {
          service.acquireThing("Moe", "Rock");
        }).toThrow();
      });
    });
  });

  describe("getPeopleWhoOwnThing", function() {
    describe("After Moe and Curly have acquired a Rocks", function() {
      var peopleWhoOwnRocks;
      var peopleWhoOwnNothing;
      beforeEach(function() {
        service.acquireThing("Moe", "Rock");
        service.acquireThing("Curly", "Rock");
        peopleWhoOwnRocks = service.getPeopleWhoOwnThing("Rock");
        peopleWhoOwnNothing = service.getPeopleWhoOwnNothing();
      });
      it("Moe and Curly own Rocks", function() {
        expect(peopleWhoOwnRocks).toEqual([moe, curly]);
      });
      it("Larry and Shep own nothing", function() {
        expect(peopleWhoOwnNothing).toEqual([larry, shep]);
      });
    });
  });

  describe("getThingsNotOwned", function() {
    describe("After Moe and Curly have acquired a Rocks", function() {
      var thingsNotOwned;
      beforeEach(function() {
        service.acquireThing("Moe", "Rock");
        service.acquireThing("Curly", "Rock");
        thingsNotOwned = service.getThingsNotOwned();
      });
      it("Paper and Scissors are not owned", function() {
        expect(thingsNotOwned).toEqual([paper, scissors]);
      });
    });
  });

  describe("getThingsOwned", function() {
    describe("After Moe and Curly acquire a Rocks", function() {
      var thingsOwned;
      var rockIsOwned;
      beforeEach(function() {
        service.acquireThing("Moe", "Rock");
        service.acquireThing("Curly", "Rock");
        thingsOwned = service.getThingsOwned();
        rockIsOwned = service.getThing("Rock").isOwned();
      });
      it("Rock is owned", function() {
        expect(thingsOwned).toEqual([rock]);
      });
      it("rock.isOwned() is true", function() {
        expect(rockIsOwned).toEqual(true);
      });
    });
  });
});


text:
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>hdt2vec</groupId>
  <artifactId>hdt2vec</artifactId>
  <version>0.0.1-SNAPSHOT</version>

  <properties>
    <nd4j.version>0.5.0</nd4j.version>
    <dl4j.version>0.5.0</dl4j.version>
  </properties>

 <build>
    <plugins>
      <plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-shade-plugin</artifactId>
				<version>2.3</version>
				<executions>
					<execution>
						<phase>package</phase>
						<goals>
							<goal>shade</goal>
						</goals>
						<configuration>
						    <finalName>hdt2vec</finalName>
						    <shadedClassifierName>all</shadedClassifierName>

							<filters>
								<filter>
									<artifact>*:*</artifact>
									<excludes>
										<exclude>META-INF/*.SF</exclude>
										<exclude>META-INF/*.DSA</exclude>
										<exclude>META-INF/*.RSA</exclude>
									</excludes>
								</filter>
							</filters>

							<transformers>
<!-- 								<transformer -->
<!-- 									implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" /> -->
							<transformer
								implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
								<mainClass>nl.vu.hdt2vec.Run</mainClass>
							</transformer>
							<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
						</transformers>
					</configuration>
				</execution>
			</executions>
		</plugin>
    </plugins>

	<resources>
	  <resource>
	      <directory>src/main/resources</directory>
	    </resource>
	  </resources>

	<pluginManagement>
	  <plugins>
     <plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-enforcer-plugin</artifactId>
     <version>1.3.1</version>
     <executions>
        <execution>
           <id>enforce</id>
           <configuration>
              <rules>
                 <DependencyConvergence/>
              </rules>
           </configuration>
           <goals>
              <goal>enforce</goal>
           </goals>
        </execution>
     </executions>
  </plugin>
  	  <plugin>
	  <groupId>org.apache.maven.plugins</groupId>
	  <artifactId>maven-compiler-plugin</artifactId>
	  <version>3.5.1</version>
	  <configuration>
	    <source>1.8</source>
	    <target>1.8</target>
	  </configuration>
	</plugin>
	</plugins>
	</pluginManagement>
	</build>

  <dependencies>
  	<dependency>
  		<groupId>org.deeplearning4j</groupId>
  		<artifactId>deeplearning4j-ui</artifactId>
  		<version>0.5.0</version>
  	</dependency>
  	<dependency>
  		<groupId>org.deeplearning4j</groupId>
  		<artifactId>deeplearning4j-nlp</artifactId>
  		<version>0.5.0</version>
  	</dependency>
  	<dependency>
  		<groupId>org.nd4j</groupId>
  		<artifactId>nd4j-native-platform</artifactId>
  		<version>0.5.0</version>
  	</dependency>
 	<dependency>
  		<groupId>org.rdfhdt</groupId>
  		<artifactId>hdt-java-core</artifactId>
  		<version>1.1</version>
  	</dependency>
	<dependency>
		<groupId>args4j</groupId>
		<artifactId>args4j</artifactId>
		<version>2.33</version>
	</dependency>
	<dependency>
        <groupId>com.github.pbloem</groupId>
        <artifactId>kit</artifactId>
        <version>v0.1.12</version>
    </dependency>
	<dependency>
	    <groupId>org.apache.commons</groupId>
	    <artifactId>commons-csv</artifactId>
	    <version>1.3</version>
	</dependency>
  </dependencies>

  <dependencyManagement>
  <dependencies>
    <dependency>
 		<groupId>org.apache.commons</groupId>
 		<artifactId>commons-math3</artifactId>
 		<version>3.6.1</version>
    </dependency>
   </dependencies>
  </dependencyManagement>

  <repositories>
	  <repository>
	      <id>jitpack.io</id>
	      <url>https://jitpack.io</url>
	  </repository>
  </repositories>

</project>


text:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<feed><tipo>Travessa</tipo><logradouro>Dois A</logradouro><bairro>Lamarão</bairro><cidade>Aracaju</cidade><uf>SE</uf><cep>49088046</cep></feed>