text:
extern "C" {
#endif

#ifndef WINAPI
#define WINAPI __stdcall
#endif

#ifndef INITGUID
#define INITGUID
#include <guiddef.h>
#undef INITGUID
#else
#include <guiddef.h>
#endif

//+------------------------------------------------------------------------------------------
// API Version Information.
// Caller should check for WebAuthNGetApiVersionNumber to check the presence of relevant APIs
// and features for their usage.
//-------------------------------------------------------------------------------------------

#define WEBAUTHN_API_VERSION_1          1
// WEBAUTHN_API_VERSION_1 : Baseline Version
//      Data Structures and their sub versions:
//          - WEBAUTHN_RP_ENTITY_INFORMATION                    :   1
//          - WEBAUTHN_USER_ENTITY_INFORMATION                  :   1
//          - WEBAUTHN_CLIENT_DATA                              :   1
//          - WEBAUTHN_COSE_CREDENTIAL_PARAMETER                :   1
//          - WEBAUTHN_COSE_CREDENTIAL_PARAMETERS               :   Not Applicable
//          - WEBAUTHN_CREDENTIAL                               :   1
//          - WEBAUTHN_CREDENTIALS                              :   Not Applicable
//          - WEBAUTHN_CREDENTIAL_EX                            :   1
//          - WEBAUTHN_CREDENTIAL_LIST                          :   Not Applicable
//          - WEBAUTHN_EXTENSION                                :   Not Applicable
//          - WEBAUTHN_EXTENSIONS                               :   Not Applicable
//          - WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS    :   3
//          - WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS      :   4
//          - WEBAUTHN_COMMON_ATTESTATION                       :   1
//          - WEBAUTHN_CREDENTIAL_ATTESTATION                   :   3
//          - WEBAUTHN_ASSERTION                                :   1
//      Extensions:
//          - WEBAUTHN_EXTENSIONS_IDENTIFIER_HMAC_SECRET
//      APIs:
//          - WebAuthNGetApiVersionNumber
//          - WebAuthNIsUserVerifyingPlatformAuthenticatorAvailable
//          - WebAuthNAuthenticatorMakeCredential
//          - WebAuthNAuthenticatorGetAssertion
//          - WebAuthNFreeCredentialAttestation
//          - WebAuthNFreeAssertion
//          - WebAuthNGetCancellationId
//          - WebAuthNCancelCurrentOperation
//          - WebAuthNGetErrorName
//          - WebAuthNGetW3CExceptionDOMError

#define WEBAUTHN_API_VERSION_2 2
// WEBAUTHN_API_VERSION_2 : Delta From WEBAUTHN_API_VERSION_1
//      Added Extensions:
//          - WEBAUTHN_EXTENSIONS_IDENTIFIER_CRED_PROTECT
//

#define WEBAUTHN_API_VERSION_3 3
// WEBAUTHN_API_VERSION_3 : Delta From WEBAUTHN_API_VERSION_2
//      Data Structures and their sub versions:
//          - WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS    :   4
//          - WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS      :   5
//          - WEBAUTHN_CREDENTIAL_ATTESTATION                   :   4
//          - WEBAUTHN_ASSERTION                                :   2
//      Added Extensions:
//          - WEBAUTHN_EXTENSIONS_IDENTIFIER_CRED_BLOB
//          - WEBAUTHN_EXTENSIONS_IDENTIFIER_MIN_PIN_LENGTH
//

#define WEBAUTHN_API_CURRENT_VERSION WEBAUTHN_API_VERSION_3

//+------------------------------------------------------------------------------------------
// Information about an RP Entity
//-------------------------------------------------------------------------------------------

#define WEBAUTHN_RP_ENTITY_INFORMATION_CURRENT_VERSION          1

typedef struct _WEBAUTHN_RP_ENTITY_INFORMATION {
    // Version of this structure, to allow for modifications in the future.
    // This field is required and should be set to CURRENT_VERSION above.
    DWORD dwVersion;

    // Identifier for the RP. This field is required.
    PCWSTR pwszId;

    // Contains the friendly name of the Relying Party, such as "Acme Corporation", "Widgets Inc" or "Awesome Site".
    // This field is required.
    PCWSTR pwszName;

    // Optional URL pointing to RP's logo.
    PCWSTR pwszIcon;
} WEBAUTHN_RP_ENTITY_INFORMATION, *PWEBAUTHN_RP_ENTITY_INFORMATION;
typedef const WEBAUTHN_RP_ENTITY_INFORMATION *PCWEBAUTHN_RP_ENTITY_INFORMATION;

//+------------------------------------------------------------------------------------------
// Information about an User Entity
//-------------------------------------------------------------------------------------------
#define WEBAUTHN_MAX_USER_ID_LENGTH                             64

#define WEBAUTHN_USER_ENTITY_INFORMATION_CURRENT_VERSION        1

typedef struct _WEBAUTHN_USER_ENTITY_INFORMATION {
    // Version of this structure, to allow for modifications in the future.
    // This field is required and should be set to CURRENT_VERSION above.
    DWORD dwVersion;

    // Identifier for the User. This field is required.
    DWORD cbId;
    _Field_size_bytes_(cbId)
    PBYTE pbId;

    // Contains a detailed name for this account, such as "john.p.smith@example.com".
    PCWSTR pwszName;

    // Optional URL that can be used to retrieve an image containing the user's current avatar,
    // or a data URI that contains the image data.
    PCWSTR pwszIcon;

    // For User: Contains the friendly name associated with the user account by the Relying Party, such as "John P. Smith".
    PCWSTR pwszDisplayName;
} WEBAUTHN_USER_ENTITY_INFORMATION, *PWEBAUTHN_USER_ENTITY_INFORMATION;
typedef const WEBAUTHN_USER_ENTITY_INFORMATION *PCWEBAUTHN_USER_ENTITY_INFORMATION;

//+------------------------------------------------------------------------------------------
// Information about client data.
//-------------------------------------------------------------------------------------------

#define WEBAUTHN_HASH_ALGORITHM_SHA_256                         L"SHA-256"
#define WEBAUTHN_HASH_ALGORITHM_SHA_384                         L"SHA-384"
#define WEBAUTHN_HASH_ALGORITHM_SHA_512                         L"SHA-512"

#define WEBAUTHN_CLIENT_DATA_CURRENT_VERSION                    1

typedef struct _WEBAUTHN_CLIENT_DATA {
    // Version of this structure, to allow for modifications in the future.
    // This field is required and should be set to CURRENT_VERSION above.
    DWORD dwVersion;

    // Size of the pbClientDataJSON field.
    DWORD cbClientDataJSON;
    // UTF-8 encoded JSON serialization of the client data.
    _Field_size_bytes_(cbClientDataJSON)
    PBYTE pbClientDataJSON;

    // Hash algorithm ID used to hash the pbClientDataJSON field.
    LPCWSTR pwszHashAlgId;
} WEBAUTHN_CLIENT_DATA, *PWEBAUTHN_CLIENT_DATA;
typedef const WEBAUTHN_CLIENT_DATA *PCWEBAUTHN_CLIENT_DATA;

//+------------------------------------------------------------------------------------------
// Information about credential parameters.
//-------------------------------------------------------------------------------------------

#define WEBAUTHN_CREDENTIAL_TYPE_PUBLIC_KEY                         L"public-key"

#define WEBAUTHN_COSE_ALGORITHM_ECDSA_P256_WITH_SHA256             -7
#define WEBAUTHN_COSE_ALGORITHM_ECDSA_P384_WITH_SHA384             -35
#define WEBAUTHN_COSE_ALGORITHM_ECDSA_P521_WITH_SHA512             -36

#define WEBAUTHN_COSE_ALGORITHM_RSASSA_PKCS1_V1_5_WITH_SHA256      -257
#define WEBAUTHN_COSE_ALGORITHM_RSASSA_PKCS1_V1_5_WITH_SHA384      -258
#define WEBAUTHN_COSE_ALGORITHM_RSASSA_PKCS1_V1_5_WITH_SHA512      -259

#define WEBAUTHN_COSE_ALGORITHM_RSA_PSS_WITH_SHA256                -37
#define WEBAUTHN_COSE_ALGORITHM_RSA_PSS_WITH_SHA384                -38
#define WEBAUTHN_COSE_ALGORITHM_RSA_PSS_WITH_SHA512                -39

#define WEBAUTHN_COSE_CREDENTIAL_PARAMETER_CURRENT_VERSION          1

typedef struct _WEBAUTHN_COSE_CREDENTIAL_PARAMETER {
    // Version of this structure, to allow for modifications in the future.
    DWORD dwVersion;

    // Well-known credential type specifying a credential to create.
    LPCWSTR pwszCredentialType;

    // Well-known COSE algorithm specifying the algorithm to use for the credential.
    LONG lAlg;
} WEBAUTHN_COSE_CREDENTIAL_PARAMETER, *PWEBAUTHN_COSE_CREDENTIAL_PARAMETER;
typedef const WEBAUTHN_COSE_CREDENTIAL_PARAMETER *PCWEBAUTHN_COSE_CREDENTIAL_PARAMETER;

typedef struct _WEBAUTHN_COSE_CREDENTIAL_PARAMETERS {
    DWORD cCredentialParameters;
    _Field_size_(cCredentialParameters)
    PWEBAUTHN_COSE_CREDENTIAL_PARAMETER pCredentialParameters;
} WEBAUTHN_COSE_CREDENTIAL_PARAMETERS, *PWEBAUTHN_COSE_CREDENTIAL_PARAMETERS;
typedef const WEBAUTHN_COSE_CREDENTIAL_PARAMETERS *PCWEBAUTHN_COSE_CREDENTIAL_PARAMETERS;

//+------------------------------------------------------------------------------------------
// Information about credential.
//-------------------------------------------------------------------------------------------
#define WEBAUTHN_CREDENTIAL_CURRENT_VERSION                         1

typedef struct _WEBAUTHN_CREDENTIAL {
    // Version of this structure, to allow for modifications in the future.
    DWORD dwVersion;

    // Size of pbID.
    DWORD cbId;
    // Unique ID for this particular credential.
    _Field_size_bytes_(cbId)
    PBYTE pbId;

    // Well-known credential type specifying what this particular credential is.
    LPCWSTR pwszCredentialType;
} WEBAUTHN_CREDENTIAL, *PWEBAUTHN_CREDENTIAL;
typedef const WEBAUTHN_CREDENTIAL *PCWEBAUTHN_CREDENTIAL;

typedef struct _WEBAUTHN_CREDENTIALS {
    DWORD cCredentials;
    _Field_size_(cCredentials)
    PWEBAUTHN_CREDENTIAL pCredentials;
} WEBAUTHN_CREDENTIALS, *PWEBAUTHN_CREDENTIALS;
typedef const WEBAUTHN_CREDENTIALS *PCWEBAUTHN_CREDENTIALS;

//+------------------------------------------------------------------------------------------
// Information about credential with extra information, such as, dwTransports
//-------------------------------------------------------------------------------------------

#define WEBAUTHN_CTAP_TRANSPORT_USB         0x00000001
#define WEBAUTHN_CTAP_TRANSPORT_NFC         0x00000002
#define WEBAUTHN_CTAP_TRANSPORT_BLE         0x00000004
#define WEBAUTHN_CTAP_TRANSPORT_TEST        0x00000008
#define WEBAUTHN_CTAP_TRANSPORT_INTERNAL    0x00000010
#define WEBAUTHN_CTAP_TRANSPORT_FLAGS_MASK  0x0000001F

#define WEBAUTHN_CREDENTIAL_EX_CURRENT_VERSION                         1

typedef struct _WEBAUTHN_CREDENTIAL_EX {
    // Version of this structure, to allow for modifications in the future.
    DWORD dwVersion;

    // Size of pbID.
    DWORD cbId;
    // Unique ID for this particular credential.
    _Field_size_bytes_(cbId)
    PBYTE pbId;

    // Well-known credential type specifying what this particular credential is.
    LPCWSTR pwszCredentialType;

    // Transports. 0 implies no transport restrictions.
    DWORD dwTransports;
} WEBAUTHN_CREDENTIAL_EX, *PWEBAUTHN_CREDENTIAL_EX;
typedef const WEBAUTHN_CREDENTIAL_EX *PCWEBAUTHN_CREDENTIAL_EX;

//+------------------------------------------------------------------------------------------
// Information about credential list with extra information
//-------------------------------------------------------------------------------------------

typedef struct _WEBAUTHN_CREDENTIAL_LIST {
    DWORD cCredentials;
    _Field_size_(cCredentials)
    PWEBAUTHN_CREDENTIAL_EX *ppCredentials;
} WEBAUTHN_CREDENTIAL_LIST, *PWEBAUTHN_CREDENTIAL_LIST;
typedef const WEBAUTHN_CREDENTIAL_LIST *PCWEBAUTHN_CREDENTIAL_LIST;

//+------------------------------------------------------------------------------------------
// Hmac-Secret extension
//-------------------------------------------------------------------------------------------

#define WEBAUTHN_EXTENSIONS_IDENTIFIER_HMAC_SECRET                  L"hmac-secret"
// Below type definitions is for WEBAUTHN_EXTENSIONS_IDENTIFIER_HMAC_SECRET
// MakeCredential Input Type:   BOOL.
//      - pvExtension must point to a BOOL with the value TRUE.
//      - cbExtension must contain the sizeof(BOOL).
// MakeCredential Output Type:  BOOL.
//      - pvExtension will point to a BOOL with the value TRUE if credential
//        was successfully created with HMAC_SECRET.
//      - cbExtension will contain the sizeof(BOOL).
// GetAssertion Input Type:     Not Supported
// GetAssertion Output Type:    Not Supported

//+------------------------------------------------------------------------------------------
//  credProtect  extension
//-------------------------------------------------------------------------------------------

#define WEBAUTHN_USER_VERIFICATION_ANY 0
#define WEBAUTHN_USER_VERIFICATION_OPTIONAL 1
#define WEBAUTHN_USER_VERIFICATION_OPTIONAL_WITH_CREDENTIAL_ID_LIST 2
#define WEBAUTHN_USER_VERIFICATION_REQUIRED 3

typedef struct _WEBAUTHN_CRED_PROTECT_EXTENSION_IN {
  // One of the above WEBAUTHN_USER_VERIFICATION_* values
  DWORD dwCredProtect;
  // Set the following to TRUE to require authenticator support for the
  // credProtect extension
  BOOL bRequireCredProtect;
} WEBAUTHN_CRED_PROTECT_EXTENSION_IN, *PWEBAUTHN_CRED_PROTECT_EXTENSION_IN;
typedef const WEBAUTHN_CRED_PROTECT_EXTENSION_IN*
    PCWEBAUTHN_CRED_PROTECT_EXTENSION_IN;

#define WEBAUTHN_EXTENSIONS_IDENTIFIER_CRED_PROTECT L"credProtect"
// Below type definitions is for WEBAUTHN_EXTENSIONS_IDENTIFIER_CRED_PROTECT
// MakeCredential Input Type:   WEBAUTHN_CRED_PROTECT_EXTENSION_IN.
//      - pvExtension must point to a WEBAUTHN_CRED_PROTECT_EXTENSION_IN struct
//      - cbExtension will contain the
//      sizeof(WEBAUTHN_CRED_PROTECT_EXTENSION_IN).
// MakeCredential Output Type:  DWORD.
//      - pvExtension will point to a DWORD with one of the above
//      WEBAUTHN_USER_VERIFICATION_* values
//        if credential was successfully created with CRED_PROTECT.
//      - cbExtension will contain the sizeof(DWORD).
// GetAssertion Input Type:     Not Supported
// GetAssertion Output Type:    Not Supported

//+------------------------------------------------------------------------------------------
//  credBlob  extension
//-------------------------------------------------------------------------------------------

typedef struct _WEBAUTHN_CRED_BLOB_EXTENSION {
  // Size of pbCredBlob.
  DWORD cbCredBlob;
  _Field_size_bytes_(cbCredBlob) PBYTE pbCredBlob;
} WEBAUTHN_CRED_BLOB_EXTENSION, *PWEBAUTHN_CRED_BLOB_EXTENSION;
typedef const WEBAUTHN_CRED_BLOB_EXTENSION* PCWEBAUTHN_CRED_BLOB_EXTENSION;

#define WEBAUTHN_EXTENSIONS_IDENTIFIER_CRED_BLOB L"credBlob"
// Below type definitions is for WEBAUTHN_EXTENSIONS_IDENTIFIER_CRED_BLOB
// MakeCredential Input Type:   WEBAUTHN_CRED_BLOB_EXTENSION.
//      - pvExtension must point to a WEBAUTHN_CRED_BLOB_EXTENSION struct
//      - cbExtension must contain the sizeof(WEBAUTHN_CRED_BLOB_EXTENSION).
// MakeCredential Output Type:  BOOL.
//      - pvExtension will point to a BOOL with the value TRUE if credBlob was
//      successfully created
//      - cbExtension will contain the sizeof(BOOL).
// GetAssertion Input Type:     BOOL.
//      - pvExtension must point to a BOOL with the value TRUE to request the
//      credBlob.
//      - cbExtension must contain the sizeof(BOOL).
// GetAssertion Output Type:    WEBAUTHN_CRED_BLOB_EXTENSION.
//      - pvExtension will point to a WEBAUTHN_CRED_BLOB_EXTENSION struct if the
//      authenticator
//        returns the credBlob in the signed extensions
//      - cbExtension will contain the sizeof(WEBAUTHN_CRED_BLOB_EXTENSION).

//+------------------------------------------------------------------------------------------
//  minPinLength  extension
//-------------------------------------------------------------------------------------------

#define WEBAUTHN_EXTENSIONS_IDENTIFIER_MIN_PIN_LENGTH L"minPinLength"
// Below type definitions is for WEBAUTHN_EXTENSIONS_IDENTIFIER_MIN_PIN_LENGTH
// MakeCredential Input Type:   BOOL.
//      - pvExtension must point to a BOOL with the value TRUE to request the
//      minPinLength.
//      - cbExtension must contain the sizeof(BOOL).
// MakeCredential Output Type:  DWORD.
//      - pvExtension will point to a DWORD with the minimum pin length if
//      returned by the authenticator
//      - cbExtension will contain the sizeof(DWORD).
// GetAssertion Input Type:     Not Supported
// GetAssertion Output Type:    Not Supported

//+------------------------------------------------------------------------------------------
// Information about Extensions.
//-------------------------------------------------------------------------------------------
typedef struct _WEBAUTHN_EXTENSION {
    LPCWSTR pwszExtensionIdentifier;
    DWORD cbExtension;
    PVOID pvExtension;
} WEBAUTHN_EXTENSION, *PWEBAUTHN_EXTENSION;
typedef const WEBAUTHN_EXTENSION *PCWEBAUTHN_EXTENSION;

typedef struct _WEBAUTHN_EXTENSIONS {
    DWORD cExtensions;
    _Field_size_(cExtensions)
    PWEBAUTHN_EXTENSION pExtensions;
} WEBAUTHN_EXTENSIONS, *PWEBAUTHN_EXTENSIONS;
typedef const WEBAUTHN_EXTENSIONS *PCWEBAUTHN_EXTENSIONS;

//+------------------------------------------------------------------------------------------
// Options.
//-------------------------------------------------------------------------------------------

#define WEBAUTHN_AUTHENTICATOR_ATTACHMENT_ANY                               0
#define WEBAUTHN_AUTHENTICATOR_ATTACHMENT_PLATFORM                          1
#define WEBAUTHN_AUTHENTICATOR_ATTACHMENT_CROSS_PLATFORM                    2
#define WEBAUTHN_AUTHENTICATOR_ATTACHMENT_CROSS_PLATFORM_U2F_V2             3

#define WEBAUTHN_USER_VERIFICATION_REQUIREMENT_ANY                          0
#define WEBAUTHN_USER_VERIFICATION_REQUIREMENT_REQUIRED                     1
#define WEBAUTHN_USER_VERIFICATION_REQUIREMENT_PREFERRED                    2
#define WEBAUTHN_USER_VERIFICATION_REQUIREMENT_DISCOURAGED                  3

#define WEBAUTHN_ATTESTATION_CONVEYANCE_PREFERENCE_ANY                      0
#define WEBAUTHN_ATTESTATION_CONVEYANCE_PREFERENCE_NONE                     1
#define WEBAUTHN_ATTESTATION_CONVEYANCE_PREFERENCE_INDIRECT                 2
#define WEBAUTHN_ATTESTATION_CONVEYANCE_PREFERENCE_DIRECT                   3

#define WEBAUTHN_ENTERPRISE_ATTESTATION_NONE 0
#define WEBAUTHN_ENTERPRISE_ATTESTATION_VENDOR_FACILITATED 1
#define WEBAUTHN_ENTERPRISE_ATTESTATION_PLATFORM_MANAGED 2

#define WEBAUTHN_LARGE_BLOB_SUPPORT_NONE 0
#define WEBAUTHN_LARGE_BLOB_SUPPORT_REQUIRED 1
#define WEBAUTHN_LARGE_BLOB_SUPPORT_PREFERRED 2

#define WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS_VERSION_1            1
#define WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS_VERSION_2            2
#define WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS_VERSION_3            3
#define WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS_VERSION_4 4
#define WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS_CURRENT_VERSION \
  WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS_VERSION_4

typedef struct _WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS {
    // Version of this structure, to allow for modifications in the future.
    DWORD dwVersion;

    // Time that the operation is expected to complete within.
    // This is used as guidance, and can be overridden by the platform.
    DWORD dwTimeoutMilliseconds;

    // Credentials used for exclusion.
    WEBAUTHN_CREDENTIALS CredentialList;

    // Optional extensions to parse when performing the operation.
    WEBAUTHN_EXTENSIONS Extensions;

    // Optional. Platform vs Cross-Platform Authenticators.
    DWORD dwAuthenticatorAttachment;

    // Optional. Require key to be resident or not. Defaulting to FALSE.
    BOOL bRequireResidentKey;

    // User Verification Requirement.
    DWORD dwUserVerificationRequirement;

    // Attestation Conveyance Preference.
    DWORD dwAttestationConveyancePreference;

    // Reserved for future Use
    DWORD dwFlags;

    //
    // The following fields have been added in WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS_VERSION_2
    //

    // Cancellation Id - Optional - See WebAuthNGetCancellationId
    GUID *pCancellationId;

    //
    // The following fields have been added in WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS_VERSION_3
    //

    // Exclude Credential List. If present, "CredentialList" will be ignored.
    PWEBAUTHN_CREDENTIAL_LIST pExcludeCredentialList;

    //
    // The following fields have been added in
    // WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS_VERSION_4
    //

    // Enterprise Attestation
    DWORD dwEnterpriseAttestation;

    // Large Blob Support: none, required or preferred
    //
    // NTE_INVALID_PARAMETER when large blob required or preferred and
    //   both bRequireResidentKey and bPreferResidentKey are set to FALSE.
    DWORD dwLargeBlobSupport;

    // Optional. Prefer key to be resident. Defaulting to FALSE. When TRUE,
    // overrides the above bRequireResidentKey.
    BOOL bPreferResidentKey;

} WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS, *PWEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS;
typedef const WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS *PCWEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS;

#define WEBAUTHN_CRED_LARGE_BLOB_OPERATION_NONE 0
#define WEBAUTHN_CRED_LARGE_BLOB_OPERATION_GET 1
#define WEBAUTHN_CRED_LARGE_BLOB_OPERATION_SET 2
#define WEBAUTHN_CRED_LARGE_BLOB_OPERATION_DELETE 3

#define WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS_VERSION_1          1
#define WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS_VERSION_2          2
#define WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS_VERSION_3          3
#define WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS_VERSION_4          4
#define WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS_VERSION_5 5
#define WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS_CURRENT_VERSION \
  WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS_VERSION_5

typedef struct _WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS {
    // Version of this structure, to allow for modifications in the future.
    DWORD dwVersion;

    // Time that the operation is expected to complete within.
    // This is used as guidance, and can be overridden by the platform.
    DWORD dwTimeoutMilliseconds;

    // Allowed Credentials List.
    WEBAUTHN_CREDENTIALS CredentialList;

    // Optional extensions to parse when performing the operation.
    WEBAUTHN_EXTENSIONS Extensions;

    // Optional. Platform vs Cross-Platform Authenticators.
    DWORD dwAuthenticatorAttachment;

    // User Verification Requirement.
    DWORD dwUserVerificationRequirement;

    // Reserved for future Use
    DWORD dwFlags;

    //
    // The following fields have been added in WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS_VERSION_2
    //

    // Optional identifier for the U2F AppId. Converted to UTF8 before being hashed. Not lower cased.
    PCWSTR pwszU2fAppId;

    // If the following is non-NULL, then, set to TRUE if the above pwszU2fAppid was used instead of
    // PCWSTR pwszRpId;
    BOOL *pbU2fAppId;

    //
    // The following fields have been added in WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS_VERSION_3
    //

    // Cancellation Id - Optional - See WebAuthNGetCancellationId
    GUID *pCancellationId;

    //
    // The following fields have been added in WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS_VERSION_4
    //

    // Allow Credential List. If present, "CredentialList" will be ignored.
    PWEBAUTHN_CREDENTIAL_LIST pAllowCredentialList;

    //
    // The following fields have been added in
    // WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS_VERSION_5
    //

    DWORD dwCredLargeBlobOperation;

    // Size of pbCredLargeBlob
    DWORD cbCredLargeBlob;
    _Field_size_bytes_(cbCredLargeBlob) PBYTE pbCredLargeBlob;
} WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS,  *PWEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS;
typedef const WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS  *PCWEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS;

//+------------------------------------------------------------------------------------------
// Attestation Info.
//
//-------------------------------------------------------------------------------------------
#define WEBAUTHN_ATTESTATION_DECODE_NONE                                0
#define WEBAUTHN_ATTESTATION_DECODE_COMMON                              1
// WEBAUTHN_ATTESTATION_DECODE_COMMON supports format types
//  L"packed"
//  L"fido-u2f"

#define WEBAUTHN_ATTESTATION_VER_TPM_2_0   L"2.0"

typedef struct _WEBAUTHN_X5C {
    // Length of X.509 encoded certificate
    DWORD cbData;
    // X.509 encoded certificate bytes
    _Field_size_bytes_(cbData)
    PBYTE pbData;
} WEBAUTHN_X5C, *PWEBAUTHN_X5C;

// Supports either Self or Full Basic Attestation

// Note, new fields will be added to the following data structure to
// support additional attestation format types, such as, TPM.
// When fields are added, the dwVersion will be incremented.
//
// Therefore, your code must make the following check:
//  "if (dwVersion >= WEBAUTHN_COMMON_ATTESTATION_CURRENT_VERSION)"

#define WEBAUTHN_COMMON_ATTESTATION_CURRENT_VERSION                     1

typedef struct _WEBAUTHN_COMMON_ATTESTATION {
    // Version of this structure, to allow for modifications in the future.
    DWORD dwVersion;

    // Hash and Padding Algorithm
    //
    // The following won't be set for "fido-u2f" which assumes "ES256".
    PCWSTR pwszAlg;
    LONG lAlg;      // COSE algorithm

    // Signature that was generated for this attestation.
    DWORD cbSignature;
    _Field_size_bytes_(cbSignature)
    PBYTE pbSignature;

    // Following is set for Full Basic Attestation. If not, set then, this is Self Attestation.
    // Array of X.509 DER encoded certificates. The first certificate is the signer, leaf certificate.
    DWORD cX5c;
    _Field_size_(cX5c)
    PWEBAUTHN_X5C pX5c;

    // Following are also set for tpm
    PCWSTR pwszVer; // L"2.0"
    DWORD cbCertInfo;
    _Field_size_bytes_(cbCertInfo)
    PBYTE pbCertInfo;
    DWORD cbPubArea;
    _Field_size_bytes_(cbPubArea)
    PBYTE pbPubArea;
} WEBAUTHN_COMMON_ATTESTATION, *PWEBAUTHN_COMMON_ATTESTATION;
typedef const WEBAUTHN_COMMON_ATTESTATION *PCWEBAUTHN_COMMON_ATTESTATION;

#define WEBAUTHN_ATTESTATION_TYPE_PACKED                                L"packed"
#define WEBAUTHN_ATTESTATION_TYPE_U2F                                   L"fido-u2f"
#define WEBAUTHN_ATTESTATION_TYPE_TPM                                   L"tpm"
#define WEBAUTHN_ATTESTATION_TYPE_NONE                                  L"none"

#define WEBAUTHN_CREDENTIAL_ATTESTATION_VERSION_1               1
#define WEBAUTHN_CREDENTIAL_ATTESTATION_VERSION_2               2
#define WEBAUTHN_CREDENTIAL_ATTESTATION_VERSION_3               3
#define WEBAUTHN_CREDENTIAL_ATTESTATION_VERSION_4 4
#define WEBAUTHN_CREDENTIAL_ATTESTATION_CURRENT_VERSION \
  WEBAUTHN_CREDENTIAL_ATTESTATION_VERSION_4

typedef struct _WEBAUTHN_CREDENTIAL_ATTESTATION {
    // Version of this structure, to allow for modifications in the future.
    DWORD dwVersion;

    // Attestation format type
    PCWSTR pwszFormatType;

    // Size of cbAuthenticatorData.
    DWORD cbAuthenticatorData;
    // Authenticator data that was created for this credential.
    _Field_size_bytes_(cbAuthenticatorData)
    PBYTE pbAuthenticatorData;

    // Size of CBOR encoded attestation information
    //0 => encoded as CBOR null value.
    DWORD cbAttestation;
    //Encoded CBOR attestation information
    _Field_size_bytes_(cbAttestation)
    PBYTE pbAttestation;

    DWORD dwAttestationDecodeType;
    // Following depends on the dwAttestationDecodeType
    //  WEBAUTHN_ATTESTATION_DECODE_NONE
    //      NULL - not able to decode the CBOR attestation information
    //  WEBAUTHN_ATTESTATION_DECODE_COMMON
    //      PWEBAUTHN_COMMON_ATTESTATION;
    PVOID pvAttestationDecode;

    // The CBOR encoded Attestation Object to be returned to the RP.
    DWORD cbAttestationObject;
    _Field_size_bytes_(cbAttestationObject)
    PBYTE pbAttestationObject;

    // The CredentialId bytes extracted from the Authenticator Data.
    // Used by Edge to return to the RP.
    DWORD cbCredentialId;
    _Field_size_bytes_(cbCredentialId)
    PBYTE pbCredentialId;

    //
    // Following fields have been added in WEBAUTHN_CREDENTIAL_ATTESTATION_VERSION_2
    //

    WEBAUTHN_EXTENSIONS Extensions;

    //
    // Following fields have been added in WEBAUTHN_CREDENTIAL_ATTESTATION_VERSION_3
    //

    // One of the WEBAUTHN_CTAP_TRANSPORT_* bits will be set corresponding to
    // the transport that was used.
    DWORD dwUsedTransport;

    //
    // Following fields have been added in
    // WEBAUTHN_CREDENTIAL_ATTESTATION_VERSION_4
    //

    BOOL bEpAtt;
    BOOL bLargeBlobSupported;
    BOOL bResidentKey;

} WEBAUTHN_CREDENTIAL_ATTESTATION, *PWEBAUTHN_CREDENTIAL_ATTESTATION;
typedef const WEBAUTHN_CREDENTIAL_ATTESTATION *PCWEBAUTHN_CREDENTIAL_ATTESTATION;

//+------------------------------------------------------------------------------------------
// authenticatorGetAssertion output.
//-------------------------------------------------------------------------------------------

#define WEBAUTHN_CRED_LARGE_BLOB_STATUS_NONE 0
#define WEBAUTHN_CRED_LARGE_BLOB_STATUS_SUCCESS 1
#define WEBAUTHN_CRED_LARGE_BLOB_STATUS_NOT_SUPPORTED 2
#define WEBAUTHN_CRED_LARGE_BLOB_STATUS_INVALID_DATA 3
#define WEBAUTHN_CRED_LARGE_BLOB_STATUS_INVALID_PARAMETER 4
#define WEBAUTHN_CRED_LARGE_BLOB_STATUS_NOT_FOUND 5
#define WEBAUTHN_CRED_LARGE_BLOB_STATUS_MULTIPLE_CREDENTIALS 6
#define WEBAUTHN_CRED_LARGE_BLOB_STATUS_LACK_OF_SPACE 7
#define WEBAUTHN_CRED_LARGE_BLOB_STATUS_PLATFORM_ERROR 8
#define WEBAUTHN_CRED_LARGE_BLOB_STATUS_AUTHENTICATOR_ERROR 9

#define WEBAUTHN_ASSERTION_VERSION_1 1
#define WEBAUTHN_ASSERTION_VERSION_2 2
#define WEBAUTHN_ASSERTION_CURRENT_VERSION WEBAUTHN_ASSERTION_VERSION_2

typedef struct _WEBAUTHN_ASSERTION {
    // Version of this structure, to allow for modifications in the future.
    DWORD dwVersion;

    // Size of cbAuthenticatorData.
    DWORD cbAuthenticatorData;
    // Authenticator data that was created for this assertion.
    _Field_size_bytes_(cbAuthenticatorData)
    PBYTE pbAuthenticatorData;

    // Size of pbSignature.
    DWORD cbSignature;
    // Signature that was generated for this assertion.
    _Field_size_bytes_(cbSignature)
    PBYTE pbSignature;

    // Credential that was used for this assertion.
    WEBAUTHN_CREDENTIAL Credential;

    // Size of User Id
    DWORD cbUserId;
    // UserId
    _Field_size_bytes_(cbUserId)
    PBYTE pbUserId;

    //
    // Following fields have been added in WEBAUTHN_ASSERTION_VERSION_2
    //

    WEBAUTHN_EXTENSIONS Extensions;

    // Size of pbCredLargeBlob
    DWORD cbCredLargeBlob;
    _Field_size_bytes_(cbCredLargeBlob) PBYTE pbCredLargeBlob;

    DWORD dwCredLargeBlobStatus;

} WEBAUTHN_ASSERTION, *PWEBAUTHN_ASSERTION;
typedef const WEBAUTHN_ASSERTION *PCWEBAUTHN_ASSERTION;

//+------------------------------------------------------------------------------------------
// APIs.
//-------------------------------------------------------------------------------------------

DWORD
WINAPI
WebAuthNGetApiVersionNumber();

HRESULT
WINAPI
WebAuthNIsUserVerifyingPlatformAuthenticatorAvailable(
    _Out_ BOOL *pbIsUserVerifyingPlatformAuthenticatorAvailable);

HRESULT
WINAPI
WebAuthNAuthenticatorMakeCredential(
    _In_        HWND                                                hWnd,
    _In_        PCWEBAUTHN_RP_ENTITY_INFORMATION                    pRpInformation,
    _In_        PCWEBAUTHN_USER_ENTITY_INFORMATION                  pUserInformation,
    _In_        PCWEBAUTHN_COSE_CREDENTIAL_PARAMETERS               pPubKeyCredParams,
    _In_        PCWEBAUTHN_CLIENT_DATA                              pWebAuthNClientData,
    _In_opt_    PCWEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS    pWebAuthNMakeCredentialOptions,
    _Outptr_result_maybenull_ PWEBAUTHN_CREDENTIAL_ATTESTATION      *ppWebAuthNCredentialAttestation);

HRESULT
WINAPI
WebAuthNAuthenticatorGetAssertion(
    _In_        HWND                                                hWnd,
    _In_        LPCWSTR                                             pwszRpId,
    _In_        PCWEBAUTHN_CLIENT_DATA                              pWebAuthNClientData,
    _In_opt_    PCWEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS      pWebAuthNGetAssertionOptions,
    _Outptr_result_maybenull_ PWEBAUTHN_ASSERTION                   *ppWebAuthNAssertion);

void
WINAPI
WebAuthNFreeCredentialAttestation(
    _In_opt_ PWEBAUTHN_CREDENTIAL_ATTESTATION pWebAuthNCredentialAttestation);

void
WINAPI
WebAuthNFreeAssertion(
    _In_ PWEBAUTHN_ASSERTION pWebAuthNAssertion);

HRESULT
WINAPI
WebAuthNGetCancellationId(
    _Out_ GUID* pCancellationId);

HRESULT
WINAPI
WebAuthNCancelCurrentOperation(
    _In_ const GUID* pCancellationId);

//
// Returns the following Error Names:
//  L"Success"              - S_OK
//  L"InvalidStateError"    - NTE_EXISTS
//  L"ConstraintError"      - HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED),
//                            NTE_NOT_SUPPORTED,
//                            NTE_TOKEN_KEYSET_STORAGE_FULL
//  L"NotSupportedError"    - NTE_INVALID_PARAMETER
//  L"NotAllowedError"      - NTE_DEVICE_NOT_FOUND,
//                            NTE_NOT_FOUND,
//                            HRESULT_FROM_WIN32(ERROR_CANCELLED),
//                            NTE_USER_CANCELLED,
//                            HRESULT_FROM_WIN32(ERROR_TIMEOUT)
//  L"UnknownError"         - All other hr values
//
PCWSTR
WINAPI
WebAuthNGetErrorName(
    _In_ HRESULT hr);

HRESULT
WINAPI
WebAuthNGetW3CExceptionDOMError(
    _In_ HRESULT hr);

#ifdef __cplusplus
}       // Balance extern "C" above
#endif

