text:
<!DOCTYPE html>

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

    <title>Hillary Ngai</title>

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

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

    <link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">
    <link href='https://fonts.googleapis.com/css?family=Kaushan+Script' rel='stylesheet' type='text/css'>
    <link href='https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
    <link href='https://fonts.googleapis.com/css?family=Roboto+Slab:400,100,300,700' rel='stylesheet' type='text/css'>

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

                </button>
                Hillary Ngai

                        Skills

                        Experience

                        Projects

                        About

                        Contact

Hillary Ngai

Biomedical Engineering

                Explore

Skills

Languages

MATLAB, python, C++, C#, Java, R, SQL, Razor, HTML/CSS, and JavaScript

Tools/Frameworks

                        Arduino, Git, PowerShell, Bootstrap, MVC ASP.NET, Entity Framework, Dapper, and Adobe Photoshop

Engineering Design

AnalyzeDirect, RadiAnt DICOM Viewer, SolidWorks, SEM

Multilingualism

                        Cantonese and French

Experience

January 2017 – April 2017

Biomedical Engineering Intern — Edwards Lifesciences, Irvine, CA

•  Created 3D models from CT scans of the inner surface of the left atrium and left ventricle of the heart using AnalyzeDirect

•	Calculated displacement of transcatheter mitral heart valve using fluoroscopy images, SolidWorks, and Excel

•	Developed and implemented IQ/OQ protocol for backpressure leakage tester

•	Inspected transcatheter heart valve frames for fractures using a SEM

May 2016 – August 2016

Full-Stack Web Developer — D+H Limited Partnership, Mississauga, ON

•	Designed and developed the user interface of online monitoring websites for various banks including TD, CIBC, and RBC using MVC ASP.NET, C#, HTML/CSS, Razor, JavaScript, and Angular JS

•	Localized text, images, and overall design of website for linguistic and cultural context manipulation

•	Mapped .NET classes to SQL database using Dapper ORM and performed query optimization in SQL

March 2014 - June 2015

Executive and Co-founder — Math Club, Mississauga, ON

•	Facilitated group discussions, assisted struggling students, and ensured all discussions remained on schedule

•	Organized and coordinated team to participate in international competition

Be A Part

Of My

Story!

Projects

Stimu-Step

Signal Processing Design Project

CalCam

Microsoft Hacks

SWAP

Engineering Design Project

About

Hillary Ngai

Biomedical Engineering Student at University of Waterloo

Contact Me

hngai@uwaterloo.ca

Hillary Ngai 2017

Stimu-Step

Signal Processing Design Project

September 2016 – December 2016

•	As a team, designed and programmed a wearable device that detects freezing of gait for people with Parkinson's disease and responds by sending vibrations to the patellar tendon to stimulate gait

•	Incorporated MATLAB (signal processing), Arduino Uno, and DC motor

<button type="button" class="btn btn-primary" data-dismiss="modal"> Close Project</button>

CalCam

Microsoft Hacks

June 2016

•	As a team, designed and coded an android app that logs users' daily nutritional intake by identifying pictures of food taken by the user

•	Incorporated the Clarifai visual recognition API, machine learning, Android Studio, Java, and Python

•	Developed corresponding marketing website using HTML/CSS and JavaScript

<button type="button" class="btn btn-primary" data-dismiss="modal"> Close Project</button>

SWAP

Engineering Design Project

September 2015 - December 2015

•	As a team, designed and produced a composting waste disposal system

•	Product design tackled health, environmental, and economic issues in the aboriginal community

•	Incorporated design evaluation practices into the final report such as QFD and life-cycle analysis

•	Assessed usability and functionality of design using quality assurance and prototype testing

<button type="button" class="btn btn-primary" data-dismiss="modal"> Close Project</button>

Project Name

Lorem ipsum dolor sit amet consectetur.

Start Bootstrap's Agency theme is based on Golden, a free PSD website template built by Mathavan Jaya. Golden is a modern and clean one page web template that was made exclusively for Best PSD Freebies. This template has a great portfolio, timeline, and meet your team sections that can be easily modified to fit your needs.

You can download the PSD template in this portfolio sample item at FreebiesXpress.com.

                            <button type="button" class="btn btn-primary" data-dismiss="modal"> Close Project</button>

Project Name

Lorem ipsum dolor sit amet consectetur.

Escape is a free PSD web template built by Mathavan Jaya. Escape is a one page web template that was designed with agencies in mind. This template is ideal for those looking for a simple one page solution to describe your business and offer your services.

You can download the PSD template in this portfolio sample item at FreebiesXpress.com.

                            <button type="button" class="btn btn-primary" data-dismiss="modal"> Close Project</button>

Project Name

Lorem ipsum dolor sit amet consectetur.

Dreams is a free PSD web template built by Mathavan Jaya. Dreams is a modern one page web template designed for almost any purpose. It's a beautiful template that's designed with the Bootstrap framework in mind.

You can download the PSD template in this portfolio sample item at FreebiesXpress.com.

                            <button type="button" class="btn btn-primary" data-dismiss="modal"> Close Project</button>


text:
import testAction from 'helpers/vuex_action_helper';
import Api from '~/api';
import * as actions from '~/registry/settings/store/actions';
import * as types from '~/registry/settings/store/mutation_types';

describe('Actions Registry Store', () => {
  describe.each`
    actionName           | mutationName               | payload
    ${'setInitialState'} | ${types.SET_INITIAL_STATE} | ${'foo'}
    ${'updateSettings'}  | ${types.UPDATE_SETTINGS}   | ${'foo'}
    ${'toggleLoading'}   | ${types.TOGGLE_LOADING}    | ${undefined}
    ${'resetSettings'}   | ${types.RESET_SETTINGS}    | ${undefined}
  `(
    '$actionName invokes $mutationName with payload $payload',
    ({ actionName, mutationName, payload }) => {
      it('should set state', done => {
        testAction(actions[actionName], payload, {}, [{ type: mutationName, payload }], [], done);
      });
    },
  );

  describe('receiveSettingsSuccess', () => {
    it('calls SET_SETTINGS', () => {
      testAction(
        actions.receiveSettingsSuccess,
        'foo',
        {},
        [{ type: types.SET_SETTINGS, payload: 'foo' }],
        [],
      );
    });
  });

  describe('fetchSettings', () => {
    const state = {
      projectId: 'bar',
    };

    const payload = {
      data: {
        container_expiration_policy: 'foo',
      },
    };

    it('should fetch the data from the API', done => {
      Api.project = jest.fn().mockResolvedValue(payload);
      testAction(
        actions.fetchSettings,
        null,
        state,
        [],
        [
          { type: 'toggleLoading' },
          { type: 'receiveSettingsSuccess', payload: payload.data.container_expiration_policy },
          { type: 'toggleLoading' },
        ],
        done,
      );
    });
  });

  describe('saveSettings', () => {
    const state = {
      projectId: 'bar',
      settings: 'baz',
    };

    const payload = {
      data: {
        tag_expiration_policies: 'foo',
      },
    };

    it('should fetch the data from the API', done => {
      Api.updateProject = jest.fn().mockResolvedValue(payload);
      testAction(
        actions.saveSettings,
        null,
        state,
        [],
        [
          { type: 'toggleLoading' },
          { type: 'receiveSettingsSuccess', payload: payload.data.container_expiration_policy },
          { type: 'toggleLoading' },
        ],
        done,
      );
    });
  });
});

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using System.Windows.Forms.Design;

namespace Oranikle.Studio.Controls
{

    [System.Windows.Forms.Design.ToolStripItemDesignerAvailability(System.Windows.Forms.Design.ToolStripItemDesignerAvailability.ToolStrip)]
    public class CtrlTabStripButton : System.Windows.Forms.ToolStripButton
    {

        private System.Drawing.Color m_BackColor2;
        private System.Drawing.Color m_BackColor2Hot;
        private System.Drawing.Color m_BackColor2Inactive;
        private System.Drawing.Color m_BackColorHot;
        private System.Drawing.Color m_BackColorInactive;
        private System.Drawing.Color m_BorderColor;
        private System.Drawing.Color m_BorderColorHot;
        private System.Drawing.Color m_BorderColorInactive;
        private int m_CloseButtonHorizontalOffset;
        private int m_CloseButtonVerticalOffset;
        private System.Drawing.Color m_TextColor;
        private System.Drawing.Color m_TextColorHot;
        private System.Drawing.Color m_TextColorInactive;
        private int m_VerticalOffset;
        private int m_VerticalOffsetHot;
        private int m_VerticalOffsetInactive;
        private bool showCloseButton;

        [System.ComponentModel.Category("Appearance")]
        [System.ComponentModel.Description("Active Border color of the TabButton")]
        public System.Drawing.Color BackColor2
        {
            get
            {
                return m_BackColor2;
            }
            set
            {
                m_BackColor2 = value;
                Invalidate();
            }
        }

        [System.ComponentModel.Description("Border color when TabButton is highlighted")]
        [System.ComponentModel.Category("Appearance")]
        public System.Drawing.Color BackColor2Hot
        {
            get
            {
                return m_BackColor2Hot;
            }
            set
            {
                m_BackColor2Hot = value;
                Invalidate();
            }
        }

        [System.ComponentModel.Description("Inactive Border color of the TabButton")]
        [System.ComponentModel.Category("Appearance")]
        public System.Drawing.Color BackColor2Inactive
        {
            get
            {
                return m_BackColor2Inactive;
            }
            set
            {
                m_BackColor2Inactive = value;
                Invalidate();
            }
        }

        [System.ComponentModel.Category("Appearance")]
        [System.ComponentModel.Description("Back color when TabButton is highlighted")]
        public System.Drawing.Color BackColorHot
        {
            get
            {
                return m_BackColorHot;
            }
            set
            {
                m_BackColorHot = value;
                Invalidate();
            }
        }

        [System.ComponentModel.Category("Appearance")]
        [System.ComponentModel.Description("Inactive Back color of the TabButton")]
        public System.Drawing.Color BackColorInactive
        {
            get
            {
                return m_BackColorInactive;
            }
            set
            {
                m_BackColorInactive = value;
                Invalidate();
            }
        }

        [System.ComponentModel.Description("Active Border color of the TabButton")]
        [System.ComponentModel.Category("Appearance")]
        public System.Drawing.Color BorderColor
        {
            get
            {
                return m_BorderColor;
            }
            set
            {
                m_BorderColor = value;
                Invalidate();
            }
        }

        [System.ComponentModel.Description("Border color when TabButton is highlighted")]
        [System.ComponentModel.Category("Appearance")]
        public System.Drawing.Color BorderColorHot
        {
            get
            {
                return m_BorderColorHot;
            }
            set
            {
                m_BorderColorHot = value;
                Invalidate();
            }
        }

        [System.ComponentModel.Category("Appearance")]
        [System.ComponentModel.Description("Inactive Border color of the TabButton")]
        public System.Drawing.Color BorderColorInactive
        {
            get
            {
                return m_BorderColorInactive;
            }
            set
            {
                m_BorderColorInactive = value;
                Invalidate();
            }
        }

        [System.ComponentModel.DefaultValue(false)]
        [System.ComponentModel.Browsable(false)]
        public new bool Checked
        {
            get
            {
                return IsSelected;
            }
            set
            {
            }
        }

