text:
// ------------------------------------------------------------------------------
//  <auto-generated>
//      This code was generated by coded UI test builder.
//      Version: 12.0.0.0
//
//      Changes to this file may cause incorrect behavior and will be lost if
//      the code is regenerated.
//  </auto-generated>
// ------------------------------------------------------------------------------

namespace Geveo.StageBitz.Test.Common
{
    using System;
    using System.CodeDom.Compiler;
    using System.Collections.Generic;
    using System.Drawing;
    using System.Text.RegularExpressions;
    using System.Windows.Input;
    using Microsoft.VisualStudio.TestTools.UITest.Extension;
    using Microsoft.VisualStudio.TestTools.UITesting;
    using Microsoft.VisualStudio.TestTools.UITesting.HtmlControls;
    using Microsoft.VisualStudio.TestTools.UITesting.WinControls;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Keyboard = Microsoft.VisualStudio.TestTools.UITesting.Keyboard;
    using Mouse = Microsoft.VisualStudio.TestTools.UITesting.Mouse;
    using MouseButtons = System.Windows.Forms.MouseButtons;

    [GeneratedCode("Coded UITest Builder", "12.0.21005.1")]
    public partial class UIMap
    {

        /// <summary>
        /// InvokePersonalDashboard
        /// </summary>
        public void InvokePersonalDashboard()
        {
            #region Variable Declarations
            HtmlHyperlink uIHomeHyperlink = this.UIProfessionalPropsManWindow.UIProfessionalPropsManDocument1.UIHomeHyperlink;
            #endregion

            // Click 'Home' link
            Mouse.Click(uIHomeHyperlink, new Point(17, 10));
        }

        /// <summary>
        /// LoginUserPortal - Use 'LoginUserPortalParams' to pass parameters into this method.
        /// </summary>
        public void LoginUserPortal()
        {
            #region Variable Declarations
            HtmlEdit uIEmailAddressEdit = this.UIWelcometoStageBitzWiWindow.UIWelcometoStageBitzDocument1.UIEmailAddressEdit;
            HtmlEdit uIPasswordEdit = this.UIWelcometoStageBitzWiWindow.UIWelcometoStageBitzDocument1.UIPasswordEdit;
            HtmlInputButton uISignInButton = this.UIWelcometoStageBitzWiWindow.UIWelcometoStageBitzDocument1.UISignInButton;
            #endregion

            // Type 'piu5001@mailinator.com' in 'Email Address' text box
            uIEmailAddressEdit.Text = this.LoginUserPortalParams.UIEmailAddressEditText;

            // Type '********' in 'Password' text box
            uIPasswordEdit.Password = this.LoginUserPortalParams.UIPasswordEditPassword;

            // Click 'Sign In' button
            Mouse.Click(uISignInButton, new Point(14, 9));
        }

        /// <summary>
        /// LogoutFromUserPortal
        /// </summary>
        public void LogoutFromUserPortal()
        {
            #region Variable Declarations
            HtmlHyperlink uISignOutHyperlink = this.UIStageBitzInternetExpWindow.UIStageBitzDocument.UIWelcomepiu5001TestSiPane.UISignOutHyperlink;
            #endregion

            // Click 'Sign Out' link
            Mouse.Click(uISignOutHyperlink, new Point(32, 14));
        }

        #region Properties
        public virtual LoginUserPortalParams LoginUserPortalParams
        {
            get
            {
                if ((this.mLoginUserPortalParams == null))
                {
                    this.mLoginUserPortalParams = new LoginUserPortalParams();
                }
                return this.mLoginUserPortalParams;
            }
        }

        public UIStartWindow UIStartWindow
        {
            get
            {
                if ((this.mUIStartWindow == null))
                {
                    this.mUIStartWindow = new UIStartWindow();
                }
                return this.mUIStartWindow;
            }
        }

        public UIStartmenuWindow UIStartmenuWindow
        {
            get
            {
                if ((this.mUIStartmenuWindow == null))
                {
                    this.mUIStartmenuWindow = new UIStartmenuWindow();
                }
                return this.mUIStartmenuWindow;
            }
        }

        public UIGoogleWindowsInterneWindow UIGoogleWindowsInterneWindow
        {
            get
            {
                if ((this.mUIGoogleWindowsInterneWindow == null))
                {
                    this.mUIGoogleWindowsInterneWindow = new UIGoogleWindowsInterneWindow();
                }
                return this.mUIGoogleWindowsInterneWindow;
            }
        }

        public UIWelcometoStageBitzWiWindow UIWelcometoStageBitzWiWindow
        {
            get
            {
                if ((this.mUIWelcometoStageBitzWiWindow == null))
                {
                    this.mUIWelcometoStageBitzWiWindow = new UIWelcometoStageBitzWiWindow();
                }
                return this.mUIWelcometoStageBitzWiWindow;
            }
        }

        public UIProfessionalPropsManWindow UIProfessionalPropsManWindow
        {
            get
            {
                if ((this.mUIProfessionalPropsManWindow == null))
                {
                    this.mUIProfessionalPropsManWindow = new UIProfessionalPropsManWindow();
                }
                return this.mUIProfessionalPropsManWindow;
            }
        }

        public UIStageBitzInternetExpWindow UIStageBitzInternetExpWindow
        {
            get
            {
                if ((this.mUIStageBitzInternetExpWindow == null))
                {
                    this.mUIStageBitzInternetExpWindow = new UIStageBitzInternetExpWindow();
                }
                return this.mUIStageBitzInternetExpWindow;
            }
        }
        #endregion

        #region Fields
        private LoginUserPortalParams mLoginUserPortalParams;

        private UIStartWindow mUIStartWindow;

        private UIStartmenuWindow mUIStartmenuWindow;

        private UIGoogleWindowsInterneWindow mUIGoogleWindowsInterneWindow;

        private UIWelcometoStageBitzWiWindow mUIWelcometoStageBitzWiWindow;

        private UIProfessionalPropsManWindow mUIProfessionalPropsManWindow;

        private UIStageBitzInternetExpWindow mUIStageBitzInternetExpWindow;
        #endregion
    }

    /// <summary>
    /// Parameters to be passed into 'LoginUserPortal'
    /// </summary>
    [GeneratedCode("Coded UITest Builder", "12.0.21005.1")]
    public class LoginUserPortalParams
    {

        #region Fields
        /// <summary>
        /// Type 'piu5001@mailinator.com' in 'Email Address' text box
        /// </summary>
        public string UIEmailAddressEditText = "piu5001@mailinator.com";

        /// <summary>
        /// Type '********' in 'Password' text box
        /// </summary>
        public string UIPasswordEditPassword = "nAO6FE+d177p7uXi8Xo+YDTB4TP2UBvd";
        #endregion
    }

    [GeneratedCode("Coded UITest Builder", "12.0.21005.1")]
    public class UIStartWindow : WinWindow
    {

        public UIStartWindow()
        {
            #region Search Criteria
            this.SearchProperties[WinWindow.PropertyNames.Name] = "Start";
            this.SearchProperties[WinWindow.PropertyNames.ClassName] = "Button";
            this.WindowTitles.Add("Start");
            #endregion
        }

        #region Properties
        public WinButton UIStartButton
        {
            get
            {
                if ((this.mUIStartButton == null))
                {
                    this.mUIStartButton = new WinButton(this);
                    #region Search Criteria
                    this.mUIStartButton.SearchProperties[WinButton.PropertyNames.Name] = "Start";
                    this.mUIStartButton.WindowTitles.Add("Start");
                    #endregion
                }
                return this.mUIStartButton;
            }
        }
        #endregion

        #region Fields
        private WinButton mUIStartButton;
        #endregion
    }

    [GeneratedCode("Coded UITest Builder", "12.0.21005.1")]
    public class UIStartmenuWindow : WinWindow
    {

        public UIStartmenuWindow()
        {
            #region Search Criteria
            this.SearchProperties[WinWindow.PropertyNames.Name] = "Start menu";
            this.SearchProperties[WinWindow.PropertyNames.ClassName] = "DV2ControlHost";
            this.WindowTitles.Add("Start menu");
            #endregion
        }

        #region Properties
        public UIItemWindow UIItemWindow
        {
            get
            {
                if ((this.mUIItemWindow == null))
                {
                    this.mUIItemWindow = new UIItemWindow(this);
                }
                return this.mUIItemWindow;
            }
        }

        public UIFavoritesWindow UIFavoritesWindow
        {
            get
            {
                if ((this.mUIFavoritesWindow == null))
                {
                    this.mUIFavoritesWindow = new UIFavoritesWindow(this);
                }
                return this.mUIFavoritesWindow;
            }
        }
        #endregion

        #region Fields
        private UIItemWindow mUIItemWindow;

        private UIFavoritesWindow mUIFavoritesWindow;
        #endregion
    }

    [GeneratedCode("Coded UITest Builder", "12.0.21005.1")]
    public class UIItemWindow : WinWindow
    {

        public UIItemWindow(UITestControl searchLimitContainer) :
                base(searchLimitContainer)
        {
            #region Search Criteria
            this.SearchProperties[WinWindow.PropertyNames.ControlId] = "4";
            this.WindowTitles.Add("Start menu");
            #endregion
        }

        #region Properties
        public UIStartmenuClient UIStartmenuClient
        {
            get
            {
                if ((this.mUIStartmenuClient == null))
                {
                    this.mUIStartmenuClient = new UIStartmenuClient(this);
                }
                return this.mUIStartmenuClient;
            }
        }
        #endregion

        #region Fields
        private UIStartmenuClient mUIStartmenuClient;
        #endregion
    }

    [GeneratedCode("Coded UITest Builder", "12.0.21005.1")]
    public class UIStartmenuClient : WinClient
    {

        public UIStartmenuClient(UITestControl searchLimitContainer) :
                base(searchLimitContainer)
        {
            #region Search Criteria
            this.WindowTitles.Add("Start menu");
            #endregion
        }

        #region Properties
        public WinMenuItem UIAllProgramsMenuItem
        {
            get
            {
                if ((this.mUIAllProgramsMenuItem == null))
                {
                    this.mUIAllProgramsMenuItem = new WinMenuItem(this);
                    #region Search Criteria
                    this.mUIAllProgramsMenuItem.SearchProperties[WinMenuItem.PropertyNames.Name] = "All Programs";
                    this.mUIAllProgramsMenuItem.WindowTitles.Add("Start menu");
                    #endregion
                }
                return this.mUIAllProgramsMenuItem;
            }
        }
        #endregion

        #region Fields
        private WinMenuItem mUIAllProgramsMenuItem;
        #endregion
    }

    [GeneratedCode("Coded UITest Builder", "12.0.21005.1")]
    public class UIFavoritesWindow : WinWindow
    {

        public UIFavoritesWindow(UITestControl searchLimitContainer) :
                base(searchLimitContainer)
        {
            #region Search Criteria
            this.SearchProperties[WinWindow.PropertyNames.ControlId] = "100";
            this.WindowTitles.Add("Start menu");
            #endregion
        }

        #region Properties
        public UIFavoritesTree UIFavoritesTree
        {
            get
            {
                if ((this.mUIFavoritesTree == null))
                {
                    this.mUIFavoritesTree = new UIFavoritesTree(this);
                }
                return this.mUIFavoritesTree;
            }
        }
        #endregion

        #region Fields
        private UIFavoritesTree mUIFavoritesTree;
        #endregion
    }

    [GeneratedCode("Coded UITest Builder", "12.0.21005.1")]
    public class UIFavoritesTree : WinTree
    {

        public UIFavoritesTree(UITestControl searchLimitContainer) :
                base(searchLimitContainer)
        {
            #region Search Criteria
            this.SearchProperties[WinTree.PropertyNames.Name] = "All Programs";
            this.WindowTitles.Add("Start menu");
            #endregion
        }

