text:
namespace Microsoft.Azure.Management.Security
{
    using Microsoft.Rest;
    using Microsoft.Rest.Azure;
    using Models;
    using Newtonsoft.Json;
    using System.Collections;
    using System.Collections.Generic;
    using System.Linq;
    using System.Net;
    using System.Net.Http;
    using System.Threading;
    using System.Threading.Tasks;

    /// <summary>
    /// IotSecuritySolutionsAnalyticsAggregatedAlertOperations operations.
    /// </summary>
    internal partial class IotSecuritySolutionsAnalyticsAggregatedAlertOperations : IServiceOperations<SecurityCenterClient>, IIotSecuritySolutionsAnalyticsAggregatedAlertOperations
    {
        /// <summary>
        /// Initializes a new instance of the IotSecuritySolutionsAnalyticsAggregatedAlertOperations class.
        /// </summary>
        /// <param name='client'>
        /// Reference to the service client.
        /// </param>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown when a required parameter is null
        /// </exception>
        internal IotSecuritySolutionsAnalyticsAggregatedAlertOperations(SecurityCenterClient client)
        {
            if (client == null)
            {
                throw new System.ArgumentNullException("client");
            }
            Client = client;
        }

        /// <summary>
        /// Gets a reference to the SecurityCenterClient
        /// </summary>
        public SecurityCenterClient Client { get; private set; }

        /// <summary>
        /// Use this method to get the aggregated alert list of yours IoT Security
        /// solution.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The name of the resource group within the user's subscription. The name is
        /// case insensitive.
        /// </param>
        /// <param name='solutionName'>
        /// The name of the IoT Security solution.
        /// </param>
        /// <param name='top'>
        /// Number of results to retrieve.
        /// </param>
        /// <param name='customHeaders'>
        /// Headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="CloudException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <return>
        /// A response object containing the response body and response headers.
        /// </return>
        public async Task<AzureOperationResponse<IPage<IoTSecurityAggregatedAlert>>> ListWithHttpMessagesAsync(string resourceGroupName, string solutionName, int? top = default(int?), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (Client.SubscriptionId == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
            }
            if (Client.SubscriptionId != null)
            {
                if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"))
                {
                    throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$");
                }
            }
            if (resourceGroupName == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
            }
            if (resourceGroupName != null)
            {
                if (resourceGroupName.Length > 90)
                {
                    throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
                }
                if (resourceGroupName.Length < 1)
                {
                    throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
                }
                if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$"))
                {
                    throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
                }
            }
            if (solutionName == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "solutionName");
            }
            string apiVersion = "2019-08-01";
            // Tracing
            bool _shouldTrace = ServiceClientTracing.IsEnabled;
            string _invocationId = null;
            if (_shouldTrace)
            {
                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
                tracingParameters.Add("apiVersion", apiVersion);
                tracingParameters.Add("resourceGroupName", resourceGroupName);
                tracingParameters.Add("solutionName", solutionName);
                tracingParameters.Add("top", top);
                tracingParameters.Add("cancellationToken", cancellationToken);
                ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
            }
            // Construct URL
            var _baseUrl = Client.BaseUri.AbsoluteUri;
            var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts").ToString();
            _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
            _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
            _url = _url.Replace("{solutionName}", System.Uri.EscapeDataString(solutionName));
            List<string> _queryParameters = new List<string>();
            if (apiVersion != null)
            {
                _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
            }
            if (top != null)
            {
                _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"'))));
            }
            if (_queryParameters.Count > 0)
            {
                _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
            }
            // Create HTTP transport objects
            var _httpRequest = new HttpRequestMessage();
            HttpResponseMessage _httpResponse = null;
            _httpRequest.Method = new HttpMethod("GET");
            _httpRequest.RequestUri = new System.Uri(_url);
            // Set Headers
            if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
            {
                _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
            }
            if (Client.AcceptLanguage != null)
            {
                if (_httpRequest.Headers.Contains("accept-language"))
                {
                    _httpRequest.Headers.Remove("accept-language");
                }
                _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
            }

            if (customHeaders != null)
            {
                foreach(var _header in customHeaders)
                {
                    if (_httpRequest.Headers.Contains(_header.Key))
                    {
                        _httpRequest.Headers.Remove(_header.Key);
                    }
                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
                }
            }

            // Serialize Request
            string _requestContent = null;
            // Set Credentials
            if (Client.Credentials != null)
            {
                cancellationToken.ThrowIfCancellationRequested();
                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
            }
            // Send Request
            if (_shouldTrace)
            {
                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
            }
            cancellationToken.ThrowIfCancellationRequested();
            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
            if (_shouldTrace)
            {
                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
            }
            HttpStatusCode _statusCode = _httpResponse.StatusCode;
            cancellationToken.ThrowIfCancellationRequested();
            string _responseContent = null;
            if ((int)_statusCode != 200)
            {
                var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
                try
                {
                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
                    CloudError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<CloudError>(_responseContent, Client.DeserializationSettings);
                    if (_errorBody != null)
                    {
                        ex = new CloudException(_errorBody.Message);
                        ex.Body = _errorBody;
                    }
                }
                catch (JsonException)
                {
                    // Ignore the exception
                }
                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
                if (_httpResponse.Headers.Contains("x-ms-request-id"))
                {
                    ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
                }
                if (_shouldTrace)
                {
                    ServiceClientTracing.Error(_invocationId, ex);
                }
                _httpRequest.Dispose();
                if (_httpResponse != null)
                {
                    _httpResponse.Dispose();
                }
                throw ex;
            }
            // Create Result
            var _result = new AzureOperationResponse<IPage<IoTSecurityAggregatedAlert>>();
            _result.Request = _httpRequest;
            _result.Response = _httpResponse;
            if (_httpResponse.Headers.Contains("x-ms-request-id"))
            {
                _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
            }
            // Deserialize Response
            if ((int)_statusCode == 200)
            {
                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
                try
                {
                    _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Page<IoTSecurityAggregatedAlert>>(_responseContent, Client.DeserializationSettings);
                }
                catch (JsonException ex)
                {
                    _httpRequest.Dispose();
                    if (_httpResponse != null)
                    {
                        _httpResponse.Dispose();
                    }
                    throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
                }
            }
            if (_shouldTrace)
            {
                ServiceClientTracing.Exit(_invocationId, _result);
            }
            return _result;
        }

