text:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.System;
using Windows.UI.Core;
using Windows.UI.ViewManagement;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;

namespace CJia.MobileMedicalDoctor.App.Common
{
    /// <summary>
    /// 提供几方面重要便利的 Page 的典型实现:
    /// <list type="bullet">
    /// <item>
    /// <description>应用程序视图状态到可视状态的映射</description>
    /// </item>
    /// <item>
    /// <description>GoBack、GoForward 和 GoHome 事件处理程序</description>
    /// </item>
    /// <item>
    /// <description>用于导航的鼠标和键盘快捷键</description>
    /// </item>
    /// <item>
    /// <description>用于导航和进程生命期管理的状态管理</description>
    /// </item>
    /// <item>
    /// <description>默认视图模型</description>
    /// </item>
    /// </list>
    /// </summary>
    [Windows.Foundation.Metadata.WebHostHidden]
    public class LayoutAwarePage : Page
    {
        /// <summary>
        /// 标识 <see cref="DefaultViewModel"/> 依赖属性。
        /// </summary>
        public static readonly DependencyProperty DefaultViewModelProperty =
            DependencyProperty.Register("DefaultViewModel", typeof(IObservableMap<String, Object>),
            typeof(LayoutAwarePage), null);

        private List<Control> _layoutAwareControls;

        /// <summary>
        /// 初始化 <see cref="LayoutAwarePage"/> 类的新实例。
        /// </summary>
        public LayoutAwarePage()
        {
            if (Windows.ApplicationModel.DesignMode.DesignModeEnabled) return;

            // 创建空默认视图模型
            this.DefaultViewModel = new ObservableDictionary<String, Object>();

            // 当此页是可视化树的一部分时,进行两个更改:
            // 1) 将应用程序视图状态映射到页的可视状态
            // 2) 处理键盘和鼠标导航请求
            this.Loaded += (sender, e) =>
            {
                this.StartLayoutUpdates(sender, e);

                // 仅当占用整个窗口时,键盘和鼠标导航才适用
                if (this.ActualHeight == Window.Current.Bounds.Height &&
                    this.ActualWidth == Window.Current.Bounds.Width)
                {
                    // 直接侦听窗口,因此无需焦点
                    Window.Current.CoreWindow.Dispatcher.AcceleratorKeyActivated +=
                        CoreDispatcher_AcceleratorKeyActivated;
                    Window.Current.CoreWindow.PointerPressed +=
                        this.CoreWindow_PointerPressed;
                }
            };

            // 当页不再可见时,撤消相同更改
            this.Unloaded += (sender, e) =>
            {
                this.StopLayoutUpdates(sender, e);
                Window.Current.CoreWindow.Dispatcher.AcceleratorKeyActivated -=
                    CoreDispatcher_AcceleratorKeyActivated;
                Window.Current.CoreWindow.PointerPressed -=
                    this.CoreWindow_PointerPressed;
            };
        }

        /// <summary>
        /// <see cref="IObservableMap<String, Object>"/> 的实现,该实现旨在
        /// 用作普通视图模型。
        /// </summary>
        protected IObservableMap<String, Object> DefaultViewModel
        {
            get
            {
                return this.GetValue(DefaultViewModelProperty) as IObservableMap<String, Object>;
            }

            set
            {
                this.SetValue(DefaultViewModelProperty, value);
            }
        }

        #region 导航支持

        /// <summary>
        /// 作为事件处理程序进行调用,以向后导航页的关联
        /// <see cref="Frame"/>,直至它达到导航堆栈顶部。
        /// </summary>
        /// <param name="sender">触发事件的实例。</param>
        /// <param name="e">描述导致事件的条件的事件数据。</param>
        protected virtual void GoHome(object sender, RoutedEventArgs e)
        {
            // 使用导航框架返回最顶层的页
            if (this.Frame != null)
            {
                while (this.Frame.CanGoBack) this.Frame.GoBack();
            }
        }

        /// <summary>
        /// 作为事件处理程序进行调用,以向后导航与此页的 <see cref="Frame"/>
        /// 关联的导航堆栈。
        /// </summary>
        /// <param name="sender">触发事件的实例。</param>
        /// <param name="e">描述导致事件的条件的事件
        /// 数据。</param>
        protected virtual void GoBack(object sender, RoutedEventArgs e)
        {
            // 使用导航框架返回上一页
            if (this.Frame != null && this.Frame.CanGoBack) this.Frame.GoBack();
        }

        /// <summary>
        /// 作为事件处理程序进行调用,以向后导航导航堆栈
        /// 关联的导航堆栈。
        /// </summary>
        /// <param name="sender">触发事件的实例。</param>
        /// <param name="e">描述导致事件的条件的事件
        /// 数据。</param>
        protected virtual void GoForward(object sender, RoutedEventArgs e)
        {
            // 使用导航框架移至下一页
            if (this.Frame != null && this.Frame.CanGoForward) this.Frame.GoForward();
        }

        /// <summary>
        /// 当此页处于活动状态并占用整个窗口时,在每次
        /// 击键(包括系统键,如 Alt 组合键)时调用。用于检测页之间的键盘
        /// 导航(即使在页本身没有焦点时)。
        /// </summary>
        /// <param name="sender">触发事件的实例。</param>
        /// <param name="args">描述导致事件的条件的事件数据。</param>
        private void CoreDispatcher_AcceleratorKeyActivated(CoreDispatcher sender,
            AcceleratorKeyEventArgs args)
        {
            var virtualKey = args.VirtualKey;

            // 仅当按向左、向右或专用上一页或下一页键时才进一步
            // 调查
            if ((args.EventType == CoreAcceleratorKeyEventType.SystemKeyDown ||
                args.EventType == CoreAcceleratorKeyEventType.KeyDown) &&
                (virtualKey == VirtualKey.Left || virtualKey == VirtualKey.Right ||
                (int)virtualKey == 166 || (int)virtualKey == 167))
            {
                var coreWindow = Window.Current.CoreWindow;
                var downState = CoreVirtualKeyStates.Down;
                bool menuKey = (coreWindow.GetKeyState(VirtualKey.Menu) & downState) == downState;
                bool controlKey = (coreWindow.GetKeyState(VirtualKey.Control) & downState) == downState;
                bool shiftKey = (coreWindow.GetKeyState(VirtualKey.Shift) & downState) == downState;
                bool noModifiers = !menuKey && !controlKey && !shiftKey;
                bool onlyAlt = menuKey && !controlKey && !shiftKey;

                if (((int)virtualKey == 166 && noModifiers) ||
                    (virtualKey == VirtualKey.Left && onlyAlt))
                {
                    // 在按上一页键或 Alt+向左键时向后导航
                    args.Handled = true;
                    this.GoBack(this, new RoutedEventArgs());
                }
                else if (((int)virtualKey == 167 && noModifiers) ||
                    (virtualKey == VirtualKey.Right && onlyAlt))
                {
                    // 在按下一页键或 Alt+向右键时向前导航
                    args.Handled = true;
                    this.GoForward(this, new RoutedEventArgs());
                }
            }
        }

        /// <summary>
        /// 当此页处于活动状态并占用整个窗口时,在每次鼠标单击、触摸屏点击
        /// 或执行等效交互时调用。用于检测浏览器样式下一页和
        /// 上一步鼠标按钮单击以在页之间导航。
        /// </summary>
        /// <param name="sender">触发事件的实例。</param>
        /// <param name="args">描述导致事件的条件的事件数据。</param>
        private void CoreWindow_PointerPressed(CoreWindow sender,
            PointerEventArgs args)
        {
            var properties = args.CurrentPoint.Properties;

            // 忽略与鼠标左键、右键和中键的键关联
            if (properties.IsLeftButtonPressed || properties.IsRightButtonPressed ||
                properties.IsMiddleButtonPressed) return;

            // 如果按下后退或前进(但不是同时),则进行相应导航
            bool backPressed = properties.IsXButton1Pressed;
            bool forwardPressed = properties.IsXButton2Pressed;
            if (backPressed ^ forwardPressed)
            {
                args.Handled = true;
                if (backPressed) this.GoBack(this, new RoutedEventArgs());
                if (forwardPressed) this.GoForward(this, new RoutedEventArgs());
            }
        }

        #endregion

        #region 可视状态切换

        /// <summary>
        /// 作为事件处理程序调用,通常是在页中发生 <see cref="Control"/> 的
        /// <see cref="FrameworkElement.Loaded"/> 事件时,以指示发送方应
        /// 开始接收与应用程序视图状态更改对应的可视状态
        /// 管理更改。
        /// </summary>
        /// <param name="sender">支持与视图状态对应的可视状态
        /// 管理的 <see cref="Control"/> 实例。</param>
        /// <param name="e">描述如何进行请求的事件数据。</param>
        /// <remarks>在请求布局更新时,会立即使用当前视图
        /// 状态设置对应可视状态。强烈建议使用连接到 <see cref="StopLayoutUpdates"/>
        /// 的对应 <see cref="FrameworkElement.Unloaded"/> 事件
        /// 处理程序。<see cref="LayoutAwarePage"/> 的实例
        /// 会自动在其 Loaded 和 Unloaded 事件中调用这些
        /// 处理程序。</remarks>
        /// <seealso cref="DetermineVisualState"/>
        /// <seealso cref="InvalidateVisualState"/>
        public void StartLayoutUpdates(object sender, RoutedEventArgs e)
        {
            var control = sender as Control;
            if (control == null) return;
            if (this._layoutAwareControls == null)
            {
                // 当更新中存在相关控件时,开始侦听视图状态更改
                Window.Current.SizeChanged += this.WindowSizeChanged;
                this._layoutAwareControls = new List<Control>();
            }
            this._layoutAwareControls.Add(control);

            // 设置控件的初始可视状态
            VisualStateManager.GoToState(control, DetermineVisualState(ApplicationView.Value), false);
        }

        private void WindowSizeChanged(object sender, WindowSizeChangedEventArgs e)
        {
            this.InvalidateVisualState();
        }

        /// <summary>
        /// 作为事件处理程序调用,通常是在发生 <see cref="Control"/> 的
        /// <see cref="FrameworkElement.Unloaded"/> 事件时,以指示发送方应开始接收
        /// 与应用程序视图状态更改对应的可视状态管理更改。
        /// </summary>
        /// <param name="sender">支持与视图状态对应的可视状态
        /// 管理的 <see cref="Control"/> 实例。</param>
        /// <param name="e">描述如何进行请求的事件数据。</param>
        /// <remarks>在请求布局更新时,会立即使用当前视图
        /// 状态设置对应可视状态。</remarks>
        /// <seealso cref="StartLayoutUpdates"/>
        public void StopLayoutUpdates(object sender, RoutedEventArgs e)
        {
            var control = sender as Control;
            if (control == null || this._layoutAwareControls == null) return;
            this._layoutAwareControls.Remove(control);
            if (this._layoutAwareControls.Count == 0)
            {
                // 当更新中没有相关控件时,停止侦听视图状态更改
                this._layoutAwareControls = null;
                Window.Current.SizeChanged -= this.WindowSizeChanged;
            }
        }

        /// <summary>
        /// 针对页中的可视状态管理将 <see cref="ApplicationViewState"/> 值
        /// 转换为字符串。默认实现使用枚举值的名称。
        /// 子类可以重写此方法以控制使用的映射方案。
        /// </summary>
        /// <param name="viewState">需要可视状态的视图状态。</param>
        /// <returns>用于驱动
        /// <see cref="VisualStateManager"/> 的可视状态名称</returns>
        /// <seealso cref="InvalidateVisualState"/>
        protected virtual string DetermineVisualState(ApplicationViewState viewState)
        {
            return viewState.ToString();
        }