        [System.ComponentModel.Category("Appearance")]
        [System.ComponentModel.Description("Text color when TabButton is highlighted")]
        public int CloseButtonHorizontalOffset
        {
            get
            {
                return m_CloseButtonHorizontalOffset;
            }
            set
            {
                m_CloseButtonHorizontalOffset = value;
                Invalidate();
            }
        }

        [System.ComponentModel.Description("Text color when TabButton is highlighted")]
        [System.ComponentModel.Category("Appearance")]
        public int CloseButtonVerticalOffset
        {
            get
            {
                return m_CloseButtonVerticalOffset;
            }
            set
            {
                m_CloseButtonVerticalOffset = value;
                Invalidate();
            }
        }

        [System.ComponentModel.Browsable(false)]
        public bool IsSelected
        {
            get
            {
                Oranikle.Studio.Controls.CtrlTabStrip ctrlTabStrip = Owner as Oranikle.Studio.Controls.CtrlTabStrip;
                if (ctrlTabStrip != null)
                    return this == ctrlTabStrip.SelectedTab;
                return false;
            }
            set
            {
                if (!value)
                    return;
                Oranikle.Studio.Controls.CtrlTabStrip ctrlTabStrip = Owner as Oranikle.Studio.Controls.CtrlTabStrip;
                if (ctrlTabStrip == null)
                    return;
                ctrlTabStrip.SelectedTab = this;
            }
        }

        [System.ComponentModel.Browsable(false)]
        public new System.Windows.Forms.Padding Margin
        {
            get
            {
                return base.Margin;
            }
            set
            {
            }
        }

        [System.ComponentModel.Browsable(false)]
        public new System.Windows.Forms.Padding Padding
        {
            get
            {
                return base.Padding;
            }
            set
            {
            }
        }

        [System.ComponentModel.Description("Show button or not to close the tab.")]
        [System.ComponentModel.Category("Appearance")]
        public bool ShowCloseButton
        {
            get
            {
                return showCloseButton;
            }
            set
            {
                showCloseButton = value;
                Invalidate();
            }
        }

        [System.ComponentModel.Category("Appearance")]
        [System.ComponentModel.Description("Active Text color of the TabButton")]
        public System.Drawing.Color TextColor
        {
            get
            {
                return m_TextColor;
            }
            set
            {
                m_TextColor = value;
                Invalidate();
            }
        }

        [System.ComponentModel.Description("Text color when TabButton is highlighted")]
        [System.ComponentModel.Category("Appearance")]
        public System.Drawing.Color TextColorHot
        {
            get
            {
                return m_TextColorHot;
            }
            set
            {
                m_TextColorHot = value;
                Invalidate();
            }
        }

        [System.ComponentModel.Category("Appearance")]
        [System.ComponentModel.Description("Inactive Text color of the TabButton")]
        public System.Drawing.Color TextColorInactive
        {
            get
            {
                return m_TextColorInactive;
            }
            set
            {
                m_TextColorInactive = value;
                Invalidate();
            }
        }

        [System.ComponentModel.Category("Appearance")]
        [System.ComponentModel.Description("Active Text color of the TabButton")]
        public int VerticalOffset
        {
            get
            {
                return m_VerticalOffset;
            }
            set
            {
                m_VerticalOffset = value;
                Invalidate();
            }
        }

        [System.ComponentModel.Description("Text color when TabButton is highlighted")]
        [System.ComponentModel.Category("Appearance")]
        public int VerticalOffsetHot
        {
            get
            {
                return m_VerticalOffsetHot;
            }
            set
            {
                m_VerticalOffsetHot = value;
                Invalidate();
            }
        }

        [System.ComponentModel.Description("Inactive Text color of the TabButton")]
        [System.ComponentModel.Category("Appearance")]
        public int VerticalOffsetInactive
        {
            get
            {
                return m_VerticalOffsetInactive;
            }
            set
            {
                m_VerticalOffsetInactive = value;
                Invalidate();
            }
        }

        protected override System.Windows.Forms.Padding DefaultMargin
        {
            get
            {
                return new System.Windows.Forms.Padding(0);
            }
        }

        public CtrlTabStripButton()
        {
            m_BorderColor = System.Drawing.Color.Gray;
            m_BorderColorInactive = System.Drawing.Color.Gray;
            m_BorderColorHot = System.Drawing.Color.Orange;
            m_BackColor2 = System.Drawing.Color.Gray;
            m_BackColor2Inactive = System.Drawing.Color.Gray;
            m_BackColor2Hot = System.Drawing.Color.Orange;
            m_BackColorInactive = System.Drawing.Color.Gray;
            m_BackColorHot = System.Drawing.Color.Orange;
            m_TextColor = System.Drawing.Color.Gray;
            m_TextColorInactive = System.Drawing.Color.Gray;
            m_TextColorHot = System.Drawing.Color.Orange;
            m_VerticalOffset = 1;
            m_VerticalOffsetInactive = 3;
            m_VerticalOffsetHot = 1;
            showCloseButton = true;
            m_CloseButtonVerticalOffset = 12;
            m_CloseButtonHorizontalOffset = 16;
            InitButton();
        }

        public CtrlTabStripButton(System.Drawing.Image image) : base(image)
        {
            m_BorderColor = System.Drawing.Color.Gray;
            m_BorderColorInactive = System.Drawing.Color.Gray;
            m_BorderColorHot = System.Drawing.Color.Orange;
            m_BackColor2 = System.Drawing.Color.Gray;
            m_BackColor2Inactive = System.Drawing.Color.Gray;
            m_BackColor2Hot = System.Drawing.Color.Orange;
            m_BackColorInactive = System.Drawing.Color.Gray;
            m_BackColorHot = System.Drawing.Color.Orange;
            m_TextColor = System.Drawing.Color.Gray;
            m_TextColorInactive = System.Drawing.Color.Gray;
            m_TextColorHot = System.Drawing.Color.Orange;
            m_VerticalOffset = 1;
            m_VerticalOffsetInactive = 3;
            m_VerticalOffsetHot = 1;
            showCloseButton = true;
            m_CloseButtonVerticalOffset = 12;
            m_CloseButtonHorizontalOffset = 16;
            InitButton();
        }

        public CtrlTabStripButton(string text) : base(text)
        {
            m_BorderColor = System.Drawing.Color.Gray;
            m_BorderColorInactive = System.Drawing.Color.Gray;
            m_BorderColorHot = System.Drawing.Color.Orange;
            m_BackColor2 = System.Drawing.Color.Gray;
            m_BackColor2Inactive = System.Drawing.Color.Gray;
            m_BackColor2Hot = System.Drawing.Color.Orange;
            m_BackColorInactive = System.Drawing.Color.Gray;
            m_BackColorHot = System.Drawing.Color.Orange;
            m_TextColor = System.Drawing.Color.Gray;
            m_TextColorInactive = System.Drawing.Color.Gray;
            m_TextColorHot = System.Drawing.Color.Orange;
            m_VerticalOffset = 1;
            m_VerticalOffsetInactive = 3;
            m_VerticalOffsetHot = 1;
            showCloseButton = true;
            m_CloseButtonVerticalOffset = 12;
            m_CloseButtonHorizontalOffset = 16;
            InitButton();
        }

        public CtrlTabStripButton(string text, System.Drawing.Image image) : base(text, image)
        {
            m_BorderColor = System.Drawing.Color.Gray;
            m_BorderColorInactive = System.Drawing.Color.Gray;
            m_BorderColorHot = System.Drawing.Color.Orange;
            m_BackColor2 = System.Drawing.Color.Gray;
            m_BackColor2Inactive = System.Drawing.Color.Gray;
            m_BackColor2Hot = System.Drawing.Color.Orange;
            m_BackColorInactive = System.Drawing.Color.Gray;
            m_BackColorHot = System.Drawing.Color.Orange;
            m_TextColor = System.Drawing.Color.Gray;
            m_TextColorInactive = System.Drawing.Color.Gray;
            m_TextColorHot = System.Drawing.Color.Orange;
            m_VerticalOffset = 1;
            m_VerticalOffsetInactive = 3;
            m_VerticalOffsetHot = 1;
            showCloseButton = true;
            m_CloseButtonVerticalOffset = 12;
            m_CloseButtonHorizontalOffset = 16;
            InitButton();
        }

        public CtrlTabStripButton(string Text, System.Drawing.Image Image, System.EventHandler Handler) : base(Text, Image, Handler)
        {
            m_BorderColor = System.Drawing.Color.Gray;
            m_BorderColorInactive = System.Drawing.Color.Gray;
            m_BorderColorHot = System.Drawing.Color.Orange;
            m_BackColor2 = System.Drawing.Color.Gray;
            m_BackColor2Inactive = System.Drawing.Color.Gray;
            m_BackColor2Hot = System.Drawing.Color.Orange;
            m_BackColorInactive = System.Drawing.Color.Gray;
            m_BackColorHot = System.Drawing.Color.Orange;
            m_TextColor = System.Drawing.Color.Gray;
            m_TextColorInactive = System.Drawing.Color.Gray;
            m_TextColorHot = System.Drawing.Color.Orange;
            m_VerticalOffset = 1;
            m_VerticalOffsetInactive = 3;
            m_VerticalOffsetHot = 1;
            showCloseButton = true;
            m_CloseButtonVerticalOffset = 12;
            m_CloseButtonHorizontalOffset = 16;
            InitButton();
        }

        public CtrlTabStripButton(string Text, System.Drawing.Image Image, System.EventHandler Handler, string name) : base(Text, Image, Handler, name)
        {
            m_BorderColor = System.Drawing.Color.Gray;
            m_BorderColorInactive = System.Drawing.Color.Gray;
            m_BorderColorHot = System.Drawing.Color.Orange;
            m_BackColor2 = System.Drawing.Color.Gray;
            m_BackColor2Inactive = System.Drawing.Color.Gray;
            m_BackColor2Hot = System.Drawing.Color.Orange;
            m_BackColorInactive = System.Drawing.Color.Gray;
            m_BackColorHot = System.Drawing.Color.Orange;
            m_TextColor = System.Drawing.Color.Gray;
            m_TextColorInactive = System.Drawing.Color.Gray;
            m_TextColorHot = System.Drawing.Color.Orange;
            m_VerticalOffset = 1;
            m_VerticalOffsetInactive = 3;
            m_VerticalOffsetHot = 1;
            showCloseButton = true;
            m_CloseButtonVerticalOffset = 12;
            m_CloseButtonHorizontalOffset = 16;
            InitButton();
        }

        private void InitButton()
        {
        }

        private void RemoveTab()
        {
            Oranikle.Studio.Controls.ItemBeforeRemoveEventArgs itemBeforeRemoveEventArgs = new Oranikle.Studio.Controls.ItemBeforeRemoveEventArgs(this);
            if (((Oranikle.Studio.Controls.CtrlTabStrip)Parent).FireItemBeforeRemoveEvent(itemBeforeRemoveEventArgs))
                return;
            if ((Tag is System.IDisposable))
                ((System.IDisposable)Tag).Dispose();
            Tag = null;
            Parent.Items.Remove(this);
            Dispose();
        }

        public override System.Drawing.Size GetPreferredSize(System.Drawing.Size constrainingSize)
        {
            System.Drawing.Size size = base.GetPreferredSize(constrainingSize);
            if ((Owner != null) && (Owner.Orientation == System.Windows.Forms.Orientation.Vertical))
            {
                size.Width += 3;
                size.Height += 10;
            }
            return size;
        }

        protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)
        {
            base.OnMouseDown(e);
            if ((e.Button == System.Windows.Forms.MouseButtons.Middle) && (((Oranikle.Studio.Controls.CtrlTabStrip)Parent).TabCount > ((Oranikle.Studio.Controls.CtrlTabStrip)Parent).MinNumOfTabButtons))
            {
                RemoveTab();
                return;
            }
            if (showCloseButton)
            {
                System.Drawing.Point point = e.Location;
                System.Drawing.Rectangle rectangle = new System.Drawing.Rectangle(Width - m_CloseButtonHorizontalOffset, m_CloseButtonVerticalOffset, 8, 8);
                if (rectangle.Contains(point) && (((Oranikle.Studio.Controls.CtrlTabStrip)Parent).TabCount > ((Oranikle.Studio.Controls.CtrlTabStrip)Parent).MinNumOfTabButtons))
                    RemoveTab();
            }
        }

        protected override void OnOwnerChanged(System.EventArgs e)
        {
            if ((Owner != null) && !(Owner is Oranikle.Studio.Controls.CtrlTabStrip))
                throw new System.Exception("Cannot add CtrlTabStripButton to " + Owner.GetType().Name);
            base.OnOwnerChanged(e);
        }

    } // class CtrlTabStripButton

}


text:
from pyxrf.gui_module.main_window import MainWindow
from PyQt5.QtWidgets import QMessageBox
from pyxrf.gui_support.gpc_class import GlobalProcessingClasses

def test_MainWindow(qtbot, monkeypatch):
    """
    Simple test that opens and closes the main window and
    checks the window dimensions
    """
    gpc = GlobalProcessingClasses()
    gpc.initialize()

    window = MainWindow(gpc=gpc)
    window.show()

    qtbot.addWidget(window)
    qtbot.waitForWindowShown(window)

    monkeypatch.setattr(QMessageBox, "exec", lambda *args: QMessageBox.No)
    window.close()
    assert not window._is_closed, "Window was closed prematurely"

    monkeypatch.setattr(QMessageBox, "exec", lambda *args: QMessageBox.Yes)
    window.close()
    assert window._is_closed, "Window was not closed properly"


text:
@interface OAuthViewController () <UIWebViewDelegate>

@end

@implementation OAuthViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    UIWebView *webView = [[UIWebView alloc] init];
    webView.frame = self.view.bounds;
    webView.delegate = self;
    [self.view addSubview:webView];

    NSURL *url = [NSURL URLWithString:@"https://api.weibo.com/oauth2/authorize?client_id=3431567134&redirect_uri=http://"];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [webView loadRequest:request];
}

-(void)webViewDidStartLoad:(UIWebView *)webView
{
    [MBProgressHUD showMessage:@"正在加载..."];
}

-(void)webViewDidFinishLoad:(UIWebView *)webView
{
    [MBProgressHUD hideHUD];
}

-(void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
    [MBProgressHUD hideHUD];
}

-(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
    NSString *url = request.URL.absoluteString;
    NSRange range = [url rangeOfString:@"code="];
    if (range.length != 0) {
        int fromIndex = (int)(range.location + range.length);
        NSString *code = [url substringFromIndex:fromIndex];
        [self accessTokenWithCode:code];
        return NO;
    }
    return YES;
}

- (void)accessTokenWithCode:(NSString *)code
{
    AFHTTPRequestOperationManager *mgr = [AFHTTPRequestOperationManager manager];
//    mgr.responseSerializer = [AFJSONResponseSerializer serializer];
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    params[@"client_id"] = @"3431567134";
    params[@"client_secret"] = @"3204569b70654f0ae46c801183b9cac8";
    params[@"grant_type"] = @"authorization_code";
    params[@"code"] = code;
    params[@"redirect_uri"] = @"http://";

    [mgr POST:@"https://api.weibo.com/oauth2/access_token" parameters:params success:^(AFHTTPRequestOperation *operation, NSDictionary *responseObject) {
        [MBProgressHUD hideHUD];

        Account *account = [Account accountWithDict:responseObject]; //字典转模型,存进沙盒
        [AccountTool saveAccount:account];

        UIWindow *window = [UIApplication sharedApplication].keyWindow;  //切换控制器
        [window switchRootViewController];

    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        NSLog(@"请求失败 %@",error);
        [MBProgressHUD hideHUD];
    }];
}

@end


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

case class SohvaException(msg: String, cause: Throwable = null) extends Exception(msg, cause)


text:
"use strict";

/**
* Service - `promise$`
* - A service for JavaScript Promises
* - Requires `bluebird`
*
* @module Extension->Promise-Service
*/

import Promise from "bluebird";

export default function bluebirdVendorService($rootScope) {
	const $promise = Promise;

	const defer = () => {
		let reject, resolve;

		// eslint-disable-next-line new-cap
		const promise = new $promise((_resolve, _reject) => {
			resolve = _resolve;
			reject = _reject;
		});

		return {
			resolve,
			reject,
			promise
		};
	};

	$promise.defer = defer;
	$promise.when = $promise.cast;

	return $promise;
};


text:
package logging

import (
	"errors"
	"fmt"
	"os"
	"time"

	//nolint:depguard // We specifically need "syscall.Win32FileAttributeData" rather than
	// "windows.Win32FileAttributeData" for fs.File.Sys().
	"syscall"

	"github.com/hectane/go-acl/api"
	"golang.org/x/sys/windows"
)

type WindowsSysInfo interface {
	SysInfo
	Owner() *windows.SID
	Group() *windows.SID
	DACL() windows.Handle
	SACL() windows.Handle
	SecurityDescriptor() windows.Handle
}

type windowsSysInfo struct {
	path  string
	data  *syscall.Win32FileAttributeData
	owner *windows.SID
	group *windows.SID
	dacl  windows.Handle
	sacl  windows.Handle
}

func osFStat(file *os.File) (SysInfo, error) {
	info, err := file.Stat()
	if err != nil {
		return nil, fmt.Errorf("failed to stat %s: %w", file.Name(), err)
	}
	wi := windowsSysInfo{
		path: file.Name(),
		data: info.Sys().(*syscall.Win32FileAttributeData),
	}
	var secDesc windows.Handle
	err = api.GetNamedSecurityInfo(
		wi.path,
		api.SE_FILE_OBJECT,
		api.OWNER_SECURITY_INFORMATION,
		&wi.owner,
		&wi.group,
		&wi.dacl,
		&wi.sacl,
		&secDesc,
	)
	if err != nil && !errors.Is(err, windows.ERROR_SUCCESS) {
		return nil, err
	}
	if _, err = windows.LocalFree(secDesc); err != nil && !errors.Is(err, windows.ERROR_SUCCESS) {
		return nil, err
	}
	return &wi, nil
}

func (wi *windowsSysInfo) Size() int64 {
	return int64(wi.data.FileSizeHigh)<<32 + int64(wi.data.FileSizeLow)
}

func (wi *windowsSysInfo) SetOwnerAndGroup(name string) error {
	err := api.SetNamedSecurityInfo(name, api.SE_FILE_OBJECT, api.OWNER_SECURITY_INFORMATION, wi.owner, wi.group, wi.dacl, wi.sacl)
	if err != nil {
		// On some systems it seems SetNamedSecurityInfo will return ERROR_SUCCESS on success... this is an odd violation of the principle
		// that windows APIs return err = nil on success but okay
		if errors.Is(err, windows.ERROR_SUCCESS) {
			return nil
		}
		return err
	}
	return nil
}

func (wi *windowsSysInfo) HaveSameOwnerAndGroup(s SysInfo) bool {
	eq := func(a, b *windows.SID) bool {
		if a == b {
			return true
		}
		if a == nil || b == nil {
			return false
		}
		return a.Equals(b)
	}
	owi, ok := s.(*windowsSysInfo)
	return ok && eq(wi.owner, owi.owner) && eq(wi.group, owi.group)
}

func (wi *windowsSysInfo) BirthTime() time.Time {
	return time.Unix(0, wi.data.CreationTime.Nanoseconds())
}

func (wi *windowsSysInfo) ModifyTime() time.Time {
	return time.Unix(0, wi.data.LastWriteTime.Nanoseconds())
}

func (wi *windowsSysInfo) ChangeTime() time.Time {
	return time.Unix(0, wi.data.LastWriteTime.Nanoseconds())
}

func (wi *windowsSysInfo) Owner() *windows.SID {
	return wi.owner
}

func (wi *windowsSysInfo) Group() *windows.SID {
	return wi.group
}

func (wi *windowsSysInfo) DACL() windows.Handle {
	return wi.dacl
}

func (wi *windowsSysInfo) SACL() windows.Handle {
	return wi.sacl
}

func (wi *windowsSysInfo) String() string {
	return fmt.Sprintf("CTIME %v, UID %v, GID %v", wi.BirthTime(), wi.owner, wi.group)
}


text:
package org.bpmscript.search;

import java.util.Locale;

import org.bpmscript.paging.IPagedResult;
import org.bpmscript.paging.IQuery;

/**
 * General purpose search engine
 */
public interface ISearchEngine {

    /**
     * Search for search results using a query and specifying a locale
     * for descriptions.
     *
     * @param query the query used to control what results are returned
     *   as well as how many (i.e. which page)
     * @param locale the language to return the reuslts in
     * @return any results matching the query
     */
    IPagedResult<ISearchResult> search(IQuery query, Locale locale);
}


text:
{% extends "errors/error.html" %}

{% block error %}

"I'd give you advice, but you wouldn't listen. No one ever does."

{{code}}: {{name}}

Looks like there was an input conflict. {{message}}

