text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using Fody;
using NServiceBus.Logging;
using Xunit;

public class NServiceBusTests
{
    static Assembly assembly;
    public static List<string> Errors = new List<string>();
    public static List<string> Fatals = new List<string>();
    public static List<string> Debugs = new List<string>();
    public static List<string> Infos = new List<string>();
    public static List<string> Warns = new List<string>();

    static NServiceBusTests()
    {
        var moduleWeaver = new ModuleWeaver();
        var testResult = moduleWeaver.ExecuteTestRun(
            assemblyPath: "AssemblyToProcess.dll",
            runPeVerify: false);
        assembly = testResult.Assembly;

        LogManager.UseFactory(new LogCapture(Fatals,
            Errors,
            Debugs,
            Infos,
            Warns));
    }

    public NServiceBusTests()
    {
        Fatals.Clear();
        Errors.Clear();
        Debugs.Clear();
        Infos.Clear();
        Warns.Clear();
    }

    [Fact]
    public void MethodThatReturns()
    {
        var type = assembly.GetType("OnException");
        var instance = (dynamic) Activator.CreateInstance(type);

        Assert.Equal("a", instance.MethodThatReturns("x", 6));
    }

    [Fact]
    public void Generic()
    {
        var type = assembly.GetType("GenericClass`1");
        var constructedType = type.MakeGenericType(typeof(string));
        var instance = (dynamic) Activator.CreateInstance(constructedType);
        instance.Debug();
        var message = Debugs.First();
        Assert.StartsWith("Method: 'Void Debug()'. Line: ~", message);
    }

    [Fact]
    public void ClassWithComplexExpressionInLog()
    {
        var type = assembly.GetType("ClassWithComplexExpressionInLog");
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.Method();
        Assert.Single(Errors);
        Assert.StartsWith("Method: 'Void Method()'. Line: ~", Errors.First());
    }

    [Fact]
    public void ClassWithExistingField()
    {
        var type = assembly.GetType("ClassWithExistingField");
        Assert.Single(type.GetFields(BindingFlags.NonPublic | BindingFlags.Static));
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.Debug();
        Assert.Single(Debugs);
        Assert.StartsWith("Method: 'Void Debug()'. Line: ~", Debugs.First());
    }

    // ReSharper disable once UnusedParameter.Local
    void CheckException(Action<object> action, List<string> list, string expected)
    {
        Exception exception = null;
        var type = assembly.GetType("OnException");
        var instance = (dynamic) Activator.CreateInstance(type);
        try
        {
            action(instance);
        }
        catch (Exception e)
        {
            exception = e;
        }
        Assert.NotNull(exception);
        Assert.Single(list);
        var first = list.First();
        Assert.True(first.StartsWith(expected), first);
    }

    [Fact]
    public void OnExceptionToDebug()
    {
        var expected = "Exception occurred in 'Void ToDebug(String, Int32)'.  param1 'x' param2 '6'";
        Action<dynamic> action = o => o.ToDebug("x", 6);
        CheckException(action, Debugs, expected);
    }

    [Fact]
    public void OnExceptionToDebugWithReturn()
    {
        var expected = "Exception occurred in 'Object ToDebugWithReturn(String, Int32)'.  param1 'x' param2 '6'";
        Action<dynamic> action = o => o.ToDebugWithReturn("x", 6);
        CheckException(action, Debugs, expected);
    }

    [Fact]
    public void OnExceptionToInfo()
    {
        var expected = "Exception occurred in 'Void ToInfo(String, Int32)'.  param1 'x' param2 '6'";
        Action<dynamic> action = o => o.ToInfo("x", 6);
        CheckException(action, Infos, expected);
    }

    [Fact]
    public void OnExceptionToInfoWithReturn()
    {
        var expected = "Exception occurred in 'Object ToInfoWithReturn(String, Int32)'.  param1 'x' param2 '6'";
        Action<dynamic> action = o => o.ToInfoWithReturn("x", 6);
        CheckException(action, Infos, expected);
    }

    [Fact]
    public void OnExceptionToWarn()
    {
        var expected = "Exception occurred in 'Void ToWarn(String, Int32)'.  param1 'x' param2 '6'";
        Action<dynamic> action = o => o.ToWarn("x", 6);
        CheckException(action, Warns, expected);
    }

    [Fact]
    public void OnExceptionToWarnWithReturn()
    {
        var expected = "Exception occurred in 'Object ToWarnWithReturn(String, Int32)'.  param1 'x' param2 '6'";
        Action<dynamic> action = o => o.ToWarnWithReturn("x", 6);
        CheckException(action, Warns, expected);
    }

    [Fact]
    public void OnExceptionToError()
    {
        var expected = "Exception occurred in 'Void ToError(String, Int32)'.  param1 'x' param2 '6'";
        Action<dynamic> action = o => o.ToError("x", 6);
        CheckException(action, Errors, expected);
    }

    [Fact]
    public void OnExceptionToErrorWithReturn()
    {
        var expected = "Exception occurred in 'Object ToErrorWithReturn(String, Int32)'.  param1 'x' param2 '6'";
        Action<dynamic> action = o => o.ToErrorWithReturn("x", 6);
        CheckException(action, Errors, expected);
    }

    [Fact]
    public void OnExceptionToFatal()
    {
        var expected = "Exception occurred in 'Void ToFatal(String, Int32)'.  param1 'x' param2 '6'";
        Action<dynamic> action = o => o.ToFatal("x", 6);
        CheckException(action, Fatals, expected);
    }

    [Fact]
    public void OnExceptionToFatalWithReturn()
    {
        var expected = "Exception occurred in 'Object ToFatalWithReturn(String, Int32)'.  param1 'x' param2 '6'";
        Action<dynamic> action = o => o.ToFatalWithReturn("x", 6);
        CheckException(action, Fatals, expected);
    }

    [Fact]
    public void IsDebugEnabled()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        Assert.True(instance.IsDebugEnabled());
    }

    [Fact]
    public void Debug()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.Debug();
        Assert.Single(Debugs);
        Assert.StartsWith("Method: 'Void Debug()'. Line: ~", Debugs.First());
    }

    [Fact]
    public void DebugString()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.DebugString();
        Assert.Single(Debugs);
        Assert.StartsWith("Method: 'Void DebugString()'. Line: ~", Debugs.First());
    }

    [Fact]
    public void DebugStringFunc()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.DebugStringFunc();
        Assert.Single(Debugs);
        Assert.StartsWith("Method: 'Void DebugStringFunc()'. Line: ~", Debugs.First());
    }

    [Fact]
    public void DebugStringParams()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.DebugStringParams();
        Assert.Single(Debugs);
        Assert.StartsWith("Method: 'Void DebugStringParams()'. Line: ~", Debugs.First());
    }

    [Fact]
    public void DebugStringException()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.DebugStringException();
        Assert.Single(Debugs);
        Assert.StartsWith("Method: 'Void DebugStringException()'. Line: ~", Debugs.First());
    }

    [Fact]
    public void DebugStringExceptionFunc()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.DebugStringExceptionFunc();
        Assert.Single(Debugs);
        Assert.StartsWith("Method: 'Void DebugStringExceptionFunc()'. Line: ~", Debugs.First());
    }

    [Fact]
    public void IsInfoEnabled()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        Assert.True(instance.IsInfoEnabled());
    }

    [Fact]
    public void Info()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.Info();
        Assert.Single(Infos);
        Assert.StartsWith("Method: 'Void Info()'. Line: ~", Infos.First());
    }

    [Fact]
    public void InfoString()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.InfoString();
        Assert.Single(Infos);
        Assert.StartsWith("Method: 'Void InfoString()'. Line: ~", Infos.First());
    }

    [Fact]
    public void InfoStringFunc()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.InfoStringFunc();
        Assert.Single(Infos);
        Assert.StartsWith("Method: 'Void InfoStringFunc()'. Line: ~", Infos.First());
    }

    [Fact]
    public void InfoStringParams()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.InfoStringParams();
        Assert.Single(Infos);
        Assert.StartsWith("Method: 'Void InfoStringParams()'. Line: ~", Infos.First());
    }

    [Fact]
    public void InfoStringException()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.InfoStringException();
        Assert.Single(Infos);
        Assert.StartsWith("Method: 'Void InfoStringException()'. Line: ~", Infos.First());
    }

    [Fact]
    public void InfoStringExceptionFunc()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.InfoStringExceptionFunc();
        Assert.Single(Infos);
        Assert.StartsWith("Method: 'Void InfoStringExceptionFunc()'. Line: ~", Infos.First());
    }

    [Fact]
    public void IsWarnEnabled()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        Assert.True(instance.IsWarnEnabled());
    }

    [Fact]
    public void Warn()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.Warn();
        Assert.Single(Warns);
        Assert.StartsWith("Method: 'Void Warn()'. Line: ~", Warns.First());
    }

    [Fact]
    public void WarnString()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.WarnString();
        Assert.Single(Warns);
        Assert.StartsWith("Method: 'Void WarnString()'. Line: ~", Warns.First());
    }

    [Fact]
    public void WarnStringFunc()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.WarnStringFunc();
        Assert.Single(Warns);
        Assert.StartsWith("Method: 'Void WarnStringFunc()'. Line: ~", Warns.First());
    }

    [Fact]
    public void WarnStringParams()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.WarnStringParams();
        Assert.Single(Warns);
        Assert.StartsWith("Method: 'Void WarnStringParams()'. Line: ~", Warns.First());
    }

    [Fact]
    public void WarnStringException()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.WarnStringException();
        Assert.Single(Warns);
        Assert.StartsWith("Method: 'Void WarnStringException()'. Line: ~", Warns.First());
    }

    [Fact]
    public void WarnStringExceptionFunc()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.WarnStringExceptionFunc();
        Assert.Single(Warns);
        Assert.StartsWith("Method: 'Void WarnStringExceptionFunc()'. Line: ~", Warns.First());
    }

    [Fact]
    public void IsErrorEnabled()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        Assert.True(instance.IsErrorEnabled());
    }

    [Fact]
    public void Error()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.Error();
        Assert.Single(Errors);
        Assert.StartsWith("Method: 'Void Error()'. Line: ~", Errors.First());
    }

    [Fact]
    public void ErrorString()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.ErrorString();
        Assert.Single(Errors);
        Assert.StartsWith("Method: 'Void ErrorString()'. Line: ~", Errors.First());
    }

    [Fact]
    public void ErrorStringFunc()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.ErrorStringFunc();
        Assert.Single(Errors);
        Assert.StartsWith("Method: 'Void ErrorStringFunc()'. Line: ~", Errors.First());
    }

    [Fact]
    public void ErrorStringParams()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.ErrorStringParams();
        Assert.Single(Errors);
        Assert.StartsWith("Method: 'Void ErrorStringParams()'. Line: ~", Errors.First());
    }

    [Fact]
    public void ErrorStringException()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.ErrorStringException();
        Assert.Single(Errors);
        Assert.StartsWith("Method: 'Void ErrorStringException()'. Line: ~", Errors.First());
    }

    [Fact]
    public void ErrorStringExceptionFunc()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.ErrorStringExceptionFunc();
        Assert.Single(Errors);
        Assert.StartsWith("Method: 'Void ErrorStringExceptionFunc()'. Line: ~", Errors.First());
    }

    [Fact]
    public void IsFatalEnabled()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        Assert.True(instance.IsFatalEnabled());
    }

    [Fact]
    public void Fatal()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.Fatal();
        Assert.Single(Fatals);
        Assert.StartsWith("Method: 'Void Fatal()'. Line: ~", Fatals.First());
    }

    [Fact]
    public void FatalString()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.FatalString();
        Assert.Single(Fatals);
        Assert.StartsWith("Method: 'Void FatalString()'. Line: ~", Fatals.First());
    }

    [Fact]
    public void FatalStringFunc()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.FatalStringFunc();
        Assert.Single(Fatals);
        Assert.StartsWith("Method: 'Void FatalStringFunc()'. Line: ~", Fatals.First());
    }

    [Fact]
    public void FatalStringParams()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.FatalStringParams();
        Assert.Single(Fatals);
        Assert.StartsWith("Method: 'Void FatalStringParams()'. Line: ~", Fatals.First());
    }

    [Fact]
    public void FatalStringException()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.FatalStringException();
        Assert.Single(Fatals);
        Assert.StartsWith("Method: 'Void FatalStringException()'. Line: ~", Fatals.First());
    }

    [Fact]
    public void FatalStringExceptionFunc()
    {
        var type = assembly.GetType("ClassWithLogging");
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.FatalStringExceptionFunc();
        Assert.Single(Fatals);
        Assert.StartsWith("Method: 'Void FatalStringExceptionFunc()'. Line: ~", Fatals.First());
    }

    [Fact]
    public async Task AsyncMethod()
    {
        var type = assembly.GetType("ClassWithCompilerGeneratedClasses");
        var instance = (dynamic) Activator.CreateInstance(type);
        Task task = instance.AsyncMethod();
        await task;
        Assert.Single(Debugs);
        Assert.StartsWith("Method: 'Task AsyncMethod()'. Line: ~", Debugs.First());
    }

    [Fact]
    public void EnumeratorMethod()
    {
        var type = assembly.GetType("ClassWithCompilerGeneratedClasses");
        var instance = (dynamic) Activator.CreateInstance(type);
        ((IEnumerable<int>) instance.EnumeratorMethod()).ToList();
        Assert.Single(Debugs);
        Assert.True(Debugs.First().StartsWith("Method: 'IEnumerable<Int32> EnumeratorMethod()'. Line: ~"), Debugs.First());
    }

    [Fact]
    public void DelegateMethod()
    {
        var type = assembly.GetType("ClassWithCompilerGeneratedClasses");
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.DelegateMethod();
        Assert.Single(Debugs);
        Assert.True(Debugs.First().StartsWith("Method: 'Void DelegateMethod()'. Line: ~"), Debugs.First());
    }

    [Fact]
    public void AsyncDelegateMethod()
    {
        var type = assembly.GetType("ClassWithCompilerGeneratedClasses");
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.AsyncDelegateMethod();
        Assert.Single(Debugs);
        Assert.True(Debugs.First().StartsWith("Method: 'Void AsyncDelegateMethod()'. Line: ~"), Debugs.First());
    }

    [Fact]
    public void LambdaMethod()
    {
        var type = assembly.GetType("ClassWithCompilerGeneratedClasses");
        var instance = (dynamic) Activator.CreateInstance(type);
        instance.LambdaMethod();
        Assert.Single(Debugs);
        Assert.True(Debugs.First().StartsWith("Method: 'Void LambdaMethod()'. Line: ~"), Debugs.First());
    }
}