        #region Properties
        public WinMenuItem UIInternetExplorerMenuItem
        {
            get
            {
                if ((this.mUIInternetExplorerMenuItem == null))
                {
                    this.mUIInternetExplorerMenuItem = new WinMenuItem(this);
                    #region Search Criteria
                    this.mUIInternetExplorerMenuItem.SearchProperties[WinMenuItem.PropertyNames.Name] = "Internet Explorer";
                    this.mUIInternetExplorerMenuItem.WindowTitles.Add("Start menu");
                    #endregion
                }
                return this.mUIInternetExplorerMenuItem;
            }
        }
        #endregion

        #region Fields
        private WinMenuItem mUIInternetExplorerMenuItem;
        #endregion
    }

    [GeneratedCode("Coded UITest Builder", "12.0.21005.1")]
    public class UIGoogleWindowsInterneWindow : BrowserWindow
    {

        public UIGoogleWindowsInterneWindow()
        {
            #region Search Criteria
            this.SearchProperties[UITestControl.PropertyNames.Name] = "Google";
            this.SearchProperties[UITestControl.PropertyNames.ClassName] = "IEFrame";
            this.WindowTitles.Add("Google");
            #endregion
        }

        public void LaunchUrl(System.Uri url)
        {
            this.CopyFrom(BrowserWindow.Launch(url));
        }

        #region Properties
        public UIGoogleDocument UIGoogleDocument
        {
            get
            {
                if ((this.mUIGoogleDocument == null))
                {
                    this.mUIGoogleDocument = new UIGoogleDocument(this);
                }
                return this.mUIGoogleDocument;
            }
        }
        #endregion

        #region Fields
        private UIGoogleDocument mUIGoogleDocument;
        #endregion
    }

    [GeneratedCode("Coded UITest Builder", "12.0.21005.1")]
    public class UIGoogleDocument : HtmlDocument
    {

        public UIGoogleDocument(UITestControl searchLimitContainer) :
                base(searchLimitContainer)
        {
            #region Search Criteria
            this.SearchProperties[HtmlDocument.PropertyNames.Id] = "gsr";
            this.SearchProperties[HtmlDocument.PropertyNames.RedirectingPage] = "False";
            this.SearchProperties[HtmlDocument.PropertyNames.FrameDocument] = "False";
            this.FilterProperties[HtmlDocument.PropertyNames.Title] = "Google";
            this.FilterProperties[HtmlDocument.PropertyNames.AbsolutePath] = "/";
            this.FilterProperties[HtmlDocument.PropertyNames.PageUrl] = "http://www.google.lk/";
            this.WindowTitles.Add("Google");
            #endregion
        }

        #region Properties
        public HtmlHyperlink UIImagesHyperlink
        {
            get
            {
                if ((this.mUIImagesHyperlink == null))
                {
                    this.mUIImagesHyperlink = new HtmlHyperlink(this);
                    #region Search Criteria
                    this.mUIImagesHyperlink.SearchProperties[HtmlHyperlink.PropertyNames.Id] = "gb_2";
                    this.mUIImagesHyperlink.SearchProperties[HtmlHyperlink.PropertyNames.Name] = null;
                    this.mUIImagesHyperlink.SearchProperties[HtmlHyperlink.PropertyNames.Target] = null;
                    this.mUIImagesHyperlink.SearchProperties[HtmlHyperlink.PropertyNames.InnerText] = "Images";
                    this.mUIImagesHyperlink.FilterProperties[HtmlHyperlink.PropertyNames.AbsolutePath] = "/imghp";
                    this.mUIImagesHyperlink.FilterProperties[HtmlHyperlink.PropertyNames.Title] = null;
                    this.mUIImagesHyperlink.FilterProperties[HtmlHyperlink.PropertyNames.Href] = "http://www.google.lk/imghp?hl=en&tab=wi";
                    this.mUIImagesHyperlink.FilterProperties[HtmlHyperlink.PropertyNames.Class] = "gbzt";
                    this.mUIImagesHyperlink.FilterProperties[HtmlHyperlink.PropertyNames.ControlDefinition] = "id=\"gb_2\" class=\"gbzt\" onclick=\"gbar.qs(";
                    this.mUIImagesHyperlink.FilterProperties[HtmlHyperlink.PropertyNames.TagInstance] = "5";
                    this.mUIImagesHyperlink.WindowTitles.Add("Google");
                    #endregion
                }
                return this.mUIImagesHyperlink;
            }
        }
        #endregion

        #region Fields
        private HtmlHyperlink mUIImagesHyperlink;
        #endregion
    }

    [GeneratedCode("Coded UITest Builder", "12.0.21005.1")]
    public class UIWelcometoStageBitzWiWindow : BrowserWindow
    {

        public UIWelcometoStageBitzWiWindow()
        {
            #region Search Criteria
            this.SearchProperties[UITestControl.PropertyNames.Name] = "Welcome to StageBitz!";
            this.SearchProperties[UITestControl.PropertyNames.ClassName] = "IEFrame";
            this.WindowTitles.Add("Welcome to StageBitz!");
            #endregion
        }

        public void LaunchUrl(System.Uri url)
        {
            this.CopyFrom(BrowserWindow.Launch(url));
        }

        #region Properties
        public UIWelcometoStageBitzDocument UIWelcometoStageBitzDocument
        {
            get
            {
                if ((this.mUIWelcometoStageBitzDocument == null))
                {
                    this.mUIWelcometoStageBitzDocument = new UIWelcometoStageBitzDocument(this);
                }
                return this.mUIWelcometoStageBitzDocument;
            }
        }

        public UIWelcometoStageBitzDocument1 UIWelcometoStageBitzDocument1
        {
            get
            {
                if ((this.mUIWelcometoStageBitzDocument1 == null))
                {
                    this.mUIWelcometoStageBitzDocument1 = new UIWelcometoStageBitzDocument1(this);
                }
                return this.mUIWelcometoStageBitzDocument1;
            }
        }
        #endregion

        #region Fields
        private UIWelcometoStageBitzDocument mUIWelcometoStageBitzDocument;

        private UIWelcometoStageBitzDocument1 mUIWelcometoStageBitzDocument1;
        #endregion
    }

    [GeneratedCode("Coded UITest Builder", "12.0.21005.1")]
    public class UIWelcometoStageBitzDocument : HtmlDocument
    {

        public UIWelcometoStageBitzDocument(UITestControl searchLimitContainer) :
                base(searchLimitContainer)
        {
            #region Search Criteria
            this.SearchProperties[HtmlDocument.PropertyNames.Id] = null;
            this.SearchProperties[HtmlDocument.PropertyNames.RedirectingPage] = "False";
            this.SearchProperties[HtmlDocument.PropertyNames.FrameDocument] = "False";
            this.FilterProperties[HtmlDocument.PropertyNames.Title] = "Welcome to StageBitz!";
            this.FilterProperties[HtmlDocument.PropertyNames.AbsolutePath] = "/StageBitz.DevUserWeb/Account/Login.aspx";
            this.FilterProperties[HtmlDocument.PropertyNames.PageUrl] = "http://localhost/StageBitz.DevUserWeb/Account/Login.aspx";
            this.WindowTitles.Add("Welcome to StageBitz!");
            #endregion
        }

        #region Properties
        public HtmlEdit tbxUserName
        {
            get
            {
                if ((this.mtbxUserName == null))
                {
                    this.mtbxUserName = new HtmlEdit(this);
                    #region Search Criteria
                    this.mtbxUserName.SearchProperties[HtmlEdit.PropertyNames.Id] = "MainContent_txtUsername";
                    this.mtbxUserName.SearchProperties[HtmlEdit.PropertyNames.Name] = "ctl00$MainContent$txtUsername";
                    this.mtbxUserName.FilterProperties[HtmlEdit.PropertyNames.LabeledBy] = "Email Address";
                    this.mtbxUserName.FilterProperties[HtmlEdit.PropertyNames.Type] = "SINGLELINE";
                    this.mtbxUserName.FilterProperties[HtmlEdit.PropertyNames.Title] = null;
                    this.mtbxUserName.FilterProperties[HtmlEdit.PropertyNames.Class] = null;
                    this.mtbxUserName.FilterProperties[HtmlEdit.PropertyNames.ControlDefinition] = "id=\"MainContent_txtUsername\" name=\"ctl00";
                    this.mtbxUserName.FilterProperties[HtmlEdit.PropertyNames.TagInstance] = "7";
                    this.mtbxUserName.WindowTitles.Add("Welcome to StageBitz!");
                    #endregion
                }
                return this.mtbxUserName;
            }
        }

        public HtmlEdit tbxPassword
        {
            get
            {
                if ((this.mtbxPassword == null))
                {
                    this.mtbxPassword = new HtmlEdit(this);
                    #region Search Criteria
                    this.mtbxPassword.SearchProperties[HtmlEdit.PropertyNames.Id] = "MainContent_txtPassword";
                    this.mtbxPassword.SearchProperties[HtmlEdit.PropertyNames.Name] = "ctl00$MainContent$txtPassword";
                    this.mtbxPassword.FilterProperties[HtmlEdit.PropertyNames.LabeledBy] = "Password";
                    this.mtbxPassword.FilterProperties[HtmlEdit.PropertyNames.Type] = "PASSWORD";
                    this.mtbxPassword.FilterProperties[HtmlEdit.PropertyNames.Title] = null;
                    this.mtbxPassword.FilterProperties[HtmlEdit.PropertyNames.Class] = null;
                    this.mtbxPassword.FilterProperties[HtmlEdit.PropertyNames.ControlDefinition] = "id=\"MainContent_txtPassword\" name=\"ctl00";
                    this.mtbxPassword.FilterProperties[HtmlEdit.PropertyNames.TagInstance] = "8";
                    this.mtbxPassword.WindowTitles.Add("Welcome to StageBitz!");
                    #endregion
                }
                return this.mtbxPassword;
            }
        }

        public HtmlInputButton btnSignIn
        {
            get
            {
                if ((this.mbtnSignIn == null))
                {
                    this.mbtnSignIn = new HtmlInputButton(this);
                    #region Search Criteria
                    this.mbtnSignIn.SearchProperties[HtmlButton.PropertyNames.Id] = "MainContent_btnSignIn";
                    this.mbtnSignIn.SearchProperties[HtmlButton.PropertyNames.Name] = "ctl00$MainContent$btnSignIn";
                    this.mbtnSignIn.FilterProperties[HtmlButton.PropertyNames.DisplayText] = "Sign In";
                    this.mbtnSignIn.FilterProperties[HtmlButton.PropertyNames.Type] = "submit";
                    this.mbtnSignIn.FilterProperties[HtmlButton.PropertyNames.Title] = null;
                    this.mbtnSignIn.FilterProperties[HtmlButton.PropertyNames.Class] = "buttonStyle";
                    this.mbtnSignIn.FilterProperties[HtmlButton.PropertyNames.ControlDefinition] = "id=\"MainContent_btnSignIn\" class=\"button";
                    this.mbtnSignIn.FilterProperties[HtmlButton.PropertyNames.TagInstance] = "10";
                    this.mbtnSignIn.WindowTitles.Add("Welcome to StageBitz!");
                    #endregion
                }
                return this.mbtnSignIn;
            }
        }
        #endregion

        #region Fields
        private HtmlEdit mtbxUserName;

        private HtmlEdit mtbxPassword;

        private HtmlInputButton mbtnSignIn;
        #endregion
    }

    [GeneratedCode("Coded UITest Builder", "12.0.21005.1")]
    public class UIWelcometoStageBitzDocument1 : HtmlDocument
    {

        public UIWelcometoStageBitzDocument1(UITestControl searchLimitContainer) :
                base(searchLimitContainer)
        {
            #region Search Criteria
            this.SearchProperties[HtmlDocument.PropertyNames.Id] = null;
            this.SearchProperties[HtmlDocument.PropertyNames.RedirectingPage] = "False";
            this.SearchProperties[HtmlDocument.PropertyNames.FrameDocument] = "False";
            this.FilterProperties[HtmlDocument.PropertyNames.Title] = "Welcome to StageBitz!";
            this.FilterProperties[HtmlDocument.PropertyNames.AbsolutePath] = "/StageBitz.DevUserWeb/Account/Login.aspx";
            this.FilterProperties[HtmlDocument.PropertyNames.PageUrl] = "http://localhost/StageBitz.DevUserWeb/Account/Login.aspx?ReturnUrl=%2fStageBitz.D" +
                "evUserWeb%2f";
            this.WindowTitles.Add("Welcome to StageBitz!");
            #endregion
        }