        /// <summary>
        /// Use this method to get a single the aggregated alert of yours IoT Security
        /// solution. This aggregation is performed by alert name.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The name of the resource group within the user's subscription. The name is
        /// case insensitive.
        /// </param>
        /// <param name='solutionName'>
        /// The name of the IoT Security solution.
        /// </param>
        /// <param name='aggregatedAlertName'>
        /// Identifier of the aggregated alert.
        /// </param>
        /// <param name='customHeaders'>
        /// Headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="CloudException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <return>
        /// A response object containing the response body and response headers.
        /// </return>
        public async Task<AzureOperationResponse<IoTSecurityAggregatedAlert>> GetWithHttpMessagesAsync(string resourceGroupName, string solutionName, string aggregatedAlertName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (Client.SubscriptionId == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
            }
            if (Client.SubscriptionId != null)
            {
                if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"))
                {
                    throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$");
                }
            }
            if (resourceGroupName == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
            }
            if (resourceGroupName != null)
            {
                if (resourceGroupName.Length > 90)
                {
                    throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
                }
                if (resourceGroupName.Length < 1)
                {
                    throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
                }
                if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$"))
                {
                    throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
                }
            }
            if (solutionName == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "solutionName");
            }
            if (aggregatedAlertName == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "aggregatedAlertName");
            }
            string apiVersion = "2019-08-01";
            // Tracing
            bool _shouldTrace = ServiceClientTracing.IsEnabled;
            string _invocationId = null;
            if (_shouldTrace)
            {
                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
                tracingParameters.Add("apiVersion", apiVersion);
                tracingParameters.Add("resourceGroupName", resourceGroupName);
                tracingParameters.Add("solutionName", solutionName);
                tracingParameters.Add("aggregatedAlertName", aggregatedAlertName);
                tracingParameters.Add("cancellationToken", cancellationToken);
                ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
            }
            // Construct URL
            var _baseUrl = Client.BaseUri.AbsoluteUri;
            var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}").ToString();
            _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
            _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
            _url = _url.Replace("{solutionName}", System.Uri.EscapeDataString(solutionName));
            _url = _url.Replace("{aggregatedAlertName}", System.Uri.EscapeDataString(aggregatedAlertName));
            List<string> _queryParameters = new List<string>();
            if (apiVersion != null)
            {
                _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
            }
            if (_queryParameters.Count > 0)
            {
                _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
            }
            // Create HTTP transport objects
            var _httpRequest = new HttpRequestMessage();
            HttpResponseMessage _httpResponse = null;
            _httpRequest.Method = new HttpMethod("GET");
            _httpRequest.RequestUri = new System.Uri(_url);
            // Set Headers
            if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
            {
                _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
            }
            if (Client.AcceptLanguage != null)
            {
                if (_httpRequest.Headers.Contains("accept-language"))
                {
                    _httpRequest.Headers.Remove("accept-language");
                }
                _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
            }

            if (customHeaders != null)
            {
                foreach(var _header in customHeaders)
                {
                    if (_httpRequest.Headers.Contains(_header.Key))
                    {
                        _httpRequest.Headers.Remove(_header.Key);
                    }
                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
                }
            }

            // Serialize Request
            string _requestContent = null;
            // Set Credentials
            if (Client.Credentials != null)
            {
                cancellationToken.ThrowIfCancellationRequested();
                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
            }
            // Send Request
            if (_shouldTrace)
            {
                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
            }
            cancellationToken.ThrowIfCancellationRequested();
            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
            if (_shouldTrace)
            {
                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
            }
            HttpStatusCode _statusCode = _httpResponse.StatusCode;
            cancellationToken.ThrowIfCancellationRequested();
            string _responseContent = null;
            if ((int)_statusCode != 200)
            {
                var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
                try
                {
                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
                    CloudError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<CloudError>(_responseContent, Client.DeserializationSettings);
                    if (_errorBody != null)
                    {
                        ex = new CloudException(_errorBody.Message);
                        ex.Body = _errorBody;
                    }
                }
                catch (JsonException)
                {
                    // Ignore the exception
                }
                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
                if (_httpResponse.Headers.Contains("x-ms-request-id"))
                {
                    ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
                }
                if (_shouldTrace)
                {
                    ServiceClientTracing.Error(_invocationId, ex);
                }
                _httpRequest.Dispose();
                if (_httpResponse != null)
                {
                    _httpResponse.Dispose();
                }
                throw ex;
            }
            // Create Result
            var _result = new AzureOperationResponse<IoTSecurityAggregatedAlert>();
            _result.Request = _httpRequest;
            _result.Response = _httpResponse;
            if (_httpResponse.Headers.Contains("x-ms-request-id"))
            {
                _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
            }
            // Deserialize Response
            if ((int)_statusCode == 200)
            {
                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
                try
                {
                    _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<IoTSecurityAggregatedAlert>(_responseContent, Client.DeserializationSettings);
                }
                catch (JsonException ex)
                {
                    _httpRequest.Dispose();
                    if (_httpResponse != null)
                    {
                        _httpResponse.Dispose();
                    }
                    throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
                }
            }
            if (_shouldTrace)
            {
                ServiceClientTracing.Exit(_invocationId, _result);
            }
            return _result;
        }

        /// <summary>
        /// Use this method to dismiss an aggregated IoT Security Solution Alert.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The name of the resource group within the user's subscription. The name is
        /// case insensitive.
        /// </param>
        /// <param name='solutionName'>
        /// The name of the IoT Security solution.
        /// </param>
        /// <param name='aggregatedAlertName'>
        /// Identifier of the aggregated alert.
        /// </param>
        /// <param name='customHeaders'>
        /// Headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="CloudException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <return>
        /// A response object containing the response body and response headers.
        /// </return>
        public async Task<AzureOperationResponse> DismissWithHttpMessagesAsync(string resourceGroupName, string solutionName, string aggregatedAlertName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (Client.SubscriptionId == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
            }
            if (Client.SubscriptionId != null)
            {
                if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"))
                {
                    throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$");
                }
            }
            if (resourceGroupName == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
            }
            if (resourceGroupName != null)
            {
                if (resourceGroupName.Length > 90)
                {
                    throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
                }
                if (resourceGroupName.Length < 1)
                {
                    throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
                }
                if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$"))
                {
                    throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
                }
            }
            if (solutionName == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "solutionName");
            }
            if (aggregatedAlertName == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "aggregatedAlertName");
            }
            string apiVersion = "2019-08-01";
            // Tracing
            bool _shouldTrace = ServiceClientTracing.IsEnabled;
            string _invocationId = null;
            if (_shouldTrace)
            {
                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
                tracingParameters.Add("apiVersion", apiVersion);
                tracingParameters.Add("resourceGroupName", resourceGroupName);
                tracingParameters.Add("solutionName", solutionName);
                tracingParameters.Add("aggregatedAlertName", aggregatedAlertName);
                tracingParameters.Add("cancellationToken", cancellationToken);
                ServiceClientTracing.Enter(_invocationId, this, "Dismiss", tracingParameters);
            }
            // Construct URL
            var _baseUrl = Client.BaseUri.AbsoluteUri;
            var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}/dismiss").ToString();
            _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
            _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
            _url = _url.Replace("{solutionName}", System.Uri.EscapeDataString(solutionName));
            _url = _url.Replace("{aggregatedAlertName}", System.Uri.EscapeDataString(aggregatedAlertName));
            List<string> _queryParameters = new List<string>();
            if (apiVersion != null)
            {
                _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
            }
            if (_queryParameters.Count > 0)
            {
                _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
            }
            // Create HTTP transport objects
            var _httpRequest = new HttpRequestMessage();
            HttpResponseMessage _httpResponse = null;
            _httpRequest.Method = new HttpMethod("POST");
            _httpRequest.RequestUri = new System.Uri(_url);
            // Set Headers
            if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
            {
                _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
            }
            if (Client.AcceptLanguage != null)
            {
                if (_httpRequest.Headers.Contains("accept-language"))
                {
                    _httpRequest.Headers.Remove("accept-language");
                }
                _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
            }

            if (customHeaders != null)
            {
                foreach(var _header in customHeaders)
                {
                    if (_httpRequest.Headers.Contains(_header.Key))
                    {
                        _httpRequest.Headers.Remove(_header.Key);
                    }
                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
                }
            }

            // Serialize Request
            string _requestContent = null;
            // Set Credentials
            if (Client.Credentials != null)
            {
                cancellationToken.ThrowIfCancellationRequested();
                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
            }
            // Send Request
            if (_shouldTrace)
            {
                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
            }
            cancellationToken.ThrowIfCancellationRequested();
            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
            if (_shouldTrace)
            {
                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
            }
            HttpStatusCode _statusCode = _httpResponse.StatusCode;
            cancellationToken.ThrowIfCancellationRequested();
            string _responseContent = null;
            if ((int)_statusCode != 200)
            {
                var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
                try
                {
                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
                    CloudError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<CloudError>(_responseContent, Client.DeserializationSettings);
                    if (_errorBody != null)
                    {
                        ex = new CloudException(_errorBody.Message);
                        ex.Body = _errorBody;
                    }
                }
                catch (JsonException)
                {
                    // Ignore the exception
                }
                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
                if (_httpResponse.Headers.Contains("x-ms-request-id"))
                {
                    ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
                }
                if (_shouldTrace)
                {
                    ServiceClientTracing.Error(_invocationId, ex);
                }
                _httpRequest.Dispose();
                if (_httpResponse != null)
                {
                    _httpResponse.Dispose();
                }
                throw ex;
            }
            // Create Result
            var _result = new AzureOperationResponse();
            _result.Request = _httpRequest;
            _result.Response = _httpResponse;
            if (_httpResponse.Headers.Contains("x-ms-request-id"))
            {
                _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
            }
            if (_shouldTrace)
            {
                ServiceClientTracing.Exit(_invocationId, _result);
            }
            return _result;
        }

        /// <summary>
        /// Use this method to get the aggregated alert list of yours IoT Security
        /// solution.
        /// </summary>
        /// <param name='nextPageLink'>
        /// The NextLink from the previous successful call to List operation.
        /// </param>
        /// <param name='customHeaders'>
        /// Headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="CloudException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <return>
        /// A response object containing the response body and response headers.
        /// </return>
        public async Task<AzureOperationResponse<IPage<IoTSecurityAggregatedAlert>>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (nextPageLink == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink");
            }
            // Tracing
            bool _shouldTrace = ServiceClientTracing.IsEnabled;
            string _invocationId = null;
            if (_shouldTrace)
            {
                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
                tracingParameters.Add("nextPageLink", nextPageLink);
                tracingParameters.Add("cancellationToken", cancellationToken);
                ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters);
            }
            // Construct URL
            string _url = "{nextLink}";
            _url = _url.Replace("{nextLink}", nextPageLink);
            List<string> _queryParameters = new List<string>();
            if (_queryParameters.Count > 0)
            {
                _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
            }
            // Create HTTP transport objects
            var _httpRequest = new HttpRequestMessage();
            HttpResponseMessage _httpResponse = null;
            _httpRequest.Method = new HttpMethod("GET");
            _httpRequest.RequestUri = new System.Uri(_url);
            // Set Headers
            if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
            {
                _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
            }
            if (Client.AcceptLanguage != null)
            {
                if (_httpRequest.Headers.Contains("accept-language"))
                {
                    _httpRequest.Headers.Remove("accept-language");
                }
                _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
            }

            if (customHeaders != null)
            {
                foreach(var _header in customHeaders)
                {
                    if (_httpRequest.Headers.Contains(_header.Key))
                    {
                        _httpRequest.Headers.Remove(_header.Key);
                    }
                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
                }
            }

            // Serialize Request
            string _requestContent = null;
            // Set Credentials
            if (Client.Credentials != null)
            {
                cancellationToken.ThrowIfCancellationRequested();
                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
            }
            // Send Request
            if (_shouldTrace)
            {
                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
            }
            cancellationToken.ThrowIfCancellationRequested();
            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
            if (_shouldTrace)
            {
                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
            }
            HttpStatusCode _statusCode = _httpResponse.StatusCode;
            cancellationToken.ThrowIfCancellationRequested();
            string _responseContent = null;
            if ((int)_statusCode != 200)
            {
                var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
                try
                {
                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
                    CloudError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<CloudError>(_responseContent, Client.DeserializationSettings);
                    if (_errorBody != null)
                    {
                        ex = new CloudException(_errorBody.Message);
                        ex.Body = _errorBody;
                    }
                }
                catch (JsonException)
                {
                    // Ignore the exception
                }
                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
                if (_httpResponse.Headers.Contains("x-ms-request-id"))
                {
                    ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
                }
                if (_shouldTrace)
                {
                    ServiceClientTracing.Error(_invocationId, ex);
                }
                _httpRequest.Dispose();
                if (_httpResponse != null)
                {
                    _httpResponse.Dispose();
                }
                throw ex;
            }
            // Create Result
            var _result = new AzureOperationResponse<IPage<IoTSecurityAggregatedAlert>>();
            _result.Request = _httpRequest;
            _result.Response = _httpResponse;
            if (_httpResponse.Headers.Contains("x-ms-request-id"))
            {
                _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
            }
            // Deserialize Response
            if ((int)_statusCode == 200)
            {
                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
                try
                {
                    _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Page<IoTSecurityAggregatedAlert>>(_responseContent, Client.DeserializationSettings);
                }
                catch (JsonException ex)
                {
                    _httpRequest.Dispose();
                    if (_httpResponse != null)
                    {
                        _httpResponse.Dispose();
                    }
                    throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
                }
            }
            if (_shouldTrace)
            {
                ServiceClientTracing.Exit(_invocationId, _result);
            }
            return _result;
        }

    }
}