text:
title: Data Calon DPRD Jateng
organization: KPU REPUBLIK INDONESIA
notes: Data Calon DPRD Jateng
resources:
  - name: CSV Data Calon DPRD Jateng
    url: 'https://github.com/pemiluAPI/pemilu-data/raw/master/calon/2014/dprd_jateng/calon-dprd_jateng.csv'
    format: csv
category:
  - Calon
maintainer: ''
maintainer_email: ''
---

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using EAValidator.Configuration;
using Timer = System.Threading.Timer;

namespace EAValidator.Forms
{
    public partial class MainForm : Form
    {
        private List<ValidationResult> validationResults;

        public MainForm()
        {
            UIDispatcher.Init();
            InitializeComponent();
        }

        private void CreateTreeNodes()
        {
            Cursor = Cursors.WaitCursor;
            toolStripStatusLabel1.Text = "Getting packages ....";
            Application.DoEvents();
            tvwPackages.Nodes.Clear();
            IEnumerable<Package> packages = Package.GetAll();
            TreeNode n = new TreeNode("Model") {Name = "0", ImageIndex = 0};
            n.Expand();
            SetChildPackages(n, packages);
            tvwPackages.Nodes.Add(n);
            toolStripStatusLabel1.Text = string.Empty;
            Cursor = Cursors.Default;
        }

        private static void SetChildPackages(TreeNode node, IEnumerable<Package> packages)
        {
            foreach (Package p in packages)
            {
                TreeNode n = node.Nodes.Add(p.IdTree, p.Name);
                n.ImageIndex = 0;
                if (n.Level < 3) n.Expand();
                SetChildPackages(n, p.Packages);
            }
        }

        private void StartValidating()
        {
            if (Project.Current == null) return;

            //Fill author dropdown
            cboAuthors.Items.Clear();
            cboAuthors.Items.Add(string.Empty);
            cboAuthors.Items.AddRange(Authors.GetAuthors().ToArray());
            Cursor = Cursors.WaitCursor;
            toolStripStatusLabel1.Text = @"Validating ....";
            Application.DoEvents();
            validationResults = Validator.Run();
            toolStripStatusLabel1.Text = string.Empty;
            Cursor = Cursors.Default;
        }

        private void ShowResults()
        {
            Cursor = Cursors.WaitCursor;
            toolStripStatusLabel1.Text = @"Showing results ....";
            Application.DoEvents();
            lvwResults.Items.Clear();
            lvwResults.Groups.Clear();
            var list = new List<ListViewItem>();
            foreach (ValidationResult result in validationResults)
            {
                if (!result.IdTree.StartsWith(tvwPackages.SelectedNode.Name)) continue;
                if (!result.Rule.IsEnabled) continue;
                if (!InFilter(result)) continue;
                var item = new ListViewItem {Text = string.Format("{0} {1}", result.Rule.Id, result.Rule.Description)};
                item.SubItems.Add(result.ElementName);
                item.SubItems.Add(result.ElementAuthor);
                item.SubItems.Add(result.Stereotype);
                item.SubItems.Add(result.Alias);
                item.SubItems.Add(result.ModifiedDate.ToString());
                item.Tag = result;
                item.ImageKey = result.Rule.Type.ToString();
                list.Add(item);
            }
            lvwResults.Items.AddRange(list.ToArray());
            toolStripStatusLabel1.Text =
                $"Total of {validationResults.Count} results, {lvwResults.Items.Count} are shown";
            Cursor = Cursors.Default;
        }

        private void MainFormLoad(object sender, EventArgs e)
        {
            AssemblyName asm = Assembly.GetExecutingAssembly().GetName();
            Text = $"{asm.Name} v{asm.Version.Major}.{asm.Version.Minor}";
            new Timer(TimerStartTick, null, 10, Timeout.Infinite);
        }

        private void BtnCopyToClipboardClick(object sender, EventArgs e)
        {
            var columns = new List<string>();
            foreach (ColumnHeader columnHeader in lvwResults.Columns)
            {
                columns.Add(columnHeader.Text);
            }
            var copyText = new StringBuilder();
            copyText.AppendLine(string.Join("\t", columns.ToArray()));
            foreach (ListViewItem listViewItem in lvwResults.SelectedItems)
            {
                var fields = new List<string>();
                foreach (ListViewItem.ListViewSubItem s in listViewItem.SubItems)
                {
                    fields.Add(s.Text);
                }
                copyText.AppendLine(string.Join("\t", fields.ToArray()));
            }
            Clipboard.Clear();
            Clipboard.SetText(copyText.ToString());
        }

        private void TvwPackagesAfterSelect(object sender, TreeViewEventArgs e)
        {
            ShowResults();
        }

        private void ReloadProject()
        {
            if (Project.Current == null) return;
            string currentName = "0";
            if (tvwPackages.SelectedNode != null) currentName = tvwPackages.SelectedNode.Name;
            CreateTreeNodes();
            string selectedAuthor = string.Empty;
            if (cboAuthors.SelectedItem != null) selectedAuthor = cboAuthors.SelectedItem.ToString();
            StartValidating();
            SelectNode(tvwPackages.Nodes, currentName);
            int i = cboAuthors.FindString(selectedAuthor);
            cboAuthors.SelectedIndex = i;
            tvwPackages.Focus();
        }

        private void SelectNode(TreeNodeCollection nodes, string currentKey)
        {
            foreach (TreeNode n in nodes)
            {
                if (n.Name == currentKey)
                {
                    tvwPackages.SelectedNode = n;
                    break;
                }
                SelectNode(n.Nodes, currentKey);
            }
        }

        private void ExitClick(object sender, EventArgs e)
        {
            Close();
        }

        private void OptionsToolStripMenuItemClick(object sender, EventArgs e)
        {
            var form = new OptionsForm();
            form.ShowDialog();
            ShowResults();
        }

        private void LvwResultsMouseDown(object sender, MouseEventArgs e)
        {
            if (lvwResults.SelectedItems.Count == 0) return;
            if (e.Button != MouseButtons.Right) return;
            contextMenuStrip1.Show(lvwResults, e.X, e.Y);
        }

        private void DisableRuleClick(object sender, EventArgs e)
        {
            ((ValidationResult) lvwResults.SelectedItems[0].Tag).Rule.IsEnabled = false;
            ShowResults();
        }

        private void LvwResultsDoubleClick(object sender, EventArgs e)
        {
            if (lvwResults.SelectedItems.Count == 0) return;
            Clipboard.SetText(((ValidationResult) lvwResults.SelectedItems[0].Tag).Guid);
        }

        private void AboutToolStripMenuItemClick(object sender, EventArgs e)
        {
            Process.Start("http://www.fflowing.nl/go/eavalidatorabout");
        }

        private void ReleaseNotesToolStripMenuItemClick(object sender, EventArgs e)
        {
            ReleaseNotesForm f = new ReleaseNotesForm();
            f.ShowDialog();
        }

        private void OpenToolStripMenuItemClick(object sender, EventArgs e)
        {
            OpenProjectForm form = new OpenProjectForm();
            DialogResult result = form.ShowDialog();
            if (result == DialogResult.OK) ReloadProject();
        }

        private void TimerStartTick(object state)
        {
            UIDispatcher.Send(OpenProject);
        }

        private void OpenProject()
        {
            string con = Settings.Default.ConnectionString;
            if (!Project.Open(con))
            {
                OpenProjectForm form = new OpenProjectForm();
                DialogResult result = form.ShowDialog(this);
                if (result != DialogResult.OK) return;
            }

            ReloadProject();
        }

        private void ReloadCurrentToolStripMenuItemClick(object sender, EventArgs e)
        {
            ReloadProject();
        }

        private void CboAuthorsSelectedIndexChanged(object sender, EventArgs e)
        {
            ShowResults();
        }

        private bool InFilter(ValidationResult result)
        {
            if (cboAuthors.Text.Length == 0) return true;
            if (result.ElementAuthor == null) return false;
            return (result.ElementAuthor.StartsWith(cboAuthors.Text, true, CultureInfo.InvariantCulture));
        }
    }
}


text:
<?php require_once __DIR__ . '/prepend.php'; ?>

<?php

  define('PAGE_TITLE', 'Base');

  renderHtmlTemplateStart('<base href="' . getFullyQualifiedUrl('/assets/img/') . '" />');

?>

The <base> element specifies the base URL/target for all relative URLs in a document.

<?php renderHtmlTemplateEnd(); ?>


text:
slug: allure-modest
name: Allure Modest
---