        #region Properties
        public HtmlEdit UIEmailAddressEdit
        {
            get
            {
                if ((this.mUIEmailAddressEdit == null))
                {
                    this.mUIEmailAddressEdit = new HtmlEdit(this);
                    #region Search Criteria
                    this.mUIEmailAddressEdit.SearchProperties[HtmlEdit.PropertyNames.Id] = "MainContent_txtUsername";
                    this.mUIEmailAddressEdit.SearchProperties[HtmlEdit.PropertyNames.Name] = "ctl00$MainContent$txtUsername";
                    this.mUIEmailAddressEdit.FilterProperties[HtmlEdit.PropertyNames.LabeledBy] = "Email Address";
                    this.mUIEmailAddressEdit.FilterProperties[HtmlEdit.PropertyNames.Type] = "SINGLELINE";
                    this.mUIEmailAddressEdit.FilterProperties[HtmlEdit.PropertyNames.Title] = null;
                    this.mUIEmailAddressEdit.FilterProperties[HtmlEdit.PropertyNames.Class] = null;
                    this.mUIEmailAddressEdit.FilterProperties[HtmlEdit.PropertyNames.ControlDefinition] = "name=\"ctl00$MainContent$txtUsername\" id=";
                    this.mUIEmailAddressEdit.FilterProperties[HtmlEdit.PropertyNames.TagInstance] = "7";
                    this.mUIEmailAddressEdit.WindowTitles.Add("Welcome to StageBitz!");
                    #endregion
                }
                return this.mUIEmailAddressEdit;
            }
        }

        public HtmlEdit UIPasswordEdit
        {
            get
            {
                if ((this.mUIPasswordEdit == null))
                {
                    this.mUIPasswordEdit = new HtmlEdit(this);
                    #region Search Criteria
                    this.mUIPasswordEdit.SearchProperties[HtmlEdit.PropertyNames.Id] = "MainContent_txtPassword";
                    this.mUIPasswordEdit.SearchProperties[HtmlEdit.PropertyNames.Name] = "ctl00$MainContent$txtPassword";
                    this.mUIPasswordEdit.FilterProperties[HtmlEdit.PropertyNames.LabeledBy] = "Password";
                    this.mUIPasswordEdit.FilterProperties[HtmlEdit.PropertyNames.Type] = "PASSWORD";
                    this.mUIPasswordEdit.FilterProperties[HtmlEdit.PropertyNames.Title] = null;
                    this.mUIPasswordEdit.FilterProperties[HtmlEdit.PropertyNames.Class] = null;
                    this.mUIPasswordEdit.FilterProperties[HtmlEdit.PropertyNames.ControlDefinition] = "name=\"ctl00$MainContent$txtPassword\" id=";
                    this.mUIPasswordEdit.FilterProperties[HtmlEdit.PropertyNames.TagInstance] = "8";
                    this.mUIPasswordEdit.WindowTitles.Add("Welcome to StageBitz!");
                    #endregion
                }
                return this.mUIPasswordEdit;
            }
        }

        public HtmlInputButton UISignInButton
        {
            get
            {
                if ((this.mUISignInButton == null))
                {
                    this.mUISignInButton = new HtmlInputButton(this);
                    #region Search Criteria
                    this.mUISignInButton.SearchProperties[HtmlButton.PropertyNames.Id] = "MainContent_btnSignIn";
                    this.mUISignInButton.SearchProperties[HtmlButton.PropertyNames.Name] = "ctl00$MainContent$btnSignIn";
                    this.mUISignInButton.FilterProperties[HtmlButton.PropertyNames.DisplayText] = "Sign In";
                    this.mUISignInButton.FilterProperties[HtmlButton.PropertyNames.Type] = "submit";
                    this.mUISignInButton.FilterProperties[HtmlButton.PropertyNames.Title] = null;
                    this.mUISignInButton.FilterProperties[HtmlButton.PropertyNames.Class] = "buttonStyle";
                    this.mUISignInButton.FilterProperties[HtmlButton.PropertyNames.ControlDefinition] = "name=\"ctl00$MainContent$btnSignIn\" class";
                    this.mUISignInButton.FilterProperties[HtmlButton.PropertyNames.TagInstance] = "10";
                    this.mUISignInButton.WindowTitles.Add("Welcome to StageBitz!");
                    #endregion
                }
                return this.mUISignInButton;
            }
        }
        #endregion

        #region Fields
        private HtmlEdit mUIEmailAddressEdit;

        private HtmlEdit mUIPasswordEdit;

        private HtmlInputButton mUISignInButton;
        #endregion
    }

    [GeneratedCode("Coded UITest Builder", "12.0.21005.1")]
    public class UIProfessionalPropsManWindow : BrowserWindow
    {

        public UIProfessionalPropsManWindow()
        {
            #region Search Criteria
            this.SearchProperties[UITestControl.PropertyNames.Name] = "Professional Props Management | StageBitz";
            this.SearchProperties[UITestControl.PropertyNames.ClassName] = "IEFrame";
            this.WindowTitles.Add("Professional Props Management | StageBitz");
            #endregion
        }

        public void LaunchUrl(System.Uri url)
        {
            this.CopyFrom(BrowserWindow.Launch(url));
        }

        #region Properties
        public UIProfessionalPropsManDocument UIProfessionalPropsManDocument
        {
            get
            {
                if ((this.mUIProfessionalPropsManDocument == null))
                {
                    this.mUIProfessionalPropsManDocument = new UIProfessionalPropsManDocument(this);
                }
                return this.mUIProfessionalPropsManDocument;
            }
        }

        public UIProfessionalPropsManDocument1 UIProfessionalPropsManDocument1
        {
            get
            {
                if ((this.mUIProfessionalPropsManDocument1 == null))
                {
                    this.mUIProfessionalPropsManDocument1 = new UIProfessionalPropsManDocument1(this);
                }
                return this.mUIProfessionalPropsManDocument1;
            }
        }
        #endregion

        #region Fields
        private UIProfessionalPropsManDocument mUIProfessionalPropsManDocument;

        private UIProfessionalPropsManDocument1 mUIProfessionalPropsManDocument1;
        #endregion
    }

    [GeneratedCode("Coded UITest Builder", "12.0.21005.1")]
    public class UIProfessionalPropsManDocument : HtmlDocument
    {

        public UIProfessionalPropsManDocument(UITestControl searchLimitContainer) :
                base(searchLimitContainer)
        {
            #region Search Criteria
            this.SearchProperties[HtmlDocument.PropertyNames.Id] = null;
            this.SearchProperties[HtmlDocument.PropertyNames.RedirectingPage] = "False";
            this.SearchProperties[HtmlDocument.PropertyNames.FrameDocument] = "False";
            this.FilterProperties[HtmlDocument.PropertyNames.Title] = "Professional Props Management | StageBitz";
            this.FilterProperties[HtmlDocument.PropertyNames.AbsolutePath] = "/StageBitz.DevUserWeb/Default.aspx";
            this.FilterProperties[HtmlDocument.PropertyNames.PageUrl] = "http://localhost/StageBitz.DevUserWeb/Default.aspx";
            this.WindowTitles.Add("Professional Props Management | StageBitz");
            #endregion
        }

        #region Properties
        public UIWelcomeAuto14TestSigPane UIWelcomeAuto14TestSigPane
        {
            get
            {
                if ((this.mUIWelcomeAuto14TestSigPane == null))
                {
                    this.mUIWelcomeAuto14TestSigPane = new UIWelcomeAuto14TestSigPane(this);
                }
                return this.mUIWelcomeAuto14TestSigPane;
            }
        }
        #endregion

        #region Fields
        private UIWelcomeAuto14TestSigPane mUIWelcomeAuto14TestSigPane;
        #endregion
    }

    [GeneratedCode("Coded UITest Builder", "12.0.21005.1")]
    public class UIWelcomeAuto14TestSigPane : HtmlDiv
    {

        public UIWelcomeAuto14TestSigPane(UITestControl searchLimitContainer) :
                base(searchLimitContainer)
        {
            #region Search Criteria
            this.SearchProperties[HtmlDiv.PropertyNames.Id] = "NavigationContent_divUserInfo";
            this.SearchProperties[HtmlDiv.PropertyNames.Name] = null;
            this.FilterProperties[HtmlDiv.PropertyNames.InnerText] = "\r\nWelcome Auto14 Test  \r\n\r\n| Sign Out";
            this.FilterProperties[HtmlDiv.PropertyNames.Title] = null;
            this.FilterProperties[HtmlDiv.PropertyNames.Class] = "right userInfo";
            this.FilterProperties[HtmlDiv.PropertyNames.ControlDefinition] = "id=\"NavigationContent_divUserInfo\" class";
            this.FilterProperties[HtmlDiv.PropertyNames.TagInstance] = "15";
            this.WindowTitles.Add("Professional Props Management | StageBitz");
            #endregion
        }

        #region Properties
        public HtmlHyperlink lnkSignOut
        {
            get
            {
                if ((this.mlnkSignOut == null))
                {
                    this.mlnkSignOut = new HtmlHyperlink(this);
                    #region Search Criteria
                    this.mlnkSignOut.SearchProperties[HtmlHyperlink.PropertyNames.Id] = null;
                    this.mlnkSignOut.SearchProperties[HtmlHyperlink.PropertyNames.Name] = null;
                    this.mlnkSignOut.SearchProperties[HtmlHyperlink.PropertyNames.Target] = null;
                    this.mlnkSignOut.SearchProperties[HtmlHyperlink.PropertyNames.InnerText] = "Sign Out";
                    this.mlnkSignOut.FilterProperties[HtmlHyperlink.PropertyNames.AbsolutePath] = "/StageBitz.DevUserWeb/Account/Logout.aspx";
                    this.mlnkSignOut.FilterProperties[HtmlHyperlink.PropertyNames.Title] = null;
                    this.mlnkSignOut.FilterProperties[HtmlHyperlink.PropertyNames.Href] = "http://localhost/StageBitz.DevUserWeb/Account/Logout.aspx";
                    this.mlnkSignOut.FilterProperties[HtmlHyperlink.PropertyNames.Class] = null;
                    this.mlnkSignOut.FilterProperties[HtmlHyperlink.PropertyNames.ControlDefinition] = "href=\"Account/Logout.aspx\"";
                    this.mlnkSignOut.FilterProperties[HtmlHyperlink.PropertyNames.TagInstance] = "2";
                    this.mlnkSignOut.WindowTitles.Add("Professional Props Management | StageBitz");
                    #endregion
                }
                return this.mlnkSignOut;
            }
        }
        #endregion

        #region Fields
        private HtmlHyperlink mlnkSignOut;
        #endregion
    }

    [GeneratedCode("Coded UITest Builder", "12.0.21005.1")]
    public class UIProfessionalPropsManDocument1 : HtmlDocument
    {

        public UIProfessionalPropsManDocument1(UITestControl searchLimitContainer) :
                base(searchLimitContainer)
        {
            #region Search Criteria
            this.SearchProperties[HtmlDocument.PropertyNames.Id] = null;
            this.SearchProperties[HtmlDocument.PropertyNames.RedirectingPage] = "False";
            this.SearchProperties[HtmlDocument.PropertyNames.FrameDocument] = "False";
            this.FilterProperties[HtmlDocument.PropertyNames.Title] = "Professional Props Management | StageBitz";
            this.FilterProperties[HtmlDocument.PropertyNames.AbsolutePath] = "/StageBitz.DevUserWeb/Company/CompanyAdministrator.aspx";
            this.FilterProperties[HtmlDocument.PropertyNames.PageUrl] = "http://localhost/StageBitz.DevUserWeb/Company/CompanyAdministrator.aspx?companyid" +
                "=176";
            this.WindowTitles.Add("Professional Props Management | StageBitz");
            #endregion
        }