#endif // WINAPI_FAMILY_PARTITION
#pragma endregion

#endif  // __WEBAUTHN_H_


text:
module SeriousErrors
  #
  # Return full error messages
  #
  # @return [Array<String>] error messages
  #
  def seriously_all_of_the_errors
    errors.full_messages
  end
end

redpajama_set_name: RedPajamaGithub


text:
package io.wcm.devops.conga.plugins.aem.it.aem65.components;

import static io.wcm.handler.media.MediaNameConstants.PROP_CSS_CLASS;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import javax.annotation.PostConstruct;

import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.models.annotations.Model;
import org.apache.sling.models.annotations.injectorspecific.Self;

import io.wcm.handler.media.Media;
import io.wcm.handler.media.MediaHandler;

/**
 * Model for the custom carousel component.
 * <p>
 * Please note: There is already is a pre-built "Carousel" Core Component which does basically the same
 * as this component with a much more sophisticated edit mode support. Use it, instead of this demo component!
 * This demo component is only an example for a custom standalone component.
 * </p>
 */
@Model(adaptables = SlingHttpServletRequest.class)
public class CustomCarousel {

  static final String NN_SLIDES = "slides";

  private String id;
  private List<Media> slideImages;

  @Self
  private SlingHttpServletRequest request;
  @Self
  private MediaHandler mediaHandler;