text:
class AddWinesPersonId < ActiveRecord::Migration
  def self.up
    add_column :wines, :person_id, :integer, :null => false, :default => 0
  end

  def self.down
    remove_column :wines, :person_id
  end
end

redpajama_set_name: RedPajamaGithub


text:
counter=0
# -- Set up variables here ---------
import_file="sample.csv"  # !! must include an empty last line in the import file !!
export_file="devices.json"
table_name="Device"

agency="DPTI"  # the additional field to be put into each item
# ----------------------------------

echo "Generating .json import file ready for DynamoDB batchWrite()..."

# Create a new file and the starting content
> $export_file
echo "{" >> $export_file
echo "    \"${table_name}\": [" >> $export_file

IFS=","  # set delimiter to ","
counter=0
sed 1d "${import_file}" | {  # skip first line of file (column name)
    while read longitude latitude
    do  # for each line (item)
        # create hashed id for each item; use md5 hashing function
        id=$(echo -n $longitude$latitude$agency | md5sum | cut --delimiter=' ' --fields=1)
        # then write main content to file
        echo "        {" >> $export_file
        echo "            \"PutRequest\": {" >> $export_file
        echo "                \"Item\": {" >> $export_file
        echo "                    \"id\": {\"S\": \"${id}\"}," >> $export_file
        echo "                    \"longitude\": {\"N\": \"${longitude}\"}," >> $export_file
        echo "                    \"latitude\": {\"N\": \"${latitude}\"}," >> $export_file
        echo "                    \"agency\": {\"S\": \"${agency}\"}" >> $export_file
        echo "                }" >> $export_file
        echo "            }" >> $export_file
        printf "        },\n\n" >> $export_file

        ((counter++))
    done

    # wrap up the file
    truncate --size=-3 "${export_file}"  # remove the trailing bits (",\n\n") from the file
    printf "\n\n    ]\n" >> $export_file
    echo "}" >> $export_file

    printf "\nImport file \"$export_file\" generated! Added $counter items.\n"
}
# used command grouping to keep $counter inside the same subshell, otherwise a new counter will be created outside
# the while loop. More info: http://mywiki.wooledge.org/BashFAQ/024


text:
'use strict';

describe('filterWatcherProvider', function() {

  //helpers
  function n(n) { return n; }
  var stub = { fn: function(x) { return n(x) } };

  beforeEach(module('a8m.filter-watcher'));

  it('should have 2 main functions `isMemoized` and `memozie`', inject(function(filterWatcher) {
    expect(filterWatcher.isMemoized).toEqual(jasmine.any(Function));
    expect(filterWatcher.memoize).toEqual(jasmine.any(Function));
  }));

  it('should called the function if it\'s not cached',
    inject(function(filterWatcher) {
      var spy = spyOn(stub, 'fn');
      (function memoizedOnly(n) {
        return filterWatcher.isMemoized('fName',n) || stub.fn(n);
      })();
      expect(spy).toHaveBeenCalled();
      expect(spy.callCount).toEqual(1);
  }));

  it('should get the result from cache if it\'s memoize',
    inject(function(filterWatcher, $rootScope) {
      var scope = $rootScope.$new();
      var spy = spyOn(stub, 'fn').andCallFake(function() {
        return 1;
      });
      function memoize(n) {
        return filterWatcher.isMemoized('fName', n) ||
          filterWatcher.memoize('fName', n, scope, stub.fn(n));
      }
      [1,1,1,1,4,4,4,4,4].forEach(function(el) {
        memoize(el);
      });
      expect(spy).toHaveBeenCalled();
      expect(spy.callCount).toEqual(2);
  }));

  it('should clear cache from scope listeners on `$destroy`',
    inject(function(filterWatcher, $rootScope) {
      var scope;
      var spy = spyOn(stub, 'fn').andCallFake(function() {
        return 1;
      });
      function memoize(n) {
        return filterWatcher.isMemoized('fName', n) ||
          filterWatcher.memoize('fName', n, scope = $rootScope.$new(), stub.fn(n));
      }
      [1,1,1,1,1,1,1,1,1,1].forEach(function(el) {
        memoize(el);
        scope.$destroy();
      });
      expect(spy.callCount).toEqual(10);
    }));
});


text:
<?php
namespace Primal\Database;
use \PDO, \DateTime;

class Record extends \ArrayObject {
	/**
	 * Table column description cache
	 * @var array
	 * @static
	 * @access private
	 */
	static $keysreference;

	/**
	 * Record was found upon loading.
	 *
	 * @var boolean
	 */
	public $found = null;

	/**
	 * Name of the database the table resides in.  Optional, should only be set if the application needs to work on multiple databases.
	 *
	 * @var string
	 * @access protected
	 */
	protected $dbname;

	/**
	 * Name of the database table this model will be interfacing with.
	 *
	 * @var string
	 * @access protected
	 */
	protected $tablename;

	/**
	 * Array containing the table's column names.
	 * If not provided by the model subclass, Primal\Database\Record will query the database for the table description
	 *
	 * @var array
	 * @access protected
	 */
	protected $keys;

	/**
	 * Array containing the table's primary keys.
	 * If not provided by the model subclass, Primal\Database\Record will query the database for the table description
	 *
	 * @var array
	 * @access protected
	 */
	protected $primary;

	/**
	 * Name of the auto_increment field for the table, if one is defined in the schema.
	 * Auto-populated by Record if either $keys or $primary is omitted.
	 *
	 * @var array
	 * @access protected
	 */
	protected $auto_increment_field;

	/**
	 * PDO object used for communication with the server
	 * If this is not set by the descendent, Record attempts to use Connection::Link()
	 *
	 * @var array
	 * @access protected
	 */
	protected $pdolink;

	/**
	 * Exports the record contents as a named array.
	 *
	 * @return array
	 */
	public function export() {return $this->getArrayCopy();}

	/**
	 * Imports a named array into the record contents.
	 *
	 * @param array $in
	 */
	public function import($in) {
		$this->exchangeArray( array_merge($this->export(), $in) );
	}

	/**
	 * Primal\Database\Record is not intended to be used on it's own and should be implemented as a subclass for the specific model.
	 * However, in the case of quick and/or simple tasks, the class may be instantiated as a standalone object as such:
	 *
	 *		$o = new Record('TableName');
	 *
	 * If the Record is implemented as a subclass which defines the table name, the constructor does one of two things
	 * depending on the data passed to it.  If the argument is an array the argument is used as the initial record; otherwise
	 * the value is converted to a string and passed to the load() function as the primary key value.
	 *
	 * If the argument is absent, an empty record is instantiated.
	 *
	 * @param array|integer|string $o optional
	 */
	function __construct($o=null, $pdolink=null) {

		//set up our pdo link.  if one is provided, always use it. If not, verify that Primal\Database\Connection exists and then grab the default link.
		if ($pdolink !== null) $this->pdolink = $pdolink;
		elseif (!$this->pdolink && class_exists('\\Primal\\Database\\Connection')) $this->pdolink = Connection::Link();
		else throw new RecordException('Could not find Primal\\Database\\Connection, you must provide a PDO database link.');

		if ($o) {
			if (is_array($o)) {
				//if passed object is an array, load it into arrayaccess as if it were the record contents
				parent::__construct($o);
			} else {
				//if tablename is defined, assume $o is a primary key and load the record.
				//otherwise, assume $o is the table name and load the table definition.
				if ($this->tablename && $this->primary) $this->load($o);
				elseif (is_string($o)) {
					$this->tablename = $o;
					$this->_loadKeys();
				}
			}
		}
	}

	/**
	 * Returns the model's table name as an SQL ready string.  Includes the database name if defined.
	 *
	 * @return string
	 * @access protected
	 */
	protected function tablename() {
		if ($this->dbname) return "`{$this->dbname}`.`{$this->tablename}`";
		else return "`{$this->tablename}`";
	}

	/**
	 * Internal function to query the database for the table description.
	 *
	 * @return void
	 * @access private
	 */
	private function _loadKeys() {
		if (static::$keysreference[$this->tablename()]) {
			$this->keys = static::$keysreference[$this->tablename()]['keys'];
			$this->primary = static::$keysreference[$this->tablename()]['primary'];
			$this->auto_increment_field = static::$keysreference[$this->tablename()]['auto_increment_field'];
			return;
		}

		$tablename = $this->tablename();

		$qs = $this->pdolink->query("SHOW COLUMNS FROM {$tablename}");
		$rows = $qs->fetchAll(PDO::FETCH_ASSOC);

		foreach ($rows as $row) {
			$t = explode('(',$row['Type']);
			$this->keys[$row['Field']] = $t[0];
			if ($row['Key']=='PRI') $this->primary[] = $row['Field'];
			if ($row['Extra']=='auto_increment') $this->auto_increment_field = $row['Field'];
		}
		if (empty($this->keys)) throw new RecordException("Can not use Record: Couldn't load any table fields.",E_USER_ERROR);
		static::$keysreference[$this->tablename()]['keys'] = $this->keys;
		static::$keysreference[$this->tablename()]['primary'] = $this->primary;
		static::$keysreference[$this->tablename()]['auto_increment_field'] = $this->auto_increment_field;
	}

	/**
	 * Internal function to verify that all primary keys have been defined in the record when performing a save() or set()
	 *
	 * @return void
	 * @access private
	 */
	private function _testPrimarys() {
		foreach ($this->primary as $pkey) if (!isset($this[$pkey]) || $this[$pkey]===null) return false;
		return true;
	}