        #region Properties
        public HtmlHyperlink UIHomeHyperlink
        {
            get
            {
                if ((this.mUIHomeHyperlink == null))
                {
                    this.mUIHomeHyperlink = new HtmlHyperlink(this);
                    #region Search Criteria
                    this.mUIHomeHyperlink.SearchProperties[HtmlHyperlink.PropertyNames.Id] = "NavigationContent_lnkHomePage";
                    this.mUIHomeHyperlink.SearchProperties[HtmlHyperlink.PropertyNames.Name] = null;
                    this.mUIHomeHyperlink.SearchProperties[HtmlHyperlink.PropertyNames.Target] = null;
                    this.mUIHomeHyperlink.SearchProperties[HtmlHyperlink.PropertyNames.InnerText] = "Home";
                    this.mUIHomeHyperlink.FilterProperties[HtmlHyperlink.PropertyNames.AbsolutePath] = "/StageBitz.DevUserWeb/Default.aspx";
                    this.mUIHomeHyperlink.FilterProperties[HtmlHyperlink.PropertyNames.Title] = null;
                    this.mUIHomeHyperlink.FilterProperties[HtmlHyperlink.PropertyNames.Href] = "http://localhost/StageBitz.DevUserWeb/Default.aspx";
                    this.mUIHomeHyperlink.FilterProperties[HtmlHyperlink.PropertyNames.Class] = null;
                    this.mUIHomeHyperlink.FilterProperties[HtmlHyperlink.PropertyNames.ControlDefinition] = "id=\"NavigationContent_lnkHomePage\" href=";
                    this.mUIHomeHyperlink.FilterProperties[HtmlHyperlink.PropertyNames.TagInstance] = "4";
                    this.mUIHomeHyperlink.WindowTitles.Add("Professional Props Management | StageBitz");
                    #endregion
                }
                return this.mUIHomeHyperlink;
            }
        }
        #endregion

        #region Fields
        private HtmlHyperlink mUIHomeHyperlink;
        #endregion
    }

    [GeneratedCode("Coded UITest Builder", "12.0.21005.1")]
    public class UIStageBitzInternetExpWindow : BrowserWindow
    {

        public UIStageBitzInternetExpWindow()
        {
            #region Search Criteria
            this.SearchProperties[UITestControl.PropertyNames.Name] = "StageBitz";
            this.SearchProperties[UITestControl.PropertyNames.ClassName] = "IEFrame";
            this.WindowTitles.Add("StageBitz");
            #endregion
        }

        public void LaunchUrl(System.Uri url)
        {
            this.CopyFrom(BrowserWindow.Launch(url));
        }

        #region Properties
        public UIStageBitzDocument UIStageBitzDocument
        {
            get
            {
                if ((this.mUIStageBitzDocument == null))
                {
                    this.mUIStageBitzDocument = new UIStageBitzDocument(this);
                }
                return this.mUIStageBitzDocument;
            }
        }
        #endregion

        #region Fields
        private UIStageBitzDocument mUIStageBitzDocument;
        #endregion
    }

    [GeneratedCode("Coded UITest Builder", "12.0.21005.1")]
    public class UIStageBitzDocument : HtmlDocument
    {

        public UIStageBitzDocument(UITestControl searchLimitContainer) :
                base(searchLimitContainer)
        {
            #region Search Criteria
            this.SearchProperties[HtmlDocument.PropertyNames.Id] = null;
            this.SearchProperties[HtmlDocument.PropertyNames.RedirectingPage] = "False";
            this.SearchProperties[HtmlDocument.PropertyNames.FrameDocument] = "False";
            this.FilterProperties[HtmlDocument.PropertyNames.Title] = "StageBitz";
            this.FilterProperties[HtmlDocument.PropertyNames.AbsolutePath] = "/StageBitz.DevUserWeb/Default.aspx";
            this.FilterProperties[HtmlDocument.PropertyNames.PageUrl] = "http://localhost/StageBitz.DevUserWeb/Default.aspx";
            this.WindowTitles.Add("StageBitz");
            #endregion
        }

        #region Properties
        public UIWelcomepiu5001TestSiPane UIWelcomepiu5001TestSiPane
        {
            get
            {
                if ((this.mUIWelcomepiu5001TestSiPane == null))
                {
                    this.mUIWelcomepiu5001TestSiPane = new UIWelcomepiu5001TestSiPane(this);
                }
                return this.mUIWelcomepiu5001TestSiPane;
            }
        }
        #endregion

        #region Fields
        private UIWelcomepiu5001TestSiPane mUIWelcomepiu5001TestSiPane;
        #endregion
    }

    [GeneratedCode("Coded UITest Builder", "12.0.21005.1")]
    public class UIWelcomepiu5001TestSiPane : HtmlDiv
    {

        public UIWelcomepiu5001TestSiPane(UITestControl searchLimitContainer) :
                base(searchLimitContainer)
        {
            #region Search Criteria
            this.SearchProperties[HtmlDiv.PropertyNames.Id] = "NavigationContent_divUserInfo";
            this.SearchProperties[HtmlDiv.PropertyNames.Name] = null;
            this.FilterProperties[HtmlDiv.PropertyNames.InnerText] = "Welcome piu5001 Test  \r\n\r\n| Sign Out ";
            this.FilterProperties[HtmlDiv.PropertyNames.Title] = null;
            this.FilterProperties[HtmlDiv.PropertyNames.Class] = "right userInfo";
            this.FilterProperties[HtmlDiv.PropertyNames.ControlDefinition] = "class=\"right userInfo\" id=\"NavigationContent_divUserInfo\"";
            this.FilterProperties[HtmlDiv.PropertyNames.TagInstance] = "17";
            this.WindowTitles.Add("StageBitz");
            #endregion
        }

        #region Properties
        public HtmlHyperlink UISignOutHyperlink
        {
            get
            {
                if ((this.mUISignOutHyperlink == null))
                {
                    this.mUISignOutHyperlink = new HtmlHyperlink(this);
                    #region Search Criteria
                    this.mUISignOutHyperlink.SearchProperties[HtmlHyperlink.PropertyNames.Id] = null;
                    this.mUISignOutHyperlink.SearchProperties[HtmlHyperlink.PropertyNames.Name] = null;
                    this.mUISignOutHyperlink.SearchProperties[HtmlHyperlink.PropertyNames.Target] = null;
                    this.mUISignOutHyperlink.SearchProperties[HtmlHyperlink.PropertyNames.InnerText] = "Sign Out";
                    this.mUISignOutHyperlink.FilterProperties[HtmlHyperlink.PropertyNames.AbsolutePath] = "/StageBitz.DevUserWeb/Account/Logout.aspx";
                    this.mUISignOutHyperlink.FilterProperties[HtmlHyperlink.PropertyNames.Title] = null;
                    this.mUISignOutHyperlink.FilterProperties[HtmlHyperlink.PropertyNames.Href] = "http://localhost/StageBitz.DevUserWeb/Account/Logout.aspx";
                    this.mUISignOutHyperlink.FilterProperties[HtmlHyperlink.PropertyNames.Class] = null;
                    this.mUISignOutHyperlink.FilterProperties[HtmlHyperlink.PropertyNames.ControlDefinition] = "href=\"Account/Logout.aspx\"";
                    this.mUISignOutHyperlink.FilterProperties[HtmlHyperlink.PropertyNames.TagInstance] = "2";
                    this.mUISignOutHyperlink.WindowTitles.Add("StageBitz");
                    #endregion
                }
                return this.mUISignOutHyperlink;
            }
        }
        #endregion

        #region Fields
        private HtmlHyperlink mUISignOutHyperlink;
        #endregion
    }
}


text:
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js/object/get-own-property-descriptor";
import _Object$defineProperty from "@babel/runtime-corejs3/core-js/object/define-property";
import _typeof from "@babel/runtime-corejs3/helpers/esm/typeof";
import _WeakMap from "@babel/runtime-corejs3/core-js/weak-map";

function _getRequireWildcardCache() {
  if (typeof _WeakMap !== "function") return null;
  var cache = new _WeakMap();

  _getRequireWildcardCache = function _getRequireWildcardCache() {
    return cache;
  };

  return cache;
}

export default function _interopRequireWildcard(obj) {
  if (obj && obj.__esModule) {
    return obj;
  }

  if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
    return {
      "default": obj
    };
  }

  var cache = _getRequireWildcardCache();

  if (cache && cache.has(obj)) {
    return cache.get(obj);
  }

  var newObj = {};
  var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor;

  for (var key in obj) {
    if (Object.prototype.hasOwnProperty.call(obj, key)) {
      var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null;

      if (desc && (desc.get || desc.set)) {
        _Object$defineProperty(newObj, key, desc);
      } else {
        newObj[key] = obj[key];
      }
    }
  }

  newObj["default"] = obj;

  if (cache) {
    cache.set(obj, newObj);
  }

  return newObj;
}

redpajama_set_name: RedPajamaGithub


text:
MediaNotificationServiceFactory::MediaNotificationServiceFactory()
    : ProfileKeyedServiceFactory(
          "MediaNotificationService",
          ProfileSelections::BuildForRegularAndIncognito()) {}

MediaNotificationServiceFactory::~MediaNotificationServiceFactory() {}

// static
MediaNotificationServiceFactory*
MediaNotificationServiceFactory::GetInstance() {
  return base::Singleton<MediaNotificationServiceFactory>::get();
}

// static
MediaNotificationService* MediaNotificationServiceFactory::GetForProfile(
    Profile* profile) {
  return static_cast<MediaNotificationService*>(
      GetInstance()->GetServiceForBrowserContext(profile, true));
}

KeyedService* MediaNotificationServiceFactory::BuildServiceInstanceFor(
    content::BrowserContext* context) const {
  bool show_from_all_profiles = false;
#if BUILDFLAG(IS_CHROMEOS_ASH)
  show_from_all_profiles = true;
#endif
  return new MediaNotificationService(Profile::FromBrowserContext(context),
                                      show_from_all_profiles);
}


text:
/*global $*/

module.exports.run = function () {
  var adder = require('./adder');
  $('#result').text(adder.add(2, 2));
};