  @PostConstruct
  private void activate() {
    id = buildId();
    slideImages = buildSlideImages();
  }

  private String buildId() {
    // build unique id from component path.
    return "customcarousel-" + request.getResource().getPath().hashCode();
  }

  private List<Media> buildSlideImages() {
    List<Media> images = new ArrayList<>();

    // get configured media references and convert them to image urls
    Resource slides = request.getResource().getChild(NN_SLIDES);
    if (slides != null) {
      for (Resource slide : slides.getChildren()) {
        Media img = mediaHandler.get(slide)
            .property(PROP_CSS_CLASS, "d-block w-100")
            .build();
        if (img.isValid()) {
          images.add(img);
        }
      }
    }

    return images;
  }

  /**
   * @return Unique ID of this component that can be used in HTML markup
   */
  public String getId() {
    return id;
  }

  /**
   * @return List of images for each slide
   */
  public List<Media> getSlideImages() {
    return Collections.unmodifiableList(this.slideImages);
  }

}


text:
package com.common.android.utils.extensions;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Locale;
import java.util.TimeZone;
import java.util.concurrent.TimeUnit;

/**
 * Created by Jan Rabe on 24/09/15.
 */
final public class DateExtensions {

    private DateExtensions() throws IllegalAccessException {
        throw new IllegalAccessException();
    }