text:
package mock.services;

import io.vertx.codegen.annotations.ProxyGen;
import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;

@ProxyGen
public interface ParrotService {

	public void echo(String original, Handler<AsyncResult<String>> handler);

}


text:
function [Phi, Gam, E, H, D, C, Q, Phig, Gamg, Eg, Hg, Dg] = garc2own(theta, din, userf);
% garc2own - Builds a call to the function which name is specified in userf.
% This function should return the system matrices.
%    [Phi, Gam, E, H, D, C, Q, Phig, Gamg, Eg, Hg, Dg] = ...
%                                           garc2own(theta, din, userf)
% Only for models with GARCH structure in the error term.
%
% 29/4/97

% Copyright (C) 1997 Jaime Terceiro
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2, or (at your option)
% any later version.
%
% This program is distributed in the hope that it will be useful, but
% WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
% General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this file.  If not, write to the Free Software Foundation,
% 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

if nargin < 3, e4error(13); end

userf = deblank(userf(:)');
if ~exist(userf), e4error(18,userf); end

[Phi, Gam, E, H, D, C, Q, Phig, Gamg, Eg, Hg, Dg] = eval([userf '(theta,din)']);


text:
import re

names = set()

for line in open('redditors.txt'):

    line = re.sub(r"\(.*\)", "", line)

    for operator in [" and ", "&", "/", ",", "+"]:
        line = line.replace(operator, "\t")

    for name in line.split("\t"):
        names.add(name.lower().strip())

for name in sorted(names):
    if name:
        print name


text:
<?
defined('C5_EXECUTE') or die("Access Denied.");
Loader::model("file_set");
if ($_REQUEST['fID'] > 0) {
	$f = File::getByID($_REQUEST['fID']);
	$fp = new Permissions($f);
	if ($fp->canEditFilePermissions()) {
		Loader::element('permission/details/file', array("f" => $f));
	}
}


text:
msbuild-artifactory-plugin
==========================

Artifactory integration with MSBuild

# Creating Artifactory Nuget package:
1. Build the solution.
2. Run nuget pack command on packaging\msbuild-artifactory-plugin.nuspec


text:
'use strict';

module.exports = function(app) {
	var users = require('../../app/controllers/users.server.controller');
	var alumnos = require('../../app/controllers/alumnos.server.controller');
	var comentarios = require('../../app/controllers/comentarios.server.controller');

	// Alumnos Routes
	app.route('/alumnos')
		.get(alumnos.list)
		.get(comentarios.list)
		.post(users.requiresLogin, alumnos.create);

	app.route('/alumnos/:alumnoId')
		.get(alumnos.read)
		.put(users.requiresLogin, alumnos.hasAuthorization, alumnos.update)
		.delete(users.requiresLogin, alumnos.hasAuthorization, alumnos.delete);

	// Finish by binding the Alumno middleware
	app.param('alumnoId', alumnos.alumnoByID);
};


text:
jParallax is just a simple parallax effect maker. No complicated **WTFs!!**, just
simply controlling your container's background image's position on scroll.

[[jParallax Website]](http://www.jhonchrizel.x10host.com/projects/jparallax/)              [[View Demo]](http://www.jhonchrizel.x10host.com/projects/demos/jparallax/)

## Installation
Download the jParallax package and include it after jQuery.
```
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="jParallax.js path here"></script>
```

## Usage
### Step 1: Adding a class to your container element.
jParallax is very simple to use. Simply add a class `jparallax` to your element.

Example:
```
<div class="jparallax">
    <!--Some Contents Here-->
</div>
```
### Step 2: Use data attributes to assign the Background Image.
Use `data-image` attribute to assign a background image.

Example: *(Using the previous code...)*
```
<div class="jparallax" data-image="path/to/backgroundimagefile.jpg">
    <!--Some Contents Here-->
</div>
```

You're done! Just simple as that.

**NOTE**: Background Image is required. Also, by default, the container's `height` is
set to `auto`. So if the parallax effect is not showing, maybe put some contents inside
it and another container below to see the effect.

## Options
You can pass options by using the data attributes.

Examples:

To set the container's height, use `data-height="500px"`.

To set the container's background image speed on scroll, use `data-speed=6`.

Currently available options:

| Attribute | Type | Default | Reuired |
| ----- | ----- | ----- | ----- |
| *data-image* | Path | null | **Yes** |
| *data-height* | number | auto | No |
| *data-speed* | float | 8 | No |

**NOTE:** When `speed` is set to 0, the background will become fixed. If 1, It will just scroll with the same speed.

# License
MIT License

Copyright (c) 2017 Jhon Chrizel Godmalin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


text:
package org.elasticsearch.xpack.core.ml.action;

import org.elasticsearch.common.io.stream.Writeable;
import org.elasticsearch.test.AbstractWireSerializingTestCase;
import org.elasticsearch.xpack.core.action.util.PageParams;
import org.elasticsearch.xpack.core.ml.action.GetFiltersAction.Request;

public class GetFiltersActionRequestTests extends AbstractWireSerializingTestCase<Request> {

    @Override
    protected Request createTestInstance() {
        if (randomBoolean()) {
            return new Request(randomAlphaOfLength(10));
        }
        Request request = new Request();
        if (randomBoolean()) {
            int from = randomInt(10000);
            int size = randomInt(10000);
            request.setPageParams(new PageParams(from, size));
        }
        return request;
    }

    @Override
    protected Writeable.Reader<Request> instanceReader() {
        return Request::new;
    }
}


text:
require 'forwardable'
require 'net/http'
require 'json'

require 'honeybadger/logging'

module Honeybadger
  module Backend
    class Response
      NOT_BLANK = /\S/

      attr_reader :code, :body, :message, :error

      FRIENDLY_ERRORS = {
        429 => "Your project is currently sending too many errors.\nThis issue should resolve itself once error traffic is reduced.".freeze,
        503 => "Your project is currently sending too many errors.\nThis issue should resolve itself once error traffic is reduced.".freeze,
        402 => "The project owner's billing information has expired (or the trial has ended).\nPlease check your payment details or email support@honeybadger.io for help.".freeze,
        403 => "The API key is invalid. Please check your API key and try again.".freeze
      }.freeze

      # Initializes the Response instance.
      #
      # @overload initialize(response)
      #   Creates an instance from a +Net::HTTPResponse+.
      #   @param [Net::HTTPResponse] response With 1 argument, the code, body,
      #     and message will be determined automatically.
      #
      # @overload initialize(code, body, message)
      #   Creates an instance from parameters.
      #   @param [Integer] code The status code. May also be :error for requests
      #     which failed to reach the server.
      #   @param [String] body The String body of the response.
      #   @param [String] message The String message returned by the server (or
      #     set by the backend in the case of an :error code).
      def initialize(*args)
        if (response = args.first).kind_of?(Net::HTTPResponse)
          @code, @body, @message = response.code.to_i, response.body.to_s, response.message
        else
          @code, @body, @message = args
        end

        @success = (200..299).cover?(@code)
        @error = parse_error(body) unless @success
      end

      def success?
        @success
      end

      def error_message
        return message if code == :error
        return FRIENDLY_ERRORS[code] if FRIENDLY_ERRORS[code]
        return error if error =~ NOT_BLANK
        msg = "The server responded with #{code}"
        msg << ": #{message}" if message =~ NOT_BLANK
        msg
      end

      private

      def parse_error(body)
        return unless body =~ NOT_BLANK
        obj = JSON.parse(body)
        return obj['error'] if obj.kind_of?(Hash)
      rescue JSON::ParserError
        nil
      end
    end

    class Base
      extend Forwardable

      include Honeybadger::Logging::Helper

      def initialize(config)
        @config = config
      end

      # Process payload for feature.
      #
      # @example
      #   backend.notify(:notices, Notice.new(...))
      #
      # @param [Symbol] feature The feature name (corresponds to HTTP
      #   endpoint). Current options are: `:notices`, `:deploys`, `:ping`.
      # @param [#to_json] payload The JSON payload to send.
      #
      # @raise NotImplementedError
      def notify(feature, payload)
        raise NotImplementedError, 'must define #notify on subclass.'
      end

      # Does a check in using the input id.
      #
      # @param [String] id The unique check_in id.
      #
      # @raise NotImplementedError
      def check_in(id)
        raise NotImplementedError, 'must define #check_in on subclass.'
      end

      # Track a deployment
      # @example
      #   backend.track_deployment({ revision: 'be2ceb6' })
      #
      # @param [#to_json] payload The JSON payload containing all deployment data.
      def track_deployment(payload)
        notify(:deploys, payload)
      end

      private

      attr_reader :config
    end
  end
end


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

    <com.google.android.material.textview.MaterialTextView
        android:id="@+id/textvieweula"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/eula_title"
        android:gravity="center"
        android:layout_alignParentTop="true"
        android:textAppearance="?android:attr/textAppearanceLargePopupMenu"/>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:layout_below="@id/textvieweula"
        android:weightSum="1">

        <WebView
            android:id="@+id/webviewEula"
            android:layout_width="fill_parent"
            android:layout_height="0dp"
            android:layout_weight="1">
        </WebView>

        <com.google.android.material.checkbox.MaterialCheckBox
            android:id="@+id/checkBoxAcceptEula"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:checked="false"
            android:layout_gravity="center"
            android:text="@string/eula_checkbox"
            android:enabled="true"/>

        <TableRow
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="12dp"
            android:textAlignment="center">

            <com.google.android.material.button.MaterialButton
                android:id="@+id/eula_refuse_btn"
                android:layout_width="120dp"
                android:layout_height="wrap_content"
                android:layout_column="0"
                android:layout_marginBottom="12dp"
                android:layout_marginStart="12dp"
                android:paddingRight="20dp"
                android:text="@string/button_cancel"
                android:paddingLeft="20dp" />

            <Space
                android:layout_width="20dp"
                android:layout_height="20dp"
                android:layout_column="1" />

            <com.google.android.material.button.MaterialButton
                android:id="@+id/eula_accept_btn"
                android:layout_width="120dp"
                android:layout_height="wrap_content"
                android:layout_column="2"
                android:layout_marginBottom="12dp"
                android:layout_marginEnd="12dp"
                android:enabled="true"
                android:paddingLeft="20dp"
                android:paddingRight="20dp"
                android:text="@string/button_accept" />
        </TableRow>

    </LinearLayout>

</RelativeLayout>


text:
@implementation KYBUser

+ (NSValueTransformer *)publicKeyJSONTransformer {
	return [MTLValueTransformer reversibleTransformerWithForwardBlock:^(NSDictionary *keyDictionary) {

		KYBKey *key = [MTLJSONAdapter modelOfClass:[KYBKey class] fromJSONDictionary:keyDictionary error:nil];
		return key;
	} reverseBlock:^(NSValue *coordinateValue) {
		return @{};
	}];
}

+ (NSValueTransformer *)pictureUrlJSONTransformer {
	return [MTLValueTransformer reversibleTransformerWithForwardBlock:^(NSString *urlString) {
		return [NSURL URLWithString:urlString];
	} reverseBlock:^(NSURL *url) {
		return [url absoluteString];
	}];
}

+ (NSValueTransformer *)proofsJSONTransformer {
	return [MTLValueTransformer mtl_JSONArrayTransformerWithModelClass:[KYBProof class]];
}

+ (NSDictionary *)JSONKeyPathsByPropertyKey
{
	NSMutableDictionary *paths = [[super JSONKeyPathsByPropertyKey] mutableCopy];

	NSDictionary *newPaths = @{@"username": @"basics.username",
							   @"uid": @"uid",
							   @"salt": @"basics.salt",
							   @"fullName": @"profile.full_name",
							   @"location": @"profile.location",
							   @"bio": @"profile.bio",
							   @"emails": @"emails",
							   @"primaryEmail": @"emails.primary.email",
							   @"pictureUrl":@"pictures.primary.url",
							   @"publicKey":@"public_keys.primary",
							   @"proofs":@"proofs_summary.all"};
	[paths addEntriesFromDictionary:newPaths];
	return paths;
}

- (NSString *)itemId
{
	return self.uid;
}

@end


text:
import { PagesTranslations } from './definitions';

export const pagesTranslationsIT: PagesTranslations = {
  noDefaultPages:
    "Non c'è una pagina principale. Si prega di scegliere una pagina",
  noPages: 'Lo scenario non ha pagine, si prega di aggiungere una nuova pagina',
  loadingPages: 'Caricare le pagine',
  noSelectedPage: 'Nessuna pagina selezionata',
  pageUndefined: 'La pagina non è definita',
  completeCompConfig:
    'Completare la configurazione del componente per visualizzarlo.',
  editComponent: 'Modifica componente',
  obsoleteComponent:
    'Il componente è stato aggiornato. Contatta il tuo trainer.',
  forEach: {
    noItems: 'Il componente non ha ricevuto alcun array di items',
    noKey: index => `Manca la key per l'item #${index}`,
  },
  missingProperty: propName => `Manca la proprietà "${propName}"`,
};


text:
<?php
if(!defined('BASEPATH'))
	exit('No direct script access allowed');

class Opusx extends OPX_Controller{

		function __construct(){
			parent::__construct();
		}

		function index($msm = ''){
			$data['id_content'] = 'opx_login';
			$data_login['message'] = $msm;
			if($this->opx_auth->is_auth()){
				/*$data_menu['menu_items'] = $this->opx_user->get_menu_items('admin');
				$data['main_menu'] = $this->load->view('menu',$data_menu,TRUE);
				$data['main_content'] = $this->load->view('admin_catalogos',NULL,TRUE);*/
				header('Location: '. base_url() .'index.php/ctrl_flete_aereo/index');
			}
			else{
				$data['main_menu'] = $this->load->view('menu',NULL,TRUE);
				$data['main_content'] = $this->load->view('login',$data_login,TRUE);
			}
			$data['main_footer'] = $this->load->view('footer',NULL,TRUE);
			$this->load->view('layout', $data);
		}

		/**
		 * Controla el procesos de login mediante con asistencia de los métodos de la clase OPX_Auth
		 */
		function login(){
			$user = $this->input->post('username');
			$password = $this->input->post('password');
			if(!$this->opx_auth->login($user, $password))
				$this->index('El nombre de usuario o contraseña no son validos');
			else
				header('Location: index');
		}

		/**
		 * Controla el procesos de logout mediante con la asistencia de los métodos de la clase OPX_Auth
		 */
		function logout(){
			$this->opx_auth->logout();
			header('Location: index');
		}
	}


text:
/**
 * ValueBase.hpp -
 * @author: Jonathan Beard
 * @version: Tue Dec 10 08:34:09 2013
 */
#ifndef _VALUEBASE_HPP_
#define _VALUEBASE_HPP_  1

#include "Returns.hpp"
namespace Node{
class ValueBase : public Returns {
public:
   ValueBase();
   virtual ~ValueBase() = default;

   /**
    * get_value - To get a value that this object was constructed
    * with, pass an initialized ptr (initialized with the proper
    * length for that data type)
    */
   virtual bool get_value( const char *typeName, void *ptr ) = 0;
};
} /* end namespace Node */
#endif /* END _VALUEBASE_HPP_ */


text:
function accum(s) {
  return s.toLowerCase().split('').map((x,y) => x.toUpperCase()+new Array(y+1).join(x)).join('-');
}

// top vote solution
function accum(s) {
  return s.split('').map((x,index) => x.toUpperCase()+Array(index+1).join(x.toLowerCase())).join('-');
}


text:
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

try:
    import reinforceflow
except ImportError:
    import os.path
    import sys
    sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..'))
    import reinforceflow
from reinforceflow.agents import DeepQ
from reinforceflow.core.policy import EGreedyPolicy
from reinforceflow.models import DeepQModel
from reinforceflow.core.optimizer import RMSProp
from reinforceflow.envs import AtariWrapper
from reinforceflow.trainers.async_trainer import AsyncTrainer

reinforceflow.set_random_seed(555)

env_name = "PongNoFrameskip-v4"
env = AtariWrapper(env_name,
                   action_repeat=4,
                   obs_stack=4,
                   new_width=84,
                   new_height=84,
                   to_gray=True,
                   noop_action=[1, 0, 0, 0, 0, 0],
                   start_action=[0, 1, 0, 0, 0, 0],
                   clip_rewards=True)

test_env = AtariWrapper(env_name,
                        action_repeat=4,
                        obs_stack=4,
                        new_width=84,
                        new_height=84,
                        to_gray=True,
                        start_action=[0, 1, 0, 0, 0, 0])

agent = DeepQ(env,
              use_double=False,
              model=DeepQModel(nature_arch=False, dueling=False),
              optimizer=RMSProp(7e-4, decay=0.99, epsilon=0.1))
threads = []
for i, eps in enumerate([0.01, 0.01, 0.01, 0.1, 0.1, 0.1, 0.5, 0.5] * 2):
    threads.append(DeepQ(env.copy(),
                         model=DeepQModel(nature_arch=False, dueling=False),
                         optimizer=agent.opt,
                         trainable_weights=agent.weights,
                         target_net=agent.target_net,
                         target_weights=agent.target_weights,
                         use_double=False,
                         targetfreq=10000,
                         policy=EGreedyPolicy(1.0, eps, 4000000),
                         name='thread%s' % i))

trainer = AsyncTrainer(agent,
                       threads,
                       maxsteps=80000000,
                       batch_size=5,
                       logdir='/tmp/rf/AsyncDeepQ/%s' % env_name,
                       logfreq=240,
                       test_env=test_env
                       )
trainer.train()


text:
class SkBitmap;

namespace extensions {

namespace {

class MockInstallPrompt;

// This class holds information about things that happen with a
// MockInstallPrompt. We create the MockInstallPrompt but need to pass
// ownership of it to CrxInstaller, so it isn't safe to hang this data on
// MockInstallPrompt itself becuase we can't guarantee it's lifetime.
class MockPromptProxy : public base::RefCountedThreadSafe<MockPromptProxy> {
 public:
  explicit MockPromptProxy(content::WebContents* web_contents);

  bool did_succeed() const { return !extension_id_.empty(); }
  const std::string& extension_id() { return extension_id_; }
  bool confirmation_requested() const { return confirmation_requested_; }
  const base::string16& error() const { return error_; }

  // To have any effect, this should be called before CreatePrompt.
  void set_record_oauth2_grant(bool record_oauth2_grant) {
    record_oauth2_grant_.reset(new bool(record_oauth2_grant));
  }

  void set_extension_id(const std::string& id) { extension_id_ = id; }
  void set_confirmation_requested() { confirmation_requested_ = true; }
  void set_error(const base::string16& error) { error_ = error; }

  scoped_ptr<ExtensionInstallPrompt> CreatePrompt();

 private:
  friend class base::RefCountedThreadSafe<MockPromptProxy>;
  virtual ~MockPromptProxy();

  // Data used to create a prompt.
  content::WebContents* web_contents_;
  scoped_ptr<bool> record_oauth2_grant_;

  // Data reported back to us by the prompt we created.
  bool confirmation_requested_;
  std::string extension_id_;
  base::string16 error_;
};

class MockInstallPrompt : public ExtensionInstallPrompt {
 public:
  MockInstallPrompt(content::WebContents* web_contents,
                    MockPromptProxy* proxy) :
      ExtensionInstallPrompt(web_contents),
      proxy_(proxy) {}

  void set_record_oauth2_grant(bool record) { record_oauth2_grant_ = record; }

  // Overriding some of the ExtensionInstallUI API.
  virtual void ConfirmInstall(
      Delegate* delegate,
      const Extension* extension,
      const ShowDialogCallback& show_dialog_callback) OVERRIDE {
    proxy_->set_confirmation_requested();
    delegate->InstallUIProceed();
  }
  virtual void OnInstallSuccess(const Extension* extension,
                                SkBitmap* icon) OVERRIDE {
    proxy_->set_extension_id(extension->id());
    base::MessageLoopForUI::current()->Quit();
  }
  virtual void OnInstallFailure(const CrxInstallerError& error) OVERRIDE {
    proxy_->set_error(error.message());
    base::MessageLoopForUI::current()->Quit();
  }

 private:
  scoped_refptr<MockPromptProxy> proxy_;
};

MockPromptProxy::MockPromptProxy(content::WebContents* web_contents)
    : web_contents_(web_contents), confirmation_requested_(false) {
}

MockPromptProxy::~MockPromptProxy() {}

scoped_ptr<ExtensionInstallPrompt> MockPromptProxy::CreatePrompt() {
  scoped_ptr<MockInstallPrompt> prompt(
      new MockInstallPrompt(web_contents_, this));
  if (record_oauth2_grant_.get())
    prompt->set_record_oauth2_grant(*record_oauth2_grant_.get());
  return prompt.PassAs<ExtensionInstallPrompt>();
}

scoped_refptr<MockPromptProxy> CreateMockPromptProxyForBrowser(
    Browser* browser) {
  return new MockPromptProxy(
      browser->tab_strip_model()->GetActiveWebContents());
}

class ManagementPolicyMock : public extensions::ManagementPolicy::Provider {
 public:
  ManagementPolicyMock() {}

  virtual std::string GetDebugPolicyProviderName() const OVERRIDE {
    return "ManagementPolicyMock";
  }

  virtual bool UserMayLoad(const Extension* extension,
                           base::string16* error) const OVERRIDE {
    *error = base::UTF8ToUTF16("Dummy error message");
    return false;
  }
};

}  // namespace

class ExtensionCrxInstallerTest : public ExtensionBrowserTest {
 public:
  scoped_ptr<WebstoreInstaller::Approval> GetApproval(
      const char* manifest_dir,
      const std::string& id,
      bool strict_manifest_checks) {
    scoped_ptr<WebstoreInstaller::Approval> result;

    base::FilePath ext_path = test_data_dir_.AppendASCII(manifest_dir);
    std::string error;
    scoped_ptr<base::DictionaryValue> parsed_manifest(
        file_util::LoadManifest(ext_path, &error));
    if (!parsed_manifest.get() || !error.empty())
      return result.Pass();

    return WebstoreInstaller::Approval::CreateWithNoInstallPrompt(
        browser()->profile(),
        id,
        parsed_manifest.Pass(),
        strict_manifest_checks);
  }

  void RunCrxInstaller(const WebstoreInstaller::Approval* approval,
                       scoped_ptr<ExtensionInstallPrompt> prompt,
                       const base::FilePath& crx_path) {
    ExtensionService* service = extensions::ExtensionSystem::Get(
        browser()->profile())->extension_service();
    scoped_refptr<CrxInstaller> installer(
        CrxInstaller::Create(service, prompt.Pass(), approval));
    installer->set_allow_silent_install(true);
    installer->set_is_gallery_install(true);
    installer->InstallCrx(crx_path);
    content::RunMessageLoop();
  }

  // Installs a crx from |crx_relpath| (a path relative to the extension test
  // data dir) with expected id |id|.
  void InstallWithPrompt(const char* ext_relpath,
                         const std::string& id,
                         scoped_refptr<MockPromptProxy> mock_install_prompt) {
    base::FilePath ext_path = test_data_dir_.AppendASCII(ext_relpath);

    scoped_ptr<WebstoreInstaller::Approval> approval;
    if (!id.empty())
      approval = GetApproval(ext_relpath, id, true);

    base::FilePath crx_path = PackExtension(ext_path);
    EXPECT_FALSE(crx_path.empty());
    RunCrxInstaller(approval.get(), mock_install_prompt->CreatePrompt(),
                    crx_path);

    EXPECT_TRUE(mock_install_prompt->did_succeed());
  }

  // Installs an extension and checks that it has scopes granted IFF
  // |record_oauth2_grant| is true.
  void CheckHasEmptyScopesAfterInstall(const std::string& ext_relpath,
                                       bool record_oauth2_grant) {
    CommandLine::ForCurrentProcess()->AppendSwitch(
        switches::kEnableExperimentalExtensionApis);

    scoped_refptr<MockPromptProxy> mock_prompt =
        CreateMockPromptProxyForBrowser(browser());

    mock_prompt->set_record_oauth2_grant(record_oauth2_grant);
    InstallWithPrompt("browsertest/scopes", std::string(), mock_prompt);

    scoped_refptr<PermissionSet> permissions =
        ExtensionPrefs::Get(browser()->profile())
            ->GetGrantedPermissions(mock_prompt->extension_id());
    ASSERT_TRUE(permissions.get());
  }
};

// This test is skipped on ChromeOS because it requires the NPAPI,
// which is not available on that platform.
#if !defined(OS_CHROMEOS)
IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, Whitelisting) {
  std::string id = "hdgllgikmikobbofgnabhfimcfoopgnd";
  ExtensionRegistry* registry = ExtensionRegistry::Get(
      browser()->profile());

  // Even whitelisted extensions with NPAPI should not prompt.
  scoped_refptr<MockPromptProxy> mock_prompt =
      CreateMockPromptProxyForBrowser(browser());
  InstallWithPrompt("uitest/plugins", id, mock_prompt);
  EXPECT_FALSE(mock_prompt->confirmation_requested());
  EXPECT_TRUE(registry->enabled_extensions().GetByID(id));
}
#endif

IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest,
                       GalleryInstallGetsExperimental) {
  // We must modify the command line temporarily in order to pack an extension
  // that requests the experimental permission.
  CommandLine* command_line = CommandLine::ForCurrentProcess();
  CommandLine old_command_line = *command_line;
  command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis);
  base::FilePath crx_path = PackExtension(
      test_data_dir_.AppendASCII("experimental"));
  ASSERT_FALSE(crx_path.empty());

  // Now reset the command line so that we are testing specifically whether
  // installing from webstore enables experimental permissions.
  *(CommandLine::ForCurrentProcess()) = old_command_line;

  EXPECT_FALSE(InstallExtension(crx_path, 0));
  EXPECT_TRUE(InstallExtensionFromWebstore(crx_path, 1));
}

IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, PlatformAppCrx) {
  CommandLine::ForCurrentProcess()->AppendSwitch(
      switches::kEnableExperimentalExtensionApis);
  EXPECT_TRUE(InstallExtension(
      test_data_dir_.AppendASCII("minimal_platform_app.crx"), 1));
}

IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, PackAndInstallExtension) {
  if (!FeatureSwitch::easy_off_store_install()->IsEnabled())
    return;

  const int kNumDownloadsExpected = 1;

  LOG(ERROR) << "PackAndInstallExtension: Packing extension";
  base::FilePath crx_path = PackExtension(
      test_data_dir_.AppendASCII("common/background_page"));
  ASSERT_FALSE(crx_path.empty());
  std::string crx_path_string(crx_path.value().begin(), crx_path.value().end());
  GURL url = GURL(std::string("file:///").append(crx_path_string));

  scoped_refptr<MockPromptProxy> mock_prompt =
      CreateMockPromptProxyForBrowser(browser());
  download_crx_util::SetMockInstallPromptForTesting(
      mock_prompt->CreatePrompt());

  LOG(ERROR) << "PackAndInstallExtension: Getting download manager";
  content::DownloadManager* download_manager =
      content::BrowserContext::GetDownloadManager(browser()->profile());

  LOG(ERROR) << "PackAndInstallExtension: Setting observer";
  scoped_ptr<content::DownloadTestObserver> observer(
      new content::DownloadTestObserverTerminal(
          download_manager, kNumDownloadsExpected,
          content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_ACCEPT));
  LOG(ERROR) << "PackAndInstallExtension: Navigating to URL";
  ui_test_utils::NavigateToURLWithDisposition(browser(), url, CURRENT_TAB,
      ui_test_utils::BROWSER_TEST_NONE);

  EXPECT_TRUE(WaitForCrxInstallerDone());
  LOG(ERROR) << "PackAndInstallExtension: Extension install";
  EXPECT_TRUE(mock_prompt->confirmation_requested());
  LOG(ERROR) << "PackAndInstallExtension: Extension install confirmed";
}