        /// <summary>
        /// 使用正确的可视状态更新侦听可视状态更改的
        /// 所有控件。
        /// </summary>
        /// <remarks>
        /// 通常与重写 <see cref="DetermineVisualState"/> 结合使用以
        ///  通知可能返回了不同值,即使未更改视图状态也是
        /// 如此。
        /// </remarks>
        public void InvalidateVisualState()
        {
            if (this._layoutAwareControls != null)
            {
                string visualState = DetermineVisualState(ApplicationView.Value);
                foreach (var layoutAwareControl in this._layoutAwareControls)
                {
                    VisualStateManager.GoToState(layoutAwareControl, visualState, false);
                }
            }
        }

        #endregion

        #region 进程生命期管理

        private String _pageKey;

        /// <summary>
        /// 在此页将要在 Frame 中显示时进行调用。
        /// </summary>
        /// <param name="e">描述如何访问此页的事件数据。Parameter
        /// 属性提供要显示的组。</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            // 通过导航返回缓存页不应触发状态加载
            if (this._pageKey != null) return;

            var frameState = SuspensionManager.SessionStateForFrame(this.Frame);
            this._pageKey = "Page-" + this.Frame.BackStackDepth;

            if (e.NavigationMode == NavigationMode.New)
            {
                // 在向导航堆栈添加新页时清除向前导航的
                // 现有状态
                var nextPageKey = this._pageKey;
                int nextPageIndex = this.Frame.BackStackDepth;
                while (frameState.Remove(nextPageKey))
                {
                    nextPageIndex++;
                    nextPageKey = "Page-" + nextPageIndex;
                }

                // 将导航参数传递给新页
                this.LoadState(e.Parameter, null);
            }
            else
            {
                // 通过将相同策略用于加载挂起状态并从缓存重新创建
                // 放弃的页,将导航参数和保留页状态传递
                // 给页
                this.LoadState(e.Parameter, (Dictionary<String, Object>)frameState[this._pageKey]);
            }
        }

        /// <summary>
        /// 当此页不再在 Frame 中显示时调用。
        /// </summary>
        /// <param name="e">描述如何访问此页的事件数据。Parameter
        /// 属性提供要显示的组。</param>
        protected override void OnNavigatedFrom(NavigationEventArgs e)
        {
            var frameState = SuspensionManager.SessionStateForFrame(this.Frame);
            var pageState = new Dictionary<String, Object>();
            this.SaveState(pageState);
            frameState[_pageKey] = pageState;
        }

        /// <summary>
        /// 使用在导航过程中传递的内容填充页。在从以前的会话
        /// 重新创建页时,也会提供任何已保存状态。
        /// </summary>
        /// <param name="navigationParameter">最初请求此页时传递给
        /// <see cref="Frame.Navigate(Type, Object)"/> 的参数值。
        /// </param>
        /// <param name="pageState">此页在以前会话期间保留的状态
        /// 字典。首次访问页面时为 null。</param>
        protected virtual void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)
        {
        }

        /// <summary>
        /// 保留与此页关联的状态,以防挂起应用程序或
        /// 从导航缓存中放弃此页。值必须符合
        /// <see cref="SuspensionManager.SessionState"/> 的序列化要求。
        /// </summary>
        /// <param name="pageState">要使用可序列化状态填充的空字典。</param>
        protected virtual void SaveState(Dictionary<String, Object> pageState)
        {
        }

        #endregion

        /// <summary>
        /// 支持重新进入以用作默认视图模型的 IObservableMap 的
        /// 实现。
        /// </summary>
        private class ObservableDictionary<K, V> : IObservableMap<K, V>
        {
            private class ObservableDictionaryChangedEventArgs : IMapChangedEventArgs<K>
            {
                public ObservableDictionaryChangedEventArgs(CollectionChange change, K key)
                {
                    this.CollectionChange = change;
                    this.Key = key;
                }

                public CollectionChange CollectionChange { get; private set; }
                public K Key { get; private set; }
            }

            private Dictionary<K, V> _dictionary = new Dictionary<K, V>();
            public event MapChangedEventHandler<K, V> MapChanged;

            private void InvokeMapChanged(CollectionChange change, K key)
            {
                var eventHandler = MapChanged;
                if (eventHandler != null)
                {
                    eventHandler(this, new ObservableDictionaryChangedEventArgs(change, key));
                }
            }

            public void Add(K key, V value)
            {
                this._dictionary.Add(key, value);
                this.InvokeMapChanged(CollectionChange.ItemInserted, key);
            }

            public void Add(KeyValuePair<K, V> item)
            {
                this.Add(item.Key, item.Value);
            }

            public bool Remove(K key)
            {
                if (this._dictionary.Remove(key))
                {
                    this.InvokeMapChanged(CollectionChange.ItemRemoved, key);
                    return true;
                }
                return false;
            }

            public bool Remove(KeyValuePair<K, V> item)
            {
                V currentValue;
                if (this._dictionary.TryGetValue(item.Key, out currentValue) &&
                    Object.Equals(item.Value, currentValue) && this._dictionary.Remove(item.Key))
                {
                    this.InvokeMapChanged(CollectionChange.ItemRemoved, item.Key);
                    return true;
                }
                return false;
            }

            public V this[K key]
            {
                get
                {
                    return this._dictionary[key];
                }
                set
                {
                    this._dictionary[key] = value;
                    this.InvokeMapChanged(CollectionChange.ItemChanged, key);
                }
            }

            public void Clear()
            {
                var priorKeys = this._dictionary.Keys.ToArray();
                this._dictionary.Clear();
                foreach (var key in priorKeys)
                {
                    this.InvokeMapChanged(CollectionChange.ItemRemoved, key);
                }
            }

            public ICollection<K> Keys
            {
                get { return this._dictionary.Keys; }
            }

            public bool ContainsKey(K key)
            {
                return this._dictionary.ContainsKey(key);
            }

            public bool TryGetValue(K key, out V value)
            {
                return this._dictionary.TryGetValue(key, out value);
            }

            public ICollection<V> Values
            {
                get { return this._dictionary.Values; }
            }

            public bool Contains(KeyValuePair<K, V> item)
            {
                return this._dictionary.Contains(item);
            }

            public int Count
            {
                get { return this._dictionary.Count; }
            }

            public bool IsReadOnly
            {
                get { return false; }
            }

            public IEnumerator<KeyValuePair<K, V>> GetEnumerator()
            {
                return this._dictionary.GetEnumerator();
            }

            System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
            {
                return this._dictionary.GetEnumerator();
            }

            public void CopyTo(KeyValuePair<K, V>[] array, int arrayIndex)
            {
                int arraySize = array.Length;
                foreach (var pair in this._dictionary)
                {
                    if (arrayIndex >= arraySize) break;
                    array[arrayIndex++] = pair;
                }
            }
        }
    }
}


text:
public class Main
{
    private static int number = 7;
    private int id;

    public static void function(){
        System.out.println( "Hello World" );
    }

    public static int function2( int i ){
        return 2 * i;
    }

    public Main(){
        id = 2 * number;
    }

    public int getId(){
        return id;
    }
}

redpajama_set_name: RedPajamaGithub


text:
author: veronicab
comments: true
date: 2012-08-26 23:14:48+00:00
layout: post
slug: next-bundle-of-masses-at-mulgoa
title: Next bundle of Masses at Mulgoa
wordpress_id: 659
categories:
- Missa cantata
- Mulgoa
---