	/**
	 * Loads a record from the database.
	 *
	 * Syntax:
	 * 		$o->load()
	 *			Loads the record using primary keys already present in the record array.
	 *
	 * 		$o->load(value)
	 *			Loads the record using a single primary key value
	 *
	 * 		$o->load(value, columnName)
	 *			Loads the record using a single value in the named column.  If multiple rows are found with that value the first row returned is used.
	 *
	 * 		$o->load(array('columnName'=>'value', ... ))
	 *			Loads the record using a sequence of columnName/Value pairs.  Necessary if your table contains a multi-column primary key.
	 *
	 * @param integer|string|array $value optional The value of the primary key, an array of key/value pairs to search for.  If absent, the function will attempt to load using information already present in the record.
	 * @param string $field optional If $value is an integer or string, $field may be used to define a specific column name to search within.
	 * @return boolean True if a matching record was found
	 */
	public function load($value=null, $field=null) {

		//no value was defined, so we're just reloading the existing record using the primary key
		if ($value===null) {
			if (empty($this->primary)) $this->_loadKeys();
			$value = array();
			foreach ($this->primary as $fld) {
				//loop through all primary keys and verify they exist in the record
				//if they don't throw an exception.
				//if they do, add them to the search array
				if (!isset($this[$fld])) throw new RecordException("Can not load Record: No value supplied for primary key '$fld'.",E_USER_ERROR);
				else $value[$fld] = $this[$fld];
			}
		} else {

			//no field was defined and the value is not an array, so we assume primary key search.
			//test to make sure the primary key field is known
			if ($field===null && !is_array($value)) {
				if (empty($this->primary)) $this->_loadKeys();
				if (empty($this->primary)) throw new RecordException("Can not load Record: No field specified and table lacks primary keys.",E_USER_ERROR);
				$field = reset($this->primary);
			}

			//$value is not an array, so we're just performing a search on a single field.
			//create an array of search values
			if (!is_array($value)) {
				$value = array($field=>$value);
			}

		}

		//we should now have an array of column=>value pairs.

		//loop through the array and build a where string, storing the parameters in an indexed array
		$where = array();
		$data = array();
		foreach ($value as $column=>$param) {
			$where[] = "`{$column}` = :$column";
			$data[":$column"] = $param;
		}
		$where = implode(' AND ', $where);

		//now perform a prepared statement query using this data
		//if the data is loaded via the query, we're done.  if it isn't,
		//set the record to the passed values, but mark found as false
		if ($this->loadWhere($where, $data)) {
			return true;
		} else {
			$this->found = false;
			if (is_array($value)) $this->import($value);
			else $this[$field] = $value;
		}
	}

	/**
	 * Loads a record using a defined SQL WHERE clause.
	 *
	 * @param string $wherestring
	 * @return boolean True if a matching record was found
	 */
	function loadWhere($wherestring, $data=null) {
		$tablename = $this->tablename();

		$query = "SELECT {$tablename}.* FROM {$tablename} WHERE {$wherestring}";

		$qs = $this->pdolink->prepare($query);
		if ($data) $qs->execute($data);
		else $qs->execute();

		if ($qs->rowCount() > 0) {
			$this->import($qs->fetch(PDO::FETCH_ASSOC));
			$this->found = true;
			return true;
		} else {
			return false;
		}

	}

	/**
	 * Deletes the current record from the database using primary keys defined in the record
	 *
	 * @return void
	 */
	function delete() {
		$tablename = $this->tablename();
		if (!$this->tablename) throw new RecordException("Can not save Record: Missing table name.",E_USER_ERROR);
		if (!$this->_testPrimarys()) throw new RecordException("Can not delete Record: Missing values for primary keys.",E_USER_ERROR);

		$where = array();
		$data = array();
		foreach ($this->primary as $pkey) {
			$where[] = "`{$pkey}`= :$pkey";
			$data[":$pkey"] = $this[$pkey];
		}

		if (!empty($where) && !empty($data)) {
			$where = implode(' AND ',$where);
			$qs = $this->pdolink->prepare("DELETE FROM {$tablename} WHERE {$where}");
			$qs->execute($data);

			if ($qs->rowCount() > 0) {
				foreach ($this->primary as $pkey) unset($this[$pkey]);
				return true;
			} else {
				return false;
			}
		}
	}

	/**
	 * Saves the record to the database using the primary keys in the record.
	 *
	 * @param string $replacement optional Skips testing if the record already exists in the database and inserts to the table using a REPLACE query.
	 * @return boolean True is record was saved.
	 */
	function save($replacement=false) {
		$tablename = $this->tablename();
		if (!$this->tablename) throw new RecordException("Can not save Record: Missing table name.",E_USER_ERROR);
		if (empty($this->keys)) $this->_loadKeys();

		$where = array();
		$data = array();
		if ($replacement) {
			//if this is a replacement, set found to false to force an insert
			$this->found = false;

		} else {
			//if the record contains all the primary keys, build a where clause
			if ($this->_testPrimarys()) {
				foreach ($this->primary as $pkey) {
					$where[] = "`{$pkey}` = :$pkey";
					$data[":$pkey"] = $this[$pkey];
				}
				$wherestring = "WHERE ".implode(' AND ', $where);
			}

			//if we don't know that it exists check if it exists before we attempt to write the data
			if ($this->found === null && $where) {

				$qs = $this->pdolink->prepare("SELECT COUNT(*) FROM {$tablename} {$wherestring}");
				$qs->execute($data);
				if ($qs->rowCount() > 0 && array_shift($qs->fetch())) {
					$this->found = true;
				} else {
					$this->found = false;
				}
			}
		}

		//build the array of new data to be written into the DB.
		$set = array();
		$setdata = array();
		foreach ($this as $column=>$value)
			if (isset($this->keys[$column]) && $column != $this->auto_increment_field) {
			//for each field in the record that is also in the table schema, and isn't an auto-increment value
			$set[] = "`{$column}` = :set$column";
			$setdata[":set$column"] = $this->processValue($value, $this->keys[$column], $column);
		}
		$setstring = empty($set)?"":"SET ".implode(', ',$set);

		//build the query
		if ($this->found) {
			//record exists, so we're doing an update
			$query = "UPDATE {$tablename} $setstring $wherestring";
			$data = array_merge($data, $setdata);
		} else {
			$query = ($replacement?"REPLACE":"INSERT")." INTO {$tablename} $setstring";
			$data = $setdata;
		}

		//run the query
		$qs = $this->pdolink->prepare($query);
		if ($qs->execute($data)) {
			if (!$this->found && $this->auto_increment_field) {
				$this[$this->auto_increment_field] = $this->pdolink->lastInsertId();
			}
			$this->found = true;
			return true;
		} else {
			return false;
		}

	}

	/**
	 * Sets the specified field to the value supplied and updates the database with the change.  If record does not exist in database, it is created.
	 *
	 * @param string $field Column name
	 * @param string|integer $value Value to be set
	 */
	function set ($field, $value) {
		$tablename = $this->tablename();
		if (!$this->tablename) throw new RecordException("Can not save Record: Missing table name.",E_USER_ERROR);
		if (empty($this->keys)) $this->_loadKeys();
		if (!$this->_testPrimarys()) throw new RecordException("Can not save Record: Missing values for primary keys.",E_USER_ERROR);

		//key isn't in the schema, reject.
		if (!$this->keys[$field]) return false;

		//build the wherestring
		$where = array();
		$data = array();
		foreach ($this->primary as $pkey) {
			$where[] = "`{$pkey}` = :$pkey";
			$data[":$pkey"] = $this[$pkey];
		}
		$wherestring = "WHERE ".implode(' AND ',$where);

		//if we don't know if the record exists, verify
		if (!$this->found === null && $where) {
			$qs = $this->pdolink->prepare("SELECT COUNT(*) AS count FROM {$tablename} {$wherestring}");
			$qs->execute($data);
			if ($qs->rowCount() > 0) {
				$this->found = true;
			} else {
				$this->found = false;
			}
		}

		//set the value internally
		$this[$field]=$value;

		//if the record does exist, do a single column update.  Otherwise trigger a save call to create the record.
		if ($this->found) {
			$qs = $this->pdolink->prepare("UPDATE {$tablename} SET `{$field}`= :ABCD {$wherestring}");

			$data[':ABCD'] = $this->processValue($value, $this->keys[$field], $field);

			if ($qs->execute($data)) {
				return true;
			} else {
				return false;
			}
		} else {
			$this->save();
		}
	}

	/**
	 * Removes the named columns from the record set (blacklist)
	 *
	 * @param string|array $fields Column name(s) to remove
	 * @return void
	 */
	function filter() {
		$args = array();
		foreach (func_get_args() as $arg) {
			if (is_array($arg)) $args = array_merge($args, $arg);
			else $args[] = $arg;
		}

		foreach ($args as $column) {
			unset($this[$column]);
		}
	}

	/**
	 * Removes all columns not included in the passed set (whitelist)
	 *
	 * @param string|array $fields Column name(s) to remove
	 * @return void
	 */
	function allow() {
		$args = array();
		foreach (func_get_args() as $arg) {
			if (is_array($arg)) $args = array_merge($args, $arg);
			else $args[] = $arg;
		}

		foreach (array_keys($this->export()) as $column) {
			if (!in_array($column, $args)) unset($this[$column]);
		}
	}

	/**
	 * Internal function for escaping column values based on datatype.
	 * Used by save() and set() to ensure that data in the INSERT and UPDATE query is formatted correctly for the table.
	 *
	 * @param mixed $value Data to be escaped
	 * @param string $type Datatype to escape as.
	 * @access protected
	 */
	protected function processValue ($value, $type) {
		switch (strtolower($type)) {
			case 'date':
			case 'datetime':
			case 'timestamp':
				if ($value instanceof DateTime) return $value->format('Y-m-d H:i:s');
				if ($value==='') return "";
				if ($value==='now') return date('Y-m-d H:i:s');
				if ($value==='null' || is_null($value)) return null;
				if ($value==='none') return "00-00-00 00:00:00";
				if (is_integer($value)) return date('Y-m-d H:i:s', $value);

				return date('Y-m-d H:i:s', strtotime((string)$value));

			case 'bool':
			case 'int':
			case 'tinyint':
			case 'smallint':
			case 'mediumint':
			case 'bigint':
				return (int)$value;

			case 'decimal':
			case 'float':
			case 'double':
			case 'real':
				return (float)$value;

			default:
				return $value;
		}
	}