    /**
     * Format dd.MM.yy hh:mm e.g.: 24.09.15 12:26
     */
    @Nullable
    public static Date parseDate(final String date) {
        final DateFormat df = new SimpleDateFormat("dd.MM.yy hh:mm");
        Date result = null;
        try {
            result = df.parse(date);
        } catch (final ParseException e) {
            e.printStackTrace();
        }
        return result;
    }

    @NonNull
    public static String parseDateInHoursMinutesDay(final Date date) {
        final DateFormat hours = new SimpleDateFormat("hh:mm");
        final DateFormat day = new SimpleDateFormat("dd.MM.yy");
        return hours.format(date) + " am " + day.format(date);
    }

    public static long getTimeZoneOffset() {
        return getTimeZoneOffset(Locale.getDefault());
    }

    public static long getTimeZoneOffset(Locale locale) {
        Calendar calendar = new GregorianCalendar(locale);
        TimeZone timeZone = calendar.getTimeZone();
        int GMTOffset = timeZone.getOffset(new Date().getTime());
        return TimeUnit.MINUTES.convert(GMTOffset, TimeUnit.MILLISECONDS);
    }

    public static boolean usesDayLightSaving() {
        return TimeZone.getDefault().inDaylightTime(new Date());
    }
}


text:
from django.apps import AppConfig

class MylistConfig(AppConfig):
    name = 'mylist'


text:
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace Panopticon
{
    public class RemoteCommand
    {
        internal Dictionary<string, object> Command { get; private set; }

        public enum CommandTypes
        {
            StartVirtualTerm,
        }

        private RemoteCommand(CommandTypes commandType)
        {
            Command = new Dictionary<string, object>();

            var caller = new Dictionary<string, object>();
            caller["Assembly"] = System.Reflection.Assembly.GetEntryAssembly().FullName;
            caller["Version"] = System.Reflection.Assembly.GetEntryAssembly().ImageRuntimeVersion;

            Command["Caller"] = caller;
            Command["Command"] = commandType.ToString();
        }

        public static RemoteCommand StartVirtualTerm_Command(string command, int width = 80, int height = 24, Eternal eternal=null)
        {
            var value = new RemoteCommand(CommandTypes.StartVirtualTerm);

            var parameters = new Dictionary<string, object>();
            parameters["Width"] = width;
            parameters["Height"] = height;
            parameters["Command"] = command;
            parameters["GUID"] = Guid.NewGuid().ToString();  // Give command a handle

            if (eternal != null)
                value.Command["Eternal"] = eternal.ToJSON();

            value.Command["Parameters"] = parameters;

            return value;
        }

        public string ToJSON()
        {
            var serializer = new JsonSerializer();

            var sb = new StringBuilder();
            using (var sw = new StringWriter(sb))
            using (var writer = new JsonTextWriter(sw))
            {
                serializer.Serialize(writer, Command);
            }

            return sb.ToString();
        }
    }

    public class Eternal
    {
        public bool RestartOnBoot { get; set; }
        public bool RestartOnExit { get; set; }

        internal Dictionary<string, object> Values { get; private set; }

        public string ToJSON()
        {
            var serializer = new JsonSerializer();

            var sb = new StringBuilder();
            using (var sw = new StringWriter(sb))
            using (var writer = new JsonTextWriter(sw))
            {
                serializer.Serialize(writer, Values);
            }

            return sb.ToString();
        }
    }
}


text:
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2019 Intel Corporation. All Rights Reserved.

#include "fw-update-device.h"
#include "../types.h"
#include "../context.h"
#include "../ds5/ds5-private.h"

#include <chrono>
#include <stdexcept>
#include <algorithm>
#include <thread>

#define DEFAULT_TIMEOUT 100
#define FW_UPDATE_INTERFACE_NUMBER 0
namespace librealsense
{
    std::string get_formatted_fw_version(uint32_t fw_last_version)
    {
        uint8_t* ptr = (uint8_t*)(&fw_last_version);
        std::vector<uint8_t> buffer(ptr, ptr + sizeof(fw_last_version));
        std::stringstream fw_version;
        std::string delimiter = "";
        for (auto i = 1; i <= buffer.size(); i++)
        {
            fw_version << delimiter << static_cast<int>(buffer[buffer.size() - i]);
            delimiter = ".";
        }
        return fw_version.str();
    }

    rs2_dfu_state update_device::get_dfu_state(std::shared_ptr<platform::usb_messenger> messenger) const
    {
        uint8_t state = RS2_DFU_STATE_DFU_ERROR;
        uint32_t transferred = 0;
        auto res = messenger->control_transfer(0xa1 /*DFU_GETSTATUS_PACKET*/, RS2_DFU_GET_STATE, 0, 0, &state, 1, transferred, DEFAULT_TIMEOUT);
        if (res == librealsense::platform::RS2_USB_STATUS_ACCESS)
            throw backend_exception("Permission Denied!\n"
                "This is often an indication of outdated or missing udev-rules.\n"
                "If using Debian package, run sudo apt-get install librealsense2-dkms\n"
                "If building from source, run ./scripts/setup_udev_rules.sh",
                RS2_EXCEPTION_TYPE_BACKEND);
        return res == platform::RS2_USB_STATUS_SUCCESS ? (rs2_dfu_state)state : RS2_DFU_STATE_DFU_ERROR;
    }

    void update_device::detach(std::shared_ptr<platform::usb_messenger> messenger) const
    {
        auto timeout = 1000;
        uint32_t transferred = 0;
        auto res = messenger->control_transfer(0x21 /*DFU_DETACH_PACKET*/, RS2_DFU_DETACH, timeout, 0, NULL, 0, transferred, timeout);
        if (res != platform::RS2_USB_STATUS_SUCCESS)
            LOG_WARNING("DFU - failed to detach device");
    }

    void update_device::read_device_info(std::shared_ptr<platform::usb_messenger> messenger)
    {
        auto state = get_dfu_state(messenger);

        if (state != RS2_DFU_STATE_DFU_IDLE)
            throw std::runtime_error("DFU detach failed!");

        dfu_fw_status_payload payload;
        uint32_t transferred = 0;
        auto sts = messenger->control_transfer(0xa1, RS2_DFU_UPLOAD, 0, 0, reinterpret_cast<uint8_t*>(&payload), sizeof(payload), transferred, DEFAULT_TIMEOUT);
        if (sts != platform::RS2_USB_STATUS_SUCCESS)
            throw std::runtime_error("Failed to read info from DFU device!");

        _serial_number_buffer = std::vector<uint8_t>(sizeof(payload.serial_number));
        _serial_number_buffer.assign((uint8_t*)&payload.serial_number, (uint8_t*)&payload.serial_number + sizeof(payload.serial_number));
        _is_dfu_locked = payload.dfu_is_locked != 0;
        _highest_fw_version = get_formatted_fw_version(payload.fw_highest_version);
        _last_fw_version = get_formatted_fw_version(payload.fw_last_version);

        std::string lock_status = _is_dfu_locked ? "device is locked" : "device is unlocked";
        LOG_INFO("This device is in DFU mode, previously-installed firmware: " << _last_fw_version <<
            ", the highest firmware ever installed: " << _highest_fw_version);

        LOG_INFO("DFU status: " << lock_status << " , DFU version is: " << payload.dfu_version);
    }

    bool update_device::wait_for_state(std::shared_ptr<platform::usb_messenger> messenger, const rs2_dfu_state state, size_t timeout) const
    {
        std::chrono::milliseconds elapsed_milliseconds;
        auto start = std::chrono::system_clock::now();
        do {
            dfu_status_payload status;
            uint32_t transferred = 0;
            auto sts = messenger->control_transfer(0xa1 /*DFU_GETSTATUS_PACKET*/, RS2_DFU_GET_STATUS, 0, 0, (uint8_t*)&status, sizeof(status), transferred, 5000);

            if (sts != platform::RS2_USB_STATUS_SUCCESS)
                return false;

            if (status.is_in_state(state)) {
                return true;
            }

            //test for dfu error state
            if (status.is_error_state()) {
                return false;
            }

            // FW doesn't set the bwPollTimeout value, therefore it is wrong to use status.bwPollTimeout
            std::this_thread::sleep_for(std::chrono::milliseconds(DEFAULT_TIMEOUT));

            auto curr = std::chrono::system_clock::now();
            elapsed_milliseconds = std::chrono::duration_cast<std::chrono::milliseconds>(curr - start);
        } while (elapsed_milliseconds < std::chrono::milliseconds(timeout));

        return false;
    }

    update_device::update_device(const std::shared_ptr<context>& ctx, bool register_device_notifications, std::shared_ptr<platform::usb_device> usb_device)
        : _context(ctx), _usb_device(usb_device), _physical_port( usb_device->get_info().id), _pid(hexify(usb_device->get_info().pid))
    {
        if (auto messenger = _usb_device->open(FW_UPDATE_INTERFACE_NUMBER))
        {
            auto state = get_dfu_state(messenger);
            LOG_DEBUG("DFU state is: " << state);
            if (state != RS2_DFU_STATE_DFU_IDLE)
                detach(messenger);

            read_device_info(messenger);
        }
        else
        {
            std::stringstream s;
            s << "access failed for " << std::hex <<  _usb_device->get_info().vid << ":"
              <<_usb_device->get_info().pid << " uid: " <<  _usb_device->get_info().id << std::dec;
            LOG_ERROR(s.str().c_str());
            throw std::runtime_error(s.str().c_str());
        }
    }

    update_device::~update_device()
    {

    }