text:
BOOL dump_binary(FILE *origin, FILE *target, uint32_t top, NSString *originPath) {
	fseek(target, top, SEEK_SET); // go the top of the target

	// we're going to be going to this position a lot so let's save it
	fpos_t topPosition;
	fgetpos(target, &topPosition);

	struct linkedit_data_command ldid; // LC_CODE_SIGNATURE load header (for resign)
	struct encryption_info_command crypt; // LC_ENCRYPTION_INFO load header (for crypt*)
	struct mach_header mach; // generic mach header
	struct load_command l_cmd; // generic load command
	struct segment_command __text; // __TEXT segment

	struct SuperBlob *codesignblob; // codesign blob pointer
	struct CodeDirectory directory; // codesign directory index

	BOOL foundCrypt = FALSE;
	BOOL foundSignature = FALSE;
	BOOL foundStartText = FALSE;
	uint32_t __text_start = 0;
	uint32_t __text_size = 0;
    VERBOSE("dumping binary: analyzing load commands");
	fread(&mach, sizeof(struct mach_header), 1, target); // read mach header to get number of load commands
	for (int lc_index = 0; lc_index < mach.ncmds; lc_index++) { // iterate over each load command
		fread(&l_cmd, sizeof(struct load_command), 1, target); // read load command from binary
		if (l_cmd.cmd == LC_ENCRYPTION_INFO) { // encryption info?
			fseek(target, -1 * sizeof(struct load_command), SEEK_CUR);
			fread(&crypt, sizeof(struct encryption_info_command), 1, target);
			foundCrypt = TRUE; // remember that it was found
		} else if (l_cmd.cmd == LC_CODE_SIGNATURE) { // code signature?
			fseek(target, -1 * sizeof(struct load_command), SEEK_CUR);
			fread(&ldid, sizeof(struct linkedit_data_command), 1, target);
			foundSignature = TRUE; // remember that it was found
		} else if (l_cmd.cmd == LC_SEGMENT) {
			// some applications, like Skype, have decided to start offsetting the executable image's
			// vm regions by substantial amounts for no apparant reason. this will find the vmaddr of
			// that segment (referenced later during dumping)
			fseek(target, -1 * sizeof(struct load_command), SEEK_CUR);
			fread(&__text, sizeof(struct segment_command), 1, target);
			if (strncmp(__text.segname, "__TEXT", 6) == 0) {
				foundStartText = TRUE;
				__text_start = __text.vmaddr;
				__text_size = __text.vmsize;
			}
			fseek(target, l_cmd.cmdsize - sizeof(struct segment_command), SEEK_CUR);
		} else {
			fseek(target, l_cmd.cmdsize - sizeof(struct load_command), SEEK_CUR); // seek over the load command
		}
        if (foundCrypt && foundSignature && foundStartText)
            break;
	}

	// we need to have found both of these
	if (!foundCrypt || !foundSignature || !foundStartText) {
        VERBOSE("dumping binary: some load commands were not found");
		return FALSE;
	}

	pid_t pid; // store the process ID of the fork
	mach_port_t port; // mach port used for moving virtual memory
	kern_return_t err; // any kernel return codes
	int status; // status of the wait
	vm_size_t local_size = 0; // amount of data moved into the buffer
	uint32_t begin;

    VERBOSE("dumping binary: obtaining ptrace handle");

	// open handle to dylib loader
	void *handle = dlopen(0, RTLD_GLOBAL | RTLD_NOW);
	// load ptrace library into handle
	ptrace_ptr_t ptrace = dlsym(handle, "ptrace");
	// begin the forking process
    VERBOSE("dumping binary: forking to begin tracing");

	if ((pid = fork()) == 0) {
		// it worked! the magic is in allowing the process to trace before execl.
		// the process will be incapable of preventing itself from tracing
		// execl stops the process before this is capable
		// PT_DENY_ATTACH was never meant to be good security, only a minor roadblock

		ptrace(PT_TRACE_ME, 0, 0, 0); // trace
		execl([originPath UTF8String], "", (char *) 0); // import binary memory into executable space
		exit(2); // exit with err code 2 in case we could not import (this should not happen)
	} else if (pid < 0) {
        printf("error: Couldn't fork, did you compile with proper entitlements?");
		return FALSE; // couldn't fork
	} else {
		// wait until the binary stops
		do {
			wait(&status);
			if (WIFEXITED( status ))
				return FALSE;
		} while (!WIFSTOPPED( status ));

        VERBOSE("dumping binary: obtaining mach port");

		// open mach port to the other process
		if ((err = task_for_pid(mach_task_self(), pid, &port) != KERN_SUCCESS)) {
			kill(pid, SIGKILL); // kill the fork
			return FALSE;
		}

        VERBOSE("dumping binary: preparing code resign");

		codesignblob = malloc(ldid.datasize);
		fseek(target, top + ldid.dataoff, SEEK_SET); // seek to the codesign blob
		fread(codesignblob, ldid.datasize, 1, target); // read the whole codesign blob
		uint32_t countBlobs = CFSwapInt32(codesignblob->count); // how many indexes?

		// iterate through each index
		for (uint32_t index = 0; index < countBlobs; index++) {
			if (CFSwapInt32(codesignblob->index[index].type) == CSSLOT_CODEDIRECTORY) { // is this the code directory?
				// we'll find the hash metadata in here
				begin = top + ldid.dataoff + CFSwapInt32(codesignblob->index[index].offset); // store the top of the codesign directory blob
				fseek(target, begin, SEEK_SET); // seek to the beginning of the blob
				fread(&directory, sizeof(struct CodeDirectory), 1, target); // read the blob
				break; // break (we don't need anything from this the superblob anymore)
			}
		}

		free(codesignblob); // free the codesign blob

		uint32_t pages = CFSwapInt32(directory.nCodeSlots); // get the amount of codeslots
		if (pages == 0) {
			kill(pid, SIGKILL); // kill the fork
			return FALSE;
		}

		void *checksum = malloc(pages * 20); // 160 bits for each hash (SHA1)
		uint8_t buf_d[0x1000]; // create a single page buffer
		uint8_t *buf = &buf_d[0]; // store the location of the buffer

        VERBOSE("dumping binary: preparing to dump");

		// we should only have to write and perform checksums on data that changes
		uint32_t togo = crypt.cryptsize + crypt.cryptoff;
        uint32_t total = togo;
		uint32_t pages_d = 0;
		BOOL header = TRUE;

		// write the header
		fsetpos(target, &topPosition);

		// in iOS 4.3+, ASLR can be enabled by developers by setting the MH_PIE flag in
		// the mach header flags. this will randomly offset the location of the __TEXT
		// segment, making it slightly difficult to identify the location of the
		// decrypted pages. instead of disabling this flag in the original binary
		// (which is slow, requires resigning, and requires reverting to the original
		// binary after cracking) we instead manually identify the vm regions which
		// contain the header and subsequent decrypted executable code.
		if (mach.flags & MH_PIE) {
            VERBOSE("dumping binary: ASLR enabled, identifying dump location dynamically");
			// perform checks on vm regions
			memory_object_name_t object;
			vm_region_basic_info_data_t info;
			mach_msg_type_number_t info_count = VM_REGION_BASIC_INFO_COUNT;
			vm_address_t region_start = 0;
			vm_size_t region_size = 0;
			vm_region_flavor_t flavor = VM_REGION_BASIC_INFO;
			err = 0;

			while (err == KERN_SUCCESS) {
				err = vm_region(port, &region_start, &region_size, flavor, (vm_region_info_t) &info, &info_count, &object);
				if (region_size == crypt.cryptsize) {
					break;
				}
				__text_start = region_start;
				region_start += region_size;
				region_size	= 0;
			}
			if (err != KERN_SUCCESS) {
				free(checksum);
				kill(pid, SIGKILL);
				return FALSE;
				printf("ASLR is enabled and we could not identify the decrypted memory region.\n");
			}
		}

        uint32_t headerProgress = sizeof(struct mach_header);
        uint32_t i_lcmd = 0;

        // overdrive dylib load command size
        uint32_t overdrive_size = sizeof(OVERDRIVE_DYLIB_PATH) + sizeof(struct dylib_command);
        overdrive_size += sizeof(long) - (overdrive_size % sizeof(long)); // load commands like to be aligned by long

        VERBOSE("dumping binary: performing dump");

		while (togo > 0) {
            // get a percentage for the progress bar
            PERCENT((int)ceil((((double)total - togo) / (double)total) * 100));

			// move an entire page into memory (we have to move an entire page regardless of whether it's a resultant or not)
			if((err = vm_read_overwrite(port, (mach_vm_address_t) __text_start + (pages_d * 0x1000), (vm_size_t) 0x1000, (pointer_t) buf, &local_size)) != KERN_SUCCESS)	{
                VERBOSE("dumping binary: failed to dump a page");
				free(checksum); // free checksum table
				kill(pid, SIGKILL); // kill fork
				return FALSE;
			}

			if (header) {
                // is this the first header page?
                if (i_lcmd == 0) {
                    // is overdrive enabled?
                    if (overdrive_enabled) {
                        // prepare the mach header for the new load command (overdrive dylib)
                        ((struct mach_header *)buf)->ncmds += 1;
                        ((struct mach_header *)buf)->sizeofcmds += overdrive_size;
                        VERBOSE("dumping binary: patched mach header (overdrive)");
                    }
                }
                // iterate over the header (or resume iteration)
                void *curloc = buf + headerProgress;
                for (;i_lcmd<mach.ncmds;i_lcmd++) {
                    struct load_command *l_cmd = (struct load_command *) curloc;
                    // is the load command size in a different page?
                    uint32_t lcmd_size;
                    if ((int)(((void*)curloc - (void*)buf) + 4) == 0x1000) {
                        // load command size is at the start of the next page
                        // we need to get it
                        vm_read_overwrite(port, (mach_vm_address_t) __text_start + ((pages_d+1) * 0x1000), (vm_size_t) 0x1, (pointer_t) &lcmd_size, &local_size);
                    } else {
                        lcmd_size = l_cmd->cmdsize;
                    }

                    if (l_cmd->cmd == LC_ENCRYPTION_INFO) {
                        struct encryption_info_command *newcrypt = (struct encryption_info_command *) curloc;
                        newcrypt->cryptid = 0; // change the cryptid to 0
                        VERBOSE("dumping binary: patched cryptid");
                    } else if (l_cmd->cmd == LC_SEGMENT) {
                        struct segment_command *newseg = (struct segment_command *) curloc;
                        if (newseg->fileoff == 0 && newseg->filesize > 0) {
                            // is overdrive enabled? this is __TEXT
                            if (overdrive_enabled) {
                                // maxprot so that overdrive can change the __TEXT protection &
                                // cryptid in realtime
                                newseg->maxprot |= VM_PROT_ALL;
                                VERBOSE("dumping binary: patched maxprot (overdrive)");
                            }
                        }
                    }
                    curloc += lcmd_size;
                    if ((void *)curloc >= (void *)buf + 0x1000) {
                        // we are currently extended past the header page
                        // offset for the next round:
                        headerProgress = (((void *)curloc - (void *)buf) % 0x1000);
                        // prevent attaching overdrive dylib by skipping
                        goto skipoverdrive;
                    }
                }
                // is overdrive enabled?
                if (overdrive_enabled) {
                    // add the overdrive dylib as long as we have room
                    if ((curloc + overdrive_size) < (buf + 0x1000)) {
                        VERBOSE("dumping binary: attaching overdrive DYLIB (overdrive)");
                        struct dylib_command *overdrive_dyld = (struct dylib_command *) curloc;
                        overdrive_dyld->cmd = LC_LOAD_DYLIB;
                        overdrive_dyld->cmdsize = overdrive_size;
                        overdrive_dyld->dylib.compatibility_version = OVERDRIVE_DYLIB_COMPATIBILITY_VERSION;
                        overdrive_dyld->dylib.current_version = OVERDRIVE_DYLIB_CURRENT_VER;
                        overdrive_dyld->dylib.timestamp = 2;
                        overdrive_dyld->dylib.name.offset = sizeof(struct dylib_command);
                        overdrive_dyld->dylib.name.ptr = (char *) sizeof(struct dylib_command);

                        char *p = (char *) overdrive_dyld + overdrive_dyld->dylib.name.offset;
                        strncpy(p, OVERDRIVE_DYLIB_PATH, sizeof(OVERDRIVE_DYLIB_PATH));
                    }
                }
				header = FALSE;
			}
        skipoverdrive:

			fwrite(buf, 0x1000, 1, target); // write the new data to the target
			sha1(checksum + (20 * pages_d), buf, 0x1000); // perform checksum on the page

			togo -= 0x1000; // remove a page from the togo
			pages_d += 1; // increase the amount of completed pages
		}

        VERBOSE("dumping binary: writing new checksum");

		// nice! now let's write the new checksum data
		fseek(target, begin + CFSwapInt32(directory.hashOffset), SEEK_SET); // go to the hash offset
		fwrite(checksum, 20*pages_d, 1, target); // write the hashes (ONLY for the amount of pages modified)

		free(checksum); // free checksum table from memory
		kill(pid, SIGKILL); // kill the fork
	}

	return TRUE;
}

void sha1(uint8_t *hash, uint8_t *data, size_t size) {
	SHA1Context context;
	SHA1Reset(&context);
	SHA1Input(&context, data, size);
	SHA1Result(&context, hash);
}


text:
#include <ndb_global.h>

#include <NdbMain.h>
#include <NdbOut.hpp>
#include <Sysfile.hpp>

void
usage(const char * prg){
  ndbout << "Usage " << prg
	 << " P[0-1].sysfile" << endl;
}

struct NSString {
  Sysfile::ActiveStatus NodeStatus;
  const char * desc;
};

static const
NSString NodeStatusStrings[] = {
  { Sysfile::NS_Active,                 "Active         " },
  { Sysfile::NS_ActiveMissed_1,         "Active missed 1" },
  { Sysfile::NS_ActiveMissed_2,         "Active missed 2" },
  { Sysfile::NS_ActiveMissed_3,         "Active missed 3" },
  { Sysfile::NS_HotSpare,               "Hot spare      " },
  { Sysfile::NS_NotActive_NotTakenOver, "Not active     " },
  { Sysfile::NS_TakeOver,               "Take over      " },
  { Sysfile::NS_NotActive_TakenOver,    "Taken over     " },
  { Sysfile::NS_NotDefined,             "Not defined    " },
  { Sysfile::NS_Standby,                "Stand by       " }
};