// Tests that scopes are only granted if |record_oauth2_grant_| on the prompt is
// true.
#if defined(OS_WIN)
#define MAYBE_GrantScopes DISABLED_GrantScopes
#else
#define MAYBE_GrantScopes GrantScopes
#endif
IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, MAYBE_GrantScopes) {
  EXPECT_NO_FATAL_FAILURE(CheckHasEmptyScopesAfterInstall("browsertest/scopes",
                                                          true));
}

IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, DoNotGrantScopes) {
  EXPECT_NO_FATAL_FAILURE(CheckHasEmptyScopesAfterInstall("browsertest/scopes",
                                                          false));
}

IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, AllowOffStore) {
  ExtensionService* service = extensions::ExtensionSystem::Get(
      browser()->profile())->extension_service();
  const bool kTestData[] = {false, true};

  for (size_t i = 0; i < arraysize(kTestData); ++i) {
    scoped_refptr<MockPromptProxy> mock_prompt =
        CreateMockPromptProxyForBrowser(browser());

    scoped_refptr<CrxInstaller> crx_installer(
        CrxInstaller::Create(service, mock_prompt->CreatePrompt()));
    crx_installer->set_install_cause(
        extension_misc::INSTALL_CAUSE_USER_DOWNLOAD);

    if (kTestData[i]) {
      crx_installer->set_off_store_install_allow_reason(
          CrxInstaller::OffStoreInstallAllowedInTest);
    }

    crx_installer->InstallCrx(test_data_dir_.AppendASCII("good.crx"));
    // The |mock_prompt| will quit running the loop once the |crx_installer|
    // is done.
    content::RunMessageLoop();
    EXPECT_EQ(kTestData[i], mock_prompt->did_succeed());
    EXPECT_EQ(kTestData[i], mock_prompt->confirmation_requested()) <<
        kTestData[i];
    if (kTestData[i]) {
      EXPECT_EQ(base::string16(), mock_prompt->error()) << kTestData[i];
    } else {
      EXPECT_EQ(l10n_util::GetStringUTF16(
          IDS_EXTENSION_INSTALL_DISALLOWED_ON_SITE),
          mock_prompt->error()) << kTestData[i];
    }
  }
}

IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, HiDpiThemeTest) {
  base::FilePath crx_path = test_data_dir_.AppendASCII("theme_hidpi_crx");
  crx_path = crx_path.AppendASCII("theme_hidpi.crx");

  ASSERT_TRUE(InstallExtension(crx_path, 1));

  const std::string extension_id("gllekhaobjnhgeagipipnkpmmmpchacm");
  ExtensionRegistry* registry = ExtensionRegistry::Get(
      browser()->profile());
  const extensions::Extension* extension =
     registry->enabled_extensions().GetByID(extension_id);
  ASSERT_TRUE(extension);
  EXPECT_EQ(extension_id, extension->id());

  UninstallExtension(extension_id);
  EXPECT_FALSE(registry->enabled_extensions().GetByID(extension_id));
}

// See http://crbug.com/315299.
#if defined(OS_WIN) || defined(OS_LINUX)
#define MAYBE_InstallDelayedUntilNextUpdate \
        DISABLED_InstallDelayedUntilNextUpdate
#else
#define MAYBE_InstallDelayedUntilNextUpdate InstallDelayedUntilNextUpdate
#endif
IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest,
                       MAYBE_InstallDelayedUntilNextUpdate) {
  const std::string extension_id("ldnnhddmnhbkjipkidpdiheffobcpfmf");
  base::FilePath crx_path = test_data_dir_.AppendASCII("delayed_install");
  ExtensionSystem* extension_system = extensions::ExtensionSystem::Get(
      browser()->profile());
  ExtensionService* service = extension_system->extension_service();
  ASSERT_TRUE(service);
  ExtensionRegistry* registry = ExtensionRegistry::Get(
      browser()->profile());
  ASSERT_TRUE(registry);

  // Install version 1 of the test extension. This extension does not have
  // a background page but does have a browser action.
  ASSERT_TRUE(InstallExtension(crx_path.AppendASCII("v1.crx"), 1));
  const extensions::Extension* extension =
     registry->enabled_extensions().GetByID(extension_id);
  ASSERT_TRUE(extension);
  ASSERT_EQ(extension_id, extension->id());
  ASSERT_EQ("1.0", extension->version()->GetString());

  // Make test extension non-idle by opening the extension's browser action
  // popup. This should cause the installation to be delayed.
  content::WindowedNotificationObserver loading_observer(
      extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING,
      content::Source<Profile>(profile()));
  BrowserActionTestUtil util(browser());
  // There is only one extension, so just click the first browser action.
  ASSERT_EQ(1, util.NumberOfBrowserActions());
  util.Press(0);
  loading_observer.Wait();
  ExtensionHost* extension_host =
      content::Details<ExtensionHost>(loading_observer.details()).ptr();

  // Install version 2 of the extension and check that it is indeed delayed.
  ASSERT_TRUE(UpdateExtensionWaitForIdle(
      extension_id, crx_path.AppendASCII("v2.crx"), 0));

  ASSERT_EQ(1u, service->delayed_installs()->size());
  extension = registry->enabled_extensions().GetByID(extension_id);
  ASSERT_EQ("1.0", extension->version()->GetString());

  // Make the extension idle again by closing the popup. This should not trigger
  // the delayed install.
  content::RenderProcessHostWatcher terminated_observer(
      extension_host->render_process_host(),
      content::RenderProcessHostWatcher::WATCH_FOR_HOST_DESTRUCTION);
  extension_host->render_view_host()->ClosePage();
  terminated_observer.Wait();
  ASSERT_EQ(1u, service->delayed_installs()->size());

  // Install version 3 of the extension. Because the extension is idle,
  // this install should succeed.
  ASSERT_TRUE(UpdateExtensionWaitForIdle(
      extension_id, crx_path.AppendASCII("v3.crx"), 0));
  extension = registry->enabled_extensions().GetByID(extension_id);
  ASSERT_EQ("3.0", extension->version()->GetString());

  // The version 2 delayed install should be cleaned up, and finishing
  // delayed extension installation shouldn't break anything.
  ASSERT_EQ(0u, service->delayed_installs()->size());
  service->MaybeFinishDelayedInstallations();
  extension = registry->enabled_extensions().GetByID(extension_id);
  ASSERT_EQ("3.0", extension->version()->GetString());
}