    void update_device::update(const void* fw_image, int fw_image_size, update_progress_callback_ptr update_progress_callback) const
    {
        // checking fw compatibility (covering the case of recovery device with wrong product line fw )
        std::vector<uint8_t> buffer((uint8_t*)fw_image, (uint8_t*)fw_image + fw_image_size);
        if (!check_fw_compatibility(buffer))
            throw librealsense::invalid_value_exception("Device: " + get_serial_number() + " failed to update firmware\nImage is unsupported for this device or corrupted");

        auto messenger = _usb_device->open(FW_UPDATE_INTERFACE_NUMBER);

        const size_t transfer_size = 1024;

        size_t remaining_bytes = fw_image_size;
        uint16_t blocks_count = uint16_t( fw_image_size / transfer_size );
        uint16_t block_number = 0;

        size_t offset = 0;
        uint32_t transferred = 0;
        int retries = 10;

        while (remaining_bytes > 0)
        {
            size_t chunk_size = std::min(transfer_size, remaining_bytes);

            auto curr_block = ((uint8_t*)fw_image + offset);
            auto sts = messenger->control_transfer(0x21 /*DFU_DOWNLOAD_PACKET*/, RS2_DFU_DOWNLOAD, block_number, 0, curr_block, uint32_t(chunk_size), transferred, 5000);
            if (sts != platform::RS2_USB_STATUS_SUCCESS || !wait_for_state(messenger, RS2_DFU_STATE_DFU_DOWNLOAD_IDLE, 1000))
            {
                auto state = get_dfu_state(messenger);
                // the update process may be interrupted by another thread that trys to create another fw_update_device.
                // this retry mechanism should overcome such scenario.
                // we limit the number of retries in order to avoid infinite loop.
                if (state == RS2_DFU_STATE_DFU_IDLE && retries--)
                    continue;

                auto sn = get_serial_number();
                if(_is_dfu_locked)
                    throw std::runtime_error("Device: " + sn  + " is locked for update.\nUse firmware version higher than: " + _highest_fw_version);
                else if (state == RS2_DFU_STATE_DFU_ERROR)
                    throw std::runtime_error("Device: " + sn + " failed to update firmware\nImage is unsupported for this device or corrupted");
                else
                    throw std::runtime_error("Device: " + sn + " failed to download firmware\nPlease verify that no other librealsense application is running");
            }

            block_number++;
            remaining_bytes -= chunk_size;
            offset += chunk_size;

            float progress = (float)block_number / (float)blocks_count;
            LOG_DEBUG("fw update progress: " << progress);
            if (update_progress_callback)
                update_progress_callback->on_update_progress(progress);
        }

        // After the final block of firmware has been sent to the device and the status solicited, the host sends a
        // DFU_DNLOAD request with the wLength field cleared to 0 and then solicits the status again.If the
        // result indicates that the device is ready and there are no errors, then the Transfer phase is complete and
        // the Manifestation phase begins.
        auto sts = messenger->control_transfer(0x21 /*DFU_DOWNLOAD_PACKET*/, RS2_DFU_DOWNLOAD, block_number, 0, NULL, 0, transferred, DEFAULT_TIMEOUT);
        if (sts != platform::RS2_USB_STATUS_SUCCESS)
            throw std::runtime_error("Failed to send final FW packet");

        // After the zero length DFU_DNLOAD request terminates the Transfer
        // phase, the device is ready to manifest the new firmware. As described
        // previously, some devices may accumulate the firmware image and perform
        // the entire reprogramming operation at one time. Others may have only a
        // small amount remaining to be reprogrammed, and still others may have
        // none. Regardless, the device enters the dfuMANIFEST-SYNC state and
        // awaits the solicitation of the status report by the host. Upon receipt
        // of the anticipated DFU_GETSTATUS, the device enters the dfuMANIFEST
        // state, where it completes its reprogramming operations.

        // WaitForDFU state sends several DFU_GETSTATUS requests, until we hit
        // either RS2_DFU_STATE_DFU_MANIFEST_WAIT_RESET or RS2_DFU_STATE_DFU_ERROR status.
        // This command also reset the device
        if (!wait_for_state(messenger, RS2_DFU_STATE_DFU_MANIFEST_WAIT_RESET, 20000))
            throw std::runtime_error("Firmware manifest failed");
    }

    sensor_interface& update_device::get_sensor(size_t i)
    {
        throw std::runtime_error("try to get sensor from fw loader device");
    }

    const sensor_interface& update_device::get_sensor(size_t i) const
    {
        throw std::runtime_error("update_device does not support get_sensor API");
    }

    size_t update_device::get_sensors_count() const
    {
        return 0;
    }

    void update_device::hardware_reset()
    {
        //TODO_MK
    }

    std::shared_ptr<matcher> update_device::create_matcher(const frame_holder& frame) const
    {
        return nullptr;
    }

    std::shared_ptr<context> update_device::get_context() const
    {
        return _context;
    }

    platform::backend_device_group update_device::get_device_data() const
    {
        throw std::runtime_error("update_device does not support get_device_data API");//TODO_MK
    }

    std::pair<uint32_t, rs2_extrinsics> update_device::get_extrinsics(const stream_interface& stream) const
    {
        throw std::runtime_error("update_device does not support get_extrinsics API");
    }

    bool update_device::is_valid() const
    {
        return true;
    }

    std::vector<tagged_profile> update_device::get_profiles_tags() const
    {
        return std::vector<tagged_profile>();
    }

    void update_device::tag_profiles(stream_profiles profiles) const
    {

    }

    bool update_device::compress_while_record() const
    {
        return false;
    }

    const std::string& update_device::get_info(rs2_camera_info info) const
    {
        switch (info)
        {
        case RS2_CAMERA_INFO_FIRMWARE_UPDATE_ID:    return get_serial_number();
        case RS2_CAMERA_INFO_NAME:                  return get_name();
        case RS2_CAMERA_INFO_PRODUCT_LINE:          return get_product_line();
        case RS2_CAMERA_INFO_PHYSICAL_PORT:         return _physical_port;
        case RS2_CAMERA_INFO_PRODUCT_ID:            return _pid;
        default:
            throw std::runtime_error("update_device does not support " + std::string(rs2_camera_info_to_string(info)));
        }
    }

    bool update_device::supports_info(rs2_camera_info info) const
    {
        switch (info)
        {
        case RS2_CAMERA_INFO_FIRMWARE_UPDATE_ID:
        case RS2_CAMERA_INFO_NAME:
        case RS2_CAMERA_INFO_PRODUCT_LINE:
        case RS2_CAMERA_INFO_PHYSICAL_PORT:
        case RS2_CAMERA_INFO_PRODUCT_ID:
            return true;

        default:
            return false;
        }
    }

    void update_device::create_snapshot(std::shared_ptr<info_interface>& snapshot) const
    {

    }
    void update_device::enable_recording(std::function<void(const info_interface&)> record_action)
    {

    }
}


text:
import * as Contracts from "./Contracts"
import * as Settings from "./Settings"
import { Value } from "./Model"

export var addition: Contracts.IArithmeticOperator = {
    name: "Addition",
    operatorHtml: "+",
    apply(operands: Value[], resultSettings: Settings.ResultSettings) {
        var result = operands.map(o => o.rawNumber).reduce((a, b) => a + b);
        return new Value(resultSettings.numberType, result);
    }
}

export var subtraction: Contracts.IArithmeticOperator = {
    name: "Subtraktion",
    operatorHtml: "-",
    apply(operands: Value[], resultSettings: Settings.ResultSettings) {
        var result = operands.map(o => o.rawNumber).reduce((a, b) => a - b);
        return new Value(resultSettings.numberType, result);
    }
}

export var multiplication: Contracts.IArithmeticOperator = {
    name: "Multiplikation",
    operatorHtml: "•",
    apply(operands: Value[], resultSettings: Settings.ResultSettings) {
        var result = operands.map(o => o.rawNumber).reduce((a, b) => a * b);
        return new Value(resultSettings.numberType, result);
    }
}

export var division: Contracts.IArithmeticOperator = {
    name: "Division",
    operatorHtml: ":",
    apply(operands: Value[], resultSettings: Settings.ResultSettings) {
        var result = operands.map(o => o.rawNumber).reduce((a, b) => a / b);
        return new Value(resultSettings.numberType, result);
    }
}


text:
<?php
  $secret = true;
  require_once("classloader.php");
 ?>
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Krzywogoniec domki całoroczne</title>

    <link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">

    <link href="vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href='https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
    <link href='https://fonts.googleapis.com/css?family=Merriweather:400,300,300italic,400italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
    <link href='https://fonts.googleapis.com/css?family=Roboto+Slab:400,700,300&subset=latin,latin-ext' rel='stylesheet' type='text/css'>

    <link href="vendor/magnific-popup/magnific-popup.css" rel="stylesheet">

    <link href="css/creative.min.css" rel="stylesheet">

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

              <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                  Toggle navigation Menu
              </button>

                      Home

                      Lokalizacja

                      Galeria

                      Okoliczne atrakcje

                      Wolne terminy

Krzywogoniec

                <hrX class="">

Wynajem całorocznych domków wypoczynkowych

w Krajobrazowym Parku Narodowym

Borów Tucholskich

                <hrX class="">

Lokalizacja

Krzywogoniec to wieś grzybowa położona w województwie kujawsko-pomorskim, w powiecie tucholskim, w gminie Cekcyn, nad jeziorem Krzywogoniec.

Otaczające wieś lasy obfitują w runo leśne w postaci grzybów, jagód, żurawiny, poziomek oraz borówek.

We wsi znajdują się dwa sklepy czynne od rana do późnych godzin wieczornych, a nad jeziorem mieści się amfiteatr, zadaszone miejsce do grillowania, boisko do koszykówki, tenisa ziemnego oraz siatkówki plażowej.

Tutejsza, nowoczesna świetlica wiejska wyposażona jest w stanowiska komputerowe z dostępem do Internetu, stół do gry w ping-ponga, a na zewnątrz plac zabaw dla najmłodszych.

                                  kliknij, aby zobaczy całe zdjęcie

                                  Domki (widok z łąki)

                                  kliknij, aby zobaczy całe zdjęcie

                                  Domki (widok z drogi)

                                  kliknij, aby zobaczy całe zdjęcie

                                  Plaża nad jeziorem

                                    kliknij, aby zobaczy całe zdjęcie

                                    Aneks kuchenny

                                    kliknij, aby zobaczy całe zdjęcie

                                    Salon (widok z aneksu kuchennego)

                                    kliknij, aby zobaczy całe zdjęcie

                                    Salon (widok z tarasu)

                                    kliknij, aby zobaczy całe zdjęcie

                                    Łazienka

                                    kliknij, aby zobaczy całe zdjęcie

                                    Mały pokój na poddaszu

                                    kliknij, aby zobaczy całe zdjęcie

                                    Średni pokój na poddaszu

                                    kliknij, aby zobaczy całe zdjęcie

                                    Duży pokój na poddaszu z balkonem

                                    kliknij, aby zobaczy całe zdjęcie

                                    Boiska do siatkówki plażowej, koszykówki oraz kort tenisowy

                                    kliknij, aby zobaczy całe zdjęcie

                                    Amfiteatr

Okoliczne atrakcje

Cekcyn - wyp. sprzętu wodnego, minigolf, amfiteatr, gastronomia

Fojutowo - akwedukt, basen pływacki, gastronomia

Gołąbek - leśna ściezka dydaktyczna "Jelenia Wyspa"

Małe Gacno - ośrodek hipoterapii

Ostrowo - stadnina koni "QŃ"

Wierzchlas - Rezerwat Cisow Staropolskich

Woziwoda - spływy kajakowe po Brdzie, gastronomia

Wolne terminy

Domek nr 1

            <?php
              // require_once("vendor/kandev/calendar.php");
              // require_once("vendor/kandev/testneor.php");

              $loader = new JsonLoader('domek1.json');
              $domek1 = new Booking( $loader );
              $domek1->generateHTML();

             ?>

Domek nr 2

              <?php

                $loader = new JsonLoader('domek2.json');
                $domek2 = new Booking( $loader );
                $domek2->generateHTML();

               ?>

© 2016 www.krzywogoniec.pl Całoroczne domki do wynajęcia. Rezerwacja: 535 833 418

by krzysko


text:
require 'spec_helper'