**Wed 12th September:** Holy Name of Mary (Introit Vultum tuum, like we did for [St Mary of the Cross]({{ site.url }}/2012/08/05/st-mary-of-the-cross/), Offertory [Ave Maria]({{ site.url }}/2012/05/18/ave-maria/), Communion: [Beata Viscera](http://www.youtube.com/watch?v=t6orwO3w8og) which sounds very familiar.  Mass 9. No Credo! (it's only a 3rd class feast)

**Fri 14th September:** [Exaltation of the Holy Cross](http://sacredheartchoir.blogspot.com.au/2008/08/exaltation-of-holy-cross.html) or [St Benedict's, Sao Paolo](http://www.christusrex.org/www2/cantgreg/missa_in_exaltatione_sanctae_crucis.html).  Introit and Gradual from Holy Thursday.  Mass 4.

**Sun 16th September:** 16th Sunday after Pentecost - see [Rene Goupil](http://www.renegoupil.org) or [St Benedict's Sao Paolo](http://www.christusrex.org/www2/cantgreg/trid_dXVIpostPentecosten.html).  Mass 11.

So, who's up for what?  Starting now we should be able to do a fair bit out of the Liber.  But it's quite okay to pace yourself and only take on what you can.  But if I know now it helps - my blood pressure if nothing else.


text:
<!--
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements. See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership. The ASF licenses this file
  to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License. You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, either express or implied. See the License for the
  specific language governing permissions and limitations
  under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.apache.cloudstack</groupId>
    <artifactId>cloudstack-framework</artifactId>
    <version>4.10.0.0-SNAPSHOT</version>
    <relativePath>../pom.xml</relativePath>
  </parent>
  <artifactId>cloud-framework-rest</artifactId>
  <name>Apache CloudStack Framework - REST</name>
  <build>
  </build>
  <dependencies>
    <dependency>
      <groupId>com.fasterxml.jackson.module</groupId>
      <artifactId>jackson-module-jaxb-annotations</artifactId>
      <version>${cs.jackson.version}</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-annotations</artifactId>
      <version>${cs.jackson.version}</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-core</artifactId>
      <version>${cs.jackson.version}</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>${cs.jackson.version}</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.jaxrs</groupId>
      <artifactId>jackson-jaxrs-json-provider</artifactId>
      <version>${cs.jackson.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-frontend-jaxrs</artifactId>
      <version>${cs.cxf.version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.eclipse.jetty</groupId>
          <artifactId>jetty-server</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-servlet_3.0_spec</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.sun.xml.bind</groupId>
          <artifactId>jaxb-impl</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
  </dependencies>
</project>


text:
/**
*Course: EG1302A - Spring 2014
*Name: Aaron Rodriguez
*Date Created: 01/28/2014
*Assignment: Assignment05
**/

#include <stdio.h>
#include <stdlib.h>

int main()
{
    printf("Example 1\n\n");

    //This example is how he information in the
    //comments on the very top looks like printed out on screen

    printf("Course: EG1302A - Spring 2014\n");
    printf("Name: Aaron Rodriguez\n");
    printf("Date Created: %d/%d/%d\n",1,28,2014);
    printf("Assignment: Assignment05\n\n");

    printf("Example 2\n\n");

    /*This examples shows the following information with no whitespace*/

    printf("Course:EG1302A-Spring2014");
    printf("Name:AaronRodriguez");
    printf("DateCreated:%d/%d/%d",1,28,2014);
    printf("Assignment:Assignment05\n\n");

    printf("Example 3\n\n");

    /*This examples shows the following information with too much whitespace*/

    printf("Course:\nEG1302A\n-\nSpring\n2014\n");
    printf("Name:\nAaron\nRodriguez\n");
    printf("Date\nCreated:\n%d/\n%d/\n%d\n",1,28,2014);
    printf("Assignment:\nAssignment05");

    return 0;
}


text:
'use strict';

// Export class for use
module.exports = {

  // Create a task object for consumption in the queue
  create: require('./create'),

  // Loads an array of tasks from a file
  load: require('./load'),

  // Validate the incoming task schema
  validate: require('./validate'),

  // Specify file formats to use
  format: require('./format'),

  // List files to be handled during this task
  listing: require('./listing')
};


text:
typedef NS_OPTIONS(NSUInteger, EXAudioInterruptionMode)
{
  EXAudioInterruptionModeMixWithOthers = 0,
  EXAudioInterruptionModeDoNotMix      = 1,
  EXAudioInterruptionModeDuckOthers    = 2
};

typedef NS_OPTIONS(NSUInteger, EXAudioRecordingOptionBitRateStrategy)
{
  EXAudioRecordingOptionBitRateStrategyConstant            = 0,
  EXAudioRecordingOptionBitRateStrategyLongTermAverage     = 1,
  EXAudioRecordingOptionBitRateStrategyVariableConstrained = 2,
  EXAudioRecordingOptionBitRateStrategyVariable            = 3
};

@protocol EXAVScopedModuleDelegate

// Call this when your module knows it won't use the audio session now
// but may do in the future (settings persist).
- (void)moduleDidBackground:(id)module;
// Call this when your module knows it will use the audio session now.
- (void)moduleDidForeground:(id)module;
// Call this when your module knows it won't use the audio session now
// or in the future (forget settings).
- (void)moduleWillDeallocate:(id)module;
- (BOOL)isActiveForModule:(id)module;
- (NSString *)activeCategory;
- (AVAudioSessionCategoryOptions)activeCategoryOptions;
- (NSError *)setActive:(BOOL)active forModule:(id)module;
- (NSError *)setCategory:(NSString *)category withOptions:(AVAudioSessionCategoryOptions)options forModule:(id)module;

@end

@protocol EXAVInterface

- (NSError *)promoteAudioSessionIfNecessary;

- (NSError *)demoteAudioSessionIfPossible;

- (void)registerVideoForAudioLifecycle:(NSObject<EXAVObject> *)video;

- (void)unregisterVideoForAudioLifecycle:(NSObject<EXAVObject> *)video;

@end

@interface EXAV : EXExportedModule <RCTBridgeModule, EXEventEmitter, EXAppLifecycleListener, EXModuleRegistryConsumer, EXAVInterface>

- (void)handleMediaServicesReset:(NSNotification *)notification;
- (void)handleAudioSessionInterruption:(NSNotification *)notification;

@end


text:
import logging

from chalice import Chalice

from chalicelib.lambda_function_1 import lambda_function_1_blueprint
from chalicelib.lambda_function_2 import lambda_function_2_blueprint
from chalicelib.lambda_function_3 import lambda_function_3_blueprint

logging.basicConfig(level=logging.INFO)
app = Chalice(app_name='serverless_framework')
app.log.setLevel(logging.INFO)

app.experimental_feature_flags.update([
    'BLUEPRINTS'
])

app.register_blueprint(lambda_function_1_blueprint)
app.register_blueprint(lambda_function_2_blueprint)
app.register_blueprint(lambda_function_3_blueprint)


text:
def run():
    """
    Remove captions from Webapp Previews.
    """
    # This should be done in a separate script, it's taking too long to be
    # a migration, and it doesn't need to be done as soon as we have deployed,
    # it can be done later.
    pass
    # for prev in Preview.objects.filter(
    #             addon__type=amo.ADDON_WEBAPP,
    #             caption__isnull=False).no_transforms().no_cache().iterator():
    #     delete_translation(prev, 'caption')


text:
package com.compomics.peptizer.util.agents;

import com.compomics.peptizer.interfaces.Agent;
import com.compomics.peptizer.interfaces.Mass;
import com.compomics.peptizer.util.AgentReport;
import com.compomics.peptizer.util.PeptideIdentification;
import com.compomics.peptizer.util.datatools.interfaces.PeptizerPeptideHit;
import com.compomics.peptizer.util.enumerator.AgentVote;
import com.compomics.peptizer.util.enumerator.SearchEngineEnum;
import org.apache.log4j.Logger;

import java.math.BigDecimal;
/**
 * Created by IntelliJ IDEA.
 * User: kenny
 * Date: 14-sep-2007
 * Time: 15:30:28
 */

/**
 * Class description: --------
 * This class was developed to inspect for mass tolerance error (Da) (experimental vs theory).
 */
public class DeltaMassPPMAgent extends Agent {
    // Class specific log4j logger for DeltaMassPPMAgent instances.
    private static Logger logger = Logger.getLogger(DeltaMassPPMAgent.class);

    /**
     * Identifies the allowed mass tolerance.
     */
    public static final String TOLERANCE = "tolerance";

    /**
     * Identifies the allowed mass tolerance.
     */
    public static final String C13 = "c13";

    public DeltaMassPPMAgent() {
        // Init the general Agent settings.
        initialize(new String[]{TOLERANCE});
        initialize(new String[]{C13});
        SearchEngineEnum[] searchEngines = {};
        compatibleSearchEngine = searchEngines;
    }

    /**
     * INSPECTION ---------- The inspection is the core of an Agent since this logic leads to the Agent's vote. This
     * method returns an array of AgentVote objects, reflecting this Agent's idea whether to select or not to select the
     * peptide hypothesis. All Agent Implementations must also create and store AgentReport for each peptide
     * hypothesis.
     *
     * @param aPeptideIdentification PeptideIdentification that has to be inspected.
     * @return AgentVote[] as a vote upon inspection for each the confident peptide hypothesises.

AgentVotes[0]
     *         gives the inspection result on PeptideHit 1

AgentVotes[1] gives the inspection result on
     *         PeptideHit 2

AgentVotes[n] gives the inspection result on PeptideHit n+1

 Where the
     *         different AgentVotes can be:

a vote approving the selection of the peptide hypothesis.

     *
a vote indifferent to the selection.

a vote objecting to select the peptide hypothesis.

     *

     *

     *         Votes positive for selection if the mass error is greater then the allowed tolerance (Ppm).
     */
    public AgentVote[] inspect(PeptideIdentification aPeptideIdentification) {

        // Localize the Dummy property.
        double lTolerance = Double.parseDouble((String) (this.iProperties.get(TOLERANCE)));

        // Localize the C13 Da tolerance property.
        boolean lC13Tolerance = Boolean.parseBoolean((String) (this.iProperties.get(C13)));

        AgentVote[] lAgentVotes = new AgentVote[aPeptideIdentification.getNumberOfConfidentPeptideHits()];
        for (int i = 0; i < lAgentVotes.length; i++) {

            // Make Agent Report!
            iReport = new AgentReport(getUniqueID());

            // 1. Get the nth confident PeptideHit.
            PeptizerPeptideHit lPeptideHit = aPeptideIdentification.getPeptideHit(i);

            AgentVote lVote = null;

            double lDeltaMass = lPeptideHit.getDeltaMass();
            double lPeptideMassByMillion = lPeptideHit.getTheoMass() / 1000000.0;
            double lPpmError = lDeltaMass / lPeptideMassByMillion;

            // The resulting Inspection score.
            if (Math.abs(lPpmError) >= lTolerance) {
                if (lC13Tolerance) {

                    lPeptideMassByMillion = (lPeptideHit.getTheoMass() - Mass.DELTAC13) / 1000000.0; // Assuming this is a C13 peak, minus -1 to simulate the C12 precursor mass.
                    lPpmError = (Math.abs(lDeltaMass) - Mass.DELTAC13) / lPeptideMassByMillion;

                    // Ok, can this be a identified C13 precursor?
                    if (lPpmError >= lTolerance) {
                        lVote = AgentVote.POSITIVE_FOR_SELECTION;
                    } else {
                        // If error is 1.01Da, then 1.01-1=0.01Da is within tolerance boundaries.
                        lVote = AgentVote.NEUTRAL_FOR_SELECTION;
                    }
                } else {
                    // Error is larger then Agent tolerance, and c13 fix is not specified.
                    lVote = AgentVote.POSITIVE_FOR_SELECTION;
                }
            } else {
                lVote = AgentVote.NEUTRAL_FOR_SELECTION;
            }

            lAgentVotes[i] = lVote;

            // Build the report!
            // Agent Result.
            // Build the report!
            // Agent Result.
            iReport.addReport(AgentReport.RK_RESULT, lAgentVotes[i]);

            // TableRow information.
            iReport.addReport(AgentReport.RK_TABLEDATA, (new BigDecimal(lPpmError)).setScale(4, BigDecimal.ROUND_HALF_DOWN));

            // Attribute Relation File Format
            iReport.addReport(AgentReport.RK_ARFF, lPpmError);

            aPeptideIdentification.addAgentReport(i + 1, getUniqueID(), iReport);
        }
        return lAgentVotes;

    }

    /**
     * Returns a description for the Agent. Note that html tags are used to stress properties. Use in tooltips and
     * configuration settings. Fill in an agent description. Report on purpose and a minor on actual implementation.
     *
     * @return String description of the DummyAgent.
     */
    public String getDescription() {
        return "Inspects for the mass error (Ppm) of the peptide. Votes 'Positive_for_selection' if the mass error is greater then the allowed tolerance ( " + this.iProperties.get(TOLERANCE) + ").  If the C13 option is set to TRUE, then the mass error -1Da will also be evaluated. Votes 'Neutral_for_selection' if less.";
    }
}


text:
package com.sp.android.add_to_evernote_note.task;

import com.evernote.client.android.EvernoteSession;
import com.evernote.edam.type.User;

/**
 * @author rwondratschek
 */
public class GetUserTask extends BaseTask<User> {

    public GetUserTask() {
        super(User.class);
    }

    @Override
    protected User checkedExecute() throws Exception {
        return EvernoteSession.getInstance().getEvernoteClientFactory().getUserStoreClient().getUser();
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<TITLE>
DataFactory (obvious 0.0.1-SNAPSHOT API)
</TITLE>

<META NAME="date" CONTENT="2011-05-19">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

obvious.data

Class DataFactory

java.lang.Object
  obvious.data.DataFactory

Direct Known Subclasses:
DataFactoryImpl

public abstract class DataFactory
extends java.lang.Object

Abstract Class DataFactory. A factory that can create
 Network and Table instances. Several methods
 are proposed to build such instances from existing instances of other tables
 or from Obvious Schema(s).
 Each binding of Obvious should implement this class.

Version:

$Revision$

Author:

Jean-Daniel Fekete

See Also:
Table,
Network

Constructor Summary

protected
DataFactory()

          Constructor.

Method Summary

abstract  Network
createGraph(Schema nodeSchema,
            Schema edgeSchema)

          Creates a network from an existing Schema instance.

abstract  Network
createGraph(Schema nodeSchema,
            Schema edgeSchema,
            java.util.Map<java.lang.String,java.lang.Object> param)

          Creates a network from an existing Schema instance.

abstract  Schema
createSchema()

          Creates an Empty Schema that can be changed.

abstract  Table
createTable(Schema schema)

          Creates a table from an existing Schema instance.

abstract  Table
createTable(Schema schema,
            java.util.Map<java.lang.String,java.lang.Object> param)

          Creates a table from an existing Schema instance.

static DataFactory
getInstance()

          Getter for attribute instance of DataFactory.

abstract  Network
wrapGraph(java.lang.Object underlyingGraph)

          Creates a network from an existing graph/network object.

abstract  Table
wrapTable(java.lang.Object underlyingTable)

          Creates a table from an existing table object.

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

DataFactory

protected DataFactory()

Constructor.

Method Detail

getInstance

public static DataFactory getInstance()
                               throws ObviousException

Getter for attribute instance of DataFactory.

Returns:
static instance of DataFactory

Throws:

ObviousException - if undefined system property

createSchema

public abstract Schema createSchema()

Creates an Empty Schema that can be changed.

Returns:
A changeable empty Schema.

createTable

public abstract Table createTable(Schema schema)
                           throws ObviousException

Creates a table from an existing Schema instance.

Parameters:
schema - original schema for the table

Returns:
table derived from the schema

Throws:

ObviousException - when the table cannot be created.

createTable

public abstract Table createTable(Schema schema,
                                  java.util.Map<java.lang.String,java.lang.Object> param)
                           throws ObviousException

Creates a table from an existing Schema instance.
 This method allows the use of specific parameters placed in param
 collection.

Parameters:
schema - original schema for the table
param - a collection of parameter for underlying constructors.

Returns:
table derived from the schema

Throws:

ObviousException - when the table cannot be created.

wrapTable

public abstract Table wrapTable(java.lang.Object underlyingTable)
                         throws ObviousException

Creates a table from an existing table object.

Parameters:
underlyingTable - original table

Returns:
obvious table

Throws:

ObviousException - when the table cannot be created.

createGraph

public abstract Network createGraph(Schema nodeSchema,
                                    Schema edgeSchema)
                             throws ObviousException

Creates a network from an existing Schema instance.

Parameters:
nodeSchema - original schema for nodes
edgeSchema - original schema for edges

Returns:
network derived from the network

Throws:

ObviousException - when the table cannot be created.

createGraph

public abstract Network createGraph(Schema nodeSchema,
                                    Schema edgeSchema,
                                    java.util.Map<java.lang.String,java.lang.Object> param)
                             throws ObviousException

Creates a network from an existing Schema instance.
 This method allows the use of specific parameters placed in param
 collection.

Parameters:
nodeSchema - original schema for nodes
edgeSchema - original schema for edges
param - a collection of parameter for underlying constructors.

Returns:
network derived from the network

Throws:

ObviousException - when the table cannot be created.

wrapGraph

public abstract Network wrapGraph(java.lang.Object underlyingGraph)
                           throws ObviousException

Creates a network from an existing graph/network object.

Parameters:
underlyingGraph - original graph object

Returns:
obvious network

Throws:

ObviousException - when the table cannot be created.

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

Copyright © 2011. All Rights Reserved.


text:
module Bplmodels
  class OAIObject < Bplmodels::SimpleObjectBase

    has_metadata :name => "oaiMetadata", :type => OAIMetadata

    has_metadata :name => "workflowMetadata", :type => WorkflowMetadata

    has_many :exemplary_image, :class_name => "Bplmodels::OAIObject", :property=> :is_exemplary_image_of

    has_file_datastream 'thumbnail300', :versionable=>false, :label=>'thumbnail300 datastream'

    #has_file_datastream :name => 'productionMaster', :type => ActiveFedora::Datastream

    def fedora_name
      'oai_object'
    end

    def to_solr(doc = {} )
      doc = super(doc)
      doc['active_fedora_model_ssi'] = self.class.name
      doc['exemplary_image_ssi'] = self.pid if self.thumbnail300.present?
      doc
    end

    def add_thumbnail_300(thumb_content, ds_label)
      self.thumbnail300.content = thumb_content
      self.thumbnail300.mimeType = 'image/jpeg'
      self.thumbnail300.dsLabel = ds_label
    end

    def add_thumbnail_relationship(thumbnail_url)
      self.descMetadata.insert_location_url(thumbnail_url, 'preview', nil)
      self.add_relationship(:is_image_of, "info:fedora/#{self.pid}")
      self.add_relationship(:is_exemplary_image_of, "info:fedora/#{self.pid}")
    end

    #Expects the following args:
    #parent_pid => id of the parent object
    #local_id => local ID of the object
    #local_id_type => type of that local ID
    #label => label of the collection
    def self.mint(args)
      args[:namespace_id] = ARK_CONFIG_GLOBAL['namespace_oai_pid']
      #TODO: Duplication check here to prevent over-writes?

      return_object = super(args)

      if !return_object.is_a?(String)
        return_object.workflowMetadata.insert_oai_defaults
      end

      return return_object
    end
  end
end


text:
#include <algorithm>
#include <numeric>
#include <string>
#include "utils/macro.h"
#include "utils/make_shared.h"
#include "application_manager/commands/command_request_impl.h"
#include "application_manager/application_manager.h"
#include "application_manager/message_helper.h"
#include "smart_objects/smart_object.h"
namespace application_manager {

namespace commands {

std::string MergeInfos(const ResponseInfo& first_info,
                       const std::string& first_str,
                       const ResponseInfo& second_info,
                       const std::string& second_str) {
  if ((first_info.interface_state == HmiInterfaces::STATE_NOT_AVAILABLE) &&
      (second_info.interface_state != HmiInterfaces::STATE_NOT_AVAILABLE) &&
      !second_str.empty()) {
    return second_str;
  }

  if ((second_info.interface_state == HmiInterfaces::STATE_NOT_AVAILABLE) &&
      (first_info.interface_state != HmiInterfaces::STATE_NOT_AVAILABLE) &&
      !first_str.empty()) {
    return first_str;
  }

  return MergeInfos(first_str, second_str);
}

std::string MergeInfos(const std::string& first, const std::string& second) {
  return first + ((!first.empty() && !second.empty()) ? ", " : "") + second;
}

std::string MergeInfos(const std::string& first,
                       const std::string& second,
                       const std::string& third) {
  std::string result = MergeInfos(first, second);
  return MergeInfos(result, third);
}

const std::string CreateInfoForUnsupportedResult(
    HmiInterfaces::InterfaceID interface) {
  switch (interface) {
    case (HmiInterfaces::InterfaceID::HMI_INTERFACE_VR): {
      return "VR is not supported by system";
    }
    case (HmiInterfaces::InterfaceID::HMI_INTERFACE_TTS): {
      return "TTS is not supported by system";
    }
    case (HmiInterfaces::InterfaceID::HMI_INTERFACE_UI): {
      return "UI is not supported by system";
    }
    case (HmiInterfaces::InterfaceID::HMI_INTERFACE_Navigation): {
      return "Navi is not supported by system";
    }
    case (HmiInterfaces::InterfaceID::HMI_INTERFACE_VehicleInfo): {
      return "VehicleInfo is not supported by system";
    }
    case (HmiInterfaces::InterfaceID::HMI_INTERFACE_RC): {
      return "Remote control is not supported by system";
    }
    default:
#ifdef ENABLE_LOG
      CREATE_LOGGERPTR_LOCAL(logger, "Commands");
      LOG4CXX_WARN(logger,
                   "Could not create info because"
                   " interface isn't valid. Interface is:"
                       << static_cast<int32_t>(interface));
#endif  // ENABLE_LOG
      return "";
  }
}

bool CheckResultCode(const ResponseInfo& first, const ResponseInfo& second) {
  if (first.is_ok && second.is_unsupported_resource) {
    return true;
  }
  if (first.is_ok && second.is_not_used) {
    return true;
  }
  if (first.is_ok && second.is_ok) {
    return true;
  }
  return false;
}

bool IsResultCodeWarning(const ResponseInfo& first,
                         const ResponseInfo& second) {
  const bool first_is_ok_second_is_warn =
      (first.is_ok || first.is_not_used) &&
      hmi_apis::Common_Result::WARNINGS == second.result_code;

  const bool both_warnings =
      hmi_apis::Common_Result::WARNINGS == first.result_code &&
      hmi_apis::Common_Result::WARNINGS == second.result_code;

  return first_is_ok_second_is_warn || both_warnings;
}

struct DisallowedParamsInserter {
  DisallowedParamsInserter(smart_objects::SmartObject& response,
                           mobile_apis::VehicleDataResultCode::eType code)
      : response_(response), code_(code) {}

  bool operator()(const std::string& param) {
    const VehicleData& vehicle_data =
        application_manager::MessageHelper::vehicle_data();
    VehicleData::const_iterator it = vehicle_data.find(param);
    if (vehicle_data.end() != it) {
      smart_objects::SmartObjectSPtr disallowed_param =
          new smart_objects::SmartObject(smart_objects::SmartType_Map);
      (*disallowed_param)[strings::data_type] = (*it).second;
      (*disallowed_param)[strings::result_code] = code_;
      response_[strings::msg_params][param.c_str()] = *disallowed_param;
      return true;
    }
    return false;
  }

 private:
  smart_objects::SmartObject& response_;
  mobile_apis::VehicleDataResultCode::eType code_;
};

ResponseInfo::ResponseInfo()
    : result_code(hmi_apis::Common_Result::INVALID_ENUM)
    , interface(HmiInterfaces::HMI_INTERFACE_INVALID_ENUM)
    , interface_state(HmiInterfaces::STATE_NOT_RESPONSE)
    , is_ok(false)
    , is_unsupported_resource(false)
    , is_not_used(false) {}

ResponseInfo::ResponseInfo(const hmi_apis::Common_Result::eType result,
                           const HmiInterfaces::InterfaceID hmi_interface,
                           ApplicationManager& application_manager)
    : result_code(result)
    , interface(hmi_interface)
    , interface_state(HmiInterfaces::STATE_NOT_RESPONSE)
    , is_ok(false)
    , is_unsupported_resource(false)
    , is_not_used(false) {
  using namespace helpers;

  interface_state =
      application_manager.hmi_interfaces().GetInterfaceState(hmi_interface);

  is_ok = Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
      result_code,
      hmi_apis::Common_Result::SUCCESS,
      hmi_apis::Common_Result::WARNINGS,
      hmi_apis::Common_Result::WRONG_LANGUAGE,
      hmi_apis::Common_Result::RETRY,
      hmi_apis::Common_Result::SAVED);

  is_not_used = hmi_apis::Common_Result::INVALID_ENUM == result_code;

  is_unsupported_resource =
      hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == result_code;
}

CommandRequestImpl::CommandRequestImpl(const MessageSharedPtr& message,
                                       ApplicationManager& application_manager)
    : CommandImpl(message, application_manager)
    , EventObserver(application_manager.event_dispatcher())
    , current_state_(kAwaitingHMIResponse)
    , hash_update_mode_(kSkipHashUpdate)
    , is_success_result_(false) {}

CommandRequestImpl::~CommandRequestImpl() {
  UpdateHash();
}

bool CommandRequestImpl::Init() {
  return true;
}

bool CommandRequestImpl::CheckPermissions() {
  return CheckAllowedParameters();
}

bool CommandRequestImpl::CleanUp() {
  return true;
}

void CommandRequestImpl::Run() {}

void CommandRequestImpl::onTimeOut() {
  LOG4CXX_AUTO_TRACE(logger_);

  unsubscribe_from_all_events();
  {
    // FIXME (dchmerev@luxoft.com): atomic_xchg fits better
    sync_primitives::AutoLock auto_lock(state_lock_);
    if (kCompleted == current_state_) {
      LOG4CXX_DEBUG(logger_, "current_state_ = kCompleted");
      // don't send timeout if request completed
      return;
    }

    current_state_ = kTimedOut;
  }

  smart_objects::SmartObjectSPtr response =
      MessageHelper::CreateNegativeResponse(connection_key(),
                                            function_id(),
                                            correlation_id(),
                                            mobile_api::Result::GENERIC_ERROR);
  AddTimeOutComponentInfoToMessage(*response);
  application_manager_.ManageMobileCommand(response, ORIGIN_SDL);
}

void CommandRequestImpl::on_event(const event_engine::Event& event) {}

void CommandRequestImpl::SendResponse(
    const bool success,
    const mobile_apis::Result::eType& result_code,
    const char* info,
    const smart_objects::SmartObject* response_params) {
  LOG4CXX_AUTO_TRACE(logger_);
  {
    sync_primitives::AutoLock auto_lock(state_lock_);
    if (kTimedOut == current_state_) {
      // don't send response if request timeout expired
      return;
    }

    current_state_ = kCompleted;
  }

  smart_objects::SmartObjectSPtr result =
      utils::MakeShared<smart_objects::SmartObject>();

  smart_objects::SmartObject& response = *result;

  response[strings::params][strings::message_type] = MessageType::kResponse;
  response[strings::params][strings::correlation_id] = correlation_id();
  response[strings::params][strings::protocol_type] =
      CommandImpl::mobile_protocol_type_;
  response[strings::params][strings::protocol_version] =
      CommandImpl::protocol_version_;
  response[strings::params][strings::connection_key] = connection_key();
  response[strings::params][strings::function_id] = function_id();

  if (response_params) {
    response[strings::msg_params] = *response_params;
  }

  if (info) {
    response[strings::msg_params][strings::info] = std::string(info);
  }

  // Add disallowed parameters and info from request back to response with
  // appropriate
  // reasons (VehicleData result codes)
  if (result_code != mobile_apis::Result::APPLICATION_NOT_REGISTERED) {
    const mobile_apis::FunctionID::eType& id =
        static_cast<mobile_apis::FunctionID::eType>(function_id());
    if ((id == mobile_apis::FunctionID::SubscribeVehicleDataID) ||
        (id == mobile_apis::FunctionID::UnsubscribeVehicleDataID)) {
      AddDisallowedParameters(response);
      AddDisallowedParametersToInfo(response);
    } else if (id == mobile_apis::FunctionID::GetVehicleDataID) {
      AddDisallowedParametersToInfo(response);
    }
  }

  response[strings::msg_params][strings::success] = success;
  response[strings::msg_params][strings::result_code] = result_code;

  is_success_result_ = success;

  application_manager_.ManageMobileCommand(result, ORIGIN_SDL);
}

bool CommandRequestImpl::CheckSyntax(const std::string& str,
                                     bool allow_empty_line) {
  if (std::string::npos != str.find_first_of("\t\n")) {
    LOG4CXX_ERROR(logger_, "CheckSyntax failed! :" << str);
    return false;
  }
  if (std::string::npos != str.find("\\n") ||
      std::string::npos != str.find("\\t")) {
    LOG4CXX_ERROR(logger_, "CheckSyntax failed! :" << str);
    return false;
  }
  if (!allow_empty_line) {
    if ((std::string::npos == str.find_first_not_of(' '))) {
      return false;
    }
  }
  return true;
}

smart_objects::SmartObject CreateUnsupportedResourceResponse(
    const hmi_apis::FunctionID::eType function_id,
    const uint32_t hmi_correlation_id,
    HmiInterfaces::InterfaceID interface) {
  smart_objects::SmartObject response(smart_objects::SmartType_Map);
  smart_objects::SmartObject& params = response[strings::params];
  params[strings::message_type] = MessageType::kResponse;
  params[strings::correlation_id] = hmi_correlation_id;
  params[strings::protocol_type] = CommandImpl::hmi_protocol_type_;
  params[strings::protocol_version] = CommandImpl::protocol_version_;
  params[strings::function_id] = function_id;
  params[hmi_response::code] = hmi_apis::Common_Result::UNSUPPORTED_RESOURCE;
  smart_objects::SmartObject& msg_params = response[strings::msg_params];
  msg_params[strings::info] = CreateInfoForUnsupportedResult(interface);
  return response;
}

bool CommandRequestImpl::ProcessHMIInterfacesAvailability(
    const uint32_t hmi_correlation_id,
    const hmi_apis::FunctionID::eType& function_id) {
  LOG4CXX_AUTO_TRACE(logger_);
  HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces();
  HmiInterfaces::InterfaceID interface =
      hmi_interfaces.GetInterfaceFromFunction(function_id);
  DCHECK(interface != HmiInterfaces::HMI_INTERFACE_INVALID_ENUM);
  const HmiInterfaces::InterfaceState state =
      hmi_interfaces.GetInterfaceState(interface);
  if (HmiInterfaces::STATE_NOT_AVAILABLE == state) {
    event_engine::Event event(function_id);
    event.set_smart_object(CreateUnsupportedResourceResponse(
        function_id, hmi_correlation_id, interface));
    event.raise(application_manager_.event_dispatcher());
    return false;
  }
  return true;
}

void CommandRequestImpl::UpdateHash() {
  LOG4CXX_AUTO_TRACE(logger_);
  if (hash_update_mode_ == kSkipHashUpdate) {
    LOG4CXX_DEBUG(logger_, "Hash update is disabled for " << function_id());
    return;
  }

  if (HmiInterfaces::InterfaceState::STATE_NOT_RESPONSE ==
      application_manager_.hmi_interfaces().GetInterfaceState(
          HmiInterfaces::InterfaceID::HMI_INTERFACE_UI)) {
    LOG4CXX_ERROR(logger_,
                  "UI interface has not responded. Hash won't be updated.");
    return;
  }

  if (!is_success_result_) {
    LOG4CXX_WARN(logger_, "Command is not succeeded. Hash won't be updated.");
    return;
  }

  ApplicationSharedPtr application =
      application_manager_.application(connection_key());
  if (!application) {
    LOG4CXX_ERROR(logger_,
                  "Application with connection key "
                      << connection_key()
                      << " not found. Not able to update hash.");
    return;
  }

  LOG4CXX_DEBUG(
      logger_,
      "Updating hash for application with connection key "
          << connection_key() << " while processing function id "
          << MessageHelper::StringifiedFunctionID(
                 static_cast<mobile_api::FunctionID::eType>(function_id())));

  application->UpdateHash();
}

uint32_t CommandRequestImpl::SendHMIRequest(
    const hmi_apis::FunctionID::eType& function_id,
    const smart_objects::SmartObject* msg_params,
    bool use_events) {
  smart_objects::SmartObjectSPtr result = new smart_objects::SmartObject;

  const uint32_t hmi_correlation_id =
      application_manager_.GetNextHMICorrelationID();

  smart_objects::SmartObject& request = *result;
  request[strings::params][strings::message_type] = MessageType::kRequest;
  request[strings::params][strings::function_id] = function_id;
  request[strings::params][strings::correlation_id] = hmi_correlation_id;
  request[strings::params][strings::protocol_version] =
      CommandImpl::protocol_version_;
  request[strings::params][strings::protocol_type] =
      CommandImpl::hmi_protocol_type_;

  if (msg_params) {
    request[strings::msg_params] = *msg_params;
  }

  if (use_events) {
    LOG4CXX_DEBUG(logger_,
                  "subscribe_on_event " << function_id << " "
                                        << hmi_correlation_id);
    subscribe_on_event(function_id, hmi_correlation_id);
  }
  if (ProcessHMIInterfacesAvailability(hmi_correlation_id, function_id)) {
    if (!application_manager_.ManageHMICommand(result)) {
      LOG4CXX_ERROR(logger_, "Unable to send request");
      SendResponse(false, mobile_apis::Result::OUT_OF_MEMORY);
    }
  } else {
    LOG4CXX_DEBUG(logger_, "Interface is not available");
  }
  return hmi_correlation_id;
}

void CommandRequestImpl::CreateHMINotification(
    const hmi_apis::FunctionID::eType& function_id,
    const NsSmart::SmartObject& msg_params) const {
  smart_objects::SmartObjectSPtr result = new smart_objects::SmartObject;
  if (!result) {
    LOG4CXX_ERROR(logger_, "Memory allocation failed.");
    return;
  }
  smart_objects::SmartObject& notify = *result;

  notify[strings::params][strings::message_type] =
      static_cast<int32_t>(application_manager::MessageType::kNotification);
  notify[strings::params][strings::protocol_version] =
      CommandImpl::protocol_version_;
  notify[strings::params][strings::protocol_type] =
      CommandImpl::hmi_protocol_type_;
  notify[strings::params][strings::function_id] = function_id;
  notify[strings::msg_params] = msg_params;

  if (!application_manager_.ManageHMICommand(result)) {
    LOG4CXX_ERROR(logger_, "Unable to send HMI notification");
  }
}

mobile_apis::Result::eType CommandRequestImpl::GetMobileResultCode(
    const hmi_apis::Common_Result::eType& hmi_code) const {
  mobile_apis::Result::eType mobile_result = mobile_apis::Result::GENERIC_ERROR;
  switch (hmi_code) {
    case hmi_apis::Common_Result::SUCCESS: {
      mobile_result = mobile_apis::Result::SUCCESS;
      break;
    }
    case hmi_apis::Common_Result::UNSUPPORTED_REQUEST: {
      mobile_result = mobile_apis::Result::UNSUPPORTED_REQUEST;
      break;
    }
    case hmi_apis::Common_Result::UNSUPPORTED_RESOURCE: {
      mobile_result = mobile_apis::Result::UNSUPPORTED_RESOURCE;
      break;
    }
    case hmi_apis::Common_Result::DISALLOWED: {
      mobile_result = mobile_apis::Result::DISALLOWED;
      break;
    }
    case hmi_apis::Common_Result::REJECTED: {
      mobile_result = mobile_apis::Result::REJECTED;
      break;
    }
    case hmi_apis::Common_Result::ABORTED: {
      mobile_result = mobile_apis::Result::ABORTED;
      break;
    }
    case hmi_apis::Common_Result::IGNORED: {
      mobile_result = mobile_apis::Result::IGNORED;
      break;
    }
    case hmi_apis::Common_Result::RETRY: {
      mobile_result = mobile_apis::Result::RETRY;
      break;
    }
    case hmi_apis::Common_Result::IN_USE: {
      mobile_result = mobile_apis::Result::IN_USE;
      break;
    }
    case hmi_apis::Common_Result::DATA_NOT_AVAILABLE: {
      mobile_result = mobile_apis::Result::VEHICLE_DATA_NOT_AVAILABLE;
      break;
    }
    case hmi_apis::Common_Result::TIMED_OUT: {
      mobile_result = mobile_apis::Result::TIMED_OUT;
      break;
    }
    case hmi_apis::Common_Result::INVALID_DATA: {
      mobile_result = mobile_apis::Result::INVALID_DATA;
      break;
    }
    case hmi_apis::Common_Result::CHAR_LIMIT_EXCEEDED: {
      mobile_result = mobile_apis::Result::CHAR_LIMIT_EXCEEDED;
      break;
    }
    case hmi_apis::Common_Result::INVALID_ID: {
      mobile_result = mobile_apis::Result::INVALID_ID;
      break;
    }
    case hmi_apis::Common_Result::DUPLICATE_NAME: {
      mobile_result = mobile_apis::Result::DUPLICATE_NAME;
      break;
    }
    case hmi_apis::Common_Result::APPLICATION_NOT_REGISTERED: {
      mobile_result = mobile_apis::Result::APPLICATION_NOT_REGISTERED;
      break;
    }
    case hmi_apis::Common_Result::WRONG_LANGUAGE: {
      mobile_result = mobile_apis::Result::WRONG_LANGUAGE;
      break;
    }
    case hmi_apis::Common_Result::OUT_OF_MEMORY: {
      mobile_result = mobile_apis::Result::OUT_OF_MEMORY;
      break;
    }
    case hmi_apis::Common_Result::TOO_MANY_PENDING_REQUESTS: {
      mobile_result = mobile_apis::Result::TOO_MANY_PENDING_REQUESTS;
      break;
    }
    case hmi_apis::Common_Result::NO_APPS_REGISTERED: {
      mobile_result = mobile_apis::Result::APPLICATION_NOT_REGISTERED;
      break;
    }
    case hmi_apis::Common_Result::NO_DEVICES_CONNECTED: {
      mobile_result = mobile_apis::Result::APPLICATION_NOT_REGISTERED;
      break;
    }
    case hmi_apis::Common_Result::WARNINGS: {
      mobile_result = mobile_apis::Result::WARNINGS;
      break;
    }
    case hmi_apis::Common_Result::GENERIC_ERROR: {
      mobile_result = mobile_apis::Result::GENERIC_ERROR;
      break;
    }
    case hmi_apis::Common_Result::USER_DISALLOWED: {
      mobile_result = mobile_apis::Result::USER_DISALLOWED;
      break;
    }
    case hmi_apis::Common_Result::SAVED: {
      mobile_result = mobile_apis::Result::SAVED;
      break;
    }
    default: {
      LOG4CXX_ERROR(logger_, "Unknown HMI result code " << hmi_code);
      break;
    }
  }

  return mobile_result;
}

bool CommandRequestImpl::CheckAllowedParameters() {
  LOG4CXX_AUTO_TRACE(logger_);

  // RegisterAppInterface should always be allowed
  if (mobile_apis::FunctionID::RegisterAppInterfaceID ==
      static_cast<mobile_apis::FunctionID::eType>(function_id())) {
    return true;
  }

  const ApplicationSharedPtr app =
      application_manager_.application(connection_key());
  if (!app) {
    LOG4CXX_ERROR(logger_,
                  "There is no registered application with "
                  "connection key '"
                      << connection_key() << "'");
    return false;
  }

  RPCParams params;

  const smart_objects::SmartObject& s_map = (*message_)[strings::msg_params];
  smart_objects::SmartMap::const_iterator iter = s_map.map_begin();
  smart_objects::SmartMap::const_iterator iter_end = s_map.map_end();

  for (; iter != iter_end; ++iter) {
    if (iter->second.asBool()) {
      LOG4CXX_DEBUG(logger_, "Request's param: " << iter->first);
      params.insert(iter->first);
    }
  }

  mobile_apis::Result::eType check_result =
      application_manager_.CheckPolicyPermissions(
          app,
          MessageHelper::StringifiedFunctionID(
              static_cast<mobile_api::FunctionID::eType>(function_id())),
          params,
          &parameters_permissions_);

  // Check, if RPC is allowed by policy
  if (mobile_apis::Result::SUCCESS != check_result) {
    smart_objects::SmartObjectSPtr response =
        MessageHelper::CreateBlockedByPoliciesResponse(
            static_cast<mobile_api::FunctionID::eType>(function_id()),
            check_result,
            correlation_id(),
            app->app_id());

    application_manager_.SendMessageToMobile(response);
    return false;
  }

  // If no parameters specified in policy table, no restriction will be
  // applied for parameters
  if (parameters_permissions_.allowed_params.empty() &&
      parameters_permissions_.disallowed_params.empty() &&
      parameters_permissions_.undefined_params.empty()) {
    return true;
  }

  RemoveDisallowedParameters();

  return true;
}

bool CommandRequestImpl::CheckHMICapabilities(
    const mobile_apis::ButtonName::eType button) const {
  LOG4CXX_AUTO_TRACE(logger_);

  using namespace smart_objects;
  using namespace mobile_apis;

  const HMICapabilities& hmi_capabilities =
      application_manager_.hmi_capabilities();
  if (!hmi_capabilities.is_ui_cooperating()) {
    LOG4CXX_ERROR(logger_, "UI is not supported by HMI");
    return false;
  }

  const SmartObject* button_capabilities_so =
      hmi_capabilities.button_capabilities();
  if (!button_capabilities_so) {
    LOG4CXX_ERROR(logger_, "Invalid button capabilities object");
    return false;
  }

  const SmartObject& button_capabilities = *button_capabilities_so;
  for (size_t i = 0; i < button_capabilities.length(); ++i) {
    const SmartObject& capabilities = button_capabilities[i];
    const ButtonName::eType current_button = static_cast<ButtonName::eType>(
        capabilities.getElement(hmi_response::button_name).asInt());
    if (current_button == button) {
      LOG4CXX_DEBUG(logger_,
                    "Button capabilities for " << button << " was found");
      return true;
    }
  }

  LOG4CXX_DEBUG(logger_,
                "Button capabilities for " << button << " was not found");
  return false;
}

void CommandRequestImpl::RemoveDisallowedParameters() {
  LOG4CXX_AUTO_TRACE(logger_);

  smart_objects::SmartObject& params = (*message_)[strings::msg_params];

  // Remove from request all disallowed parameters
  RPCParams::const_iterator it_disallowed =
      parameters_permissions_.disallowed_params.begin();
  RPCParams::const_iterator it_disallowed_end =
      parameters_permissions_.disallowed_params.end();
  for (; it_disallowed != it_disallowed_end; ++it_disallowed) {
    if (params.keyExists(*it_disallowed)) {
      const std::string key = *it_disallowed;
      params.erase(key);
      removed_parameters_permissions_.disallowed_params.insert(key);
      LOG4CXX_INFO(logger_,
                   "Following parameter is disallowed by user: " << key);
    }
  }

  // Remove from request all undefined yet parameters
  RPCParams::const_iterator it_undefined =
      parameters_permissions_.undefined_params.begin();
  RPCParams::const_iterator it_undefined_end =
      parameters_permissions_.undefined_params.end();
  for (; it_undefined != it_undefined_end; ++it_undefined) {
    if (params.keyExists(*it_undefined)) {
      const std::string key = *it_undefined;
      params.erase(key);
      removed_parameters_permissions_.undefined_params.insert(key);
      LOG4CXX_INFO(logger_,
                   "Following parameter is disallowed by policy: " << key);
    }
  }

  // Remove from request all parameters missed in allowed
  const VehicleData& vehicle_data =
      application_manager::MessageHelper::vehicle_data();

  VehicleData::const_iterator it_vehicle_data = vehicle_data.begin();
  VehicleData::const_iterator it_vehicle_data_end = vehicle_data.end();
  for (; it_vehicle_data != it_vehicle_data_end; ++it_vehicle_data) {
    const std::string key = it_vehicle_data->first;
    if (params.keyExists(key) &&
        parameters_permissions_.allowed_params.end() ==
            std::find(parameters_permissions_.allowed_params.begin(),
                      parameters_permissions_.allowed_params.end(),
                      key)) {
      params.erase(key);
      removed_parameters_permissions_.undefined_params.insert(key);
      LOG4CXX_INFO(logger_,
                   "Following parameter is not found among allowed parameters '"
                       << key << "' and will be treated as disallowed.");
    }
  }
}

void CommandRequestImpl::AddDissalowedParameterToInfoString(
    std::string& info, const std::string& param) const {
  // prepare disallowed params enumeration for response info string
  if (info.empty()) {
    info = "\'" + param + "\'";
  } else {
    info = info + "," + " " + "\'" + param + "\'";
  }
}

void CommandRequestImpl::AddDisallowedParametersToInfo(
    smart_objects::SmartObject& response) const {
  std::string info;

  RPCParams::const_iterator it =
      removed_parameters_permissions_.disallowed_params.begin();
  for (; it != removed_parameters_permissions_.disallowed_params.end(); ++it) {
    AddDissalowedParameterToInfoString(info, (*it));
  }

  it = removed_parameters_permissions_.undefined_params.begin();
  for (; it != removed_parameters_permissions_.undefined_params.end(); ++it) {
    AddDissalowedParameterToInfoString(info, (*it));
  }

  if (!info.empty()) {
    info += " disallowed by policies.";

    if (!response[strings::msg_params][strings::info].asString().empty()) {
      // If we already have info add info about disallowed params to it
      response[strings::msg_params][strings::info] =
          response[strings::msg_params][strings::info].asString() + " " + info;
    } else {
      response[strings::msg_params][strings::info] = info;
    }
  }
}

void CommandRequestImpl::AddDisallowedParameters(
    smart_objects::SmartObject& response) {
  DisallowedParamsInserter disallowed_inserter(
      response, mobile_apis::VehicleDataResultCode::VDRC_USER_DISALLOWED);
  std::for_each(removed_parameters_permissions_.disallowed_params.begin(),
                removed_parameters_permissions_.disallowed_params.end(),
                disallowed_inserter);

  DisallowedParamsInserter undefined_inserter(
      response, mobile_apis::VehicleDataResultCode::VDRC_DISALLOWED);
  std::for_each(removed_parameters_permissions_.undefined_params.begin(),
                removed_parameters_permissions_.undefined_params.end(),
                undefined_inserter);
}

bool CommandRequestImpl::HasDisallowedParams() const {
  return ((!removed_parameters_permissions_.disallowed_params.empty()) ||
          (!removed_parameters_permissions_.undefined_params.empty()));
}

bool CommandRequestImpl::PrepareResultForMobileResponse(
    hmi_apis::Common_Result::eType result_code,
    HmiInterfaces::InterfaceID interface) const {
  LOG4CXX_AUTO_TRACE(logger_);
  using namespace helpers;
  if (Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
          result_code,
          hmi_apis::Common_Result::SUCCESS,
          hmi_apis::Common_Result::WARNINGS,
          hmi_apis::Common_Result::WRONG_LANGUAGE,
          hmi_apis::Common_Result::RETRY,
          hmi_apis::Common_Result::SAVED)) {
    return true;
  }

  const HmiInterfaces::InterfaceState state =
      application_manager_.hmi_interfaces().GetInterfaceState(interface);
  if ((hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == result_code) &&
      (HmiInterfaces::STATE_NOT_AVAILABLE != state)) {
    return true;
  }
  return false;
}

bool CommandRequestImpl::PrepareResultForMobileResponse(
    ResponseInfo& out_first, ResponseInfo& out_second) const {
  LOG4CXX_AUTO_TRACE(logger_);
  bool result = CheckResultCode(out_first, out_second) ||
                CheckResultCode(out_second, out_first);
  return result;
}

void CommandRequestImpl::GetInfo(
    const smart_objects::SmartObject& response_from_hmi,
    std::string& out_info) {
  if (response_from_hmi[strings::msg_params].keyExists(strings::info)) {
    if (!response_from_hmi[strings::msg_params][strings::info].empty()) {
      out_info =
          response_from_hmi[strings::msg_params][strings::info].asString();
    }
  }
}

mobile_apis::Result::eType CommandRequestImpl::PrepareResultCodeForResponse(
    const ResponseInfo& first, const ResponseInfo& second) {
  LOG4CXX_AUTO_TRACE(logger_);
  mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM;
  if (IsResultCodeUnsupported(first, second) ||
      IsResultCodeUnsupported(second, first)) {
    return mobile_apis::Result::UNSUPPORTED_RESOURCE;
  }
  if (IsResultCodeWarning(first, second) ||
      IsResultCodeWarning(second, first)) {
    return mobile_apis::Result::WARNINGS;
  }
  // If response contains erroneous result code SDL need return erroneus
  // result code.
  hmi_apis::Common_Result::eType first_result =
      hmi_apis::Common_Result::INVALID_ENUM;
  hmi_apis::Common_Result::eType second_result =
      hmi_apis::Common_Result::INVALID_ENUM;
  if (!first.is_unsupported_resource) {
    first_result = first.result_code;
  }
  if (!second.is_unsupported_resource) {
    second_result = second.result_code;
  }
  result_code =
      MessageHelper::HMIToMobileResult(std::max(first_result, second_result));
  return result_code;
}

const CommandParametersPermissions& CommandRequestImpl::parameters_permissions()
    const {
  return parameters_permissions_;
}

void CommandRequestImpl::StartAwaitForInterface(
    const HmiInterfaces::InterfaceID interface_id) {
  sync_primitives::AutoLock lock(awaiting_response_interfaces_lock_);
  awaiting_response_interfaces_.insert(interface_id);
}

bool CommandRequestImpl::IsInterfaceAwaited(
    const HmiInterfaces::InterfaceID& interface_id) const {
  sync_primitives::AutoLock lock(awaiting_response_interfaces_lock_);
  std::set<HmiInterfaces::InterfaceID>::const_iterator it =
      awaiting_response_interfaces_.find(interface_id);
  return (it != awaiting_response_interfaces_.end());
}

void CommandRequestImpl::EndAwaitForInterface(
    const HmiInterfaces::InterfaceID& interface_id) {
  sync_primitives::AutoLock lock(awaiting_response_interfaces_lock_);
  std::set<HmiInterfaces::InterfaceID>::const_iterator it =
      awaiting_response_interfaces_.find(interface_id);
  if (it != awaiting_response_interfaces_.end()) {
    awaiting_response_interfaces_.erase(it);
  } else {
    LOG4CXX_WARN(logger_,
                 "EndAwaitForInterface called on interface \
                    which was not put into await state: "
                     << interface_id);
  }
}

bool CommandRequestImpl::IsResultCodeUnsupported(
    const ResponseInfo& first, const ResponseInfo& second) const {
  const bool first_ok_second_unsupported =
      (first.is_ok || first.is_not_used) && second.is_unsupported_resource;
  const bool both_unsupported =
      first.is_unsupported_resource && second.is_unsupported_resource;
  return first_ok_second_unsupported || both_unsupported;
}

std::string GetComponentNameFromInterface(
    const HmiInterfaces::InterfaceID& interface) {
  switch (interface) {
    case HmiInterfaces::HMI_INTERFACE_Buttons:
      return "Buttons";
    case HmiInterfaces::HMI_INTERFACE_BasicCommunication:
      return "BasicCommunication";
    case HmiInterfaces::HMI_INTERFACE_VR:
      return "VR";
    case HmiInterfaces::HMI_INTERFACE_TTS:
      return "TTS";
    case HmiInterfaces::HMI_INTERFACE_UI:
      return "UI";
    case HmiInterfaces::HMI_INTERFACE_Navigation:
      return "Navigation";
    case HmiInterfaces::HMI_INTERFACE_VehicleInfo:
      return "VehicleInfo";
    case HmiInterfaces::HMI_INTERFACE_SDL:
      return "SDL";
    default:
      return "Unknown type";
  }
}

const std::string InfoInterfaceSeparator(
    const std::string& sum, const HmiInterfaces::InterfaceID container_value) {
  return sum.empty()
             ? GetComponentNameFromInterface(container_value)
             : sum + ", " + GetComponentNameFromInterface(container_value);
}

void CommandRequestImpl::AddTimeOutComponentInfoToMessage(
    smart_objects::SmartObject& response) const {
  using NsSmartDeviceLink::NsSmartObjects::SmartObject;
  LOG4CXX_AUTO_TRACE(logger_);
  sync_primitives::AutoLock lock(awaiting_response_interfaces_lock_);
  if (awaiting_response_interfaces_.empty()) {
    LOG4CXX_ERROR(logger_, "No interfaces awaiting, info param is empty");
    return;
  }

  const std::string not_responding_interfaces_string =
      std::accumulate(awaiting_response_interfaces_.begin(),
                      awaiting_response_interfaces_.end(),
                      std::string(""),
                      InfoInterfaceSeparator);
  LOG4CXX_DEBUG(
      logger_,
      "Not responding interfaces string: " << not_responding_interfaces_string);
  if (!not_responding_interfaces_string.empty()) {
    const std::string component_info =
        not_responding_interfaces_string + " component does not respond";
    response[strings::msg_params][strings::info] = component_info;
  }
}

}  // namespace commands

}  // namespace application_manager


text:
<?xml version="1.0" encoding="UTF-8"?>
<Tokens version="1.0">
	<File path="Categories/UIViewController+Buttons.html">

		<Token>
			<TokenIdentifier>//apple_ref/occ/cat/UIViewController(Buttons)</TokenIdentifier>
			<Abstract type="html"></Abstract>
			<DeclaredIn>UIViewController+Buttons.h</DeclaredIn>

			<NodeRef refid="25"/>
		</Token>

	</File>
</Tokens>


text:
<?php

namespace spec\Sylius\Bundle\ApiBundle\Serializer;

use ApiPlatform\Core\Api\IriConverterInterface;
use Doctrine\Common\Collections\ArrayCollection;
use PhpSpec\ObjectBehavior;
use Sylius\Bundle\ApiBundle\Serializer\ZoneDenormalizer;
use Sylius\Component\Addressing\Model\Zone;
use Sylius\Component\Addressing\Model\ZoneInterface;
use Sylius\Component\Addressing\Model\ZoneMemberInterface;
use Sylius\Component\Core\Model\ProductInterface;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;

class ZoneDenormalizerSpec extends ObjectBehavior
{
    function let(IriConverterInterface $iriConverter): void
    {
        $this->beConstructedWith($iriConverter);
    }

    function it_is_initializable(): void
    {
        $this->shouldHaveType(ZoneDenormalizer::class);
    }

    function it_supports_only_zone_interface(ZoneInterface $zone): void
    {
        $this
            ->supportsDenormalization(
                new Zone(),
                ZoneInterface::class,
                null,
                [AbstractNormalizer::OBJECT_TO_POPULATE => $zone]
            )
            ->shouldReturn(true)
        ;

        $this
            ->supportsDenormalization(
                new Zone(),
                ProductInterface::class,
                null,
                [AbstractNormalizer::OBJECT_TO_POPULATE => $zone]
            )
            ->shouldReturn(false)
        ;
    }

    function it_does_not_support_denormalization_if_object_to_populate_is_not_a_zone(ProductInterface $product): void
    {
        $this
            ->supportsDenormalization(
                new Zone(),
                ZoneInterface::class,
                null,
                [AbstractNormalizer::OBJECT_TO_POPULATE => $product]
            )
            ->shouldReturn(false)
        ;

        $this
            ->supportsDenormalization(
                new Zone(),
                ZoneInterface::class,
            )
            ->shouldReturn(false)
        ;

        $this
            ->supportsDenormalization(
                new Zone(),
                ZoneInterface::class,
                null,
                [AbstractNormalizer::OBJECT_TO_POPULATE => 'I am even not an object!']
            )
            ->shouldReturn(false)
        ;
    }

    function it_fixes_members_that_were_removed_and_added_again_and_uses_default_denormalizer(
        IriConverterInterface $iriConverter,
        ZoneInterface $zone,
        ZoneMemberInterface $belgiumZone,
        ZoneMemberInterface $germanyZone,
        ZoneMemberInterface $franceZone,
        DenormalizerInterface $denormalizer,
    ): void {
        $belgiumZone->getCode()->willReturn('EU-BE');
        $germanyZone->getCode()->willReturn('EU-DE');
        $franceZone->getCode()->willReturn('EU-FR');

        $zone->getMembers()->willReturn(new ArrayCollection([
            $belgiumZone->getWrappedObject(),
            $germanyZone->getWrappedObject(),
            $franceZone->getWrappedObject(),
        ]));

        $iriConverter->getIriFromItem($belgiumZone)->willReturn('iri/EU-BE');
        $iriConverter->getIriFromItem($germanyZone)->willReturn('iri/EU-DE');
        $iriConverter->getIriFromItem($franceZone)->willReturn('iri/EU-FR');

        $denormalizer->denormalize(
            [
                'members' => [
                    'iri/EU-BE',
                    ['code' => 'EU-PL'],
                    'iri/EU-FR',
                ],
            ],
            Zone::class,
            null,
            [
                AbstractNormalizer::OBJECT_TO_POPULATE => $zone,
                'sylius_zone_denormalizer_already_called' => true,
            ]
        )->shouldBeCalled();

        $this->setDenormalizer($denormalizer);
        $this->denormalize(
            [
                'members' => [
                    'iri/EU-BE',
                    ['code' => 'EU-FR'],
                    ['code' => 'EU-PL'],
                ],
            ],
            Zone::class,
            null,
            [
                AbstractNormalizer::OBJECT_TO_POPULATE => $zone,
            ]
        );
    }

    public function it_does_not_fix_members_if_there_are_no_members_in_data(
        IriConverterInterface $iriConverter,
        ZoneInterface $zone,
        ZoneMemberInterface $belgiumZone,
        ZoneMemberInterface $germanyZone,
        ZoneMemberInterface $franceZone,
        DenormalizerInterface $denormalizer,
    ): void {
        $belgiumZone->getCode()->willReturn('EU-BE');
        $germanyZone->getCode()->willReturn('EU-DE');
        $franceZone->getCode()->willReturn('EU-FR');

        $zone->getMembers()->willReturn(new ArrayCollection([
            $belgiumZone->getWrappedObject(),
            $germanyZone->getWrappedObject(),
            $franceZone->getWrappedObject(),
        ]));

        $iriConverter->getIriFromItem($belgiumZone)->shouldNotBeCalled();
        $iriConverter->getIriFromItem($germanyZone)->shouldNotBeCalled();
        $iriConverter->getIriFromItem($franceZone)->shouldNotBeCalled();

        $denormalizer->denormalize(
            [],
            Zone::class,
            null,
            [
                AbstractNormalizer::OBJECT_TO_POPULATE => $zone,
                'sylius_zone_denormalizer_already_called' => true,
            ]
        )->shouldBeCalled();

        $this->setDenormalizer($denormalizer);
        $this->denormalize(
            [],
            Zone::class,
            null,
            [
                AbstractNormalizer::OBJECT_TO_POPULATE => $zone,
            ]
        );
    }
}


text:
automations
===========

my all automations go here...


text:
#ifndef _ASM_M32R_PARAM_H
#define _ASM_M32R_PARAM_H

#ifdef __KERNEL__
# define HZ		CONFIG_HZ	/* Internal kernel timer frequency */
# define USER_HZ	100		/* .. some user interfaces are in "ticks" */
# define CLOCKS_PER_SEC	(USER_HZ)	/* like times() */
#endif

#ifndef HZ
#define HZ 100
#endif

#define EXEC_PAGESIZE	4096

#ifndef NOGROUP
#define NOGROUP		(-1)
#endif

#define MAXHOSTNAMELEN	64	/* max length of hostname */

#endif /* _ASM_M32R_PARAM_H */


text:
.colorswitch {
	width: 500px;
	height: 200px;
	border: 1px solid #222;
	margin: 200px auto;
	-moz-transition: all 2s ease-out;
	-o-transition: all 2s ease-out;
	-webkit-transition: all 2s ease-out;
	-ms-transition: all 2s ease-out;
	transition: all 2s ease-out;
}


text:
namespace Appleseed.Content.Web.Modules
{
    using System;
    using System.Collections;
    using System.Web.UI.WebControls;

    using Appleseed.Framework;
    using Appleseed.Framework.Settings.Cache;
    using Appleseed.Framework.Site.Configuration;
    using Appleseed.Framework.Web.UI;
    using Appleseed.Framework.Web.UI.WebControls;

    using History = Appleseed.Framework.History;
    using HyperLink = Appleseed.Framework.Web.UI.WebControls.HyperLink;
    using LinkButton = Appleseed.Framework.Web.UI.WebControls.LinkButton;

    /// <summary>
    /// Summary description for Property Page
    /// </summary>
    [History("Jes1111", "2003/03/04", "Cache flushing now handled by inherited page")]
    public partial class PagePropertyPage : PropertyPage
    {
        protected Panel EditPanel;
        protected HyperLink adminPropertiesButton;
        protected PlaceHolder AddEditControl;
        protected LinkButton saveAndCloseButton;

        #region Web Form Designer generated code

        /// <summary>
        /// On init
        /// </summary>
        /// <param name="e"></param>
        protected override void OnInit(EventArgs e)
        {
            this.PlaceHolderButtons.EnableViewState = false;
            this.PlaceholderButtons2.EnableViewState = false;

            //Controls must be created here
            this.UpdateButton = new LinkButton();
            this.UpdateButton.CssClass = "CommandButton";

            PlaceHolderButtons.Controls.Add(this.UpdateButton);

            // jminond added to top of property page so no need to scroll for save
            LinkButton update2 = new LinkButton();
            update2.CssClass = "CommandButton";
            update2.TextKey = "Apply";
            update2.Text = "Apply";
            update2.Click += new EventHandler(UpdateButton_Click);
            PlaceholderButtons2.Controls.Add(update2);

            this.CancelButton = new LinkButton();
            this.CancelButton.CssClass = "CommandButton";
            PlaceHolderButtons.Controls.Add(this.CancelButton);

            string NavigateUrlPropertyPage = Appleseed.Framework.HttpUrlBuilder.BuildUrl("~/DesktopModules/CoreModules/Admin/ModuleSettings.aspx", PageID, ModuleID);

            if (Request.QueryString.GetValues("ModalChangeMaster") != null)
            {
                NavigateUrlPropertyPage += "&ModalChangeMaster=true";
                if (Request.QueryString.GetValues("camefromEditPage") != null)
                    NavigateUrlPropertyPage += "&camefromEditPage=true";
            }

            adminPropertiesButton = new HyperLink();
            adminPropertiesButton.TextKey = "MODULESETTINGS_BASE_SETTINGS";
            adminPropertiesButton.Text = "Edit base settings";
            adminPropertiesButton.CssClass = "CommandButton";
            adminPropertiesButton.NavigateUrl = NavigateUrlPropertyPage;

            if (Framework.Security.UserProfile.HasPortalAdministrationAccess() || Framework.Security.UserProfile.HasModuleAddEditAccess())
            {
                PlaceHolderButtons.Controls.Add(adminPropertiesButton);
            }

            // jminond added to top of property page so no need to scroll for save
            LinkButton cancel2 = new LinkButton();
            cancel2.CssClass = "CommandButton";
            cancel2.TextKey = "Cancel";
            cancel2.Text = "Cancel";
            cancel2.Click += new EventHandler(CancelButton_Click);
            PlaceholderButtons2.Controls.Add(cancel2);

            // jminond added to top of property page so no need to scroll for save
            HyperLink adminPropertiesButton2 = new HyperLink();
            adminPropertiesButton2.TextKey = "MODULESETTINGS_BASE_SETTINGS";
            adminPropertiesButton2.Text = "Edit base settings";
            adminPropertiesButton2.CssClass = "CommandButton";
            adminPropertiesButton2.NavigateUrl = NavigateUrlPropertyPage;

            if (Framework.Security.UserProfile.HasPortalAdministrationAccess() || Framework.Security.UserProfile.HasModuleAddEditAccess())
            {
                PlaceholderButtons2.Controls.Add(adminPropertiesButton2);
            }

            this.EditTable.UpdateControl += new UpdateControlEventHandler(this.EditTable_UpdateControl);
            this.Load += new EventHandler(this.PagePropertyPage_Load);
            base.OnInit(e);
        }
        #endregion

        private void PagePropertyPage_Load(object sender, EventArgs e)
        {
            //We reset cache before display page to ensure dropdown shows actual data
            //by Pekka Ylenius
            CurrentCache.Remove(Key.ModuleSettings(ModuleID));
            // Using settings grouping tabs or not is set in config file. --Hongwei Shen
            EditTable.UseGroupingTabs = Appleseed.Framework.Settings.Config.UseSettingsGroupingTabs;
            // The width and height will take effect only when using grouping tabs.
            // When not using grouping tabs, width and height should be set in css
            // class -- Hongwei Shen
            EditTable.Width = 1000;
            //EditTable.Height = Appleseed.Framework.Settings.Config.SettingsGroupingHeight;
            EditTable.CssClass = "st_control";
            EditTable.DataSource = new SortedList(this.ModuleSettings);
            EditTable.DataBind();
        }

        /// <summary>
        /// Persists the changes to database
        /// </summary>
        protected override void OnUpdate(EventArgs e)
        {
            base.OnUpdate(e);

            // Only Update if Input Data is Valid
            if (Page.IsValid == true)
            {
                // Update settings in the database
                EditTable.UpdateControls();
            }

            if (Request.QueryString.GetValues("ModalChangeMaster") != null)
            {
                if (this.Module.GuidID == new Guid("{5AB6843E-5A24-4D36-BB3D-0AE815DDB3B1}"))
                    Response.Write("<script type=\"text/javascript\">window.parent.location = window.parent.location.href.split('?')[0];</script>");
                else
                    Response.Write("<script type=\"text/javascript\">window.parent.location = window.parent.location.href;</script>");
            }
        }

        private void UpdateButton_Click(object sender, EventArgs e)
        {
            this.OnUpdate(e);
        }

        private void CancelButton_Click(object sender, EventArgs e)
        {
            this.OnCancel(e);
        }

        private void DeleteButton_Click(object sender, EventArgs e)
        {
            this.OnDelete(e);
        }

        protected override void OnCancel(EventArgs e)
        {
            base.OnCancel(e);
            //Response.Redirect(HttpUrlBuilder.BuildUrl("~/" + HttpUrlBuilder.DefaultPage, PageID));
        }

        private void EditTable_UpdateControl(object sender,
                                             Appleseed.Framework.Web.UI.WebControls.SettingsTableEventArgs e)
        {
            Framework.Site.Configuration.ModuleSettings.UpdateModuleSetting(ModuleID, ((ISettingItem)e.CurrentItem).EditControl.ID, ((ISettingItem)e.CurrentItem).Value.ToString());
        }
    }
}


text:
//////////////////////////////////////
////////// Class Definition //////////
//////////////////////////////////////

// @param domObjects either an array or a browser's native collection.
function uiHtml_Group(domObjects, optHandler) {
  this._super();
  this.__items = domObjects;
  this.__handler = optHandler;

  // (ctoohey) used to distinguish uiHtml_Select from uiHtml_Group when returned by uiHtml_Group.createByEither
  this.__type = "group";

  if (this.__handler == null) {
    // NOTE: in order for this to work, the collection should contain
    //       at least one item
    var firstItem = domObjects[0];
    if (firstItem == null) {
      // this violation could happen if a select does not contain any option
      throw new uiUtil_IllegalStateException(
          "A group should contain at least one item.");
    }

    // NOTE: list sometimes contains a lot of items, in which case it is
    //       highly inefficient to create objects for wrapping each,
    //       therefore it is better to get a handler for all of them
    //
    // assume that the rest of the elements are of the same type
    this.__handler = uiHtml_Group.__getWrapper(firstItem);
  }
}

uiHtml_Group = uiUtil_Object.declareClass(uiHtml_Group, uiUtil_Object);

////////////////////////////////////////
////////// Non-static Methods //////////
////////////////////////////////////////

uiHtml_Group.prototype.appendEventHandler = function(event, handler) {
  for (var i = 0; i < this.__items.length; ++i) {
    this.__handler.appendEventHandler(this.__items[i], event, handler);
  }
};

uiHtml_Group.prototype.executeAggregateEventHandler = function(event, optDomEvent) {
  for (var i = 0; i < this.__items.length; ++i) {
    this.__handler.executeAggregateEventHandler(this.__items[i], event, optDomEvent);
  }
};

uiHtml_Group.prototype.__constructItemArgs = function(item, args) {
  var argArray = new Array();
  var outputIndex = 0;
  argArray[outputIndex++] = item;

  var start = args.callee.length - 1;
  for (var i = start; i < args.length; ++i) {
    argArray[outputIndex++] = args[i];
  }
  return argArray;
};

uiHtml_Group.prototype.traverse = function(
    handlerOwner, handlerFunction, optArgN) {
  var argArray = this.__constructItemArgs(null, arguments);

  for (var i = 0; i < this.__items.length; ++i) {
    argArray[0] = this.__items[i];
    handlerFunction.apply(handlerOwner, argArray);
  }
};

uiHtml_Group.prototype.getItemHandler = function() {
  return this.__handler;
};

uiHtml_Group.prototype.size = function() {
  return this.__items.length;
};

uiHtml_Group.prototype.getItemAt = function(index) {
  return this.__items[index];
};

uiHtml_Group.prototype.setItemAt = function(index, item) {
  this.__items[index] = item;
};

uiHtml_Group.prototype.addItem = function(item) {
  throw new Exception("Operation not supported by super class. " +
      "This is an optional operation of the subclass.");
};

// Returns an array of items in the group.
uiHtml_Group.prototype._getItems = function() {
  return this.__items;
};

uiHtml_Group.prototype.hasValue = function(value) {
  for (var i = 0; i < this.__items.length; ++i) {
    if (this.__handler.getLogicalValue(this.__items[i]) == value) {
      return true;
    }
  }

  return false;
};

// author:ctoohey
// observe and ignore child tags matching their forValue is done via
// a regular expression match
uiHtml_Group.prototype.hasRegExpValue = function(forValue) {
  var forValueRegExp = new RegExp(forValue);
  // note: the __items array contains multiple items for selectboxes and
  //       radiobutton groups, but for all other types of element this array
  //       just contains a single widget
  // note: the forValue=null (e.g. when observeForNull tag is used) situation has
  //       already been handled in Rule._holds,
  //       so know that forValue is not null at this point, meaning that if
  //       this group represents selectible widgets (i.e. select options,
  //       radio buttons, checkboxes) that at least one of them is selected.
  //       thus, must iterate thru all of the selectible items to make sure none
  //       of them matches before returning false, but as soon as there is a match,
  //       return true.
  for (var i = 0; i < this.__items.length; ++i) {
    var logicalValue = this.__handler.getLogicalValue(this.__items[i]);
    if (logicalValue != null && logicalValue.match(forValueRegExp)) {
      return true;
    }
  }

  return false;
};

uiHtml_Group.prototype.getValues = function() {
  var values = new Array();
  for (var i = 0; i < this.__items.length; ++i) {
    var value = this.__handler.getLogicalValue(this.__items[i]);
    if (value != null) {
      values.push(value);
    }
  }

  return values;
};

uiHtml_Group.prototype.handleItemAtIndex = function(
    index, owner, handler, optArgN) {
  var argArray = this.__constructItemArgs(this.__items[index], arguments);
  return handler.apply(owner, argArray);
};

uiHtml_Group.prototype.handleItemWithValue = function(
    value, owner, handler, optArgN) {
  for (var i = 0; i < this.__items.length; ++i) {
    if (this.__items[i].value == value) {
      var argArray = this.__constructItemArgs(this.__items[i], arguments);
      return handler.apply(owner, argArray);
    }
  }
};

////////////////////////////////////
////////// Static Methods //////////
////////////////////////////////////

// Returns either a browser's native collection of multiple dom objects
// or an array of objects, thus allowing either to be accessed in a
// similar manner.
// The browser specific collection doesn't get converted to array, since
// it could impose big performance impact.
uiHtml_Group.__getDomObjectsByEither = function(id, name) {
  var domObjects;
  var domObject = uiHtml_Document.getInstance().getDomObjectById(id, false);
  if (domObject == null) {
    // either id was not specified, or must be name of a radio button group, need to use
    // getDomObjectsByName (all radio buttons have the same name)
    if (name == null || name.length == 0) {
      // special handling for LavaWeb component handler elementId which represents radio button group
      // need to construct the element name for the radio button group, which is of the format:
      // "component['COMPONENT_NAME'].PROPERTY_NAME

      // parse out component name from id
      var endComponent = id.indexOf("_");
      var component = id.substring(0, endComponent);
      // parse out property name from id
      var property = id.substring(endComponent + 1);

      name = "components['" + component + "']." + property;
    }
    domObjects = uiHtml_Document.getInstance().getDomObjectsByName(name, false);
  }
  else {
    domObjects = new Array(domObject);
  }

  // note that getElementsByName() always return a collection, so
  // it's best to check for the first item in the collection
  if (domObjects[0] == null) {
    throw new uiUtil_IllegalArgumentException(
        "Invalid element ID: " + id + " and name: " + name);
  }
  return domObjects;
};

uiHtml_Group.createByEither = function(id, name) {
  // if both id and name are specified, first the id is used to attempt to locate the
  //  HTML element, and if not found, then the name is used
  // if no component is specified in the tag and elementId is specifed, id is equal to
  //  elementId
  // if a component and elementId are specified in the tag, is component_elementId, e.g.
  // e.g. if elementId="noChgImp" component="instrument", then id="instrument_noChgImp"
  // if elementName is specifed in the tag, name is equal to elementName, and component
  //  is ignored
  var domObjects = uiHtml_Group.__getDomObjectsByEither(id, name);

  try {
    // it's not possible to have multiple select boxes with the same name
    // so we assume that 'obj' would never be an array of 'select'
    if (uiHtml_Element.getWidgetType(domObjects[0]) == "select") {
      return new uiHtml_Select(domObjects[0]);
    }
    else {
      return new uiHtml_Group(domObjects);
    }
  }
  catch (e) {
    // provide more detailed info
    if (e instanceof uiUtil_Exception) {
      throw new uiUtil_CreateException("[" + name + "] " + e.getMessage());
    }
  }
};

uiHtml_Group.__getWrapper = function(domWidget) {
  switch(uiHtml_Element.getWidgetType(domWidget)) {
    case "checkbox" :
        return uiHtml_CheckBoxWrapper.getInstance();
    case "radio"    :
        return uiHtml_RadioWrapper.getInstance();
    default         :
        return uiHtml_ElementWrapper.getInstance();
  }
};


text:
using UnityEngine;

namespace Devdayo.FSM.Event
{
    [DisallowMultipleComponent]
    public sealed class TransformParentChange : Observable
    {
        void OnTransformParentChanged()
        {
            Notify();
        }
    }

    [DisallowMultipleComponent]
    public sealed class TransformChildrenChange : Observable
    {
        void OnTransformChildrenChanged()
        {
            Notify();
        }
    }
}


text:
using System;

namespace SmartDev.ConfigurationMapper
{
	[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
	public class ScopeAttribute: Attribute
	{
		public string Name { get; set; }

		public ScopeAttribute(string name)
		{
			if (String.IsNullOrWhiteSpace(name))
				throw new ArgumentNullException("name");

			Name = name;
		}
	}
}