#if defined(FULL_SAFE_BROWSING)
IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, Blacklist) {
  scoped_refptr<FakeSafeBrowsingDatabaseManager> blacklist_db(
      new FakeSafeBrowsingDatabaseManager(true));
  Blacklist::ScopedDatabaseManagerForTest scoped_blacklist_db(blacklist_db);

  blacklist_db->SetUnsafe("gllekhaobjnhgeagipipnkpmmmpchacm");

  base::FilePath crx_path = test_data_dir_.AppendASCII("theme_hidpi_crx")
                                          .AppendASCII("theme_hidpi.crx");
  EXPECT_FALSE(InstallExtension(crx_path, 0));
}
#endif

IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, NonStrictManifestCheck) {
  scoped_refptr<MockPromptProxy> mock_prompt =
      CreateMockPromptProxyForBrowser(browser());

  // We want to simulate the case where the webstore sends a more recent
  // version of the manifest, but the downloaded .crx file is old since
  // the newly published version hasn't fully propagated to all the download
  // servers yet. So load the v2 manifest, but then install the v1 crx file.
  std::string id = "lhnaeclnpobnlbjbgogdanmhadigfnjp";
  scoped_ptr<WebstoreInstaller::Approval> approval =
      GetApproval("crx_installer/v2_no_permission_change/", id, false);

  RunCrxInstaller(approval.get(), mock_prompt->CreatePrompt(),
                  test_data_dir_.AppendASCII("crx_installer/v1.crx"));

  EXPECT_TRUE(mock_prompt->did_succeed());
}

IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, KioskOnlyTest) {
  base::FilePath crx_path =
      test_data_dir_.AppendASCII("kiosk/kiosk_only.crx");
  EXPECT_FALSE(InstallExtension(crx_path, 0));
#if defined(OS_CHROMEOS)
  // Simulate ChromeOS kiosk mode. |scoped_user_manager| will take over
  // lifetime of |user_manager|.
  chromeos::FakeUserManager* fake_user_manager =
      new chromeos::FakeUserManager();
  fake_user_manager->AddKioskAppUser("example@example.com");
  fake_user_manager->LoginUser("example@example.com");
  chromeos::ScopedUserManagerEnabler scoped_user_manager(fake_user_manager);
  EXPECT_TRUE(InstallExtension(crx_path, 1));
#endif
}

#if defined(OS_CHROMEOS)
IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, InstallToSharedLocation) {
  base::ShadowingAtExitManager at_exit_manager;
  CommandLine::ForCurrentProcess()->AppendSwitch(
      chromeos::switches::kEnableExtensionAssetsSharing);
  base::ScopedTempDir cache_dir;
  ASSERT_TRUE(cache_dir.CreateUniqueTempDir());
  ExtensionAssetsManagerChromeOS::SetSharedInstallDirForTesting(
      cache_dir.path());

  base::FilePath crx_path = test_data_dir_.AppendASCII("crx_installer/v1.crx");
  const extensions::Extension* extension = InstallExtension(
      crx_path, 1, extensions::Manifest::EXTERNAL_PREF);
  base::FilePath extension_path = extension->path();
  EXPECT_TRUE(cache_dir.path().IsParent(extension_path));
  EXPECT_TRUE(base::PathExists(extension_path));

  std::string extension_id = extension->id();
  UninstallExtension(extension_id);
  ExtensionRegistry* registry = ExtensionRegistry::Get(
      browser()->profile());
  EXPECT_FALSE(registry->enabled_extensions().GetByID(extension_id));

  content::RunAllBlockingPoolTasksUntilIdle();

  EXPECT_FALSE(base::PathExists(extension_path));
}
#endif

IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, DoNotSync) {
  ExtensionService* service = extensions::ExtensionSystem::Get(
                                  browser()->profile())->extension_service();
  scoped_refptr<CrxInstaller> crx_installer(
      CrxInstaller::CreateSilent(service));
  crx_installer->set_do_not_sync(true);
  crx_installer->InstallCrx(test_data_dir_.AppendASCII("good.crx"));
  EXPECT_TRUE(WaitForCrxInstallerDone());
  ASSERT_TRUE(crx_installer->extension());

  const ExtensionPrefs* extension_prefs =
      ExtensionPrefs::Get(browser()->profile());
  EXPECT_TRUE(extension_prefs->DoNotSync(crx_installer->extension()->id()));
  EXPECT_FALSE(extensions::util::ShouldSyncApp(crx_installer->extension(),
                                               browser()->profile()));
}

IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, ManagementPolicy) {
  ManagementPolicyMock policy;
  extensions::ExtensionSystem::Get(profile())
      ->management_policy()
      ->RegisterProvider(&policy);

  base::FilePath crx_path = test_data_dir_.AppendASCII("crx_installer/v1.crx");
  EXPECT_FALSE(InstallExtension(crx_path, 0));
}

IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, WithheldElevationCheck) {
  // Enable consent flag and install extension. The <all_hosts> permission will
  // be withheld.
  scoped_ptr<FeatureSwitch::ScopedOverride> enable_scripts_switch(
      new FeatureSwitch::ScopedOverride(
          FeatureSwitch::scripts_require_action(), true));

  const char kManifest[] =
      "{"
      "  \"name\": \"Withheld test\","
      "  \"version\": \"1.0\","
      "  \"permissions\": ["
      "    \"http://*/*\""
      "  ],"
      "  \"manifest_version\": 2"
      "}";
  TestExtensionDir dir;
  dir.WriteManifest(kManifest);
  base::FilePath crx_path = dir.Pack();
  EXPECT_FALSE(crx_path.empty());
  const Extension* extension = InstallExtension(crx_path, 1);
  EXPECT_TRUE(base::PathExists(extension->path()));

  std::string extension_id = extension->id();
  ExtensionRegistry* registry = ExtensionRegistry::Get(
      browser()->profile());
  EXPECT_TRUE(registry->enabled_extensions().GetByID(extension_id));

  // Disable consent flag and reinstall extension. It should now be disabled
  // because previously withheld permissions are now being requested.
  enable_scripts_switch.reset();
  extension = InstallExtension(crx_path, -1);
  EXPECT_FALSE(registry->enabled_extensions().GetByID(extension_id));
  EXPECT_TRUE(registry->disabled_extensions().GetByID(extension_id));
  EXPECT_TRUE(ExtensionPrefs::Get(browser()->profile())->GetDisableReasons(
      extension_id) & Extension::DISABLE_PERMISSIONS_INCREASE);
}

}  // namespace extensions


text:
#ifndef EDITOR_WIDGETS_ASSETSELECTOR_H
#define EDITOR_WIDGETS_ASSETSELECTOR_H

#include "ResourceBrowser.h"

#include <functional>

namespace editor {

class AssetSelector final : public ResourceBrowser {
    public:
        AssetSelector(AssetType filter, const char* name = nullptr);

        template<typename F>
        void set_selected_callback(F&& func) {
            _selected = y_fwd(func);
        }

    protected:
        void asset_selected(AssetId id) override;

        core::Result<core::String> entry_icon(const core::String& full_name, EntryType type) const override;

    private:
        AssetType _filter;
        std::function<bool(AssetId)> _selected = [](const auto&) { return false; };
};

}

#endif // EDITOR_WIDGETS_ASSETSELECTOR_H


text:
const electron = require('electron')
const fs = require('fs')
//const test = require('./build/Release/Encryption')

const ipc = electron.ipcMain
// Module to control application life.
const app = electron.app
// Module to create native browser window.
const BrowserWindow = electron.BrowserWindow

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.

var testing = false;

let chartWindow
let serverWindow
let internalServerWindow
let testWindow

function createWindow () {
  var dir = "./previous_traces"
  if (!fs.existsSync(dir)){
    fs.mkdirSync(dir);
  }
  // Create the browser window.
  //internalServerWindow = new BrowserWindow({width: 800, height: 600, title: "InternalServer"})
  if(testing) {
    testWindow = new BrowserWindow({width: 800, height: 600, title: "Test"})
    testWindow.loadURL(`file://${__dirname}/test.html`)
    testWindow.webContents.openDevTools()
  }
  else {
      chartWindow = new BrowserWindow({width: 800, height: 600, title: "Chart", minHeight: 490, minWidth: 760})
      chartWindow.setMenuBarVisibility(false);
      serverWindow = new BrowserWindow({width: 800, height: 600, title: "Server", show: false})
  //serverWindow.hide();
  //
  // and load the index.html of the app.
  //internalServerWindow.loadURL(`file://${__dirname}/internal-server/internal-server.html`)
  chartWindow.loadURL(`file://${__dirname}/visualization/visualization.html`)
  serverWindow.loadURL(`file://${__dirname}/server/server.html`)
  //

  // Open the DevTools.
  //chartWindow.webContents.openDevTools()
  //serverWindow.webContents.openDevTools()
  //internalServerWindow.webContents.openDevTools()
   chartWindow.on('closed', function () {
    // Dereference the window object, usually you would store windows
    // in an array if your app supports multi windows, this is the time
    // when you should delete the corresponding element.
    chartWindow = null
    serverWindow.close();
    //internalServerWindow = null
  })
  }
  //
  // Emitted when the window is closed.

}

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow)

// Quit when all windows are closed.
app.on('window-all-closed', function () {
  // On OS X it is common for applications and their menu bar
  // to stay active until the user quits explicitly with Cmd + Q
  if (process.platform !== 'darwin') {
    app.quit()
  }
})

app.on('activate', function () {
  // On OS X it's common to re-create a window in the app when the
  // dock icon is clicked and there are no other windows open.
  if (chartWindow === null) {
    createWindow()
  }
})

ipc.on('to-chart', function(event, data) {
  chartWindow.webContents.send(data.channel, data);
})

ipc.on('to-server', function(event, data) {
  serverWindow.webContents.send(data.channel, data);
})

// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.


text:
/* this file has been autogenerated by vtkNodeJsWrap */
/* editing this might proof futile */

#ifndef NATIVE_EXTENSION_VTK_VTKAMRENZOREADERWRAP_H
#define NATIVE_EXTENSION_VTK_VTKAMRENZOREADERWRAP_H

#include <nan.h>

#include <vtkSmartPointer.h>
#include <vtkAMREnzoReader.h>

#include "vtkAMRBaseReaderWrap.h"
#include "../../plus/plus.h"

class VtkAMREnzoReaderWrap : public VtkAMRBaseReaderWrap
{
	public:
		using Nan::ObjectWrap::Wrap;
		static void Init(v8::Local<v8::Object> exports);
		static void InitPtpl();
		static void ConstructorGetter(
			v8::Local<v8::String> property,
			const Nan::PropertyCallbackInfo<v8::Value>& info);

		VtkAMREnzoReaderWrap(vtkSmartPointer<vtkAMREnzoReader>);
		VtkAMREnzoReaderWrap();
		~VtkAMREnzoReaderWrap( );
		static Nan::Persistent<v8::FunctionTemplate> ptpl;

	private:
		static void New(const Nan::FunctionCallbackInfo<v8::Value>& info);