const
char * getNSString(Uint32 ns){
  for(Uint32 i = 0; i<(sizeof(NodeStatusStrings)/sizeof(NSString)); i++)
    if((Uint32)NodeStatusStrings[i].NodeStatus == ns)
      return NodeStatusStrings[i].desc;
  return "<Unknown state>";
}

void
fill(const char * buf, int mod){
  int len = strlen(buf)+1;
  ndbout << buf << " ";
  while((len % mod) != 0){
    ndbout << " ";
    len++;
  }
}

void
print(const char * filename, const Sysfile * sysfile){
  char buf[255];
  ndbout << "----- Sysfile: " << filename
	 << " seq: " << hex << sysfile->m_restart_seq
	 << " -----" << endl;
  ndbout << "Initial start ongoing: "
	 << Sysfile::getInitialStartOngoing(sysfile->systemRestartBits)
	 << ", ";

  ndbout << "Restart Ongoing: "
	 << Sysfile::getRestartOngoing(sysfile->systemRestartBits)
	 << ", ";

  ndbout << "LCP Ongoing: "
	 << Sysfile::getLCPOngoing(sysfile->systemRestartBits)
	 << endl;

  ndbout << "-- Global Checkpoint Identities: --" << endl;
  sprintf(buf, "keepGCI = %u", sysfile->keepGCI);
  fill(buf, 40);
  ndbout << " -- Tail of REDO log" << endl;

  sprintf(buf, "oldestRestorableGCI = %u", sysfile->oldestRestorableGCI);
  fill(buf, 40);
  ndbout << " -- " << endl;

  sprintf(buf, "newestRestorableGCI = %u", sysfile->newestRestorableGCI);
  fill(buf, 40);
  ndbout << " -- " << endl;

  sprintf(buf, "latestLCP = %u", sysfile->latestLCP_ID);
  fill(buf, 40);
  ndbout << " -- " << endl;

  ndbout << "-- Node status: --" << endl;
  for(int i = 1; i < MAX_NDB_NODES; i++){
    if(Sysfile::getNodeStatus(i, sysfile->nodeStatus) !=Sysfile::NS_NotDefined){
      sprintf(buf,
	      "Node %.2d -- %s GCP: %d, NodeGroup: %d, TakeOverNode: %d, "
	      "LCP Ongoing: %s",
	      i,
	      getNSString(Sysfile::getNodeStatus(i,sysfile->nodeStatus)),
	      sysfile->lastCompletedGCI[i],
	      Sysfile::getNodeGroup(i, sysfile->nodeGroups),
	      Sysfile::getTakeOverNode(i, sysfile->takeOver),
	      BitmaskImpl::get(NdbNodeBitmask::Size,
			       sysfile->lcpActive, i) != 0 ? "yes" : "no");
      ndbout << buf << endl;
    }
  }
}

NDB_COMMAND(printSysfile,
	    "printSysfile", "printSysfile", "Prints a sysfile", 16384){
  if(argc < 2){
    usage(argv[0]);
    return 0;
  }

  for(int i = 1; i<argc; i++){
    const char * filename = argv[i];

    struct stat sbuf;
    const int res = stat(filename, &sbuf);
    if(res != 0){
      ndbout << "Could not find file: \"" << filename << "\"" << endl;
      continue;
    }
    const Uint32 bytes = sbuf.st_size;

    Uint32 * buf = new Uint32[bytes/4+1];

    FILE * f = fopen(filename, "rb");
    if(f == 0){
      ndbout << "Failed to open file" << endl;
      delete [] buf;
      continue;
    }
    Uint32 sz = fread(buf, 1, bytes, f);
    fclose(f);
    if(sz != bytes){
      ndbout << "Failure while reading file" << endl;
      delete [] buf;
      continue;
    }

    print(filename, (Sysfile *)&buf[0]);
    delete [] buf;
    continue;
  }
  return 0;
}


text:
:root {
  --fill-color: #fff;
}

.bar {
  position: relative;
}

.bar-horizontal {
  composes: bar;
  width: 100%;
}

.bar-vertical {
  composes: bar;
  height: 100%;
}

.fill {
  background-color: var(--fill-color);
  position: absolute;
  bottom: 0;
  left: 0;
}

.slider {
  position: absolute 0;
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  cursor: pointer;
  outline: none;

  &:focus { outline: none; }
}

.slider-horizontal {
  composes: slider;
  appearance: none;
}

.slider-vertical {
  composes: slider;
  appearance: slider-vertical;
  opacity: 0;
}

.marker {
  position: absolute;
  display: inline-block;
}

.marker-vertical {
  composes: marker;
}

.marker-horizontal {
  composes: marker;
}


text:
OrdersController.class_eval do
  before_filter :authorize_trollied_action

  alias_method :original_default_conditions_hash, :default_conditions_hash
  def default_conditions_hash
    hash = original_default_conditions_hash
    if @current_basket != @site_basket
      hash[:basket_id] = @current_basket.id
    end
    hash
  end

   def set_defaults_for_order_checkout
     return if @order.contact_name.present? && @order.contact_phone.present?

     trolley = @trolley || current_user.trolley
     # opted for two queries rather than one combined query
     # and pulling apart latest values from multiple results
     # WARNING: mysql specific select distinct syntax
     previous_contact_name_order = trolley.orders.find(:first,
                                                       :select => "distinct(contact_name)",
                                                       :order => 'updated_at DESC')

     @order.contact_name ||= previous_contact_name_order.contact_name if previous_contact_name_order.present? && previous_contact_name_order.contact_name.present?

     previous_contact_phone_order = trolley.orders.find(:first,
                                                        :select => "distinct(contact_phone)",
                                                        :order => 'updated_at DESC')

     @order.contact_phone ||= previous_contact_phone_order.contact_phone if previous_contact_phone_order.present? && previous_contact_phone_order.contact_phone.present?
   end

   def number_per_page
     50
   end
end


text:
<!doctype html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <title>Syllabus</title>

    <link href="/stylesheets/all-1508a1bf.css" rel="stylesheet" type="text/css" />
    <link href='http://fonts.googleapis.com/css?family=Oxygen:400,300,700'
      rel='stylesheet' type='text/css'>

    MENU

Prework

Syllabus

Timeline

Setup

Atom

Homebrew

rbenv (ruby)

XCode

Resources

Instructor Contact Info

Jesse Wolgamott

jesse@theironyard.com

713-397-2814

jwo (slack)

TA Contact Info

Caroline Devine

@caroline (slack)

Schedule

Class is from Feb 2, 2016 - April 24, 2016

Lecture is from 9:30 AM to 12:30 PM Monday-Thursday, with breaks during that time.
Depending on the topic, we may end early.

Lab is from 1 PM to 4 PM Monday-Thursday and 9 AM - 4 PM on Friday.

Optional Reviews: most days from 2:00 - 3:00 depending on scheduling.

Office hours and one-on-one instruction

A teacher or TA will be available Monday-Friday from 9 AM to 5 PM at minimum.
During lab time, you can schedule one-on-one time with either of us. After hours,
we may be available in the classroom or in HipChat, which we use for group
communication.

Holidays

No Holidays. Spring Break RIP.

Capstone Project

During the last three weeks of the course, you will be working on your capstone
project, putting all you've learned into practice.

At the end of week 9, you'll present your idea for a final project and
get feedback, helping you scope the project. During weeks 10, 11, and 12, you'll
work primarily on this project. We will have lecture time, but it will be
tailored to what you need to know for your project and may be optional. We will
let you know what days lecture is optional.

This project must use Ruby on Rails to build a web application of significant
size, backed by a database and using some of the libraries we covered during
class.

A front-end development course is happening at the same time as our class. If
anyone wants to combine efforts with members of that class, that is a fantastic
idea, but expectations for your project will be higher.

Materials

All students must bring their own MacBook laptop. Your MacBook should have a
minimum of 4 GB of RAM and 128 GB of hard drive space. Those are minimum specs,
and I recommend getting 8 GB of RAM and a 256 GB hard drive, but that's your
choice to make. Any of the current
MacBook Air models or
MacBook Pro models will work.
I have a 13-inch MacBook Pro and really dig it.

Your MacBook must be running OS X el Capitan. el Capitan is a free upgrade from
the App Store.

There is no commercial software required for the class, but you may want to
purchase some. We are going to use a free text editor in class –
Atom – but Sublime Text is
great.

Policies

Absence policy

You can miss up to 4 lectures; after that, your job placement is
forfeit. I don't recommend missing any, as we will be moving very fast.

Late homework policy

Your homework is due by 6 AM on the day it is due. After that, it is late. Like
the absence policy, you can turn in homework late 4 times, although I do not
recommend it.

I would rather see a solid attempt on time than a complete assignment late.
Solid attempts are not considered late.

Honor code

You are expected to do your own work. You should use all resources available to
you, including open-source code, but copy and pasting open-source code is
prohibited: you should use it only for inspiration or as a library in a bigger
project.

Copying homework is taken very seriously and can result in forfeiting job
placement.

Code of Conduct

Like the technical community as a whole, classes at The Iron Yard are made up of
a mixture of people from all different backgrounds.

Diversity is one of our huge strengths, but it can also lead to communication
issues and unhappiness. To that end, we have a few ground rules that we ask
people to adhere to when they're taking a class at The Iron Yard. These rules
apply equally to teachers, students, other staff, and guest lecturers.

This isn't an exhaustive list of things that you can't do. Rather, take it in
the spirit in which it's intended - a guide to make it easier to enrich all of
us, the technical communities in which we participate.

This code of conduct applies to all communication: this includes in class,
HipChat, email, and other forums such as Skype, Google+ Hangouts, etc.

If you believe someone is violating the code of conduct, we ask that you report
it by talking to your teacher. If you do not feel comfortable talking to your
teacher, speak with any Iron Yard teacher or campus director.

Be welcoming, friendly, and patient.

Be considerate. Your work will be used by other people, and you in turn
will depend on the work of others. Any decision you take will affect your
colleagues, and you should take those consequences into account when making
decisions.

Be respectful. Not all of us will agree all the time, but disagreement is
no excuse for poor behavior and poor manners. We might all experience some
frustration now and then, but we cannot allow that frustration to turn into a
personal attack. It's important to remember that a community where people feel
uncomfortable or threatened is not a productive one. Members of the Iron Yard
community should be respectful when dealing with other members as well as with
people outside the Iron Yard community.

Be careful in the words that you choose. Be kind to others. Do not insult
or put down other people. Behave professionally. Remember that harassment and
sexist, racist, or exclusionary behavior are not appropriate for this class.
This includes, but is not limited to:

Violent threats or language directed against another person.

Sexist, racist, or otherwise discriminatory jokes and language.

Posting sexually explicit or violent material.

Personal insults, especially those using racist or sexist terms.

Unwelcome sexual attention.

Advocating for, or encouraging, any of the above behavior.

Repeated harassment of others.
In general, if someone asks you to stop, then stop.

When we disagree, we try to understand why. Disagreements, both social
and technical, happen all the time and The Iron Yard is no exception. It is
important that we resolve disagreements and differing views constructively.
Remember that we're different. The strength of The Iron Yard comes from its
varied members, people from a wide range of backgrounds. Different people have
different perspectives on issues. Being unable to understand why someone holds
a viewpoint doesn't mean that they're wrong. Don't forget that it is human to
err and blaming each other doesn't get us anywhere, rather offer to help
resolving issues and to help learn from mistakes.

This text is taken from the Django project.


text:
<?php

/*

Modifies the WordPress dashboard for non admin users.

*/