	/**
	 * Returns the requested field formatted as a date if the value is a valid date. Returns null otherwise.
	 *
	 * @param string $field Column name to retreive.
	 * @param string $format Optional, date() format string
	 * @return void
	 */
	function getDate($field, $format='m/d/Y') {
		if (!$this[$field]) return null;
		$time = strtotime($this[$field]);
		if ($time>0) return date($format, $time);
		return null;
	}

	/**
	 * Fetch an array of models containing the results of the request.
	 *
	 * Syntax:
	 * 		$results = $o->LoadMultiple()
	 * 			Fetches all rows in the table.
	 *
	 * 		$results = $o->LoadMultiple(array)
	 * 			Fetches all rows in the table that match the column=>value pairs passed in the array.
	 *
	 * 		$results = $o->LoadMultiple('ORDER BY ...')
	 * 			Fetches all rows in the table, ordered by a defined SQL ORDER clause.
	 *
	 * 		$results = $o->LoadMultiple('WHERE ...')
	 * 			Fetches all rows in the table which match a defined SQL WHERE clause.
	 *
	 * 		$results = $o->LoadMultiple('SELECT ...')
	 * 			Fetches all rows in the table using a defined SQL SELECT statement.  Necessary for performing custom joins.
	 *
	 * @param string $query
	 * @param string $field optional Array of data to be used for the prepared statement's parameters
	 * @return array
	 */
	static function LoadMultiple($query='', $data=null) {
		$o = new static();
		$tablename = $o->tablename();

		//received an array of column=>value pairs to search on.
		if (is_array($query) && $data==null) {
			//loop through the array and build a where string, storing the parameters in an indexed array
			$where = array();
			$data = array();
			foreach ($query as $column=>$param) {
				$where[] = "`{$column}` = :$column";
				$data[":$column"] = $param;
			}
			$query = "WHERE ".implode(' AND ', $where);
		}

		if (!$query) $fullquery = "SELECT {$tablename}.* FROM {$tablename}";
		else {
			$qb = array_shift(explode(' ',$query));
			switch (strtoupper($qb)) {
				case "INSERT":
				case "REPLACE":
				case "DELETE":
					throw new RecordException("You should not be using LoadMultiple for {$qb} queries");

				case "WHERE":
				case "GROUP":
				case "ORDER":
					$fullquery = "SELECT {$tablename}.* FROM {$tablename} {$query}";
					break;

				case "SELECT":
				default:
					$fullquery = $query;
					break;

			}
		}

		$qs = $o->pdolink->prepare($fullquery);
		$qs->execute($data);

		$results = array();
		if ($qs->rowCount() > 0) foreach ($qs->fetchAll(PDO::FETCH_ASSOC) as $row) {
			$o = new static($row);
			$o->found = true;
			$results[] = $o;
		}

		return $results;
	}

	/**
	 * Returns all records for the data model
	 *
	 * @param string $orderby optional mysql order by directive
	 * @param string $limit optional number of rows to return
	 * @param string $start optional starting position for rows returned
	 * @return array
	 */
	static function All($orderby='', $limit=0, $start=0) {
		$limit = $limit?"LIMIT ".(int)$start.', '.(int)$limit:'';
		$orderby = $orderby?"ORDER BY $orderby":'';
		return static::LoadMultiple(trim("$orderby $limit"));
	}

	/**
	 * Returns the total number of records in the data model
	 *
	 * @return integer
	 */
	static function Total() {
		$o = new static();
		$tablename = $o->tablename();
		$q = "SELECT COUNT(*) FROM {$tablename}";

		$qs = $o->pdolink->prepare($q);
		$qs->execute();

		$row = $qs->fetch(PDO::FETCH_NUM);
		return (int)$row[0];
	}

	/**
	 * Returns an array of single characters and the total number records starting with that character for the column provided
	 *
	 * @param string $colname
	 * @return array
	 */
	static function Index($colname) {
		$o = new static();
		$tablename = $o->tablename();
		$q = "SELECT LEFT(`$colname`, 1) AS `firstletter`, COUNT(*) AS `counter` FROM {$tablename} GROUP BY `firstletter` ORDER BY `$colname`";

		$qs = $o->pdolink->prepare($q);
		$qs->execute();

		return $qs->rowCount() ? $qs->fetchAll(PDO::FETCH_ASSOC) : array();
	}

	/**
	 * This is a development function only designed to help you build optimized Record objects.
	 * It is designed to be executed from a developer console and should never be used in actual code
	 *
	 * Syntax: Primal\Database\Record::BuildDefaults('tablename');
	 * Result: Outputs PHP code for pre-defining the column names and primary keys for the table your model accesses.
	 * Copy and paste the resulting code into your model's class declaration.
	 *
	 * @param string $tablename Name of the database table the model is created for.
	 * @return void
	 */
	public function BuildDefaults($tablename) {
		if (!$tablename) throw new RecordException("Can not build defaults: Missing table name.",E_USER_ERROR);

		$o = new self();
		$o->tablename = $tablename;
		$o->_loadKeys();

		echo "<pre>";

		echo 'var $tablename = '."'$tablename';\n";

		$ar = array();
		foreach ($o->primary as $key) $ar[] = "'$key'";
		echo 'var $primary = array(',"\n\t", implode(",\n\t",$ar), "\n);\n";
		if ($o->auto_increment_field) echo 'var $auto_increment_field = '."'$o->auto_increment_field';\n";

		$ar = array();
		foreach ($o->keys as $key=>$value) $ar[] = "'$key'=>'$value'";
		echo 'var $keys = array(',"\n\t", implode(",\n\t",$ar), "\n);\n";

		echo "</pre>";
	}

}

class RecordException extends \Exception {}


text:
package ua.com.fielden.platform.dom;

/**
 * Represents simple HTML tag's attribute that consists of name only. Useful for boolean attributes.
 *
 * @author TG Team
 *
 */
public class NoValueAttribute extends Attribute<Object> {

    public NoValueAttribute(final String name) {
        super(name, null, null);
    }
}


text:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="script-src http://127.0.0.1:* 'unsafe-inline'">
<script src="resources/dump-as-text.js"></script>
</head>
<body>
<script src="resources/inject-script.js"></script>
</body>
</html>


text:
package io.apiman.osgi.pax.testing;

import io.apiman.osgi.pax.testing.util.GatewayRestTestPlan;
import io.apiman.osgi.pax.testing.util.KarafConfiguration;
import org.junit.Rule;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.junit.PaxExamServer;

@RunWith(GatewayRestOSGITester.class)
@GatewayRestTestPlan("test-plans/api/api-testPlan.xml")
public class SimpleKarafTest {
}


text:
  Sainte-Colombe est
       un village
       situé dans le département de Côte-d'Or en Bourgogne. Elle comptait 67 habitants en 2008.

Le parc d'habitations, à Sainte-Colombe, était réparti en 2011 en zero appartements et 49 maisons soit
 un marché plutôt équilibré.

Si vous envisagez de demenager à Sainte-Colombe, vous pourrez aisément trouver une maison à acheter.

La commune propose quelques  équipements, elle propose entre autres un terrain de tennis.

À coté de Sainte-Colombe sont positionnées géographiquement les villes de
Braux localisée à 3 km, 181 habitants,
Charigny localisée à 2 km, 40 habitants,
Brain localisée à 5 km, 24 habitants,
Velogny localisée à 2 km, 36 habitants,
Marcilly-et-Dracy située à 4 km, 92 habitants,
Clamerey localisée à 5 km, 175 habitants,
 entre autres. De plus, Sainte-Colombe est située à seulement 23 km de Montbard.


text:
layout: post
title: "Ian Quinn presents at CU"
modified: 2014-11-20 21:46:13 -0700
tags: [music theory, Ian Quinn]
category: blog
image:
  teaser: iq-teaser.jpg
  feature:
  credit:
  creditlink:
comments: true
share: true
categories: [personal news]
---

Today my dissertation advisor from Yale gave a presentation at CU. It was part of the music theory & musicology colloquium series, and the computer science colloquium series. It was an engaging talk, and it was great to see such a mix of musicians and computer scientists taking an interest. Here are some photos from the colloquium.

[![](/media/iq/iq-4.jpg)](/media/iq/iq4.jpg)

[![](/media/iq/iq-3.jpg)](/media/iq/iq3.jpg)

[![](/media/iq/iq-2.jpg)](/media/iq/iq2.jpg)

[![](/media/iq/iq-1.jpg)](/media/iq/iq1.jpg)


text:
package seedu.address.ui;

import javafx.stage.Stage;
import seedu.address.logic.Logic;
import seedu.address.model.Model;

/**
 * API of UI component
 */
public interface Ui {

    /** Starts the UI (and the App).  */
    void start(Stage primaryStage);

    /** Stops the UI. */
    void stop();

    /** Sets the logic of the UI */
    public void setLogic(Logic logic);

    /** Sets the model of the UI */
    public void setModel(Model model);
}