{% endblock error %}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <!-- "ACTION BAR" -->

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/ab_transparent_dark_holo"
        android:minHeight="@dimen/action_bar_default_height" >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_marginBottom="2dip"
            android:layout_weight="0"
            android:drawablePadding="0dip"
            android:gravity="center_vertical"
            android:paddingLeft="@dimen/step2"
            android:paddingRight="@dimen/step2"
            android:text="@string/tap_recorder"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textColor="@color/primary_text_holo_dark"
            android:textSize="@dimen/action_bar_title_text_size"
            android:textStyle="bold" />

        <ProgressBar
            android:id="@+id/prgb_dot"
            style="?android:attr/progressBarStyleHorizontal"
            android:layout_width="12dp"
            android:layout_height="12dp"
            android:layout_gravity="center_vertical"
            android:indeterminate="true"
            android:indeterminateDrawable="@drawable/record_dot" />

        <View
            android:layout_width="fill_parent"
            android:layout_height="0dp"
            android:layout_weight="1" />

        <ImageView
            android:id="@+id/img_settings"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_gravity="center_vertical"
            android:layout_weight="0"
            android:background="@drawable/item_background_holo_dark"
            android:focusable="true"
            android:paddingLeft="@dimen/step2"
            android:paddingRight="@dimen/step2"
            android:scaleType="center"
            android:src="@drawable/ic_settings" />
    </LinearLayout>

    <!-- TIMERS -->

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="@dimen/step2"
        android:layout_marginRight="@dimen/step2"
        android:layout_marginTop="@dimen/step2" >

        <TextView
            android:id="@+id/text_time_current"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:layout_weight="1"
            android:includeFontPadding="false"
            android:text="00:00.0"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textColor="@color/gray" />

        <TextView
            android:id="@+id/text_time_total"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:layout_marginLeft="@dimen/step"
            android:includeFontPadding="false"
            android:text="00:00.0"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textColor="@color/blue" />
    </LinearLayout>

    <!-- TOUCH PANEL -->

    <RelativeLayout
        android:id="@+id/layout_touch"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_marginLeft="@dimen/step2"
        android:layout_marginRight="@dimen/step2"
        android:layout_marginTop="@dimen/step2"
        android:layout_weight="1"
        android:background="@drawable/recorder_touch_panel" >

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:src="@drawable/rec_touch" />

        <!-- Intensity level -->

        <TextView
            android:id="@+id/text_intensity_current"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
            android:layout_marginLeft="@dimen/step2"
            android:layout_marginTop="@dimen/step2"
            android:includeFontPadding="false"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:textColor="@color/white" />

        <!-- Recorder state -->

        <TextView
            android:id="@+id/text_state"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:layout_margin="@dimen/step2"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:textColor="@color/primary_text_holo_dark" />
    </RelativeLayout>

    <!-- BUTTON PANEL -->

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/step2"
        android:background="@drawable/ab_bottom_solid_dark_holo"
        android:minHeight="@dimen/action_bar_default_height" >

        <ImageView
            android:id="@+id/img_rec"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_gravity="center_vertical"
            android:layout_weight="1"
            android:background="@drawable/item_background_holo_dark"
            android:clickable="true"
            android:focusable="true"
            android:scaleType="center"
            android:src="@drawable/ic_rec" />

        <ImageView
            android:id="@+id/img_play"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_gravity="center_vertical"
            android:layout_weight="1"
            android:background="@drawable/item_background_holo_dark"
            android:clickable="true"
            android:focusable="true"
            android:scaleType="center"
            android:src="@drawable/ic_play" />

        <ImageView
            android:id="@+id/img_stop"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_gravity="center_vertical"
            android:layout_weight="1"
            android:background="@drawable/item_background_holo_dark"
            android:clickable="true"
            android:focusable="true"
            android:scaleType="center"
            android:src="@drawable/ic_stop" />

        <ImageView
            android:id="@+id/img_save"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_gravity="center_vertical"
            android:layout_weight="1"
            android:background="@drawable/item_background_holo_dark"
            android:clickable="true"
            android:focusable="true"
            android:scaleType="center"
            android:src="@drawable/ic_save" />
    </LinearLayout>

</LinearLayout>