function dashboard_customization() {

    if (!current_user_can('manage_options') ) {

             global $wp_meta_boxes, $wp_admin_bar;

             // Remove dashboard widgets

             unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);

             unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);

             unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);

             unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);

             // Remove toolbar nodes

             $wp_admin_bar->remove_menu('wp-logo');

             $wp_admin_bar->remove_menu('comments');

             $wp_admin_bar->remove_menu('new-content');

             $wp_admin_bar->remove_menu('site-name');

             // Customize dashboard

             // Remove help menu

             add_filter( 'contextual_help', 'remove_contextual_help', 999, 3 );

             function remove_contextual_help($old_help, $screen_id, $screen){

                        $screen->remove_help_tabs();

                        return $old_help;

             }

             // Remove update notification

             add_filter( 'pre_site_transient_update_core', create_function( '$a', "return null;" ) );

             // Change footer message

             function change_footer_admin () {

                         return 'BIL Conference';

             }

             add_filter('admin_footer_text', 'change_footer_admin', 9999);

             // Change footer version

             function change_footer_version() {

                         return ' ';

             }

             add_filter( 'update_footer', 'change_footer_version', 9999);

             // add 'Submit Guest Post' menu to adminbar

             // $wp_admin_bar->add_menu( array(

             // 'parent' => false,

             // 'id' => '',

             // 'title' => __(''),

             // 'href' => '#'

             // ));
}

// add custom widget in dashboard

function bil_general_info_widget() {

    echo '
';

    echo '
BIL Custom Dashboard Widget
';

    echo '
';

}

function add_bil_general_info_widget() {

    wp_add_dashboard_widget( 'bil-general-info', 'General BIL Info','bil_general_info_widget');

}

/* Hook function */

add_action( 'wp_before_admin_bar_render', 'dashboard_customization' );

add_action( 'wp_dashboard_setup', 'add_bil_general_info_widget' );


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Grevillea 20(no. 95): 86 (1892)

#### Original name
Sphaeria pyrina Kunze

### Remarks
null


text:
rangy.createModule("DomUtil", function(api, module) {
    var log = log4javascript.getLogger("rangy.dom");
    var UNDEF = "undefined";
    var util = api.util;

    // Perform feature tests
    if (!util.areHostMethods(document, ["createDocumentFragment", "createElement", "createTextNode"])) {
        module.fail("document missing a Node creation method");
    }

    if (!util.isHostMethod(document, "getElementsByTagName")) {
        module.fail("document missing getElementsByTagName method");
    }

    var el = document.createElement("div");
    if (!util.areHostMethods(el, ["insertBefore", "appendChild", "cloneNode"] ||
            !util.areHostObjects(el, ["previousSibling", "nextSibling", "childNodes", "parentNode"]))) {
        module.fail("Incomplete Element implementation");
    }

    // innerHTML is required for Range's createContextualFragment method
    if (!util.isHostProperty(el, "innerHTML")) {
        module.fail("Element is missing innerHTML property");
    }

    var textNode = document.createTextNode("test");
    if (!util.areHostMethods(textNode, ["splitText", "deleteData", "insertData", "appendData", "cloneNode"] ||
            !util.areHostObjects(el, ["previousSibling", "nextSibling", "childNodes", "parentNode"]) ||
            !util.areHostProperties(textNode, ["data"]))) {
        module.fail("Incomplete Text Node implementation");
    }

    /*----------------------------------------------------------------------------------------------------------------*/

    // Removed use of indexOf because of a bizarre bug in Opera that is thrown in one of the Acid3 tests. I haven't been
    // able to replicate it outside of the test. The bug is that indexOf returns -1 when called on an Array that
    // contains just the document as a single element and the value searched for is the document.
    var arrayContains = /*Array.prototype.indexOf ?
        function(arr, val) {
            return arr.indexOf(val) > -1;
        }:*/

        function(arr, val) {
            var i = arr.length;
            while (i--) {
                if (arr[i] === val) {
                    return true;
                }
            }
            return false;
        };

    // Opera 11 puts HTML elements in the null namespace, it seems, and IE 7 has undefined namespaceURI
    function isHtmlNamespace(node) {
        var ns;
        return typeof node.namespaceURI == UNDEF || ((ns = node.namespaceURI) === null || ns == "http://www.w3.org/1999/xhtml");
    }

    function parentElement(node) {
        var parent = node.parentNode;
        return (parent.nodeType == 1) ? parent : null;
    }

    function getNodeIndex(node) {
        var i = 0;
        while( (node = node.previousSibling) ) {
            ++i;
        }
        return i;
    }

    function getNodeLength(node) {
        switch (node.nodeType) {
            case 7:
            case 10:
                return 0;
            case 3:
            case 8:
                return node.length;
            default:
                return node.childNodes.length;
        }
    }

    function getCommonAncestor(node1, node2) {
        var ancestors = [], n;
        for (n = node1; n; n = n.parentNode) {
            ancestors.push(n);
        }

        for (n = node2; n; n = n.parentNode) {
            if (arrayContains(ancestors, n)) {
                return n;
            }
        }

        return null;
    }

    function isAncestorOf(ancestor, descendant, selfIsAncestor) {
        var n = selfIsAncestor ? descendant : descendant.parentNode;
        while (n) {
            if (n === ancestor) {
                return true;
            } else {
                n = n.parentNode;
            }
        }
        return false;
    }

    function isOrIsAncestorOf(ancestor, descendant) {
        return isAncestorOf(ancestor, descendant, true);
    }

    function getClosestAncestorIn(node, ancestor, selfIsAncestor) {
        var p, n = selfIsAncestor ? node : node.parentNode;
        while (n) {
            p = n.parentNode;
            if (p === ancestor) {
                return n;
            }
            n = p;
        }
        return null;
    }

    function isCharacterDataNode(node) {
        var t = node.nodeType;
        return t == 3 || t == 4 || t == 8 ; // Text, CDataSection or Comment
    }

    function isTextOrCommentNode(node) {
        if (!node) {
            return false;
        }
        var t = node.nodeType;
        return t == 3 || t == 8 ; // Text or Comment
    }

    function insertAfter(node, precedingNode) {
        var nextNode = precedingNode.nextSibling, parent = precedingNode.parentNode;
        if (nextNode) {
            parent.insertBefore(node, nextNode);
        } else {
            parent.appendChild(node);
        }
        return node;
    }

    // Note that we cannot use splitText() because it is bugridden in IE 9.
    function splitDataNode(node, index, positionsToPreserve) {
        log.debug("splitDataNode called at index " + index + " in node " + inspectNode(node));
        var newNode = node.cloneNode(false);
        newNode.deleteData(0, index);
        node.deleteData(index, node.length - index);
        insertAfter(newNode, node);

        // Preserve positions
        if (positionsToPreserve) {
            for (var i = 0, position; position = positionsToPreserve[i++]; ) {
                // Handle case where position was inside the portion of node after the split point
                if (position.node == node && position.offset > index) {
                    position.node = newNode;
                    position.offset -= index;
                }
                // Handle the case where the position is a node offset within node's parent
                else if (position.node == node.parentNode && position.offset > getNodeIndex(node)) {
                    ++position.offset;
                }
            }
        }
        return newNode;
    }

    function getDocument(node) {
        if (node.nodeType == 9) {
            return node;
        } else if (typeof node.ownerDocument != UNDEF) {
            return node.ownerDocument;
        } else if (typeof node.document != UNDEF) {
            return node.document;
        } else if (node.parentNode) {
            return getDocument(node.parentNode);
        } else {
            throw module.createError("getDocument: no document found for node");
        }
    }

    function getWindow(node) {
        var doc = getDocument(node);
        if (typeof doc.defaultView != UNDEF) {
            return doc.defaultView;
        } else if (typeof doc.parentWindow != UNDEF) {
            return doc.parentWindow;
        } else {
            throw module.createError("Cannot get a window object for node");
        }
    }

    function getIframeDocument(iframeEl) {
        if (typeof iframeEl.contentDocument != UNDEF) {
            return iframeEl.contentDocument;
        } else if (typeof iframeEl.contentWindow != UNDEF) {
            return iframeEl.contentWindow.document;
        } else {
            throw module.createError("getIframeDocument: No Document object found for iframe element");
        }
    }

    function getIframeWindow(iframeEl) {
        if (typeof iframeEl.contentWindow != UNDEF) {
            return iframeEl.contentWindow;
        } else if (typeof iframeEl.contentDocument != UNDEF) {
            return iframeEl.contentDocument.defaultView;
        } else {
            throw module.createError("getIframeWindow: No Window object found for iframe element");
        }
    }

    // This looks bad. Is it worth it?
    function isWindow(obj) {
        return obj && util.isHostMethod(obj, "setTimeout") && util.isHostObject(obj, "document");
    }

    function getContentDocument(obj, module, methodName) {
        var doc;

        if (!obj) {
            doc = document;
        }

        // Test if a DOM node has been passed and obtain a document object for it if so
        else if (util.isHostProperty(obj, "nodeType")) {
            doc = (obj.nodeType == 1 && obj.tagName.toLowerCase() == "iframe")
                ? getIframeDocument(obj) : getDocument(obj);
        }

        // Test if the doc parameter appears to be a Window object
        else if (isWindow(obj)) {
            doc = obj.document;
        }

        if (!doc) {
            throw module.createError(methodName + "(): Parameter must be a Window object or DOM node");
        }

        return doc;
    }

    function getRootContainer(node) {
        var parent;
        while ( (parent = node.parentNode) ) {
            node = parent;
        }
        return node;
    }

    function comparePoints(nodeA, offsetA, nodeB, offsetB) {
        // See http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html#Level-2-Range-Comparing
        var nodeC, root, childA, childB, n;
        if (nodeA == nodeB) {
            log.debug("case 1");
            // Case 1: nodes are the same
            return offsetA === offsetB ? 0 : (offsetA < offsetB) ? -1 : 1;
        } else if ( (nodeC = getClosestAncestorIn(nodeB, nodeA, true)) ) {
            log.debug("case 2", inspectNode(nodeC), getNodeIndex(nodeC));
            // Case 2: node C (container B or an ancestor) is a child node of A
            return offsetA <= getNodeIndex(nodeC) ? -1 : 1;
        } else if ( (nodeC = getClosestAncestorIn(nodeA, nodeB, true)) ) {
            log.debug("case 3");
            // Case 3: node C (container A or an ancestor) is a child node of B
            return getNodeIndex(nodeC) < offsetB  ? -1 : 1;
        } else {
            log.debug("case 4");
            // Case 4: containers are siblings or descendants of siblings
            root = getCommonAncestor(nodeA, nodeB);
            childA = (nodeA === root) ? root : getClosestAncestorIn(nodeA, root, true);
            childB = (nodeB === root) ? root : getClosestAncestorIn(nodeB, root, true);

            if (childA === childB) {
                // This shouldn't be possible
                log.warn("comparePoints got to case 4 and childA and childB are the same!", nodeA, offsetA, nodeB, offsetB);
                throw module.createError("comparePoints got to case 4 and childA and childB are the same!");
            } else {
                n = root.firstChild;
                while (n) {
                    if (n === childA) {
                        return -1;
                    } else if (n === childB) {
                        return 1;
                    }
                    n = n.nextSibling;
                }
            }
        }
    }

    /*----------------------------------------------------------------------------------------------------------------*/

    // Test for IE's crash (IE 6/7) or exception (IE >= 8) when a reference to garbage-collected text node is queried
    var crashyTextNodes = false;

    function isBrokenNode(node) {
        try {
            node.parentNode;
            return false;
        } catch (e) {
            return true;
        }
    }

    (function() {
        var el = document.createElement("b");
        el.innerHTML = "1";
        var textNode = el.firstChild;
        el.innerHTML = "<br>";
        crashyTextNodes = isBrokenNode(textNode);

        api.features.crashyTextNodes = crashyTextNodes;
    })();

    /*----------------------------------------------------------------------------------------------------------------*/

    function inspectNode(node) {
        if (!node) {
            return "[No node]";
        }
        if (crashyTextNodes && isBrokenNode(node)) {
            return "[Broken node]";
        }
        if (isCharacterDataNode(node)) {
            return '"' + node.data + '"';
        }
        if (node.nodeType == 1) {
            var idAttr = node.id ? ' id="' + node.id + '"' : "";
            return "<" + node.nodeName + idAttr + ">[" + node.childNodes.length + "][" + node.innerHTML.slice(0, 20) + "]";
        }
        return node.nodeName;
    }

    function fragmentFromNodeChildren(node) {
        var fragment = getDocument(node).createDocumentFragment(), child;
        while ( (child = node.firstChild) ) {
            fragment.appendChild(child);
        }
        return fragment;
    }

    var getComputedStyleProperty;
    if (typeof window.getComputedStyle != UNDEF) {
        getComputedStyleProperty = function(el, propName) {
            return getWindow(el).getComputedStyle(el, null)[propName];
        };
    } else if (typeof document.documentElement.currentStyle != UNDEF) {
        getComputedStyleProperty = function(el, propName) {
            return el.currentStyle[propName];
        };
    } else {
        module.fail("No means of obtaining computed style properties found");
    }

    function NodeIterator(root) {
        this.root = root;
        this._next = root;
    }

    NodeIterator.prototype = {
        _current: null,

        hasNext: function() {
            return !!this._next;
        },

        next: function() {
            var n = this._current = this._next;
            var child, next;
            if (this._current) {
                child = n.firstChild;
                if (child) {
                    this._next = child;
                } else {
                    next = null;
                    while ((n !== this.root) && !(next = n.nextSibling)) {
                        n = n.parentNode;
                    }
                    this._next = next;
                }
            }
            return this._current;
        },

        detach: function() {
            this._current = this._next = this.root = null;
        }
    };

    function createIterator(root) {
        return new NodeIterator(root);
    }

    function DomPosition(node, offset) {
        this.node = node;
        this.offset = offset;
    }

    DomPosition.prototype = {
        equals: function(pos) {
            return !!pos && this.node === pos.node && this.offset == pos.offset;
        },

        inspect: function() {
            return "[DomPosition(" + inspectNode(this.node) + ":" + this.offset + ")]";
        },

        toString: function() {
            return this.inspect();
        }
    };

    function DOMException(codeName) {
        this.code = this[codeName];
        this.codeName = codeName;
        this.message = "DOMException: " + this.codeName;
    }

    DOMException.prototype = {
        INDEX_SIZE_ERR: 1,
        HIERARCHY_REQUEST_ERR: 3,
        WRONG_DOCUMENT_ERR: 4,
        NO_MODIFICATION_ALLOWED_ERR: 7,
        NOT_FOUND_ERR: 8,
        NOT_SUPPORTED_ERR: 9,
        INVALID_STATE_ERR: 11
    };

    DOMException.prototype.toString = function() {
        return this.message;
    };

    api.dom = {
        arrayContains: arrayContains,
        isHtmlNamespace: isHtmlNamespace,
        parentElement: parentElement,
        getNodeIndex: getNodeIndex,
        getNodeLength: getNodeLength,
        getCommonAncestor: getCommonAncestor,
        isAncestorOf: isAncestorOf,
        isOrIsAncestorOf: isOrIsAncestorOf,
        getClosestAncestorIn: getClosestAncestorIn,
        isCharacterDataNode: isCharacterDataNode,
        isTextOrCommentNode: isTextOrCommentNode,
        insertAfter: insertAfter,
        splitDataNode: splitDataNode,
        getDocument: getDocument,
        getWindow: getWindow,
        getIframeWindow: getIframeWindow,
        getIframeDocument: getIframeDocument,
        getBody: util.getBody,
        isWindow: isWindow,
        getContentDocument: getContentDocument,
        getRootContainer: getRootContainer,
        comparePoints: comparePoints,
        isBrokenNode: isBrokenNode,
        inspectNode: inspectNode,
        getComputedStyleProperty: getComputedStyleProperty,
        fragmentFromNodeChildren: fragmentFromNodeChildren,
        createIterator: createIterator,
        DomPosition: DomPosition
    };

    api.DOMException = DOMException;
});