text:
namespace gaalet
{

//default multivector element type
typedef double default_element_t;

template<typename EL, typename ER, bool EL_SIZE = (sizeof(EL) >= sizeof(ER))>
struct element_type_size_compare_traits;
template<typename EL, typename ER>
struct element_type_size_compare_traits<EL, ER, true>
{
   typedef EL element_t;
};
template<typename EL, typename ER>
struct element_type_size_compare_traits<EL, ER, false>
{
   typedef ER element_t;
};

template<typename EL, typename ER, bool EL_INT = std::numeric_limits<EL>::is_signed, bool ER_INT = std::numeric_limits<ER>::is_signed>
struct element_type_signed_traits;

template<typename EL, typename ER>
struct element_type_signed_traits<EL, ER, true, true>
{
   typedef typename element_type_size_compare_traits<EL, ER>::element_t element_t;
};
template<typename EL, typename ER>
struct element_type_signed_traits<EL, ER, false, false>
{
   typedef typename element_type_size_compare_traits<EL, ER>::element_t element_t;
};
template<typename EL, typename ER>
struct element_type_signed_traits<EL, ER, true, false>
{
   typedef EL element_t;
};
template<typename EL, typename ER>
struct element_type_signed_traits<EL, ER, false, true>
{
   typedef ER element_t;
};

template<typename EL, typename ER, bool EL_INT = std::numeric_limits<EL>::is_integer, bool ER_INT = std::numeric_limits<ER>::is_integer>
struct element_type_integer_traits;

template<typename EL, typename ER>
struct element_type_integer_traits<EL, ER, true, true>
{
   typedef typename element_type_signed_traits<EL, ER>::element_t element_t;
};
template<typename EL, typename ER>
struct element_type_integer_traits<EL, ER, false, false>
{
   typedef typename element_type_signed_traits<EL, ER>::element_t element_t;
};
template<typename EL, typename ER>
struct element_type_integer_traits<EL, ER, false, true>
{
   typedef EL element_t;
};
template<typename EL, typename ER>
struct element_type_integer_traits<EL, ER, true, false>
{
   typedef ER element_t;
};

template<typename EL, typename ER>
struct element_type_combination_traits
{
   typedef typename element_type_integer_traits<EL, ER>::element_t element_t;
};
template<typename E>
struct element_type_combination_traits<E, E>
{
   typedef E element_t;
};

//null element traits
template<typename E, bool is_integer>
struct null_element_type_traits {
   static constexpr E value = 0;
};
template<typename E>
struct null_element_type_traits<E, false> {
   static constexpr E value = 0.0;
};

template<typename E>
struct null_element {
   static constexpr E value() {
      return null_element_type_traits<E, std::numeric_limits<E>::is_integer>::value;
   }
};

} //end namespace gaalet

#endif


text:
package org.keycloak.testsuite.federation.ldap.noimport;

import org.junit.Assert;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
import org.keycloak.models.RealmModel;
import org.keycloak.models.UserModel;
import org.keycloak.testsuite.federation.ldap.LDAPMultipleAttributesTest;
import org.keycloak.testsuite.federation.ldap.LDAPTestAsserts;
import org.keycloak.testsuite.federation.ldap.LDAPTestContext;

/**
 * @author Marek Posolda
 */
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class LDAPMultipleAttributesNoImportTest extends LDAPMultipleAttributesTest {

    @Override
    protected boolean isImportEnabled() {
        return false;
    }

    @Test
    public void testUserImport() {
        testingClient.server().run(session -> {
            LDAPTestContext ctx = LDAPTestContext.init(session);
            session.userCache().clear();
            RealmModel appRealm = ctx.getRealm();

            // Test user NOT imported in local storage now. He is available just through "session.users()"
            UserModel user = session.users().getUserByUsername(appRealm, "jbrown");
            Assert.assertNotNull(user);
            Assert.assertNull(session.userLocalStorage().getUserById(appRealm, user.getId()));
            LDAPTestAsserts.assertUserImported(session.users(), appRealm, "jbrown", "James", "Brown", "jbrown@keycloak.org", "88441");
        });
    }

}


text:
/*
 * Z index layers:
 *
 * 0: Main screen
 * 10: Control bar
 * 50: Transition blocker
 * 60: Connection popups
 * 100: Status bar
 * ...
 * 1000: Javascript crash
 * ...
 * 10000: Max (used for polyfills)
 */

body {
  margin:0;
  padding:0;
  font-family: Helvetica;
  /*Background image with light grey curve.*/
  background-color:#494949;
  background-repeat:no-repeat;
  background-position:right bottom;
  height:100%;
  touch-action: none;
}

html {
  height:100%;
}

.noVNC_only_touch.noVNC_hidden {
  display: none;
}

.noVNC_disabled {
  color: rgb(128, 128, 128);
}

/* ----------------------------------------
 * Spinner
 * ----------------------------------------
 */

.noVNC_spinner {
  position: relative;
}
.noVNC_spinner, .noVNC_spinner::before, .noVNC_spinner::after {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  box-shadow: -60px 10px 0 rgba(255, 255, 255, 0);
  animation: noVNC_spinner 1.0s linear infinite;
}
.noVNC_spinner::before {
  content: "";
  position: absolute;
  left: 0px;
  top: 0px;
  animation-delay: -0.1s;
}
.noVNC_spinner::after {
  content: "";
  position: absolute;
  top: 0px;
  left: 0px;
  animation-delay: 0.1s;
}
@keyframes noVNC_spinner {
  0% { box-shadow: -60px 10px 0 rgba(255, 255, 255, 0); width: 20px; }
  25% { box-shadow: 20px 10px 0 rgba(255, 255, 255, 1); width: 10px; }
  50% { box-shadow: 60px 10px 0 rgba(255, 255, 255, 0); width: 10px; }
}

/* ----------------------------------------
 * Input Elements
 * ----------------------------------------
 */

input:not([type]),
input[type=date],
input[type=datetime-local],
input[type=email],
input[type=month],
input[type=number],
input[type=password],
input[type=search],
input[type=tel],
input[type=text],
input[type=time],
input[type=url],
input[type=week],
textarea {
  /* Disable default rendering */
  -webkit-appearance: none;
  -moz-appearance: none;
  background: none;

  margin: 2px;
  padding: 2px;
  border: 1px solid rgb(192, 192, 192);
  border-radius: 5px;
  color: black;
  background: linear-gradient(to top, rgb(255, 255, 255) 80%, rgb(240, 240, 240));
}

input[type=button],
input[type=color],
input[type=reset],
input[type=submit],
select {
  /* Disable default rendering */
  -webkit-appearance: none;
  -moz-appearance: none;
  background: none;

  margin: 2px;
  padding: 2px;
  border: 1px solid rgb(192, 192, 192);
  border-bottom-width: 2px;
  border-radius: 5px;
  color: black;
  background: linear-gradient(to top, rgb(255, 255, 255), rgb(240, 240, 240));

  /* This avoids it jumping around when :active */
  vertical-align: middle;
}

input[type=button],
input[type=color],
input[type=reset],
input[type=submit] {
  padding-left: 20px;
  padding-right: 20px;
}

option {
  color: black;
  background: white;
}

input:not([type]):focus,
input[type=button]:focus,
input[type=color]:focus,
input[type=date]:focus,
input[type=datetime-local]:focus,
input[type=email]:focus,
input[type=month]:focus,
input[type=number]:focus,
input[type=password]:focus,
input[type=reset]:focus,
input[type=search]:focus,
input[type=submit]:focus,
input[type=tel]:focus,
input[type=text]:focus,
input[type=time]:focus,
input[type=url]:focus,
input[type=week]:focus,
select:focus,
textarea:focus {
  box-shadow: 0px 0px 3px rgba(74, 144, 217, 0.5);
  border-color: rgb(74, 144, 217);
  outline: none;
}

input[type=button]::-moz-focus-inner,
input[type=color]::-moz-focus-inner,
input[type=reset]::-moz-focus-inner,
input[type=submit]::-moz-focus-inner {
  border: none;
}

input:not([type]):disabled,
input[type=button]:disabled,
input[type=color]:disabled,
input[type=date]:disabled,
input[type=datetime-local]:disabled,
input[type=email]:disabled,
input[type=month]:disabled,
input[type=number]:disabled,
input[type=password]:disabled,
input[type=reset]:disabled,
input[type=search]:disabled,
input[type=submit]:disabled,
input[type=tel]:disabled,
input[type=text]:disabled,
input[type=time]:disabled,
input[type=url]:disabled,
input[type=week]:disabled,
select:disabled,
textarea:disabled {
  color: rgb(128, 128, 128);
  background: rgb(240, 240, 240);
}

input[type=button]:active,
input[type=color]:active,
input[type=reset]:active,
input[type=submit]:active,
select:active {
  border-bottom-width: 1px;
  margin-top: 3px;
}

:root:not(.noVNC_touch) input[type=button]:hover:not(:disabled),
:root:not(.noVNC_touch) input[type=color]:hover:not(:disabled),
:root:not(.noVNC_touch) input[type=reset]:hover:not(:disabled),
:root:not(.noVNC_touch) input[type=submit]:hover:not(:disabled),
:root:not(.noVNC_touch) select:hover:not(:disabled) {
  background: linear-gradient(to top, rgb(255, 255, 255), rgb(250, 250, 250));
}

/* ----------------------------------------
 * WebKit centering hacks
 * ----------------------------------------
 */

.noVNC_center {
  /*
   * This is a workaround because webkit misrenders transforms and
   * uses non-integer coordinates, resulting in blurry content.
   * Ideally we'd use "top: 50%; transform: translateY(-50%);" on
   * the objects instead.
   */
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.noVNC_center > * {
  pointer-events: auto;
}
.noVNC_vcenter {
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  pointer-events: none;
}
.noVNC_vcenter > * {
  pointer-events: auto;
}

/* ----------------------------------------
 * Layering
 * ----------------------------------------
 */

.noVNC_connect_layer {
  z-index: 60;
}

/* ----------------------------------------
 * Fallback error
 * ----------------------------------------
 */

#noVNC_fallback_error {
  z-index: 1000;
  visibility: hidden;
}
#noVNC_fallback_error.noVNC_open {
  visibility: visible;
}

#noVNC_fallback_error > div {
  max-width: 90%;
  padding: 15px;

  transition: 0.5s ease-in-out;

  transform: translateY(-50px);
  opacity: 0;

  text-align: center;
  font-weight: bold;
  color: #fff;

  border-radius: 10px;
  box-shadow: 6px 6px 0px rgba(0, 0, 0, 0.5);
  background: rgba(200,55,55,0.8);
}
#noVNC_fallback_error.noVNC_open > div {
  transform: translateY(0);
  opacity: 1;
}