text:
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xsi="http://www.w3.org/2001/XMLSchema-instance" schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
  <!--
         This file has been generated by the EasyExtends bundle ( http://sonata-project.org/easy-extends )

         References :
            xsd                  : https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd
            xml mapping          : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/xml-mapping/en
            association mapping  : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/association-mapping/en
    -->
  <entity name="Application\Refactor\ReferenceBundle\Entity\Fiche" table="page__fiche">
    <id name="id" type="integer" column="id">
      <generator strategy="AUTO"/>
    </id>
    <indexes>
      <index name="search_idx" columns="title"/>
    </indexes>
    <field name="title" type="string" column="title" length="255" nullable="false"/>
    <field name="created_at" type="datetime" column="created_at" nullable="false"/>
    <field name="updated_at" type="datetime" column="updated_at" nullable="true"/>
    <lifecycle-callbacks>
      <lifecycle-callback type="prePersist" method="prePersist"/>
      <lifecycle-callback type="preUpdate" method="preUpdate"/>
    </lifecycle-callbacks>
  </entity>
</doctrine-mapping>


text:
- dep updates, minor changes

### 3.4.11

- mongodb shutdown fix

### 3.4.10

- mongodb 6 support

### 3.4.9

- dep updates

### 3.4.6

- platform detection override, see [de.flapdoodle.os](https://github.com/flapdoodle-oss/de.flapdoodle.os)

### 3.4.5

- Process.waitFor timeout added

### 3.4.4

- mongodb dist upgrade

### 3.4.3

- new spring integration sub project
- fixed spring compat after refactoring

### 3.4.2

- restored spring compat after refactoring (still broken)

### 3.4.1

- moved feature detection to packageresolver repo

### 3.4.0

- moved packageresolver to extra repo

### 3.3.1

- ubuntu 21.x support

### 3.3.0

- mongodb version updates

### 3.2.8

- redhat support fixed thanks to @infoShare

### 3.2.7

- redhat support

### 3.2.6

- centos bugfix

### 3.2.5

- amazon linux support

### 3.2.4

- linux mint support
- linux fallback to ubuntu 20.04 LTS

### 3.2.3

- spring boot api fix

### 3.2.2

- debian support added

### 3.2.1

- centos support added

### 3.2.0

- major rework, now supporting mongodb 4.4.x and 5.x

### 3.0.0

- big refactoring

#### 2.1.1 / 2.1.0

- implemented getFeatures of an IFeatureAwareVersion to create your own GenericVersion with Features of Version X
- fixes gh-255
- fixes gh-244 updating mongodb driver
- use random port in test
- use process lib 2.0.5
- Fix transisent dependency on Apache Commons-IO
- removed version 3.7
- Name the tests by version to help diagnose problems with specific versions
- added toString in GenericFeatureAwareVersion
- fixes gh-240
- gh-237 Unable to use '--archive' with mongodump

#### 2.0.4
- mongodump with archive option

#### 2.0.2 & 2.0.3
- jdk 9 compatibility issue thanks to https://github.com/flapdoodle-oss/de.flapdoodle.embed.process/pull/66

#### 2.0.1

- mongodb 3.6
- mongodb nightly builds
- `--shardsvr`did not get honored when starting mongod, thanks to https://github.com/faizan-talena

#### 2.0.0

- java8, immutables.org, bugfixes

#### 1.50.0

- major refactoring in de.flapdoodle.embed.process thanks to https://github.com/julien-may
- extracted files are keept, which should give some faster tests :)

#### 1.48.2

- re-release of 1.48.1

#### 1.48.1

- mongo version upgrade (2.6.10, 3.0.4, 3.1.5)

#### 1.47.3

- mongo client dependency changed to provided, now you can use version 2.x.x or 3.0.0

#### 1.47.2

#### 1.47.1

- many fixes by https://github.com/jochenberger
- mongo version upgrade to (3.0.2)

#### 1.47.0

- changed logging to slf4j
- mongo version upgrade (2.6.8, 3.0.0)

#### 1.46.4

- Implement equals and hashCode on GenericFeatureAwareVersion so that CachingArtifactStore can work. Version is a component of Distribution, which is used as the cache key of CachingArtifactStore

#### 1.46.3
- skipped due to release 'problems'

#### 1.46.2
- skipped due to release 'problems'

#### 1.46.1

- support for OSGi (thanks to Niels Betram)
- support for FreeBSD (thanks to Alex Sanchez)
- updated gradle build
- switch to enable textsearch in mongodb before 2.6

#### 1.46.0

- changed to semantic versions
- custom database dir supported
- upgrade mongo versions
- changed some log levels, fixed some error logs
- proxy configuration added

#### 1.45

- embed.process upgrade (better error logging)

#### 1.44

- mongo version upgrade (2.6.0, ...)
- mongo import command support

#### 1.43

#### 1.42

- massive performance improvment (removed option -v (can be enabled by config))
- mongo version upgrade (2.5.4, 2.4.9, 2.2.7)

#### 1.41

- mongo env command line bug fix (now working)
- mongo version upgrade (2.5.4, 2.4.8, 2.2.6)

#### 1.40

- mongo env command line bug fix

#### 1.39

- embed process dep update

#### 1.38

- embed process dep update
- bug fixes
- update examples

#### 1.37

- new mongo version supported

#### 1.36

- dependencies updated

#### 1.35

- syncDelay set to 0 (no sync)
- process listener added (can copy db files after test into custom directory)

#### 1.34

- added builder for mongod and mongos config
- dependencies updated

#### 1.33 (not public)

#### 1.32

- added 2.5.0 as new development version
- added example for custom download path

#### 1.31

- minor bugfixes

#### 1.30

- deprecate old versions (left current production(2.4.1) and previous version left(2.2.3))
- coming versions will change use the 2.4 branch of mongodb as production version
- no release time check for deprecated versions, so use with care

#### 1.29

- major api changes, speed improvement, easier configuration, need to update documentation

#### 1.28

- mongod config refactor
- configurable startup timeout
- added windows2008 support

#### 1.27

- dep version change

#### 1.26

- bind_ip configuration parameter support (MongodConfig constructor)

#### 1.25

- dep version change

#### 1.24

- dep version change

#### 1.23

- added 2.0.7, 2.2.0
- mongodb java driver update to 2.9.0 (test dependency)

#### 1.22

- maven dep version range does not work as expected -> disabled

#### 1.21

- dependency version range for de.flapdoodle.embed.process

#### 1.20

- NPE fix with custom database directory
- custom database directory will not be deleted

#### 1.19

- **massive refactoring, some api breaks**
- **project split**
- some relevant process.stop() improvements

#### 1.18

- added some unit test support (thanx to trajano)
- added some logging only runtime config option
- added 2.0.7-rc1, 2.2.0-rc0
- command line post processor hock

#### 1.17

- added version 2.0.6 and 2.1.2
- version refactoring
- you can now have a custom version, so you do not depend on a new release of this project

#### 1.16

- added version 2.0.5 (main version 2.0 now points to it)
- changed http user agent
- customizeable mongod process output
- better loopback device detection for mongod process shutdown via command

#### 1.15

- now we send ctrl+c on linux and osx, then send shutdown to server, then taskkill on windows (may the force be with us)
- disable journal for faster turnaround times
- noauth added
- customize artifact storage path
- detection if localhost is not loopback (command shutdown on mongod does not work for remote access)
- formated process output
- much better windows support

#### 1.14

- changed back to send ctrl+c and then send shutdown

#### 1.13

- mongod process management improvement
 (windows mongod shutdown improvement (alpha) (some trouble stopping process on windows - http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4770092))
 - send shutdown to server
 - send ctrl+c to mongod will perform clean shutdown (untested on windows using taskkill)
- now with 2.1.1

#### 1.12

- NUMA support (alpha) - http://www.mongodb.org/display/DOCS/NUMA

#### 1.11

- timeout fix on slow systems
- stability on win plattforms (hopefully)

#### 1.10

- race condition and cleanup of mongod process

#### 1.9

- fixed 64Bit detection - amd64
- now with main versions 1.6, 1.8, 2.0, 2.1


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.mklab.taskit.server.domain;

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

/**
 * 呼び出しリストで参照するリストアイテムを表すクラスです。
 *
 * @author Yuhi Ishikura
 */
public class HelpCallListItem {

  private HelpCall helpCall;
  private List<String> usersInCharge = new ArrayList<String>();

  /**
   * {@link HelpCallListItem}オブジェクトを構築します。
   */
  public HelpCallListItem() {
    // for framework
  }

  /**
   * {@link HelpCallListItem}オブジェクトを構築します。
   *
   * @param helpCall 呼び出し情報
   * @param usersInCharge 呼び出し生徒に対応中の担当者
   */
  public HelpCallListItem(HelpCall helpCall, List<String> usersInCharge) {
    if (helpCall == null) throw new NullPointerException();
    if (usersInCharge == null) throw new NullPointerException();
    this.helpCall = helpCall;
    this.usersInCharge = usersInCharge;
  }

  /**
   * 呼び出し情報を取得します。
   *
   * @return 呼び出し情報
   */
  public HelpCall getHelpCall() {
    return this.helpCall;
  }

  /**
   * 呼び出しに対応中の担当者を取得します。
   *
   * @return usersInCharge 担当者のリスト
   */
  public List<String> getUsersInCharge() {
    return this.usersInCharge;
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + ((this.helpCall == null) ? 0 : this.helpCall.hashCode());
    result = prime * result + ((this.usersInCharge == null) ? 0 : this.usersInCharge.hashCode());
    return result;
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;
    if (getClass() != obj.getClass()) return false;
    HelpCallListItem other = (HelpCallListItem)obj;
    if (this.helpCall == null) {
      if (other.helpCall != null) return false;
    } else if (!this.helpCall.equals(other.helpCall)) return false;
    if (this.usersInCharge == null) {
      if (other.usersInCharge != null) return false;
    } else if (!this.usersInCharge.equals(other.usersInCharge)) return false;
    return true;
  }

}


text:
#include "FixedEndsPenalizedLeastSquares.h"
#include "BSplineBasis.h"
#include "BSplineTools.h"

namespace Scine {
namespace Utils {

namespace BSplines {

FixedEndsPenalizedLeastSquares::FixedEndsPenalizedLeastSquares(const Eigen::Ref<const Eigen::MatrixXd>& dataPoints,
                                                               const Eigen::VectorXd& dataCoordinates,
                                                               const Eigen::VectorXd& knotVector, int splineDegree,
                                                               bool uniformKnotVector, double lambda, int kappa)
  : dataPoints_(dataPoints),
    dataCoordinates_(dataCoordinates),
    knotVector_(knotVector),
    splineDegree_(splineDegree),
    uniformKnotVector_(uniformKnotVector),
    lambda_(lambda),
    kappa_(kappa) {
  assert(dataPoints.rows() == dataCoordinates.size());
  n_ = static_cast<int>(knotVector.size()) - splineDegree_ - 2;
  m_ = static_cast<int>(dataPoints_.rows()) - 1;
  dim_ = static_cast<int>(dataPoints_.cols());
}

Eigen::MatrixXd FixedEndsPenalizedLeastSquares::calculateControlPoints() {
  auto Q = generateQVectors();
  auto Qmat = calculateConstantTermsMatrix(Q);
  auto Nmat = calculateCoefficientMatrix();
  initializeSolver(Nmat);
  return generateControlPointMatrix(Qmat);
}

Eigen::MatrixXd FixedEndsPenalizedLeastSquares::calculateCoefficientMatrix() {
  Eigen::MatrixXd Nmat(m_ - 1, n_ - 1);
  for (int g = 1; g <= m_ - 1; ++g) {
    for (int i = 1; i <= n_ - 1; ++i) {
      Nmat(g - 1, i - 1) = BSplineBasis::evaluate(i, splineDegree_, n_, knotVector_, dataCoordinates_(g));
    }
  }
  return Nmat;
}

Eigen::MatrixXd FixedEndsPenalizedLeastSquares::generateQVectors() {
  Eigen::MatrixXd Q(m_ + 1, dim_);
  Q.setZero();

  for (int g = 1; g <= m_ - 1; ++g) {
    Q.row(g) = dataPoints_.row(g);
    double rec1 = BSplineBasis::evaluate(0, splineDegree_, n_, knotVector_, dataCoordinates_(g));
    double rec2 = BSplineBasis::evaluate(n_, splineDegree_, n_, knotVector_, dataCoordinates_(g));
    for (int l = 0; l < dim_; ++l) {
      Q(g, l) -= rec1 * dataPoints_(0, l);
      Q(g, l) -= rec2 * dataPoints_(m_, l);
    }
  }

  return Q;
}

Eigen::MatrixXd FixedEndsPenalizedLeastSquares::calculateConstantTermsMatrix(const Eigen::MatrixXd& Q) {
  Eigen::MatrixXd Qmat(n_ - 1, dim_);
  for (int i = 1; i <= n_ - 1; ++i) {
    Eigen::VectorXd accum(dim_, 1);
    accum.setZero();

    for (int g = 1; g <= m_ - 1; ++g) {
      accum += BSplineBasis::evaluate(i, splineDegree_, n_, knotVector_, dataCoordinates_(g)) * Q.row(g);
    }
    Qmat.row(i - 1) = accum;
  }
  return Qmat;
}

Eigen::MatrixXd FixedEndsPenalizedLeastSquares::calculateFiniteDifferenceMatrix() const {
  assert(kappa_ <= n_);
  assert(uniformKnotVector_ && "For penalization, the knot vector must be equidistant according to Eilers. The "
                               "equations for non-equidistant knot vectors is not yet implemented.");

  Eigen::MatrixXd DeltaMat(n_ - 1 - kappa_, n_ - 1);
  DeltaMat.setZero();

  for (int i = 0; i <= n_ - kappa_ - 2; ++i) {
    for (int j = 0; j <= n_ - 2; ++j) {
      DeltaMat(i, j) = BSplineTools::differenceOperator(i, j, kappa_);
    }
  }

  return DeltaMat;
}

void FixedEndsPenalizedLeastSquares::initializeSolver(const Eigen::MatrixXd& Nmat) {
  Eigen::MatrixXd m = Nmat.transpose() * Nmat;

  if (lambda_ != 0) {
    auto deltaMat = calculateFiniteDifferenceMatrix();
    m += lambda_ * (deltaMat.transpose() * deltaMat);
  }

  svdOfNmat_.compute(m, Eigen::ComputeThinU | Eigen::ComputeThinV);
}

Eigen::MatrixXd FixedEndsPenalizedLeastSquares::generateControlPointMatrix(const Eigen::MatrixXd& Qmat) {
  Eigen::MatrixXd cp(n_ + 1, dim_);

  Eigen::MatrixXd Pinternal(n_ - 1, dim_);
  Pinternal = svdOfNmat_.solve(Qmat);

  // construct control point vector P_
  cp.row(0) = dataPoints_.row(0);
  for (int i = 1; i <= n_ - 1; ++i) {
    cp.row(i) = Pinternal.row(i - 1);
  }
  cp.row(n_) = dataPoints_.row(m_);
  return cp;
}

} // namespace BSplines
} // namespace Utils
} // namespace Scine


text:
import Ember from 'ember';
import { fullUrlForImage } from '../helpers/full-url-for-image';
const { computed } = Ember;

export default Ember.Component.extend({
  classNames: ['cell'],
  classNameBindings: ['placement'],
  attributeBindings: ['style'],
  style: computed('', function () {
    var image = this.get('image');
    return 'background-image: url(' + fullUrlForImage([image]) + ')';
  }),
  placement: computed.alias('position'),
  //Events
  click: function () {
    this.send('openGallery');
  },
  //Actions
  actions: {
    openGallery: function() {
      var self = this;
      var getComponentByClassName = function (className) {
        var viewRegistry = self._viewRegistry;
        var component = null;

        for (var key in viewRegistry) {
          var current = viewRegistry[key];
          var classNames = current.classNames.join('|');
          if (classNames.indexOf(className) !== -1) {
            component = current;
          }
        }
        return component;
      };

      var imageGallery = getComponentByClassName('image-gallery');
      if (imageGallery) {
        imageGallery.send('open', this.get('image'));
      }
    }
  }
});


text:
<?php

namespace RawPHP\CommunicationLogger\Model;

/**
 * Class EventTrait
 *
 * @package RawPHP\CommunicationLogger\Model
 */
trait EventTrait
{
    /** @var  mixed */
    protected $id;
    /** @var  string */
    protected $endpoint;
    /** @var  string */
    protected $method;
    /** @var  string */
    protected $reference;
    /** @var  string */
    protected $latency;
    /** @var  string */
    protected $request;
    /** @var  string */
    protected $response;

    /**
     * @return mixed
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * @param mixed $id
     *
     * @return Event
     */
    public function setId($id)
    {
        $this->id = $id;

        return $this;
    }

    /**
     * @return string
     */
    public function getEndpoint()
    {
        return $this->endpoint;
    }

    /**
     * @param string $endpoint
     *
     * @return IEvent
     */
    public function setEndpoint($endpoint)
    {
        $this->endpoint = $endpoint;

        return $this;
    }

    /**
     * @return string
     */
    public function getMethod()
    {
        return $this->method;
    }

    /**
     * @param string $method
     *
     * @return IEvent
     */
    public function setMethod($method)
    {
        $this->method = $method;

        return $this;
    }

    /**
     * @return string
     */
    public function getReference()
    {
        return $this->reference;
    }

    /**
     * @param string $reference
     *
     * @return IEvent
     */
    public function setReference($reference)
    {
        $this->reference = $reference;

        return $this;
    }

    /**
     * @return string
     */
    public function getLatency()
    {
        return $this->latency;
    }

    /**
     * @param float $latency
     *
     * @return IEvent
     */
    public function setLatency($latency)
    {
        $this->latency = $latency;

        return $this;
    }

    /**
     * @return string
     */
    public function getRequest()
    {
        return $this->request;
    }

    /**
     * @param string $request
     *
     * @return IEvent
     */
    public function setRequest($request)
    {
        $this->request = $request;

        return $this;
    }

    /**
     * @return string
     */
    public function getResponse()
    {
        return $this->response;
    }

    /**
     * @param string $response
     *
     * @return IEvent
     */
    public function setResponse($response)
    {
        $this->response = $response;

        return $this;
    }
}


text:
<?php
namespace App\Backend\Submodules\Site\Models;

class Site extends \App\Common\Models\Site\Site
{
    use \App\Backend\Models\Base;
}


text:
function C = conv(A,B)
% CONV Convolution and polynomial multiplication.
%    C = CONV(A, B) convolves vectors A and B.  The resulting
%    vector is length LENGTH(A)+LENGTH(B)-1.
%    If A and B are vectors of polynomial coefficients, convolving
%    them is equivalent to multiplying the two polynomials.
%
%    Class support for inputs A,B:
%       float: vpi, double, single, or any other integer form.
%
%    See also deconv, conv2, convn, filter
%
% Author: John D'Errico
% e-mail: woodchips@rochester.rr.com
% Release: 1.0
% Release date: 6/14/09

na = numel(A);
nb = numel(B);

if (na == 0) || (nb == 0)
  % propagate empty
  C = [];
elseif ~isvector(A) || ~isvector(B)
  error('VPI:CONV:nonvectors','One of A or B was not a vector or scalar')
elseif (na == 1) || (nb == 1)
  % just a scalar multiplication here
  C = A*B;
else
  % both A and B MUST be vectors. preallocate the
  % result as a vector. The orientation of the
  % vector will depend on the shape of B.
  C = repmat(vpi(0),size(B));
  % extend C to be the correct length.
  C(na + nb - 1) = 0;

  % just do the convolution as a loop.
  ind = 0:(nb-1);
  for i = 1:na
    j = i + ind;
    C(j) = C(j) + A(i)*B;
  end

end


text:
var net = require("net");
var should = require("should");
var helper = require("../../helper.js");
var tcpinNode = require("../../../../nodes/core/io/31-tcpin.js");

describe('TCP Request Node', function() {
    var server = undefined;
    var port = 9000;

    function startServer(done) {
        port += 1;
        server = net.createServer(function(c) {
	    c.on('data', function(data) {
		var rdata = "ACK:"+data.toString();
		c.write(rdata);
	    });
            c.on('error', function(err) {
		startServer(done);
            });
        }).listen(port, "127.0.0.1", function(err) {
            done();
        });
    }

    before(function(done) {
        startServer(done);
    });

    after(function() {
        server.close();
    });

    afterEach(function() {
        helper.unload();
    });

    function testTCP(flow, val0, val1, done) {
        helper.load(tcpinNode, flow, function() {
            var n1 = helper.getNode("n1");
            var n2 = helper.getNode("n2");
            n2.on("input", function(msg) {
                try {
                    msg.should.have.property('payload', Buffer(val1));
                    done();
                } catch(err) {
                    done(err);
                }
            });
	    if((typeof val0) === 'object') {
		n1.receive(val0);
	    } else {
		n1.receive({payload:val0});
	    }
        });
    }

    it('should send & recv data', function(done) {
        var flow = [{id:"n1", type:"tcp request", server:"localhost", port:port, out:"time", splitc: "0", wires:[["n2"]] },
                    {id:"n2", type:"helper"}];
	testTCP(flow, "foo", "ACK:foo", done)
    });

    it('should send & recv data when specified character received', function(done) {
        var flow = [{id:"n1", type:"tcp request", server:"localhost", port:port, out:"char", splitc: "0", wires:[["n2"]] },
                    {id:"n2", type:"helper"}];
	testTCP(flow, "foo0bar0", "ACK:foo0", done);
    });

    it('should send & recv data after fixed number of chars received', function(done) {
        var flow = [{id:"n1", type:"tcp request", server:"localhost", port:port, out:"count", splitc: "7", wires:[["n2"]] },
                    {id:"n2", type:"helper"}];
	testTCP(flow, "foo bar", "ACK:foo", done);
    });

    it('should send & receive, then keep connection', function(done) {
        var flow = [{id:"n1", type:"tcp request", server:"localhost", port:port, out:"sit", splitc: "5", wires:[["n2"]] },
                    {id:"n2", type:"helper"}];
	testTCP(flow, "foo", "ACK:foo", done);
    });

    it('should send & close', function(done) {
        var flow = [{id:"n1", type:"tcp request", server:"localhost", port:port, out:"sit", splitc: "5", wires:[["n2"]] },
                    {id:"n2", type:"helper"}];
	testTCP(flow, "foo", "ACK:foo", done);
    });

    it('should send & recv data to/from server:port from msg', function(done) {
        var flow = [{id:"n1", type:"tcp request", server:"", port:"", out:"time", splitc: "0", wires:[["n2"]] },
                    {id:"n2", type:"helper"}];
	testTCP(flow, {payload:"foo", host:"localhost", port:port}, "ACK:foo", done)
    });

});


text:
<?php

/**
 * home actions.
 *
 * @package    codelovely
 * @subpackage home
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class homeActions extends ApplicationActions
{
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
  public function executeIndex(sfWebRequest $request)
  {

  }

  public function executeFeedback(sfWebRequest $request)
  {
    $this->form = new FeedbackForm();

    if ($this->getUser()->isAuthenticated()){
      $this->form->setDefault('email', $this->getUser()->getModel()->getEmail());
    }

    if ($request->isMethod('post')){
      $params = $request->getParameter($this->form->getName());
      $this->form->bind($params);

      if ($this->form->isValid()){
        $queue = new RedisJobQueue(SendEmailWorker::QUEUE_NAME);

        $vars = array(
          'body'    => $this->form->getValue('body'),
          'type'    => $this->form->getValue('type'),
          'subject' => $this->form->getValue('subject'),
          'email'   => $this->form->getValue('email')
        );
        $message = $this->getPartial('mail/feedback', $vars);

        $job = array(
          'to' => 'sanjeevan.a+codelovely@gmail.com',
          'subject' => 'New feedback for codelovely.com',
          'message' => $message,
          'from' => 'noreply@' . $_SERVER['HTTP_HOST']
        );

        $queue = new RedisJobQueue(SendEmailWorker::QUEUE_NAME);
        $queue->addJob($job, false, false);

        $this->getUser()->setFlash('notice', 'Your feedback has been sent!', false);
      }
    }
  }
}


text:
title: PhoneGap Desktop App 0.3.2
date: 2016-05-11 00:00:00 Z
tags:
- PhoneGap Blog
- Release
- News
author: Herm Wong
---

PhoneGap Desktop 0.3.2 is addresses an issue with plugins not loading in the browser platform and several bug fixes. See the CHANGELOG below for more details.

## Installation

You can install the latest version of the PhoneGap Desktop App from our docs:

- [Install on OS X](http://docs.phonegap.com/references/desktop-app/install/mac/)
- [Install on Windows](http://docs.phonegap.com/references/desktop-app/install/win/)

## What's New

For those interested in the full CHANGELOG:

- [#579](https://github.com/phonegap/phonegap-app-desktop/issues/579) - added a button to clear the server log-holder
- [#593](https://github.com/phonegap/phonegap-app-desktop/issues/593) - changing port re-serves app but does not highlight properly
- [#595](https://github.com/phonegap/phonegap-app-desktop/issues/595) - after removing projects, creating a new one will add removed projects
- [#598](https://github.com/phonegap/phonegap-app-desktop/issues/598) - duplicate error on create project
- [#599](https://github.com/phonegap/phonegap-app-desktop/issues/599) - existing project error on local path but no local path entered yet
- [#600](https://github.com/phonegap/phonegap-app-desktop/issues/600) - config.xml error on project create
- [#601](https://github.com/phonegap/phonegap-app-desktop/issues/601) - different project being served than desktop app highlights green
- [#603](https://github.com/phonegap/phonegap-app-desktop/issues/603) - plugins not loaded in browser
- [#608](https://github.com/phonegap/phonegap-app-desktop/issues/608) - ip address list needs to have an offline mode
- [#612](https://github.com/phonegap/phonegap-app-desktop/issues/612) - copying config after installing dependencies can lead to incorrect module versions in build
- [#613](https://github.com/phonegap/phonegap-app-desktop/issues/613) - closing log window will show ip address when server is off

## Getting Involved

We would like to thank our users for helping us improve the PhoneGap Desktop App by submitting feedback and issues.

Help us improve by submitting [issues, feature requests and ideas](https://github.com/phonegap/phonegap-app-desktop/issues) or by sending us a [pull request](https://github.com/phonegap/phonegap-app-desktop) to an existing issue.


text:
<?xml version='1.0' encoding='utf-8'?>
<plugin id="com.onsip.sipjs" version="0.6.3" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
    <name>sip.js</name>
    <js-module name="sipjs" src="src/SIP.js" />

    <!-- This is the line that makes require('../package.json') work -->
    <!-- TODO change src to "package.json" once Cordova is released with
         https://github.com/apache/cordova-lib/pull/71
    -->
    <js-module name="/package.json" src="cordova_package.json.js" />

    <js-module name="Utils" src="src/Utils.js" />
    <js-module name="LoggerFactory" src="src/LoggerFactory.js" />
    <js-module name="EventEmitter" src="src/EventEmitter.js" />
    <js-module name="Constants" src="src/Constants.js" />
    <js-module name="Exceptions" src="src/Exceptions.js" />
    <js-module name="Timers" src="src/Timers.js" />
    <js-module name="Transport" src="src/Transport.js" />
    <js-module name="Parser" src="src/Parser.js" />
    <js-module name="SIPMessage" src="src/SIPMessage.js" />
    <js-module name="URI" src="src/URI.js" />
    <js-module name="NameAddrHeader" src="src/NameAddrHeader.js" />
    <js-module name="Transactions" src="src/Transactions.js" />
    <js-module name="Dialog/RequestSender" src="src/Dialog/RequestSender.js" />
    <js-module name="Dialogs" src="src/Dialogs.js" />
    <js-module name="RequestSender" src="src/RequestSender.js" />
    <js-module name="RegisterContext" src="src/RegisterContext.js" />
    <js-module name="MediaHandler" src="src/MediaHandler.js" />
    <js-module name="ClientContext" src="src/ClientContext.js" />
    <js-module name="ServerContext" src="src/ServerContext.js" />
    <js-module name="Session/DTMF" src="src/Session/DTMF.js" />
    <js-module name="Session" src="src/Session.js" />
    <js-module name="Subscription" src="src/Subscription.js" />
    <js-module name="WebRTC/MediaHandler" src="src/WebRTC/MediaHandler.js" />
    <js-module name="WebRTC/MediaStreamManager" src="src/WebRTC/MediaStreamManager.js" />
    <js-module name="WebRTC" src="src/WebRTC.js" />
    <js-module name="UA" src="src/UA.js" />
    <js-module name="Hacks" src="src/Hacks.js" />
    <js-module name="SanityCheck" src="src/SanityCheck.js" />
    <js-module name="DigestAuthentication" src="src/DigestAuthentication.js" />
    <js-module name="Grammar/dist/Grammar" src="src/Grammar/dist/Grammar.js" />
</plugin>


text:
package li.strolch.model.activity;

import static java.util.stream.Collectors.toList;
import static li.strolch.model.StrolchModelConstants.BAG_RELATIONS;
import static li.strolch.utils.collections.CollectionsHelper.singletonCollector;

import java.text.MessageFormat;
import java.util.*;
import java.util.Map.Entry;
import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.stream.Stream;

import li.strolch.exception.StrolchElementNotFoundException;
import li.strolch.exception.StrolchException;
import li.strolch.exception.StrolchModelException;
import li.strolch.exception.StrolchPolicyException;
import li.strolch.model.*;
import li.strolch.model.Locator.LocatorBuilder;
import li.strolch.model.parameter.Parameter;
import li.strolch.model.policy.PolicyDef;
import li.strolch.model.policy.PolicyDefs;
import li.strolch.model.visitor.StrolchElementVisitor;
import li.strolch.utils.dbc.DBC;

/**
 * Parameterized object grouping a collection of {@link Activity} and {@link Action} objects defining the process to be
 * scheduled
 *
 * @author Martin Smock <martin.smock@bluewin.ch>
 */
public class Activity extends AbstractStrolchRootElement
		implements IActivityElement, StrolchRootElement, Comparable<Activity> {

	protected Locator locator;
	protected Version version;

	protected Activity parent;
	protected TimeOrdering timeOrdering;
	protected Map<String, IActivityElement> elements;
	protected PolicyDefs policyDefs;

	/**
	 * Empty constructor - for marshalling only!
	 */
	public Activity() {
		super();
	}

	/**
	 * Default constructor
	 *
	 * @param id
	 * 		the id
	 * @param name
	 * 		the name
	 * @param type
	 * 		the type
	 */
	public Activity(String id, String name, String type, TimeOrdering timeOrdering) {
		super(id, name, type);
		this.timeOrdering = timeOrdering;
	}

	@Override
	public void setId(String id) {
		this.locator = null;
		super.setId(id);
	}

	@Override
	public String getObjectType() {
		return Tags.ACTIVITY;
	}

	public TimeOrdering getTimeOrdering() {
		return this.timeOrdering;
	}

	public void setTimeOrdering(TimeOrdering timeOrdering) {
		assertNotReadonly();
		this.timeOrdering = timeOrdering;
	}

	@Override
	public boolean hasVersion() {
		return this.version != null;
	}

	@Override
	public Version getVersion() {
		return this.version;
	}

	@Override
	public void setVersion(Version version) throws IllegalArgumentException, IllegalStateException {
		if (!isRootElement())
			throw new IllegalStateException("Can't set the version on non root of " + getLocator());

		if (version != null && !getLocator().equals(version.getLocator())) {
			String msg = "Illegal version as locator is not same: Element: {0} Version: {1}";
			throw new IllegalArgumentException(MessageFormat.format(msg, getLocator(), version));
		}

		this.version = version;
	}

	private void initElements() {
		if (this.elements == null) {
			// use a LinkedHashMap since we will iterate elements in the order
			// added and lookup elements by ID
			this.elements = new LinkedHashMap<>();
		}
	}

	@Override
	public boolean isAction() {
		return false;
	}

	@Override
	public boolean isActivity() {
		return true;
	}

	/**
	 * Returns true if this {@link Activity} contains any children i.e. any of {@link Action} or {@link Activity}
	 *
	 * @return true if this {@link Activity} contains any children i.e. any of {@link Action} or {@link Activity}
	 */
	public boolean hasElements() {
		return this.elements != null && !this.elements.isEmpty();
	}

	/**
	 * Returns true if this {@link Activity} contains a child with the given id. The element instance type is ignored,
	 * i.e. {@link Action} or {@link Activity}
	 *
	 * @param id
	 * 		the id of the element to check for
	 *
	 * @return true if this {@link Activity} contains a child with the given id. The element instance type is ignored,
	 * i.e. {@link Action} or {@link Activity}
	 */
	public boolean hasElement(String id) {
		return this.elements != null && this.elements.containsKey(id);
	}

	/**
	 * add an activity element to the {@code LinkedHashMap} of {@code IActivityElements}
	 *
	 * @param activityElement
	 * 		the element to add
	 */
	public void addElement(IActivityElement activityElement) {
		assertCanAdd(activityElement);
		activityElement.setParent(this);
		this.elements.put(activityElement.getId(), activityElement);
	}

	/**
	 * add an activity element to the {@code LinkedHashMap} of {@code IActivityElements} before the given element
	 *
	 * @param element
	 * 		the element before which to add the other element
	 * @param elementToAdd
	 * 		the element to add
	 */
	public void addElementBefore(IActivityElement element, IActivityElement elementToAdd) {
		assertCanAdd(elementToAdd);

		Iterator<Entry<String, IActivityElement>> iterator = this.elements.entrySet().iterator();
		LinkedHashMap<String, IActivityElement> elements = new LinkedHashMap<>();
		boolean added = false;
		while (iterator.hasNext()) {
			Entry<String, IActivityElement> next = iterator.next();

			if (!added && next.getValue().equals(element)) {
				elements.put(elementToAdd.getId(), elementToAdd);
				elements.put(next.getKey(), next.getValue());
				added = true;
			}

			elements.put(next.getKey(), next.getValue());
		}
		if (!added)
			throw new IllegalStateException("Element " + element.getId() + " was not found, couldn't add before!");

		elementToAdd.setParent(this);
		this.elements = elements;
	}

	/**
	 * add an activity element to the {@code LinkedHashMap} of {@code IActivityElements} after the given element
	 *
	 * @param element
	 * 		the element before which to add the other element
	 * @param elementToAdd
	 * 		the element to add
	 */
	public void addElementAfter(IActivityElement element, IActivityElement elementToAdd) {
		assertCanAdd(elementToAdd);

		Iterator<Entry<String, IActivityElement>> iterator = this.elements.entrySet().iterator();
		LinkedHashMap<String, IActivityElement> elements = new LinkedHashMap<>();
		boolean added = false;
		while (iterator.hasNext()) {
			Entry<String, IActivityElement> next = iterator.next();
			elements.put(next.getKey(), next.getValue());

			if (!added && next.getValue().equals(element)) {
				elements.put(elementToAdd.getId(), elementToAdd);
				added = true;
			}
		}
		if (!added)
			throw new IllegalStateException("Element " + element.getId() + " was not found, couldn't add after!");

		elementToAdd.setParent(this);
		this.elements = elements;
	}

	private void assertCanAdd(IActivityElement elementToAdd) {
		assertNotReadonly();
		DBC.PRE.assertNotEquals("Can't add element to itself!", this, elementToAdd);
		DBC.PRE.assertNull("Parent can't already be set!", elementToAdd.getParent());

		// TODO make sure we can't create a circular dependency

		initElements();
		String id = elementToAdd.getId();
		if (id == null)
			throw new StrolchException("Cannot add IActivityElement without id.");
		if (this.elements.containsKey(id))
			throw new StrolchException(
					"Activity " + getLocator() + " already contains an activity element with id = " + id);
	}

	/**
	 * Removes the element with the given id and returns it, if it exists
	 *
	 * @param id
	 * 		the id of the element to remove
	 *
	 * @return the removed element, or null if it does not exist
	 */
	@SuppressWarnings("unchecked")
	public <T extends IActivityElement> T remove(String id) {
		assertNotReadonly();
		IActivityElement element = this.elements.remove(id);
		if (element != null)
			element.setParent(null);
		return (T) element;
	}

	/**
	 * Returns the {@link Action} with the given ID which is a direct child of this {@link Activity}
	 *
	 * @param id
	 * 		the id of the {@link Action} to return
	 *
	 * @return the {@link Action} with the given ID
	 */
	public Action getAction(String id) {
		return getElement(id);
	}

	/**
	 * Returns the {@link Activity} with the given ID which is a direct child of this {@link Activity}
	 *
	 * @param id
	 * 		the id of the {@link Activity} to return
	 *
	 * @return the {@link Activity} with the given ID
	 */
	public Activity getActivity(String id) {
		return getElement(id);
	}

	/**
	 * get {@code IActivityElement} by id
	 *
	 * @param id
	 * 		the id of the {@code IActivityElement}
	 *
	 * @return IActivityElement
	 */
	public <T extends IActivityElement> T getElement(String id) {
		if (this.elements == null)
			throw new IllegalArgumentException("Element " + id + " does not exist on " + getLocator());
		@SuppressWarnings("unchecked")
		T t = (T) this.elements.get(id);
		if (t == null)
			throw new IllegalArgumentException("Element " + id + " does not exist on " + getLocator());
		return t;
	}

	public Optional<IActivityElement> getPreviousElement(IActivityElement element) {
		if (!hasElements())
			return Optional.empty();

		IActivityElement previous = null;

		Iterator<Entry<String, IActivityElement>> iter = elementIterator();
		while (iter.hasNext()) {
			IActivityElement elem = iter.next().getValue();
			if (elem == element)
				return Optional.ofNullable(previous);
			else
				previous = elem;
		}

		return Optional.empty();
	}

	public Optional<IActivityElement> getPreviousElementByType(IActivityElement element, String type) {
		if (!hasElements())
			return Optional.empty();

		List<IActivityElement> reversed = new ArrayList<>(this.elements.values());
		Collections.reverse(reversed);

		boolean foundElem = false;
		Iterator<IActivityElement> iter = reversed.iterator();
		IActivityElement elem;
		while (iter.hasNext()) {
			elem = iter.next();

			if (foundElem && elem.getType().equals(type))
				return Optional.of(elem);
			else if (elem == element) {
				foundElem = true;
			}
		}

		return Optional.empty();
	}

	public Optional<IActivityElement> getNextElement(IActivityElement element) {
		if (!hasElements())
			return Optional.empty();

		Iterator<Entry<String, IActivityElement>> iter = elementIterator();
		IActivityElement previous = iter.next().getValue();

		while (iter.hasNext()) {
			IActivityElement elem = iter.next().getValue();
			if (previous == element)
				return Optional.ofNullable(elem);
			else
				previous = elem;
		}

		return Optional.empty();
	}

	public Optional<IActivityElement> getNextElementByType(IActivityElement element, String type) {
		if (!hasElements())
			return Optional.empty();

		Iterator<Entry<String, IActivityElement>> iter = elementIterator();

		boolean foundElem = false;
		IActivityElement elem;
		while (iter.hasNext()) {
			elem = iter.next().getValue();

			if (foundElem && elem.getType().equals(type))
				return Optional.of(elem);
			else if (elem == element) {
				foundElem = true;
			}
		}

		return Optional.empty();
	}

	public List<IActivityElement> getElementsByType(String type) {
		List<IActivityElement> elements = new ArrayList<>();
		Iterator<Entry<String, IActivityElement>> iter = elementIterator();
		while (iter.hasNext()) {
			IActivityElement element = iter.next().getValue();
			if (element.getType().equals(type))
				elements.add(element);
		}
		return elements;
	}

	/**
	 * @return get the {@code LinkedHashMap} of {@code IActivityElements}
	 */
	public Map<String, IActivityElement> getElements() {
		if (this.elements == null)
			return Collections.emptyMap();
		return this.elements;
	}

	/**
	 * @return the iterator for entries, which include the id as key and the {@link IActivityElement} as value
	 */
	public Iterator<Entry<String, IActivityElement>> elementIterator() {
		if (this.elements == null)
			return Collections.emptyIterator();
		return this.elements.entrySet().iterator();
	}

	/**
	 * @return the stream for entries, which include the id as key and the {@link IActivityElement} as value
	 */
	public Stream<Entry<String, IActivityElement>> elementStream() {
		if (this.elements == null)
			return Stream.empty();
		return this.elements.entrySet().stream();
	}

	public Stream<IActivityElement> streamElements() {
		if (this.elements == null)
			return Stream.empty();
		return this.elements.values().stream();
	}

	public Stream<IActivityElement> streamElementsByType(String type) {
		return streamElements().filter(e -> e.getType().equals(type));
	}

	public Stream<IActivityElement> streamElements(Predicate<IActivityElement> predicate) {
		return streamElements().filter(predicate);
	}

	public Stream<Activity> streamActivities() {
		return streamElements() //
				.filter(IActivityElement::isActivity) //
				.map(IActivityElement::asActivity);
	}

	public Stream<Activity> streamActivities(Predicate<Activity> predicate) {
		return streamActivities().filter(predicate);
	}

	public Stream<Activity> streamActivitiesByType(String type) {
		return streamActivities(a -> a.getType().equals(type));
	}

	public Stream<Action> streamActions() {
		return streamElements() //
				.filter(IActivityElement::isAction) //
				.map(IActivityElement::asAction);
	}

	public Stream<Action> streamActions(Predicate<Action> predicate) {
		return streamActions().filter(predicate);
	}

	public Stream<Action> streamActionsByType(String type) {
		return streamActions(a -> a.getType().equals(type));
	}

	public Stream<Action> streamActionsDeep() {
		return streamElements().flatMap(e -> {
			if (e.isAction())
				return Stream.of(e);
			return e.asActivity().streamActionsDeep();
		}).map(IActivityElement::asAction);
	}

	public Stream<Action> streamActionsDeep(Predicate<Action> predicate) {
		return streamActionsDeep().filter(predicate);
	}

	public <T extends IActivityElement> T findElement(Predicate<IActivityElement> predicate,
			Supplier<String> msgSupplier) {
		@SuppressWarnings("unchecked")
		T t = (T) streamElements().filter(predicate).collect(singletonCollector(msgSupplier));
		return t;
	}

	public List<IActivityElement> findElementsByType(String type) {
		return findElements(e -> e.getType().equals(type));
	}

	public List<IActivityElement> findElements(Predicate<IActivityElement> predicate) {
		return streamElements().filter(predicate).collect(toList());
	}

	public List<Action> findActions(Predicate<Action> predicate) {
		return streamActions(predicate).collect(toList());
	}

	public List<Action> findActionsDeep(Predicate<Action> predicate) {
		return streamActionsDeep().filter(predicate).collect(toList());
	}

	/**
	 * Returns all the actions as a flat list
	 *
	 * @return the list of actions
	 */
	public List<Action> getActionsAsFlatList() {
		return streamActionsDeep().toList();
	}

	/**
	 * Returns all the actions in the entire hierarchy with the given state
	 *
	 * @param state
	 * 		the state of the action to return
	 *
	 * @return the list of actions with the given state
	 */
	public List<Action> getActionsWithState(State state) {
		return streamActionsDeep(action -> action.getState() == state).toList();
	}

	/**
	 * Returns all the actions in the entire hierarchy with the given type
	 *
	 * @param type
	 * 		the type of action to return
	 *
	 * @return the list of actions with the given type
	 */
	public List<Action> getActionsByType(String type) {
		return streamActionsDeep(action -> action.getType().equals(type)).toList();
	}

	public <T extends IActivityElement> T getElementByLocator(Locator locator) {
		DBC.PRE.assertEquals("Locator is not for this activity!", getLocator(), locator.trim(3));
		DBC.PRE.assertTrue("Locator must have at least 5 parts", locator.getSize() >= 4);

		IActivityElement element = this;
		for (int i = 3; i < locator.getSize(); i++) {
			String next = locator.get(i);

			if (!(element instanceof Activity)) {
				String msg = "Invalid locator {0} with part {1} as not an Activity but deeper element specified"; //$NON-NLS-1$
				throw new StrolchModelException(MessageFormat.format(msg, locator, next));
			}

			element = ((Activity) element).getElement(next);
			if (element == null)
				throw new StrolchElementNotFoundException(locator + " does not exist!");
		}

		@SuppressWarnings("unchecked")
		T t = (T) element;
		return t;
	}

	@Override
	public Activity asActivity() {
		return this;
	}

	@Override
	public Long getStart() {
		long start = Long.MAX_VALUE;
		if (this.elements == null)
			return start;
		Iterator<Entry<String, IActivityElement>> elementIterator = elementIterator();
		while (elementIterator.hasNext()) {
			IActivityElement element = elementIterator.next().getValue();
			start = Math.min(start, element.getStart());
		}
		return start;
	}

	@Override
	public Long getEnd() {
		long end = 0L;
		if (this.elements == null)
			return end;
		Iterator<Entry<String, IActivityElement>> elementIterator = elementIterator();
		while (elementIterator.hasNext()) {
			IActivityElement element = elementIterator.next().getValue();
			end = Math.max(end, element.getEnd());
		}
		return end;
	}

	@Override
	public State getState() {
		if (this.elements == null || this.elements.isEmpty())
			return State.CREATED;
		return State.getState(this);
	}

	@Override
	public PolicyDefs getPolicyDefs() {
		if (this.policyDefs == null)
			throw new StrolchPolicyException(getLocator() + " has no Policies defined!");
		return this.policyDefs;
	}

	@Override
	public PolicyDef getPolicyDef(Class<?> clazz) {
		return getPolicyDefs().getPolicyDef(clazz);
	}

	@Override
	public PolicyDef getPolicyDef(String type) {
		return getPolicyDefs().getPolicyDef(type);
	}

	@Override
	public PolicyDef getPolicyDef(Class<?> clazz, PolicyDef defaultDef) {
		if (!hasPolicyDefs())
			return defaultDef;
		return getPolicyDefs().getPolicyDef(clazz, defaultDef);
	}

	@Override
	public PolicyDef getPolicyDef(String type, PolicyDef defaultDef) {
		if (!hasPolicyDefs())
			return defaultDef;
		return getPolicyDefs().getPolicyDef(type, defaultDef);
	}

	@Override
	public boolean hasPolicyDefs() {
		return this.policyDefs != null;
	}

	@Override
	public boolean hasPolicyDef(String type) {
		return this.policyDefs != null && this.policyDefs.hasPolicyDef(type);
	}

	@Override
	public boolean hasPolicyDef(Class<?> clazz) {
		return this.policyDefs != null && this.policyDefs.hasPolicyDef(clazz);
	}

	@Override
	public void setPolicyDefs(PolicyDefs policyDefs) {
		assertNotReadonly();
		this.policyDefs = policyDefs;
		this.policyDefs.setParent(this);
	}

	@Override
	public void addOrUpdate(PolicyDef policyDef) {
		assertNotReadonly();
		DBC.PRE.assertNotNull("policyDef", policyDef);
		if (this.policyDefs == null) {
			this.policyDefs = new PolicyDefs();
			this.policyDefs.setParent(this);
		}
		this.policyDefs.addOrUpdate(policyDef);
	}

	@Override
	public Locator getLocator() {
		if (this.locator == null) {
			LocatorBuilder lb = new LocatorBuilder();
			fillLocator(lb);
			this.locator = lb.build();
		}
		return this.locator;
	}

	@Override
	protected void fillLocator(LocatorBuilder locatorBuilder) {
		if (this.parent != null)
			this.parent.fillLocator(locatorBuilder);
		else
			locatorBuilder.append(Tags.ACTIVITY).append(getType());
		locatorBuilder.append(getId());
	}

	@Override
	public Activity getParent() {
		return this.parent;
	}

	@Override
	public Activity getRootElement() {
		return (this.parent == null) ? this : this.parent.getRootElement();
	}

	@Override
	public boolean isRootElement() {
		return (this.parent == null);
	}

	@Override
	public Activity getClone() {
		return getClone(false);
	}

	@Override
	public Activity getClone(boolean withVersion) {

		Activity clone = new Activity();
		clone.timeOrdering = this.timeOrdering;

		super.fillClone(clone);

		if (this.elements == null)
			return clone;

		for (IActivityElement element : this.elements.values()) {
			clone.addElement(element.getClone());
		}

		if (this.policyDefs != null)
			clone.setPolicyDefs(this.policyDefs.getClone());

		if (withVersion)
			clone.setVersion(this.version);

		clone.locator = this.locator;

		return clone;
	}

	@Override
	public void setReadOnly() {
		if (this.policyDefs != null)
			this.policyDefs.setReadOnly();
		elementStream().forEach(e -> e.getValue().setReadOnly());
		super.setReadOnly();
	}

	@Override
	public String toString() {
		final StringBuilder builder = new StringBuilder();
		builder.append("Activity [id=");
		builder.append(this.id);
		builder.append(", name=");
		builder.append(this.name);
		builder.append(", type=");
		builder.append(this.type);
		builder.append(", state=");
		builder.append(getState());
		builder.append(", start=");
		builder.append(getStart());
		builder.append(", end=");
		builder.append(getEnd());
		if (isRootElement()) {
			builder.append(", version=");
			builder.append(this.version);
		}
		builder.append("]");
		return builder.toString();
	}

	@Override
	public int compareTo(Activity o) {
		return getId().compareTo(o.getId());
	}

	@Override
	public <T> T accept(StrolchElementVisitor<T> visitor) {
		return visitor.visitActivity(this);
	}

	@Override
	public <U, T extends Parameter<U>> T findRelationParam(String paramKey) {
		return findParameter(BAG_RELATIONS, paramKey);
	}

	@Override
	public <U, T extends Parameter<U>> T findRelationParam(String paramKey, boolean assertExists) {
		return findParameter(BAG_RELATIONS, paramKey, assertExists);
	}

	@Override
	public <U, T extends Parameter<U>> T findParameter(String bagKey, String paramKey) {

		T parameter = getParameter(bagKey, paramKey);
		if (parameter != null)
			return parameter;

		if (this.parent != null)
			return this.parent.findParameter(bagKey, paramKey);

		return null;
	}

	@Override
	public <U, T extends Parameter<U>> T findParameter(String bagKey, String paramKey, boolean assertExists)
			throws StrolchModelException {

		T parameter = getParameter(bagKey, paramKey);
		if (parameter != null)
			return parameter;

		parameter = this.parent == null ? null : this.parent.findParameter(bagKey, paramKey);
		if (assertExists && parameter == null) {
			String msg = "The Parameter {0} does not exist";
			throw new StrolchModelException(MessageFormat.format(msg, getLocator().append(Tags.BAG, bagKey, paramKey)));
		}

		return parameter;
	}

	@Override
	public PolicyDef findPolicy(Class<?> clazz, PolicyDef defaultDef) throws StrolchModelException {
		return findPolicy(clazz.getSimpleName(), defaultDef);
	}

	@Override
	public PolicyDef findPolicy(String className, PolicyDef defaultDef) throws StrolchModelException {
		if (hasPolicyDef(className))
			return getPolicyDef(className);

		if (this.parent == null) {
			if (defaultDef != null)
				return defaultDef;

			String msg = "The PolicyDef {0} does not exist";
			throw new StrolchModelException(MessageFormat.format(msg, className));
		}

		return this.parent.findPolicy(className, defaultDef);
	}

	@Override
	public void setParent(Activity activity) {
		assertNotReadonly();
		this.parent = activity;
	}

	public static Locator locatorFor(String type, String id) {
		return Locator.valueOf(Tags.ACTIVITY, type, id);
	}
}


text:
zf-development-mode
===================

This ZF2 "development mode" module allows you to specify configuration and
modules that should only be enabled when in development, and not when in
production.

Requirements
------------

Please see the [composer.json](composer.json) file.

Installation with Composer
--------------------------

1. Add `"zfcampus/zf-development-mode": "1.*"` to the `"require"` section your
   `composer.json` file and run `php composer.phar update`.
1. Copy `development.config.dist` to your application's `config/` directory,
   without renaming the file, and edit as required. Commit this file to your
   version control system.
1. Add any development modules to the `"require-dev"` section of your
   application's `composer.json`. e.g:

   ```javascript
        "zendframework/zend-developer-tools": "dev-master",
        "zendframework/zftool": "dev-master"
   ```

   and run `composer.update`.
1. If you're using Zend Developer Tools, Copy
   `./vendor/zendframework/zend-developer-tools/config/zenddevelopertools.local.php.dist`
   to `./config/autoload/zenddevelopertools.local.php`. Change any settings in
   it according to your needs.
1. Add `'ZF\DevelopmentMode'` to the list of Modules in your
   application's `config/application.config.php` file.
1. In your application's `public/index.php`, replace these lines:

   ```php
        // Run the application!
        Zend\Mvc\Application::init(require 'config/application.config.php')->run();
   ```

   with

   ```php
        // Run the application!
        // Config
        $appConfig = include APPLICATION_PATH . '/config/application.config.php';

        if (file_exists(APPLICATION_PATH . '/config/development.config.php')) {
            $appConfig = Zend\Stdlib\ArrayUtils::merge($appConfig, include APPLICATION_PATH . '/config/development.config.php');
        }

        // Run the application!
        Zend\Mvc\Application::init($appConfig)->run();
   ```

To enable development mode
--------------------------

```sh
cd path/to/install
php public/index.php development enable
```

To disable development mode
---------------------------

```sh
cd path/to/install
php public/index.php development disable
```

**Note:** Don't run development mode on your production server.


text:
// Copyright © 2014 Lénaïc Bagnères, hnc@singularity.fr

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

#ifndef HNC_UNUSED_HPP
#define HNC_UNUSED_HPP

/**
 * @brief Remove warning about unused variable
 *
 * @code
   #include <hnc/unused.hpp>
   @endcode
 *
 * @param[in] variable_name Name of unused variable
 */
#define hnc_unused(variable_name) (void)(variable_name)

#endif