text:
namespace em = enterprise_management;

namespace enterprise_reporting {
namespace {
// Retry starts with 1 minute delay and is doubled with every failure.
const net::BackoffEntry::Policy kDefaultReportUploadBackoffPolicy = {
    0,      // Number of initial errors to ignore before applying
            // exponential back-off rules.
    60000,  // Initial delay is 60 seconds.
    2,      // Factor by which the waiting time will be multiplied.
    0.1,    // Fuzzing percentage.
    -1,     // No maximum delay.
    -1,     // It's up to the caller to reset the backoff time.
    false   // Do not always use initial delay.
};

void RecordReportResponseMetrics(ReportResponseMetricsStatus status) {
  base::UmaHistogramEnumeration("Enterprise.CloudReportingResponse", status);
}

}  // namespace

ReportUploader::ReportUploader(policy::CloudPolicyClient* client,
                               int maximum_number_of_retries)
    : client_(client),
      backoff_entry_(&kDefaultReportUploadBackoffPolicy),
      maximum_number_of_retries_(maximum_number_of_retries) {}
ReportUploader::~ReportUploader() = default;

void ReportUploader::SetRequestAndUpload(ReportType report_type,
                                         ReportRequestQueue requests,
                                         ReportCallback callback) {
  report_type_ = report_type;
  requests_ = std::move(requests);
  callback_ = std::move(callback);
  Upload();
}

void ReportUploader::Upload() {
  auto callback = base::BindRepeating(&ReportUploader::OnRequestFinished,
                                      weak_ptr_factory_.GetWeakPtr());

  switch (report_type_) {
    case ReportType::kFull:
    case ReportType::kBrowserVersion: {
      auto request = std::make_unique<ReportRequest::DeviceReportRequestProto>(
          requests_.front()->GetDeviceReportRequest());
#if BUILDFLAG(IS_CHROMEOS_ASH)
      client_->UploadChromeOsUserReport(std::move(request),
                                        std::move(callback));
#else
      client_->UploadChromeDesktopReport(std::move(request),
                                         std::move(callback));
#endif
      break;
    }
    case ReportType::kProfileReport: {
      client_->UploadChromeProfileReport(
          std::make_unique<em::ChromeProfileReportRequest>(
              requests_.front()->GetChromeProfileReportRequest()),
          std::move(callback));
      break;
    }
  }
}  // BUILDFLAG(IS_CHROMEOS_ASH)

void ReportUploader::OnRequestFinished(bool status) {
  if (status) {
    NextRequest();
    RecordReportResponseMetrics(ReportResponseMetricsStatus::kSuccess);
    return;
  }

  switch (client_->last_dm_status()) {
    case policy::DM_STATUS_REQUEST_FAILED:  // network error
      RecordReportResponseMetrics(ReportResponseMetricsStatus::kNetworkError);
      Retry();
      break;
    case policy::DM_STATUS_TEMPORARY_UNAVAILABLE:  // 5xx server error
      RecordReportResponseMetrics(
          ReportResponseMetricsStatus::kTemporaryServerError);
      Retry();
      break;
    // DM_STATUS_SERVICE_DEVICE_ID_CONFLICT is caused by 409 conflict. It can
    // be caused by either device id conflict or DDS concur error which is
    // a database error. We only want to retry for the second case. However,
    // there is no way for us to tell difference right now so we will retry
    // regardless.
    case policy::DM_STATUS_SERVICE_TOO_MANY_REQUESTS:
      RecordReportResponseMetrics(
          ReportResponseMetricsStatus::kDDSConcurrencyError);
      Retry();
      break;
    case policy::DM_STATUS_REQUEST_TOO_LARGE:
      // Treats the REQUEST_TOO_LARGE error as a success upload. It's likely
      // a calculation error during request generating and there is nothing
      // can be done here.
      RecordReportResponseMetrics(
          ReportResponseMetricsStatus::kRequestTooLargeError);
      NextRequest();
      break;
    default:
      RecordReportResponseMetrics(ReportResponseMetricsStatus::kOtherError);
      SendResponse(ReportStatus::kPersistentError);
      break;
  }
}

void ReportUploader::Retry() {
  backoff_entry_.InformOfRequest(false);
  // We have retried enough, time to give up.
  if (HasRetriedTooOften()) {
    SendResponse(ReportStatus::kTransientError);
    return;
  }
  backoff_request_timer_.Start(
      FROM_HERE, backoff_entry_.GetTimeUntilRelease(),
      base::BindOnce(&ReportUploader::Upload, weak_ptr_factory_.GetWeakPtr()));
}

bool ReportUploader::HasRetriedTooOften() {
  return backoff_entry_.failure_count() > maximum_number_of_retries_;
}

void ReportUploader::SendResponse(const ReportStatus status) {
  std::move(callback_).Run(status);
}

void ReportUploader::NextRequest() {
  // We don't reset the backoff in case there are multiple requests in a row
  // and we don't start from 1 minute again.
  backoff_entry_.InformOfRequest(true);
  requests_.pop();
  if (requests_.size() == 0)
    SendResponse(ReportStatus::kSuccess);
  else
    Upload();
  return;
}

}  // namespace enterprise_reporting


text:
SPK_NAME = selfoss
SPK_VERS = 2.13
SPK_REV = 6
SPK_ICON = src/selfoss.png
DSM_UI_DIR = app

DEPENDS  = cross/busybox cross/$(SPK_NAME)

MAINTAINER = moneytoo
DESCRIPTION = The new multipurpose rss reader, live stream, mashup, aggregation web application.
ADMIN_URL = /selfoss/
RELOAD_UI = yes
DISPLAY_NAME = Selfoss
CHANGELOG = "1. Update Selfoss to 2.13<br>2. Fix DSM4.3 compatibility"

HOMEPAGE   = http://selfoss.aditu.de/
LICENSE    = GPLv3

WIZARDS_DIR = src/wizard/
CONF_DIR = src/conf/

INSTALLER_SCRIPT = src/installer.sh
SSS_SCRIPT       = src/dsm-control.sh

INSTALL_DEP_SERVICES = apache-web mysql
START_DEP_SERVICES = apache-web mysql

INSTALL_PREFIX = /usr/local/$(SPK_NAME)

POST_STRIP_TARGET = selfoss_extra_install

BUSYBOX_CONFIG = daemon nice
ENV += BUSYBOX_CONFIG="$(BUSYBOX_CONFIG)"

include ../../mk/spksrc.spk.mk

.PHONY: selfoss_extra_install
selfoss_extra_install:
	install -m 755 -d $(STAGING_DIR)/var
	install -m 755 src/selfoss.sh $(STAGING_DIR)/bin/
	install -m 755 -d $(STAGING_DIR)/app
	install -m 644 src/app/config $(STAGING_DIR)/app/config


text:
<?php

namespace MultiLocale\Service;

use MultiLocale\Locale\Detector;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;

class DetectorFactory implements FactoryInterface {

    /**
     * @param  ServiceLocatorInterface $serviceLocator
     * @return Detector
     */
    public function createService(ServiceLocatorInterface $serviceLocator) {
        $config = $serviceLocator->get('config');
        $config = $config['multi_locale'];

        $detector = new Detector;
        $events = $serviceLocator->get('EventManager');
        $detector->setEventManager($events);

        $plugins = $serviceLocator->get('MultiLocale\Strategy\StrategyPluginManagerFactory');
        foreach ($config['strategies'] as $strategy):
            if (is_string($strategy)):
                $class = $plugins->get($strategy);
                $detector->addStrategy($class);
            elseif (is_array($strategy)):
                $name = $strategy['name'];
                $class = $plugins->get($name);

                if (array_key_exists('options', $strategy) && method_exists($class, 'setOptions')):
                    $class->setOptions($strategy['options']);
                endif;

                $priority = 1;
                if (array_key_exists('priority', $strategy)):
                    $priority = $strategy['priority'];
                endif;

                $detector->addStrategy($class, $priority);
            else:
                throw new Exception\StrategyConfigurationException(
                'Strategy configuration must be a string or an array'
                );
            endif;
        endforeach;

        if (array_key_exists('default', $config)):
            $detector->setDefault($config['default']);
        endif;

        if (array_key_exists('supported', $config)):
            $detector->setSupported($config['supported']);
        endif;

        return $detector;
    }

}


text:
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
        Toggle navigation

      </button>
       Han Zhang

BLOG

PROJECTS

RESUME