		static void ConvertToCGSOff(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void ConvertToCGSOn(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void GetConvertToCGS(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void GetNumberOfBlocks(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void GetNumberOfLevels(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void NewInstance(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void SafeDownCast(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void SetConvertToCGS(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void SetFileName(const Nan::FunctionCallbackInfo<v8::Value>& info);

#ifdef VTK_NODE_PLUS_VTKAMRENZOREADERWRAP_CLASSDEF
		VTK_NODE_PLUS_VTKAMRENZOREADERWRAP_CLASSDEF
#endif
};

#endif


text:
"""
Tests basic ThreadSanitizer support (detecting a data race).
"""

import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
import lldbsuite.test.lldbutil as lldbutil
import json

class TsanBasicTestCase(TestBase):

    mydir = TestBase.compute_mydir(__file__)

    @expectedFailureAll(
        oslist=["linux"],
        bugnumber="non-core functionality, need to reenable and fix later (DES 2014.11.07)")
    @expectedFailureNetBSD
    @skipIfFreeBSD  # llvm.org/pr21136 runtimes not yet available by default
    @skipIfRemote
    @skipUnlessThreadSanitizer
    def test(self):
        self.build()
        self.tsan_tests()

    def setUp(self):
        # Call super's setUp().
        TestBase.setUp(self)
        self.line_malloc = line_number('main.c', '// malloc line')
        self.line_thread1 = line_number('main.c', '// thread1 line')
        self.line_thread2 = line_number('main.c', '// thread2 line')

    def tsan_tests(self):
        exe = self.getBuildArtifact("a.out")
        self.expect(
            "file " + exe,
            patterns=["Current executable set to .*a.out"])

        self.runCmd("run")

        stop_reason = self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason()
        if stop_reason == lldb.eStopReasonExec:
            # On OS X 10.10 and older, we need to re-exec to enable
            # interceptors.
            self.runCmd("continue")

        # the stop reason of the thread should be breakpoint.
        self.expect("thread list", "A data race should be detected",
                    substrs=['stopped', 'stop reason = Data race detected'])

        self.assertEqual(
            self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason(),
            lldb.eStopReasonInstrumentation)

        # test that the TSan dylib is present
        self.expect(
            "image lookup -n __tsan_get_current_report",
            "__tsan_get_current_report should be present",
            substrs=['1 match found'])

        # We should be stopped in __tsan_on_report
        process = self.dbg.GetSelectedTarget().process
        thread = process.GetSelectedThread()
        frame = thread.GetSelectedFrame()
        self.assertTrue("__tsan_on_report" in frame.GetFunctionName())

        # The stopped thread backtrace should contain either line1 or line2
        # from main.c.
        found = False
        for i in range(0, thread.GetNumFrames()):
            frame = thread.GetFrameAtIndex(i)
            if frame.GetLineEntry().GetFileSpec().GetFilename() == "main.c":
                if frame.GetLineEntry().GetLine() == self.line_thread1:
                    found = True
                if frame.GetLineEntry().GetLine() == self.line_thread2:
                    found = True
        self.assertTrue(found)

        self.expect(
            "thread info -s",
            "The extended stop info should contain the TSan provided fields",
            substrs=[
                "instrumentation_class",
                "description",
                "mops"])

        output_lines = self.res.GetOutput().split('\n')
        json_line = '\n'.join(output_lines[2:])
        data = json.loads(json_line)
        self.assertEqual(data["instrumentation_class"], "ThreadSanitizer")
        self.assertEqual(data["issue_type"], "data-race")
        self.assertEqual(len(data["mops"]), 2)

        backtraces = thread.GetStopReasonExtendedBacktraces(
            lldb.eInstrumentationRuntimeTypeAddressSanitizer)
        self.assertEqual(backtraces.GetSize(), 0)

        backtraces = thread.GetStopReasonExtendedBacktraces(
            lldb.eInstrumentationRuntimeTypeThreadSanitizer)
        self.assertTrue(backtraces.GetSize() >= 2)

        # First backtrace is a memory operation
        thread = backtraces.GetThreadAtIndex(0)
        found = False
        for i in range(0, thread.GetNumFrames()):
            frame = thread.GetFrameAtIndex(i)
            if frame.GetLineEntry().GetFileSpec().GetFilename() == "main.c":
                if frame.GetLineEntry().GetLine() == self.line_thread1:
                    found = True
                if frame.GetLineEntry().GetLine() == self.line_thread2:
                    found = True
        self.assertTrue(found)

        # Second backtrace is a memory operation
        thread = backtraces.GetThreadAtIndex(1)
        found = False
        for i in range(0, thread.GetNumFrames()):
            frame = thread.GetFrameAtIndex(i)
            if frame.GetLineEntry().GetFileSpec().GetFilename() == "main.c":
                if frame.GetLineEntry().GetLine() == self.line_thread1:
                    found = True
                if frame.GetLineEntry().GetLine() == self.line_thread2:
                    found = True
        self.assertTrue(found)

        self.runCmd("continue")

        # the stop reason of the thread should be a SIGABRT.
        self.expect("thread list", "We should be stopped due a SIGABRT",
                    substrs=['stopped', 'stop reason = signal SIGABRT'])

        # test that we're in pthread_kill now (TSan abort the process)
        self.expect("thread list", "We should be stopped in pthread_kill",
                    substrs=['pthread_kill'])


text:
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.

#include "XmppPrivatePCH.h"
#include "XmppJingle.h"
#include "XmppConnectionJingle.h"
#include "XmppChatJingle.h"

#if WITH_XMPP_JINGLE

/**
 * Holds a chat message for send/receive via Xmpp task
 */
class FXmppChatMessageJingle
{
public:
	FXmppChatMessageJingle(
		const buzz::Jid& InFromJid = buzz::Jid(),
		const buzz::Jid& InToJid = buzz::Jid(),
		const std::string& InBody = std::string(),
		const std::string& InTimestamp = std::string()
		)
		: FromJid(InFromJid)
		, ToJid(InToJid)
		, Body(InBody)
		, Timestamp(InTimestamp)
	{}

	/** id of message sender */
	buzz::Jid FromJid;
	/** id of message recipient */
	buzz::Jid ToJid;
	/** body of the chat message */
	std::string Body;
	/** timestamp */
	std::string Timestamp;
};

/**
 * Task for receiving Xmpp chat messages
 */
class FXmppChatReceiveTask : public buzz::XmppTask
{
public:
	explicit FXmppChatReceiveTask(buzz::XmppTaskParentInterface* Parent)
		: buzz::XmppTask(Parent, buzz::XmppEngine::HL_TYPE)
	{}

	virtual ~FXmppChatReceiveTask()
	{
		// task shouldn't really be deleted until done but just in case
		if (!IsDone())
		{
			Stop();
		}
	}

	virtual int ProcessStart()
	{
		// see if there are any new stanzas to process
		const buzz::XmlElement* Stanza = NextStanza();
		if (Stanza == NULL)
		{
			return STATE_BLOCKED;
		}
		ProcessChatStanza(Stanza);
		return STATE_START;
	}

	/** signal callback for when chat message is received & processed */
	sigslot::signal1<const FXmppChatMessageJingle& /*Chat*/> SignalChatReceived;

protected:

	virtual bool HandleStanza(const buzz::XmlElement* Stanza)
	{
		const std::string ChatType = "chat";

		bool bHandled = false;
		// Skip all but stanzas of message type
		if (Stanza->Name() == buzz::QN_MESSAGE &&
			// Skip all but chat messages
			Stanza->Attr(buzz::QN_TYPE) == ChatType &&
			// Must have a valid message body
			Stanza->FirstNamed(buzz::QN_BODY) != NULL)
		{
			// Queue stanza for task processing
			QueueStanza(Stanza);
			bHandled = true;
		}
		return bHandled;
	}

	void ProcessChatStanza(const buzz::XmlElement* Stanza)
	{
		check(Stanza != NULL);

		const buzz::XmlElement* XmlBody = Stanza->FirstNamed(buzz::QN_BODY);

		static const buzz::StaticQName QN_DELAY = { "urn:xmpp:delay", "delay" };
		const buzz::XmlElement* Delay = Stanza->FirstNamed(QN_DELAY);

		FXmppChatMessageJingle ChatMessage(
			buzz::Jid(Stanza->Attr(buzz::QN_FROM)),
			buzz::Jid(Stanza->Attr(buzz::QN_TO)),
			XmlBody != NULL ? XmlBody->BodyText() : std::string(),
			Delay != NULL ? Delay->Attr(buzz::kQnStamp) : std::string()
			);

		SignalChatReceived(ChatMessage);
	}
};

/**
* Task for sending Xmpp chat messages
*/
class FXmppChatSendTask : public buzz::XmppTask
{
public:
	explicit FXmppChatSendTask(buzz::XmppTaskParentInterface* Parent)
		: buzz::XmppTask(Parent)
	{}

	buzz::XmppReturnStatus Send(const buzz::Jid& ToJid, const FXmppChatMessageJingle& ChatMessage)
	{
		if (GetState() != STATE_INIT &&
			GetState() != STATE_START)
		{
			return buzz::XMPP_RETURN_BADSTATE;
		}

		buzz::Jid ToJidFull(ToJid.node(), GetClient()->jid().domain(), buzz::STR_EMPTY);
		buzz::XmlElement* Stanza = ChatToStanza(ToJidFull, ChatMessage);
		QueueStanza(Stanza);
		delete Stanza;

		return buzz::XMPP_RETURN_OK;
	}

	virtual int ProcessStart()
	{
		// see if there are any new stanzas to process
		const buzz::XmlElement* Stanza = NextStanza();
		if (Stanza == NULL)
		{
			return STATE_BLOCKED;
		}
		if (SendStanza(Stanza) != buzz::XMPP_RETURN_OK)
		{
			return STATE_ERROR;
		}
		return STATE_START;
	}

protected:

	buzz::XmlElement* ChatToStanza(const buzz::Jid& ToJid, const FXmppChatMessageJingle& Message)
	{
		buzz::XmlElement* Result = new buzz::XmlElement(buzz::QN_MESSAGE);

		const std::string ChatType = "chat";

		Result->AddAttr(buzz::QN_TO, ToJid.Str());
		Result->AddAttr(buzz::QN_TYPE, ChatType);
		buzz::XmlElement* Body = new buzz::XmlElement(buzz::QN_BODY);
		Body->SetBodyText(Message.Body);
		Result->AddElement(Body);

		return Result;
	}
};

FXmppChatJingle::FXmppChatJingle(class FXmppConnectionJingle& InConnection)
	: ChatRcvTask(NULL)
	, ChatSendTask(NULL)
	, Connection(InConnection)
{
}

FXmppChatJingle::~FXmppChatJingle()
{
	FXmppChatMessage* RcvMessage = NULL;
	while (ReceivedChatQueue.Dequeue(RcvMessage))
	{
		delete RcvMessage;
	}
	FXmppChatMessageJingle* SndMessage = NULL;
	while (SendChatQueue.Dequeue(SndMessage))
	{
		delete SndMessage;
	}
}

static void ConvertToMessage(FXmppChatMessage& OutMessage, const FXmppChatMessageJingle& InMessageJingle)
{
	FXmppJingle::ConvertToJid(OutMessage.FromJid, InMessageJingle.FromJid);
	FXmppJingle::ConvertToJid(OutMessage.ToJid, InMessageJingle.ToJid);
	OutMessage.Body = UTF8_TO_TCHAR(InMessageJingle.Body.c_str());
	if (!InMessageJingle.Timestamp.empty())
	{
		FDateTime::ParseIso8601(UTF8_TO_TCHAR(InMessageJingle.Timestamp.c_str()), OutMessage.Timestamp);
	}
	else
	{
		OutMessage.Timestamp = FDateTime::UtcNow();
	}
}

static void ConvertFromMessage(FXmppChatMessageJingle& OutMessageJingle, const FXmppChatMessage& InMessage)
{
	FXmppJingle::ConvertFromJid(OutMessageJingle.FromJid, InMessage.FromJid);
	FXmppJingle::ConvertFromJid(OutMessageJingle.ToJid, InMessage.ToJid);
	OutMessageJingle.Body = TCHAR_TO_UTF8(*InMessage.Body);
}

static void DebugPrintChat(const FXmppChatMessage& ChatMessage)
{
	UE_LOG(LogXmpp, Log, TEXT("   FromJid = %s"), *ChatMessage.FromJid.GetFullPath());
	UE_LOG(LogXmpp, Log, TEXT("   ToJid= %s"), *ChatMessage.ToJid.GetFullPath());
	UE_LOG(LogXmpp, Log, TEXT("   Body= %s"), *ChatMessage.Body);
}

bool FXmppChatJingle::SendChat(FString RecipientId, const FXmppChatMessage& ChatMessage)
{
	FXmppChatMessageJingle* NewChat = new FXmppChatMessageJingle();
	ConvertFromMessage(*NewChat, ChatMessage);
	return SendChatQueue.Enqueue(NewChat);
}

bool FXmppChatJingle::Tick(float DeltaTime)
{
	while (!ReceivedChatQueue.IsEmpty())
	{
		FXmppChatMessage* ChatMessage = NULL;
		if (ReceivedChatQueue.Dequeue(ChatMessage))
		{
			OnReceiveChat().Broadcast(Connection.AsShared(), ChatMessage->FromJid, MakeShareable(ChatMessage));
		}
	}
	return true;
}

void FXmppChatJingle::HandlePumpStarting(buzz::XmppPump* XmppPump)
{
	if (ChatRcvTask == NULL)
	{
		ChatRcvTask = new FXmppChatReceiveTask(XmppPump->client());
		ChatRcvTask->SignalChatReceived.connect(this, &FXmppChatJingle::OnSignalChatReceived);
 		ChatRcvTask->Start();
	}
	if (ChatSendTask == NULL)
	{
		ChatSendTask = new FXmppChatSendTask(XmppPump->client());
		ChatSendTask->Start();
	}
}

void FXmppChatJingle::HandlePumpQuitting(buzz::XmppPump* XmppPump)
{
	// delete happens automatically when tasks are completed
	if (ChatRcvTask != NULL)
	{
		ChatRcvTask->Abort(true);
		ChatRcvTask = NULL;
	}
	if (ChatSendTask != NULL)
	{
		ChatSendTask->Abort(true);
		ChatSendTask = NULL;
	}
}

void FXmppChatJingle::HandlePumpTick(buzz::XmppPump* XmppPump)
{
	while (!SendChatQueue.IsEmpty())
	{
		FXmppChatMessageJingle* ChatMessage = NULL;
		if (SendChatQueue.Dequeue(ChatMessage))
		{
			// kick off hte send task
			if (ChatSendTask != NULL)
			{
				ChatSendTask->Send(ChatMessage->ToJid, *ChatMessage);
			}
			delete ChatMessage;
		}
	}
}

void FXmppChatJingle::OnSignalChatReceived(const FXmppChatMessageJingle& ChatMessageJingle)
{
	FXmppChatMessage* NewMessage = new FXmppChatMessage();
	ConvertToMessage(*NewMessage, ChatMessageJingle);
	DebugPrintChat(*NewMessage);

	ReceivedChatQueue.Enqueue(NewMessage);
}

#endif //WITH_XMPP_JINGLE


text:
package org.cyclops.cyclopscore.config.configurabletypeaction;

import org.cyclops.cyclopscore.config.extendedconfig.DummyConfig;

/**
 * Just a dummy action.
 * @author rubensworks
 *
 */
public class DummyAction extends ConfigurableTypeAction<DummyConfig, Void> {

}


text:
.DEFAULT_GOAL := build

PACKAGES = $(shell go list ./... | grep -v /vendor/)

TESTARGS ?= -race

CURRENTDIR = $(shell pwd)
SOURCEDIR = $(CURRENTDIR)
SOURCES := $(shell find $(SOURCEDIR) -name '*.go')
APP_SOURCES := $(shell find $(SOURCEDIR) -name '*.go' -not -path '$(SOURCEDIR)/vendor/*')

PATH := $(CURRENTDIR)/bin:$(PATH)

COVERAGEDIR = $(CURRENTDIR)/coverage

VERSION = $(shell cat .goxc.json | python -c "import json,sys;obj=json.load(sys.stdin);print obj['PackageVersion'];")

TEMPDIR := $(shell mktemp -d)
LD_FLAGS = -ldflags '-w' -ldflags "-X main.VERSION=$(VERSION)"

TEST_TARGETS = $(PACKAGES)

all: build

deps:
	@./install_consul.sh
	@mkdir -p $(COVERAGEDIR)
	@which gover > /dev/null || \
        (go get github.com/modocache/gover)
	@which goxc > /dev/null || \
        (go get github.com/laher/goxc)
	@which goimports > /dev/null || \
        (go get golang.org/x/tools/cmd/goimports)

build-deps: deps format
	@mkdir -p bin/

build: check build-deps test
	CGO_ENABLED=0 go build $(LD_FLAGS) -o bin/marathon-consul

build-linux: build-deps
	CGO_ENABLED=0 GOOS=linux go build -a -tags netgo $(LD_FLAGS) -o bin/marathon-consul

docker: build-linux
	docker build -t allegro/marathon-consul .

test: deps $(SOURCES) $(TEST_TARGETS)
	gover $(COVERAGEDIR) $(COVERAGEDIR)/gover.coverprofile

$(TEST_TARGETS):
	go test -coverprofile=coverage/$(shell basename $@).coverprofile $(TESTARGS) $@

check-deps: deps
	@which golangci-lint > /dev/null || \
		(GO111MODULE=on go get -v github.com/golangci/golangci-lint/cmd/golangci-lint@v1.25.0)

check: check-deps $(SOURCES) test
	golangci-lint run --config=golangcilinter.yaml ./...

format:
	goimports -w -l $(APP_SOURCES)

FPM-exists:
	@fpm -v || \
	(echo >&2 "FPM must be installed on the system. See https://github.com/jordansissel/fpm"; false)

deb: FPM-exists build-linux
	mkdir -p dist/$(VERSION)/
	cd dist/$(VERSION)/ && \
	fpm -s dir \
	    -t deb \
        -n marathon-consul \
        -v $(VERSION) \
        --url="https://github.com/allegro/marathon-consul" \
        --vendor=Allegro \
        --architecture=amd64 \
        --maintainer="Allegro Group <opensource@allegro.pl>" \
        --description "Marathon-consul service (performs Marathon Tasks registration as Consul Services for service discovery) Marathon-consul takes information provided by the Marathon event bus and forwards it to Consul agents. It also re-syncs all the information from Marathon to Consul on startup and repeats it with given interval." \
        --deb-priority optional \
        --workdir $(TEMPDIR) \
        --license "Apache License, version 2.0" \
        ../../bin/marathon-consul=/usr/bin/marathon-consul \
        ../../debian/marathon-consul.service=/etc/systemd/system/marathon-consul.service \
        ../../debian/marathon-consul.upstart=/etc/init/marathon-consul.conf \
        ../../debian/config.json=/etc/marathon-consul.d/config.json

release: deb deps
	goxc

version: deps
	goxc -wc -pv=$(v)
	git add .goxc.json
	git commit -m "Release $(v)"

.PHONY: all bump build release deb


text:
export function control(isProd: boolean, days: number): string {
    if (days === 0 || !isProd) {
        return 'public, no-cache, no-store, must-revalidate';
    }
    const sec = days * 24 * 60 * 60;
    return `public, max-age=${sec}`;
}


text:
package io.github.movementspeed.nhglib.graphics.worlds.strategies.base;

import io.github.movementspeed.nhglib.core.ecs.components.scenes.NodeComponent;
import io.github.movementspeed.nhglib.graphics.scenes.Scene;
import io.github.movementspeed.nhglib.utils.data.Bounds;

/**
 * Created by Fausto Napoli on 29/12/2016.
 * Determines how to handle entities based on world size.
 */
public abstract class WorldStrategy {
    public abstract void update(Scene scene, Bounds bounds, NodeComponent referenceNodeComponent);
}


text:
#ifndef QQNXINPUTCONTEXT_H
#define QQNXINPUTCONTEXT_H

#include <qpa/qplatforminputcontext.h>
#include "qqnxscreeneventfilter.h"

#include <QtCore/QLocale>
#include <QtCore/QMetaType>
#include <QtCore/QList>
#include <qpa/qplatformintegration.h>

#include "imf/imf_client.h"
#include "imf/input_control.h"

QT_BEGIN_NAMESPACE

class QQnxAbstractVirtualKeyboard;
class QQnxIntegration;
class QQnxImfRequest;

class QQnxInputContext : public QPlatformInputContext, public QQnxScreenEventFilter
{
    Q_OBJECT
public:
    explicit QQnxInputContext(QQnxIntegration *integration, QQnxAbstractVirtualKeyboard &keyboard);
    ~QQnxInputContext();

    // Indices for selecting and setting highlight colors.
    enum HighlightIndex {
        ActiveRegion,
        AutoCorrected,
        Reverted,
    };

    bool isValid() const;

    bool filterEvent(const QEvent *event);
    QRectF keyboardRect() const;
    void reset();
    void commit();
    void update(Qt::InputMethodQueries);
    bool handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap, int sequenceId);

    void showInputPanel();
    void hideInputPanel();
    bool isInputPanelVisible() const;

    QLocale locale() const;
    void setFocusObject(QObject *object);

    static void setHighlightColor(int index, const QColor &color);

    static bool checkSpelling(const QString &text, void *context, void (*spellCheckDone)(void *context, const QString &text, const QList<int> &indices));

private Q_SLOTS:
    void keyboardVisibilityChanged(bool visible);
    void keyboardLocaleChanged(const QLocale &locale);
    void processImfEvent(QQnxImfRequest *event);

private:
    // IMF Event dispatchers
    bool dispatchFocusGainEvent(int inputHints);
    void dispatchFocusLossEvent();
    bool dispatchRequestSoftwareInputPanel();
    bool dispatchCloseSoftwareInputPanel();
    int handleSpellCheck(spell_check_event_t *event);
    int32_t processEvent(event_t *event);

    void closeSession();
    bool openSession();
    bool hasSession();
    void updateCursorPosition();
    void endComposition();
    void finishComposingText();
    bool hasSelectedText();
    void updateComposition(spannable_string_t *text, int32_t new_cursor_position);

    // IMF Event handlers - these events will come in from QCoreApplication.
    int32_t onCommitText(spannable_string_t *text, int32_t new_cursor_position);
    int32_t onDeleteSurroundingText(int32_t left_length, int32_t right_length);
    int32_t onGetCursorCapsMode(int32_t req_modes);
    int32_t onFinishComposingText();
    int32_t onGetCursorPosition();
    spannable_string_t *onGetTextAfterCursor(int32_t n, int32_t flags);
    spannable_string_t *onGetTextBeforeCursor(int32_t n, int32_t flags);
    int32_t onSendEvent(event_t *event);
    int32_t onSetComposingRegion(int32_t start, int32_t end);
    int32_t onSetComposingText(spannable_string_t *text, int32_t new_cursor_position);
    int32_t onIsTextSelected(int32_t* pIsSelected);
    int32_t onIsAllTextSelected(int32_t* pIsSelected);
    int32_t onForceUpdate();

    int m_caretPosition;
    bool m_isComposing;
    QString m_composingText;
    bool m_isUpdatingText;
    bool m_inputPanelVisible;
    QLocale m_inputPanelLocale;
    // The object that had focus when the last highlight color was set.
    QObject *m_focusObject;
    // Indexed by HighlightIndex
    QColor m_highlightColor[3];
    QQnxIntegration *m_integration;
    QQnxAbstractVirtualKeyboard &m_virtualKeyboard;
};

QT_END_NAMESPACE

#endif // QQNXINPUTCONTEXT_H