describe Mocrata::Request do
  describe '#response' do
    it 'forms response' do
      request = Mocrata::Request.new(
        'https://data.sfgov.org/resource/funx-qxxn', :json)

      expect_any_instance_of(Mocrata::Response).to receive(
        :validate!).and_return(true)

      expect(request.send(:http)).to receive(:request).and_return(true)

      expect(request.response).to be_an_instance_of(Mocrata::Response)
    end
  end

  describe '#content_type' do
    it 'raises exception with null format' do
      request = Mocrata::Request.new(
        'https://data.sfgov.org/resource/funx-qxxn', nil)

      expect {
        request.content_type
      }.to raise_error(Mocrata::Request::RequestError)
    end

    it 'raises exception with invalid format' do
      request = Mocrata::Request.new(
        'https://data.sfgov.org/resource/funx-qxxn', :nope)

      expect {
        request.content_type
      }.to raise_error(Mocrata::Request::RequestError)
    end

    it 'returns valid content type' do
      request = Mocrata::Request.new(
        'https://data.sfgov.org/resource/funx-qxxn', :csv)

      expect(request.content_type).to eq('text/csv')
    end
  end

  describe '#http' do
    it 'uses ssl' do
      request = Mocrata::Request.new(
        'https://data.sfgov.org/resource/funx-qxxn', nil)

      expect(request.send(:http).use_ssl?).to be true
    end
  end

  describe '#soda_params' do
    describe 'with pagination' do
      it 'has default params' do
        request = Mocrata::Request.new('', nil, paginate: true)

        result = request.send(:soda_params)

        expect(result).to eq(:$limit => 1000, :$offset => 0)
      end

      it 'has custom params' do
        request = Mocrata::Request.new('', nil, paginate: true, page: 2)

        result = request.send(:soda_params)

        expect(result).to eq(:$limit => 1000, :$offset => 1000)
      end
    end

    describe 'without pagination' do
      it 'is empty by default' do
        request = Mocrata::Request.new('', nil)

        expect(request.send(:soda_params)).to eq({})
      end
    end

    it 'ignores unrecognized parameters' do
      request = Mocrata::Request.new('', nil, {}, foo: 'bar', top: 0)

      expect(request.send(:soda_params)).to eq(:$top => 0)
    end
  end

  describe '#pagination_params' do
    it 'is formed with default pagination options' do
      request = Mocrata::Request.new('', nil, paginate: true)

      result = request.send(:pagination_params)

      expect(result).to eq(:$limit => 1000, :$offset => 0)
    end

    it 'is formed with custom pagination options' do
      request = Mocrata::Request.new('', nil, page: 5, per_page: 100)

      result = request.send(:pagination_params)

      expect(result).to eq(:$limit => 100, :$offset => 400)
    end
  end

  describe '#paginate?' do
    it 'is false by default' do
      request = Mocrata::Request.new('', nil)

      expect(request.send(:paginate?)).to eq(false)
    end

    it 'allows override' do
      request = Mocrata::Request.new('', nil, paginate: true)

      expect(request.send(:paginate?)).to eq(true)
    end

    it 'is true if page option is present' do
      request = Mocrata::Request.new('', nil, page: 1)

      expect(request.send(:paginate?)).to eq(true)
    end

    it 'is true if per_page option is present' do
      request = Mocrata::Request.new('', nil, per_page: 1)

      expect(request.send(:paginate?)).to eq(true)
    end
  end

  describe '#response_options' do
    it 'is empty by default' do
      request = Mocrata::Request.new('', nil)

      expect(request.send(:response_options)).to eq({})
    end

    it 'filters request options' do
      request = Mocrata::Request.new('', nil, page: 1, preserve_header: true)

      expect(request.send(:response_options)).to eq(preserve_header: true)
    end
  end

  describe '#uri' do
    before :each do
      expect(Mocrata.config).to receive(:per_page).and_return(10)
    end

    it 'is formed with default parameters' do
      request = Mocrata::Request.new(
        'https://data.sfgov.org/resource/funx-qxxn', nil, paginate: true)

      result = request.send(:uri).to_s

      expect(result).to eq(
        'https://data.sfgov.org/resource/funx-qxxn?$limit=10&$offset=0')
    end

    it 'is formed with custom parameters' do
      request = Mocrata::Request.new(
        'https://data.sfgov.org/resource/funx-qxxn', nil,
        per_page: 5,
        page:     3,
        paginate: true)

      result = request.send(:uri).to_s

      expect(result).to eq(
        'https://data.sfgov.org/resource/funx-qxxn?$limit=5&$offset=10')
    end
  end

  describe '.query_string' do
    it 'forms empty query string' do
      expect(Mocrata::Request.query_string({})).to eq('')
    end

    it 'forms simple query string' do
      result = Mocrata::Request.query_string(foo: 'bar')
      expect(result).to eq('foo=bar')
    end

    it 'forms complex string' do
      result = Mocrata::Request.query_string(foo: 'bar', bar: 'baz')
      expect(result).to eq('foo=bar&bar=baz')
    end

    it 'escapes values' do
      result = Mocrata::Request.query_string(foo: '"\'Stop!\' said Fred"')

      expect(result).to eq('foo=%22%27Stop%21%27+said+Fred%22')
    end
  end
end


text:
using System;
using Esfa.Vacancy.Application.Commands.CreateApprenticeship;
using Esfa.Vacancy.Domain.Entities;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using Ploeh.AutoFixture;
using Ploeh.AutoFixture.AutoMoq;

namespace Esfa.Vacancy.UnitTests.CreateApprenticeship.Application.GivenACreateApprenticeshipParametersMapper
{
    [TestFixture]
    public class WhenMappingFromARequest
    {
        private EmployerInformation _employerInformation;
        private CreateApprenticeshipParameters _mappedParameters;
        private CreateApprenticeshipRequest _request;
        private int _randomWageType;
        private int _randomLegacyWageType;
        private DurationType _randomDurationType;
        private DomainDurationType _randomDomainDurationType;
        private Mock<IWageTypeMapper> _mockWageTypeMapper;
        private int _randomWageUnit;
        private Mock<IWageTextFormatter> _mockWageTextFormatter;

        [SetUp]
        public void SetUp()
        {
            var fixture = new Fixture().Customize(new AutoMoqCustomization());
            _randomWageType = fixture.Create<int>();
            _randomLegacyWageType = fixture.Create<int>();
            _randomWageUnit = fixture.Create<int>();

            _randomDurationType = (DurationType)new Random().Next(1, 4);
            var durationTypeMapper = new DurationMapper();
            _randomDomainDurationType = durationTypeMapper.MapTypeToDomainType(_randomDurationType);

            _request = fixture.Build<CreateApprenticeshipRequest>()
                .With(request => request.WageType, (WageType)_randomWageType)
                .With(request => request.WageUnit, (WageUnit)_randomWageUnit)
                .With(request => request.DurationType, _randomDurationType)
                .With(request => request.IsEmployerDisabilityConfident, fixture.Create<bool>())
                .Create();

            _mockWageTypeMapper = fixture.Freeze<Mock<IWageTypeMapper>>();
            _mockWageTypeMapper
                .Setup(typeMapper => typeMapper.MapToLegacy(It.IsAny<CreateApprenticeshipRequest>()))
                .Returns((LegacyWageType)_randomLegacyWageType);

            _mockWageTextFormatter = fixture.Freeze<Mock<IWageTextFormatter>>();

            fixture.Inject<IDurationMapper>(durationTypeMapper);

            _employerInformation = fixture.Create<EmployerInformation>();

            var mapper = fixture.Create<CreateApprenticeshipParametersMapper>();

            _mappedParameters = mapper.MapFromRequest(_request, _employerInformation);
        }

        [Test]
        public void ThenMapsTitle()
        {
            _mappedParameters.Title.Should().Be(_request.Title);
        }

        [Test]
        public void ThenMapsUserEmail()
        {
            _mappedParameters.HistoryUserName.Should().Be(_request.UserEmail);
        }

        [Test]
        public void ThenMapsShortDescription()
        {
            _mappedParameters.ShortDescription.Should().Be(_request.ShortDescription);
        }

        [Test]
        public void ThenMapsLongDescription()
        {
            _mappedParameters.Description.Should().Be(_request.LongDescription);
        }

        [Test]
        public void ThenMapsApplicationClosingDate()
        {
            _mappedParameters.ApplicationClosingDate.Should().Be(_request.ApplicationClosingDate.Date);
        }

        [Test]
        public void ThenMapsExpectedStartDate()
        {
            _mappedParameters.ExpectedStartDate.Should().Be(_request.ExpectedStartDate.Date);
        }

        [Test]
        public void ThenMapsDesiredSkills()
        {
            _mappedParameters.DesiredSkills.Should().Be(_request.DesiredSkills);
        }

        [Test]
        public void ThenMapsDesiredPersonalQualities()
        {
            _mappedParameters.DesiredPersonalQualities.Should().Be(_request.DesiredPersonalQualities);
        }

        [Test]
        public void ThenMapsDesiredQualifications()
        {
            _mappedParameters.DesiredQualifications.Should().Be(_request.DesiredQualifications);
        }

        [Test]
        public void ThenMapsFutureProspects()
        {
            _mappedParameters.FutureProspects.Should().Be(_request.FutureProspects);
        }

        [Test]
        public void ThenMapsThingsToConsider()
        {
            _mappedParameters.ThingsToConsider.Should().Be(_request.ThingsToConsider);
        }

        [Test]
        public void ThenMapsTrainingToBeProvided()
        {
            _mappedParameters.TrainingToBeProvided.Should().Be(_request.TrainingToBeProvided);
        }

        [Test]
        public void ThenAssignsValueFromDurationTypeMapper()
        {
            _mappedParameters.DurationTypeId.Should().Be((int)_randomDomainDurationType);
        }

        [Test]
        public void ThenMapsDurationValue()
        {
            _mappedParameters.DurationValue.Should().Be(_request.ExpectedDuration);
        }

        [Test]
        public void ThenMapsWorkingWeek()
        {
            _mappedParameters.WorkingWeek.Should().Be(_request.WorkingWeek);
        }

        [Test]
        public void ThenUsesWageTypeMapper()
        {
            _mockWageTypeMapper.Verify(
                mapper => mapper.MapToLegacy(
                    It.Is<CreateApprenticeshipRequest>(req => req.WageType == (WageType)_randomWageType)),
                    Times.Once);
        }

        [Test]
        public void ThenAssignsValueFromWageTypeMapper()
        {
            _mappedParameters.WageType.Should().Be(_randomLegacyWageType);
        }

        [Test]
        public void ThenMapsWageTypeReason()
        {
            _mappedParameters.WageTypeReason.Should().Be(_request.WageTypeReason);
        }

        [Test]
        public void ThenMapsWageUnit()
        {
            _mappedParameters.WageUnitId.Should().Be(_randomWageUnit);
        }

        [Test]
        public void ThenMapsMinWage()
        {
            _mappedParameters.WageLowerBound.Should().Be(_request.MinWage);
        }

        [Test]
        public void ThenMapsMaxWage()
        {
            _mappedParameters.WageUpperBound.Should().Be(_request.MaxWage);
        }

        [Test]
        public void ThenMapsWeeklyWage()
        {
            _mappedParameters.WeeklyWage.Should().Be(_request.FixedWage);
        }

        [Test]
        public void ThenMapsWageText()
        {
            _mockWageTextFormatter.Verify(mapper => mapper.GetWageText(It.IsAny<CreateApprenticeshipRequest>()),
                                          Times.Once);
        }

        [Test]
        public void ThenMapsNumberOfPositions()
        {
            _mappedParameters.NumberOfPositions.Should().Be(_request.NumberOfPositions);
        }

        [Test]
        public void ThenMapsVacancyOwnerRelationshipId()
        {
            _mappedParameters.VacancyOwnerRelationshipId
                .Should().Be(_employerInformation.VacancyOwnerRelationshipId);
        }

        [Test]
        public void ThenMapsProviderId()
        {
            _mappedParameters.ProviderId
                .Should().Be(_employerInformation.ProviderId);
        }

        [Test]
        public void ThenMapsProviderSiteId()
        {
            _mappedParameters.ProviderSiteId
                .Should().Be(_employerInformation.ProviderSiteId);
        }

        [Test]
        public void ThenMapsContactName()
        {
            _mappedParameters.ContactName
                .Should().Be(_request.ContactName);
        }

        [Test]
        public void ThenMapsContactEmail()
        {
            _mappedParameters.ContactEmail
                .Should().Be(_request.ContactEmail);
        }

        [Test]
        public void ThenMapsContactNumber()
        {
            _mappedParameters.ContactNumber
                .Should().Be(_request.ContactNumber);
        }

        [Test]
        public void ThenMapsTrainingType()
        {
            _mappedParameters.TrainingTypeId.Should().Be((int)_request.TrainingType);
        }

        [Test]
        public void ThenMapsIsDisabilityConfident()
        {
            _mappedParameters.IsDisabilityConfident.Should().Be(_request.IsEmployerDisabilityConfident.Value);
        }