#noVNC_fallback_errormsg {
  font-weight: normal;
}

#noVNC_fallback_errormsg .noVNC_message {
  display: inline-block;
  text-align: left;
  font-family: monospace;
  white-space: pre-wrap;
}

#noVNC_fallback_error .noVNC_location {
  font-style: italic;
  font-size: 0.8em;
  color: rgba(255, 255, 255, 0.8);
}

#noVNC_fallback_error .noVNC_stack {
  max-height: 50vh;
  padding: 10px;
  margin: 10px;
  font-size: 0.8em;
  text-align: left;
  font-family: monospace;
  white-space: pre;
  border: 1px solid rgba(0, 0, 0, 0.5);
  background: rgba(0, 0, 0, 0.2);
  overflow: auto;
}

/* ----------------------------------------
 * Control Bar
 * ----------------------------------------
 */

#noVNC_control_bar_anchor {
  /* The anchor is needed to get z-stacking to work */
  position: fixed;
  z-index: 10;

  transition: 0.5s ease-in-out;

  /* Edge misrenders animations wihthout this */
  transform: translateX(0);
}
:root.noVNC_connected #noVNC_control_bar_anchor.noVNC_idle {
  opacity: 0.8;
}
#noVNC_control_bar_anchor.noVNC_right {
  left: auto;
  right: 0;
}

#noVNC_control_bar {
  position: relative;
  left: -100%;

  transition: 0.5s ease-in-out;

  background-color: rgb(110, 132, 163);
  border-radius: 0 10px 10px 0;

}
#noVNC_control_bar.noVNC_open {
  box-shadow: 6px 6px 0px rgba(0, 0, 0, 0.5);
  left: 0;
}
#noVNC_control_bar::before {
  /* This extra element is to get a proper shadow */
  content: "";
  position: absolute;
  z-index: -1;
  height: 100%;
  width: 30px;
  left: -30px;
  transition: box-shadow 0.5s ease-in-out;
}
#noVNC_control_bar.noVNC_open::before {
  box-shadow: 6px 6px 0px rgba(0, 0, 0, 0.5);
}
.noVNC_right #noVNC_control_bar {
  left: 100%;
  border-radius: 10px 0 0 10px;
}
.noVNC_right #noVNC_control_bar.noVNC_open {
  left: 0;
}
.noVNC_right #noVNC_control_bar::before {
  visibility: hidden;
}

#noVNC_control_bar_handle {
  position: absolute;
  left: -15px;
  top: 0;
  transform: translateY(35px);
  width: calc(100% + 30px);
  height: 50px;
  z-index: -1;
  cursor: pointer;
  border-radius: 5px;
  background-color: rgb(83, 99, 122);
  background-image: url("../images/handle_bg.svg");
  background-repeat: no-repeat;
  background-position: right;
  box-shadow: 3px 3px 0px rgba(0, 0, 0, 0.5);
}
#noVNC_control_bar_handle:after {
  content: "";
  transition: transform 0.5s ease-in-out;
  background: url("../images/handle.svg");
  position: absolute;
  top: 22px; /* (50px-6px)/2 */
  right: 5px;
  width: 5px;
  height: 6px;
}
#noVNC_control_bar.noVNC_open #noVNC_control_bar_handle:after {
  transform: translateX(1px) rotate(180deg);
}
:root:not(.noVNC_connected) #noVNC_control_bar_handle {
  display: none;
}
.noVNC_right #noVNC_control_bar_handle {
  background-position: left;
}
.noVNC_right #noVNC_control_bar_handle:after {
  left: 5px;
  right: 0;
  transform: translateX(1px) rotate(180deg);
}
.noVNC_right #noVNC_control_bar.noVNC_open #noVNC_control_bar_handle:after {
  transform: none;
}
#noVNC_control_bar_handle div {
  position: absolute;
  right: -35px;
  top: 0;
  width: 50px;
  height: 50px;
}
:root:not(.noVNC_touch) #noVNC_control_bar_handle div {
  display: none;
}
.noVNC_right #noVNC_control_bar_handle div {
  left: -35px;
  right: auto;
}

#noVNC_control_bar .noVNC_scroll {
  max-height: 100vh; /* Chrome is buggy with 100% */
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 10px 0 5px;
}
.noVNC_right #noVNC_control_bar .noVNC_scroll {
  padding: 0 5px 0 10px;
}

/* Control bar hint */
#noVNC_control_bar_hint {
  position: fixed;
  left: calc(100vw - 50px);
  right: auto;
  top: 50%;
  transform: translateY(-50%) scale(0);
  width: 100px;
  height: 50%;
  max-height: 600px;

  visibility: hidden;
  opacity: 0;
  transition: 0.2s ease-in-out;
  background: transparent;
  box-shadow: 0 0 10px black, inset 0 0 10px 10px rgba(110, 132, 163, 0.8);
  border-radius: 10px;
  transition-delay: 0s;
}
#noVNC_control_bar_anchor.noVNC_right #noVNC_control_bar_hint{
  left: auto;
  right: calc(100vw - 50px);
}
#noVNC_control_bar_hint.noVNC_active {
  visibility: visible;
  opacity: 1;
  transition-delay: 0.2s;
  transform: translateY(-50%) scale(1);
}

/* General button style */
.noVNC_button {
  display: block;
  padding: 4px 4px;
  margin: 10px 0;
  vertical-align: middle;
  border:1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
}
.noVNC_button.noVNC_selected {
  border-color: rgba(0, 0, 0, 0.8);
  background: rgba(0, 0, 0, 0.5);
}
.noVNC_button:disabled {
  opacity: 0.4;
}
.noVNC_button:focus {
  outline: none;
}
.noVNC_button:active {
  padding-top: 5px;
  padding-bottom: 3px;
}
/* Android browsers don't properly update hover state if touch events
 * are intercepted, but focus should be safe to display */
:root:not(.noVNC_touch) .noVNC_button.noVNC_selected:hover,
.noVNC_button.noVNC_selected:focus {
  border-color: rgba(0, 0, 0, 0.4);
  background: rgba(0, 0, 0, 0.2);
}
:root:not(.noVNC_touch) .noVNC_button:hover,
.noVNC_button:focus {
  background: rgba(255, 255, 255, 0.2);
}
.noVNC_button.noVNC_hidden {
  display: none;
}

/* Panels */
.noVNC_panel {
  transform: translateX(25px);

  transition: 0.5s ease-in-out;

  max-height: 100vh; /* Chrome is buggy with 100% */
  overflow-x: hidden;
  overflow-y: auto;

  visibility: hidden;
  opacity: 0;

  padding: 15px;

  background: #fff;
  border-radius: 10px;
  color: #000;
  border: 2px solid #E0E0E0;
  box-shadow: 6px 6px 0px rgba(0, 0, 0, 0.5);
}
.noVNC_panel.noVNC_open {
  visibility: visible;
  opacity: 1;
  transform: translateX(75px);
}
.noVNC_right .noVNC_vcenter {
  left: auto;
  right: 0;
}
.noVNC_right .noVNC_panel {
  transform: translateX(-25px);
}
.noVNC_right .noVNC_panel.noVNC_open {
  transform: translateX(-75px);
}

.noVNC_panel hr {
  border: none;
  border-top: 1px solid rgb(192, 192, 192);
}

.noVNC_panel label {
  display: block;
  white-space: nowrap;
}

.noVNC_panel .noVNC_heading {
  background-color: rgb(110, 132, 163);
  border-radius: 5px;
  padding: 5px;
  /* Compensate for padding in image */
  padding-right: 8px;
  color: white;
  font-size: 20px;
  margin-bottom: 10px;
  white-space: nowrap;
}
.noVNC_panel .noVNC_heading img {
  vertical-align: bottom;
}

.noVNC_submit {
  float: right;
}

/* Expanders */
.noVNC_expander {
  cursor: pointer;
}
.noVNC_expander::before {
  content: url("../images/expander.svg");
  display: inline-block;
  margin-right: 5px;
  transition: 0.2s ease-in-out;
}
.noVNC_expander.noVNC_open::before {
  transform: rotateZ(90deg);
}
.noVNC_expander ~ * {
  margin: 5px;
  margin-left: 10px;
  padding: 5px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 5px;
}
.noVNC_expander:not(.noVNC_open) ~ * {
  display: none;
}

/* Control bar content */

#noVNC_control_bar .noVNC_logo {
  font-size: 13px;
}

:root:not(.noVNC_connected) #noVNC_view_drag_button {
  display: none;
}

/* noVNC Touch Device only buttons */
:root:not(.noVNC_connected) #noVNC_mobile_buttons {
  display: none;
}
:root:not(.noVNC_touch) #noVNC_mobile_buttons {
  display: none;
}

/* Extra manual keys */
:root:not(.noVNC_connected) #noVNC_toggle_extra_keys_button {
  display: none;
}

#noVNC_modifiers {
  background-color: rgb(92, 92, 92);
  border: none;
  padding: 0 10px;
}

/* Shutdown/Reboot */
:root:not(.noVNC_connected) #noVNC_power_button {
  display: none;
}
#noVNC_power {
}
#noVNC_power_buttons {
  display: none;
}

#noVNC_power input[type=button] {
  width: 100%;
}

/* Clipboard */
:root:not(.noVNC_connected) #noVNC_clipboard_button {
  display: none;
}
#noVNC_clipboard {
  /* Full screen, minus padding and left and right margins */
  max-width: calc(100vw - 2*15px - 75px - 25px);
}
#noVNC_clipboard_text {
  width: 500px;
  max-width: 100%;
}

/* Settings */
#noVNC_settings {
}
#noVNC_settings ul {
  list-style: none;
  margin: 0px;
  padding: 0px;
}
#noVNC_setting_port {
  width: 80px;
}
#noVNC_setting_path {
  width: 100px;
}