        [Test]
        public void ThenMapsAdditionalLocationInformation()
        {
            _mappedParameters.AdditionalLocationInformation.Should().Be(_request.AdditionalLocationInformation);
        }
    }
}


text:
[![Build Status](https://img.shields.io/travis/chrisb/tvml/master.svg?style=flat-square)](https://travis-ci.org/chrisb/tvml)
[![Gemnasium](https://img.shields.io/gemnasium/chrisb/tvml.svg?style=flat-square)](https://gemnasium.com/chrisb/tvml)
[![Code Climate](https://img.shields.io/codeclimate/github/chrisb/tvml.svg?style=flat-square)](https://codeclimate.com/github/chrisb/tvml)
[![Coverage](https://img.shields.io/coveralls/chrisb/tvml.svg?style=flat-square)](https://coveralls.io/r/chrisb/tvml)
[![Security](https://hakiri.io/github/chrisb/tvml/master.svg)](https://hakiri.io/github/chrisb/tvml/master/shield)

[![Join the chat at https://gitter.im/chrisb/tvml](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/chrisb/tvml)

Provides a way of working with Apple's TVML documents, templates, and elements in an elegant and friendly Ruby-style DSL.

The TVML gem is based on [Builder](https://github.com/jimweirich/builder). For an example of how to integrate TVML with Sinatra, check out the [tvml-example repo](https://github.com/chrisb/tvml-example).

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'tvml'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install tvml

## Usage

```ruby
doc = TVML::Document.new
doc.template = TVML::Template::Alert.new.tap do |alert|
  alert.title       = "Hello World"
  alert.description = "How are things?"
end

doc.build # => "<?xml version=\"1.0\" encoding=\"UTF-8\"?><document><alertTemplate><description>How are things?</description><title>Hello World</title></alertTemplate></document>"
```

## Development

After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rspec spec/` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/chrisb/tvml.

## Copyright

Copyright (c) 2015-2016 Chris Bielinski. See `MIT-LICENSE` for details.


text:
<!DOCTYPE html>

		<meta charset="utf-8" />

		<title>v4.0.8+1 - Notes d'utilisation

					 - Historique des versions

 - Boîte à outils de l'expérience Web
</title>
		<meta content="width=device-width, initial-scale=1" name="viewport" />

		<meta name="description" content="v4.0.8+1 - Notes d'utilisation - Historique des versions - Boîte à outils de l'expérience Web (BOEW)" />

<link href="../../../assets/favicon.ico" rel="icon" type="image/x-icon" />
<link rel="stylesheet" href="../../../css/wet-boew.css" />

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

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

		Passer au contenu principal

		Passer à « À propos de ce site »

Sélection de la langue

Français (actuel)

English

Recherche et menus

Recherche et menus

	<object type="image/svg+xml" tabindex="-1" data="../../../assets/logo.svg"></object>
	Boîte à outils de l'expérience Web, Projet à source ouverte collaboratif dirigé par le Gouvernement du Canada

Recherche

					<form action="https://google.ca/search" method="get" role="search" class="form-inline">

		Recherchez le site Web
		<input id="wb-srch-q" class="form-control" name="q" type="search" value="" size="27" maxlength="150" />
		<input type="hidden" name="q" value="site:wet-boew.github.io OR site:github.com/wet-boew/" />

	<button type="submit" id="wb-srch-sub" class="btn btn-default">Recherche</button>

</form>

Menu des sujets

Projet de la BOEW

Mise en œuvre de la BOEW

Contribuer à la BOEW

Vous êtes ici :

				Accueil

					Historique des versions

v4.0.8+1 - Notes d'utilisation

v4.0.8+1 - Notes d'utilisation

Vous cherchez la BOEW v3.1?

À partir du 23 septembre 2014, la version 3.1 de la Boîte à outils de l'expérience Web n'est plus supportée. Le code source et la documentation ont été déplacés vers le dépôt wet-boew-legacy.

Date de lancement : <time>2014-11-20</time>

Téléchargements

Quoi de neuf?

Needs translation

Geomap:Addition of srsCode property to the proj4 object. OL needs this property in order to be able to load ArcGis Mapserver layer.

Menu: Allow integration with the data-ajax plugin

Template: Added missing space in the IE8 html tag declaration

Tabs: Fixed tab selection when switching from mobile to desktop view

Détails

Nombre des « commits » 7

@LaurentGoderre : 3 « commits »

@jsmoreau : 2 « commits »

@pjackson28 : 1 « commits »

@shawnthompson : 1 « commits »

Liste des « commits »

Addition of srsCode property to the proj4 object. OL needs this property in order to be able to load ArcGis Mapserver layer. - jsmoreau, 2014-10-28 13:23:53 -0400

Multimedia Player - YouTube: fixed #6224 - Shawn Thompson, 2014-11-04 13:00:18 -0500

Addition of an ESRI REST basemap example - jsmoreau, 2014-11-10 11:07:11 -0500

Updated the build version to v4.0.9-development - Laurent Goderre, 2014-11-18 14:03:40 -0500

Menu: Allow integration with the data-ajax plugin - Laurent Goderre, 2014-11-19 12:10:01 -0500

Added missing space in the IE8 html tag declaration - Laurent Goderre, 2014-11-19 15:44:11 -0500

Tabs: Fixed tab selection when switching from mobile to desktop view - Paul Jackson, 2014-11-20 12:56:17 -0500

Date de modification :

<time property="dateModified">2014-11-20</time>

À propos de ce site

Contactez-nous

Questions ou commentaires?

À propos

À propos de la Boîte à outils de l'expérience Web

À propos des normes Web

Nouvelles

Activité du projet récente

Statistiques du projet

Restez branchés

Twitter


text:
/**
**  @file tcCarrierObject.h
*/
/*
**  Copyright (c) 2014, GCBLUE PROJECT
**  All rights reserved.
**
**  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
**
**  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
**
**  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the
**     documentation and/or other materials provided with the distribution.
**
**  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from
**     this software without specific prior written permission.
**
**  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
**  NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
**  COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
**  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
**  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
**  IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef _TCCARRIEROBJECT_H_
#define _TCCARRIEROBJECT_H_

#if _MSC_VER > 1000
#pragma once
#endif

#include "tcFile.h"
#include "tcSurfaceObject.h"
#include "tcFlightOpsObject.h"

class tcStream;
class tcCommandStream;
class tcCreateStream;
class tcUpdateStream;
class tcGameStream;

namespace scriptinterface
{
	class tcScenarioLogger;
}

namespace database
{
    struct AirComplement;
    struct MagazineLoadout;
}

/**
 * Models a Carrier
 * Changed to derive from tcFlightOpsObject instead of implementing
 * flight ops here.
 *
 * @see tcSurfaceObject
 * @see tcFlightOpsObject
 */
class tcCarrierObject : public tcSurfaceObject, public tcFlightOpsObject
{
public:
	virtual void ApplyGeneralDamage(float damage, tcGameObject* damager);
    virtual float ApplyAdvancedDamage(const Damage& damage, tcGameObject* damager);

    virtual void Clear();
    virtual void RandInitNear(float afLon_deg, float afLat_deg);
    void PrintToFile(tcFile& file);
    void SaveToFile(tcFile& file);
    void LoadFromFile(tcFile& file);
    virtual void Serialize(tcFile& file, bool mbLoad);
	virtual void SaveToPython(scriptinterface::tcScenarioLogger& logger);

    virtual void Update(double afStatusTime);

    virtual tcCommandStream& operator<<(tcCommandStream& stream);
    virtual tcCreateStream& operator<<(tcCreateStream& stream);
    virtual tcUpdateStream& operator<<(tcUpdateStream& stream);
    virtual tcGameStream& operator<<(tcGameStream& stream);

    virtual tcCommandStream& operator>>(tcCommandStream& stream);
    virtual tcCreateStream& operator>>(tcCreateStream& stream);
    virtual tcUpdateStream& operator>>(tcUpdateStream& stream);
    virtual tcGameStream& operator>>(tcGameStream& stream);

    virtual void ClearNewCommand();
    virtual bool HasNewCommand() const;

    virtual void AutoConfigurePlatform(const std::string& setupName);

    tcCarrierObject();
    tcCarrierObject(tcCarrierObject&);
    tcCarrierObject(tcShipDBObject* obj);
    virtual ~tcCarrierObject();
};

#endif


text:
from spectrum import Spectrogram, dolphin_filename, readwav

def test_spectrogram():

    data, samplerate = readwav(dolphin_filename)
    p = Spectrogram(data, ws=128, W=4096, sampling=samplerate)
    p.periodogram()
    p.plot()


text:
import copy
import json
import pytest

from mock import MagicMock
from ansible.module_utils import hetzner

class ModuleFailException(Exception):
    def __init__(self, msg, **kwargs):
        super(ModuleFailException, self).__init__(msg)
        self.fail_msg = msg
        self.fail_kwargs = kwargs

def get_module_mock():
    def f(msg, **kwargs):
        raise ModuleFailException(msg, **kwargs)

    module = MagicMock()
    module.fail_json = f
    module.from_json = json.loads
    return module

# ########################################################################################

FETCH_URL_JSON_SUCCESS = [
    (
        (None, dict(
            body=json.dumps(dict(
                a='b'
            )).encode('utf-8'),
        )),
        None,
        (dict(
            a='b'
        ), None)
    ),
    (
        (None, dict(
            body=json.dumps(dict(
                error=dict(
                    code="foo",
                    status=400,
                    message="bar",
                ),
                a='b'
            )).encode('utf-8'),
        )),
        ['foo'],
        (dict(
            error=dict(
                code="foo",
                status=400,
                message="bar",
            ),
            a='b'
        ), 'foo')
    ),
]

FETCH_URL_JSON_FAIL = [
    (
        (None, dict(
            body=json.dumps(dict(
                error=dict(
                    code="foo",
                    status=400,
                    message="bar",
                ),
            )).encode('utf-8'),
        )),
        None,
        'Request failed: 400 foo (bar)'
    ),
    (
        (None, dict(
            body=json.dumps(dict(
                error=dict(
                    code="foo",
                    status=400,
                    message="bar",
                ),
            )).encode('utf-8'),
        )),
        ['bar'],
        'Request failed: 400 foo (bar)'
    ),
]

@pytest.mark.parametrize("return_value, accept_errors, result", FETCH_URL_JSON_SUCCESS)
def test_fetch_url_json(monkeypatch, return_value, accept_errors, result):
    module = get_module_mock()
    hetzner.fetch_url = MagicMock(return_value=return_value)

    assert hetzner.fetch_url_json(module, 'https://foo/bar', accept_errors=accept_errors) == result

@pytest.mark.parametrize("return_value, accept_errors, result", FETCH_URL_JSON_FAIL)
def test_fetch_url_json_fail(monkeypatch, return_value, accept_errors, result):
    module = get_module_mock()
    hetzner.fetch_url = MagicMock(return_value=return_value)

    with pytest.raises(ModuleFailException) as exc:
        hetzner.fetch_url_json(module, 'https://foo/bar', accept_errors=accept_errors)

    assert exc.value.fail_msg == result
    assert exc.value.fail_kwargs == dict()

# ########################################################################################

GET_FAILOVER_SUCCESS = [
    (
        '1.2.3.4',
        (None, dict(
            body=json.dumps(dict(
                failover=dict(
                    active_server_ip='1.1.1.1',
                    ip='1.2.3.4',
                    netmask='255.255.255.255',
                )
            )).encode('utf-8'),
        )),
        '1.1.1.1',
        dict(
            active_server_ip='1.1.1.1',
            ip='1.2.3.4',
            netmask='255.255.255.255',
        )
    ),
]

GET_FAILOVER_FAIL = [
    (
        '1.2.3.4',
        (None, dict(
            body=json.dumps(dict(
                error=dict(
                    code="foo",
                    status=400,
                    message="bar",
                ),
            )).encode('utf-8'),
        )),
        'Request failed: 400 foo (bar)'
    ),
]

@pytest.mark.parametrize("ip, return_value, result, record", GET_FAILOVER_SUCCESS)
def test_get_failover_record(monkeypatch, ip, return_value, result, record):
    module = get_module_mock()
    hetzner.fetch_url = MagicMock(return_value=copy.deepcopy(return_value))

    assert hetzner.get_failover_record(module, ip) == record

@pytest.mark.parametrize("ip, return_value, result", GET_FAILOVER_FAIL)
def test_get_failover_record_fail(monkeypatch, ip, return_value, result):
    module = get_module_mock()
    hetzner.fetch_url = MagicMock(return_value=copy.deepcopy(return_value))

    with pytest.raises(ModuleFailException) as exc:
        hetzner.get_failover_record(module, ip)

    assert exc.value.fail_msg == result
    assert exc.value.fail_kwargs == dict()

@pytest.mark.parametrize("ip, return_value, result, record", GET_FAILOVER_SUCCESS)
def test_get_failover(monkeypatch, ip, return_value, result, record):
    module = get_module_mock()
    hetzner.fetch_url = MagicMock(return_value=copy.deepcopy(return_value))

    assert hetzner.get_failover(module, ip) == result

@pytest.mark.parametrize("ip, return_value, result", GET_FAILOVER_FAIL)
def test_get_failover_fail(monkeypatch, ip, return_value, result):
    module = get_module_mock()
    hetzner.fetch_url = MagicMock(return_value=copy.deepcopy(return_value))

    with pytest.raises(ModuleFailException) as exc:
        hetzner.get_failover(module, ip)

    assert exc.value.fail_msg == result
    assert exc.value.fail_kwargs == dict()

# ########################################################################################

SET_FAILOVER_SUCCESS = [
    (
        '1.2.3.4',
        '1.1.1.1',
        (None, dict(
            body=json.dumps(dict(
                failover=dict(
                    active_server_ip='1.1.1.2',
                )
            )).encode('utf-8'),
        )),
        ('1.1.1.2', True)
    ),
    (
        '1.2.3.4',
        '1.1.1.1',
        (None, dict(
            body=json.dumps(dict(
                error=dict(
                    code="FAILOVER_ALREADY_ROUTED",
                    status=400,
                    message="Failover already routed",
                ),
            )).encode('utf-8'),
        )),
        ('1.1.1.1', False)
    ),
]

SET_FAILOVER_FAIL = [
    (
        '1.2.3.4',
        '1.1.1.1',
        (None, dict(
            body=json.dumps(dict(
                error=dict(
                    code="foo",
                    status=400,
                    message="bar",
                ),
            )).encode('utf-8'),
        )),
        'Request failed: 400 foo (bar)'
    ),
]

@pytest.mark.parametrize("ip, value, return_value, result", SET_FAILOVER_SUCCESS)
def test_set_failover(monkeypatch, ip, value, return_value, result):
    module = get_module_mock()
    hetzner.fetch_url = MagicMock(return_value=copy.deepcopy(return_value))

    assert hetzner.set_failover(module, ip, value) == result

@pytest.mark.parametrize("ip, value, return_value, result", SET_FAILOVER_FAIL)
def test_set_failover_fail(monkeypatch, ip, value, return_value, result):
    module = get_module_mock()
    hetzner.fetch_url = MagicMock(return_value=copy.deepcopy(return_value))

    with pytest.raises(ModuleFailException) as exc:
        hetzner.set_failover(module, ip, value)

    assert exc.value.fail_msg == result
    assert exc.value.fail_kwargs == dict()


text:
"""
Named projection classes that can be created or parsed.
"""

def find(projname, crstype, strict=False):
    """
    Search for a projection name located in this module.

    Arguments:

    - **projname**: The projection name to search for.
    - **crstype**: Which CRS naming convention to search (different
        CRS formats have different names for the same projection).
    - **strict** (optional): If False, ignores minor name mismatches
        such as underscore or character casing, otherwise must be exact
        match (defaults to False).
    """
    if not strict:
        projname = projname.lower().replace(" ","_")
    for itemname,item in globals().items():
        if itemname.startswith("_"):
            continue
        try:
            if hasattr(item.name, crstype):
                itemname = getattr(item.name, crstype)
                if not strict:
                    itemname = itemname.lower().replace(" ","_")
                if projname == itemname:
                    return item
        except:
            pass
    else:
        return None

##+proj      Projection name (see `proj -l`)
class Projection:
    proj4 = "+proj"
    ogc_wkt = "PROJECTION"
    esri_wkt = "PROJECTION"

    name = None

    def __init__(self, **kwargs):
        """
        A generic container for the specific projection used.

        Args:

        - **name**: A pycrs.projections.ProjName instance with the name given by each supported format.
        """
        self.name = kwargs.get('name', self.name)

    def to_proj4(self):
        return "+proj=%s" %self.name.proj4

    def to_ogc_wkt(self):
        return 'PROJECTION["%s"]' %self.name.ogc_wkt

    def to_esri_wkt(self):
        return 'PROJECTION["%s"]' %self.name.esri_wkt

class ProjName:
    def __init__(self, proj4="", ogc_wkt="", esri_wkt=""):
        self.proj4 = proj4
        self.ogc_wkt = ogc_wkt
        self.esri_wkt = esri_wkt

# Specific predefined ellipsoid classes
class Robinson(Projection):
    name = ProjName(
        proj4 = "robin",
        ogc_wkt = "Robinson",
        esri_wkt = "Robinson",
        )

class UTM(Projection):
    name = ProjName(
        proj4 = "utm",
        ogc_wkt = "Transverse_Mercator",
        esri_wkt = "Transverse_Mercator",
        )

class ObliqueMercator(Projection):
    name = ProjName(
        proj4 = "omerc",
        ogc_wkt = "Hotine_Oblique_Mercator_Two_Point_Natural_Origin", #"Hotine_Oblique_Mercator"
        esri_wkt = "Hotine_Oblique_Mercator_Two_Point_Natural_Origin", #"Hotine_Oblique_Mercator_Azimuth_Natural_Origin"
        )

class AlbersEqualArea(Projection):
    name = ProjName(
        proj4 = "aea",
        ogc_wkt = "Albers_Conic_Equal_Area",
        esri_wkt = "Albers",
        )

class CylindricalEqualArea(Projection):
    name = ProjName(
        proj4 = "cea",
        ogc_wkt = "Cylindrical_Equal_Area",
        esri_wkt = "Cylindrical_Equal_Area",
        )

class EquiDistantConic(Projection):
    name = ProjName(
        proj4 = "eqdc",
        ogc_wkt = "Equidistant_Conic",
        esri_wkt = "Equidistant_Conic",
        )

class EquiDistantCylindrical(Projection):
    # same as equirectangular...?
    name = ProjName(
        proj4 = "eqc",
        ogc_wkt = "Equidistant_Cylindrical",
        esri_wkt = "Equidistant_Cylindrical",
        )

class EquiRectangular(Projection):
    # same as equidistant cylindrical
    name = ProjName(
        proj4 = "eqc",
        ogc_wkt = "Equirectangular",
        esri_wkt = "Equirectangular",
        )

class TransverseMercator(Projection):
    name = ProjName(
        proj4 = "tmerc",
        ogc_wkt = "Transverse_Mercator",
        esri_wkt = "Transverse_Mercator",
        )

class GallStereographic(Projection):
    name = ProjName(
        proj4 = "gall",
        ogc_wkt = "Gall_Stereographic",
        esri_wkt = "Gall_Stereographic",
        )

class Gnomonic(Projection):
    name = ProjName(
        proj4 = "gnom",
        ogc_wkt = "Gnomonic",
        esri_wkt = "Gnomonic",
        )

class LambertAzimuthalEqualArea(Projection):
    name = ProjName(
        proj4 = "laea",
        ogc_wkt = "Lambert_Azimuthal_Equal_Area",
        esri_wkt = "Lambert_Azimuthal_Equal_Area",
        )

class MillerCylindrical(Projection):
    name = ProjName(
        proj4 = "mill",
        ogc_wkt = "Miller_Cylindrical",
        esri_wkt = "Miller_Cylindrical",
        )

class Mollweide(Projection):
    name = ProjName(
        proj4 = "moll",
        ogc_wkt = "Mollweide",
        esri_wkt = "Mollweide",
        )

class ObliqueStereographic(Projection):
    name = ProjName(
        proj4 = "sterea",
        ogc_wkt = "Oblique_Stereographic",
        esri_wkt = "Oblique Stereographic", #"Stereographic_North_Pole"
        )

class Orthographic(Projection):
    name = ProjName(
        proj4 = "ortho",
        ogc_wkt = "Orthographic",
        esri_wkt = "Orthographic",
        )

class Stereographic(Projection):
    name = ProjName(
        proj4 = "stere",
        ogc_wkt = "Stereographic",
        esri_wkt = "Stereographic",
        )

class PolarStereographic(Projection):
    name = ProjName(
        proj4 = "stere",
        ogc_wkt = "Polar_Stereographic", # could also be just stereographic
        esri_wkt = "Stereographic", # but also spelled with additional _South/North_Pole, for the same projection and diff params (maybe just for humans)?...
        )

class Sinusoidal(Projection):
    name = ProjName(
        proj4 = "sinu",
        ogc_wkt = "Sinusoidal",
        esri_wkt = "Sinusoidal",
        )

class VanDerGrinten(Projection):
    name = ProjName(
        proj4 = "vandg",
        ogc_wkt = "VanDerGrinten",
        esri_wkt = "Van_der_Grinten_I",
        )

class LambertConformalConic(Projection):
    name = ProjName(
        proj4 = "lcc",
        ogc_wkt = "Lambert_Conformal_Conic", # possible has some variants
        esri_wkt = "Lambert_Conformal_Conic",
        )

class Krovak(Projection):
    name = ProjName(
        proj4 = "krovak",
        ogc_wkt = "Krovak",
        esri_wkt = "Krovak",
        )

class NearSidedPerspective(Projection):
    name = ProjName(
        proj4 = "nsper",
        ogc_wkt = "Near_sided_perspective",
        esri_wkt = "Near_sided_perspective", # not confirmed
        )

class TiltedPerspective(Projection):
    name = ProjName(
        proj4 = "tsper",
        ogc_wkt = "Tilted_perspective",
        esri_wkt = "Tilted_perspective", # not confirmed
        )

class InteruptedGoodeHomolosine(Projection):
    name = ProjName(
        proj4 = "igh",
        ogc_wkt = "Interrupted_Goodes_Homolosine",
        esri_wkt = "Interrupted_Goodes_Homolosine",
        )

class Larrivee(Projection):
    name = ProjName(
        proj4 = "larr",
        ogc_wkt = "Larrivee",
        esri_wkt = "Larrivee", # not confirmed
        )

class LamberEqualAreaConic(Projection):
    name = ProjName(
        proj4 = "leac",
        ogc_wkt = "Lambert_Equal_Area_Conic",
        esri_wkt = "Lambert_Equal_Area_Conic", # not confirmed
        )

class Mercator(Projection):
    name = ProjName(
        proj4 = "merc",
        ogc_wkt = "Mercator", # has multiple varieties
        esri_wkt = "Mercator",
        )

class ObliqueCylindricalEqualArea(Projection):
    name = ProjName(
        proj4 = "ocea",
        ogc_wkt = "Oblique_Cylindrical_Equal_Area",
        esri_wkt = "Oblique_Cylindrical_Equal_Area",
        )

class Polyconic(Projection):
    name = ProjName(
        proj4 = "poly",
        ogc_wkt = "Polyconic",
        esri_wkt = "Polyconic",
        )

class EckertIV(Projection):
    name = ProjName(
        proj4 = "eck4",
        ogc_wkt = "Eckert_IV",
        esri_wkt = "Eckert_IV",
        )

class EckertVI(Projection):
    name = ProjName(
        proj4 = "eck6",
        ogc_wkt = "Eckert_VI",
        esri_wkt = "Eckert_VI",
        )

class AzimuthalEquidistant(Projection):
    name = ProjName(
        proj4 = "aeqd",
        ogc_wkt = "Azimuthal_Equidistant",
        esri_wkt = "Azimuthal_Equidistant",
        )

class GeostationarySatellite(Projection):
    name = ProjName(
        proj4 = "geos",
        ogc_wkt = "Geostationary_Satellite",
        esri_wkt = "Geostationary_Satellite",
        )


text:
var Tag = require('../model/Tag.js');
var should = require('should');

describe('Tag', function() {
	describe('.Tag()', function() {
		it('should create a new tag', function() {
			var tag = new Tag ({
				name: 'Dogs'
			});

			tag.name.should.equal('Dogs');
		})
	})

	describe('Tag.find', function() {
		it('should find a tag by id', function() {
			Tag.find(1, function(err, tag) {
				if (err) throw err;
				tag.name.should.equal('Dogs');
			})
		})
	})

	describe('Tag.all', function() {
		it('should return all tags', function() {
			Tag.count(function(err, num) {
				Tag.all(function(err, tags) {
					tags.length.should.equal(num);
					tags[0].should.be.an.instanceOf(Tag);
				})
			})
		})
	})
})