/* Version */

.noVNC_version_wrapper {
  font-size: small;
}

.noVNC_version {
  margin-left: 1rem;
}

/* Connection Controls */
:root:not(.noVNC_connected) #noVNC_disconnect_button {
  display: none;
}

/* ----------------------------------------
 * Status Dialog
 * ----------------------------------------
 */

#noVNC_status {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  transform: translateY(-100%);

  cursor: pointer;

  transition: 0.5s ease-in-out;

  visibility: hidden;
  opacity: 0;

  padding: 5px;

  display: flex;
  flex-direction: row;
  justify-content: center;
  align-content: center;

  line-height: 25px;
  word-wrap: break-word;
  color: #fff;

  border-bottom: 1px solid rgba(0, 0, 0, 0.9);
}
#noVNC_status.noVNC_open {
  transform: translateY(0);
  visibility: visible;
  opacity: 1;
}

#noVNC_status::before {
  content: "";
  display: inline-block;
  width: 25px;
  height: 25px;
  margin-right: 5px;
}

#noVNC_status.noVNC_status_normal {
  background: rgba(128,128,128,0.9);
}
#noVNC_status.noVNC_status_normal::before {
  content: url("../images/info.svg") " ";
}
#noVNC_status.noVNC_status_error {
  background: rgba(200,55,55,0.9);
}
#noVNC_status.noVNC_status_error::before {
  content: url("../images/error.svg") " ";
}
#noVNC_status.noVNC_status_warn {
  background: rgba(180,180,30,0.9);
}
#noVNC_status.noVNC_status_warn::before {
  content: url("../images/warning.svg") " ";
}

/* ----------------------------------------
 * Connect Dialog
 * ----------------------------------------
 */

#noVNC_connect_dlg {
  transition: 0.5s ease-in-out;

  transform: scale(0, 0);
  visibility: hidden;
  opacity: 0;
}
#noVNC_connect_dlg.noVNC_open {
  transform: scale(1, 1);
  visibility: visible;
  opacity: 1;
}
#noVNC_connect_dlg .noVNC_logo {
  transition: 0.5s ease-in-out;
  padding: 10px;
  margin-bottom: 10px;

  font-size: 80px;
  text-align: center;

  border-radius: 5px;
}
@media (max-width: 440px) {
  #noVNC_connect_dlg {
    max-width: calc(100vw - 100px);
  }
  #noVNC_connect_dlg .noVNC_logo {
    font-size: calc(25vw - 30px);
  }
}
#noVNC_connect_button {
  cursor: pointer;

  padding: 10px;

  color: white;
  background-color: rgb(110, 132, 163);
  border-radius: 12px;

  text-align: center;
  font-size: 20px;

  box-shadow: 6px 6px 0px rgba(0, 0, 0, 0.5);
}
#noVNC_connect_button div {
  margin: 2px;
  padding: 5px 30px;
  border: 1px solid rgb(83, 99, 122);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: linear-gradient(to top, rgb(110, 132, 163), rgb(99, 119, 147));

  /* This avoids it jumping around when :active */
  vertical-align: middle;
}
#noVNC_connect_button div:active {
  border-bottom-width: 1px;
  margin-top: 3px;
}
:root:not(.noVNC_touch) #noVNC_connect_button div:hover {
  background: linear-gradient(to top, rgb(110, 132, 163), rgb(105, 125, 155));
}

#noVNC_connect_button img {
  vertical-align: bottom;
  height: 1.3em;
}

/* ----------------------------------------
 * Password Dialog
 * ----------------------------------------
 */

#noVNC_credentials_dlg {
  position: relative;

  transform: translateY(-50px);
}
#noVNC_credentials_dlg.noVNC_open {
  transform: translateY(0);
}
#noVNC_credentials_dlg ul {
  list-style: none;
  margin: 0px;
  padding: 0px;
}
.noVNC_hidden {
  display: none;
}

/* ----------------------------------------
 * Main Area
 * ----------------------------------------
 */

/* Transition screen */
#noVNC_transition {
  display: none;

  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;

  color: white;
  background: rgba(0, 0, 0, 0.5);
  z-index: 50;

  /*display: flex;*/
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
:root.noVNC_loading #noVNC_transition,
:root.noVNC_connecting #noVNC_transition,
:root.noVNC_disconnecting #noVNC_transition,
:root.noVNC_reconnecting #noVNC_transition {
  display: flex;
}
:root:not(.noVNC_reconnecting) #noVNC_cancel_reconnect_button {
  display: none;
}
#noVNC_transition_text {
  font-size: 1.5em;
}

/* Main container */
#noVNC_container {
  width: 100%;
  height: 100%;
  background-color: #313131;
  border-bottom-right-radius: 800px 600px;
  /*border-top-left-radius: 800px 600px;*/
}

#noVNC_keyboardinput {
  width: 1px;
  height: 1px;
  background-color: #fff;
  color: #fff;
  border: 0;
  position: absolute;
  left: -40px;
  z-index: -1;
  ime-mode: disabled;
}

/*Default noVNC logo.*/
/* From: http://fonts.googleapis.com/css?family=Orbitron:700 */
@font-face {
  font-family: 'Orbitron';
  font-style: normal;
  font-weight: 700;
  src: local('?'), url('Orbitron700.woff') format('woff'),
                   url('Orbitron700.ttf') format('truetype');
}

.noVNC_logo {
  color:yellow;
  font-family: 'Orbitron', 'OrbitronTTF', sans-serif;
  line-height:90%;
  text-shadow: 0.1em 0.1em 0 black;
}
.noVNC_logo span{
  color:green;
}

#noVNC_bell {
  display: none;
}

/* ----------------------------------------
 * Media sizing
 * ----------------------------------------
 */

@media screen and (max-width: 640px){
  #noVNC_logo {
    font-size: 150px;
  }
}

@media screen and (min-width: 321px) and (max-width: 480px) {
  #noVNC_logo {
    font-size: 110px;
  }
}

@media screen and (max-width: 320px) {
  #noVNC_logo {
    font-size: 90px;
  }
}


text:
package com.amazonaws.services.chimesdkmediapipelines.model;

import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;

/**
 *

 * The video artifact configuration object.
 *

 *
 * @see AWS API Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class VideoArtifactsConfiguration implements Serializable, Cloneable, StructuredPojo {

    /**
     *

     * Indicates whether the video artifact is enabled or disabled.
     *

     */
    private String state;
    /**
     *

     * The MUX type of the video artifact configuration object.
     *

     */
    private String muxType;

    /**
     *

     * Indicates whether the video artifact is enabled or disabled.
     *

     *
     * @param state
     *        Indicates whether the video artifact is enabled or disabled.
     * @see ArtifactsState
     */

    public void setState(String state) {
        this.state = state;
    }

    /**
     *

     * Indicates whether the video artifact is enabled or disabled.
     *

     *
     * @return Indicates whether the video artifact is enabled or disabled.
     * @see ArtifactsState
     */

    public String getState() {
        return this.state;
    }

    /**
     *

     * Indicates whether the video artifact is enabled or disabled.
     *

     *
     * @param state
     *        Indicates whether the video artifact is enabled or disabled.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see ArtifactsState
     */

    public VideoArtifactsConfiguration withState(String state) {
        setState(state);
        return this;
    }

    /**
     *

     * Indicates whether the video artifact is enabled or disabled.
     *

     *
     * @param state
     *        Indicates whether the video artifact is enabled or disabled.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see ArtifactsState
     */

    public VideoArtifactsConfiguration withState(ArtifactsState state) {
        this.state = state.toString();
        return this;
    }

    /**
     *

     * The MUX type of the video artifact configuration object.
     *

     *
     * @param muxType
     *        The MUX type of the video artifact configuration object.
     * @see VideoMuxType
     */

    public void setMuxType(String muxType) {
        this.muxType = muxType;
    }

    /**
     *

     * The MUX type of the video artifact configuration object.
     *

     *
     * @return The MUX type of the video artifact configuration object.
     * @see VideoMuxType
     */

    public String getMuxType() {
        return this.muxType;
    }

    /**
     *

     * The MUX type of the video artifact configuration object.
     *

     *
     * @param muxType
     *        The MUX type of the video artifact configuration object.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see VideoMuxType
     */

    public VideoArtifactsConfiguration withMuxType(String muxType) {
        setMuxType(muxType);
        return this;
    }

    /**
     *

     * The MUX type of the video artifact configuration object.
     *

     *
     * @param muxType
     *        The MUX type of the video artifact configuration object.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see VideoMuxType
     */

    public VideoArtifactsConfiguration withMuxType(VideoMuxType muxType) {
        this.muxType = muxType.toString();
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getState() != null)
            sb.append("State: ").append(getState()).append(",");
        if (getMuxType() != null)
            sb.append("MuxType: ").append(getMuxType());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof VideoArtifactsConfiguration == false)
            return false;
        VideoArtifactsConfiguration other = (VideoArtifactsConfiguration) obj;
        if (other.getState() == null ^ this.getState() == null)
            return false;
        if (other.getState() != null && other.getState().equals(this.getState()) == false)
            return false;
        if (other.getMuxType() == null ^ this.getMuxType() == null)
            return false;
        if (other.getMuxType() != null && other.getMuxType().equals(this.getMuxType()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getState() == null) ? 0 : getState().hashCode());
        hashCode = prime * hashCode + ((getMuxType() == null) ? 0 : getMuxType().hashCode());
        return hashCode;
    }

    @Override
    public VideoArtifactsConfiguration clone() {
        try {
            return (VideoArtifactsConfiguration) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

    @com.amazonaws.annotation.SdkInternalApi
    @Override
    public void marshall(ProtocolMarshaller protocolMarshaller) {
        com.amazonaws.services.chimesdkmediapipelines.model.transform.VideoArtifactsConfigurationMarshaller.getInstance().marshall(this, protocolMarshaller);
    }
}