text:
// -----------------------------------------------------------------------
//  <copyright file="Precision.cs" company="Phoenix Game Studios, LLC">
//      Copyright (c) 2017 Phoenix Game Studios, LLC. All rights reserved.
//      Licensed under the MIT License.
//      See https://github.com/PhoenixGameStudios/DangrLib/blob/master/LICENSE for full license information.
//  </copyright>
// -----------------------------------------------------------------------

namespace Dangr.Core.Math
{
    using System;
    using System.Runtime.InteropServices;

    /// <summary>
    /// Utilities for comparing floating point numbers.
    /// </summary>
    public static class Precision
    {
        private const int FLOAT_SHIFT_BITS = 31;
        private const int DOUBLE_SHIFT_BITS = 63;
        private const uint FLOAT_BIT_MASK = 0x80000000;
        private const ulong DOUBLE_BIT_MASK = 0x8000000000000000;

        /// <summary>
        /// Union of a floating point variable and an integer.
        /// </summary>
        [StructLayout(LayoutKind.Explicit)]
        private struct FloatIntUnion
        {
            /// <summary>
            /// The union's value as a floating point variable.
            /// </summary>
            [FieldOffset(0)]
            public float Float;

            /// <summary>
            /// The union's value as an integer.
            /// </summary>
            [FieldOffset(0)]
            public int Int;

            /// <summary>
            /// The union's value as an unsigned integer.
            /// </summary>
            [FieldOffset(0)]
            public uint UInt;
        }

        /// <summary>
        /// Union of a double precision floating point variable and a long.
        /// </summary>
        [StructLayout(LayoutKind.Explicit)]
        private struct DoubleLongUnion
        {
            /// <summary>
            /// The union's value as a double precision floating point variable.
            /// </summary>
            [FieldOffset(0)]
            public double Double;

            /// <summary>
            /// The union's value as a long.
            /// </summary>
            [FieldOffset(0)]
            public long Long;

            /// <summary>
            /// The union's value as an unsigned long.
            /// </summary>
            [FieldOffset(0)]
            public ulong ULong;
        }

        /// <summary>
        /// Compares two numbers given some amount of allowed error.
        /// </summary>
        /// <param name="x">The first number.</param>
        /// <param name="y">The second number.</param>
        /// <param name="epsilon">The amount of error allowed when checking for equality.</param>
        /// <returns>0 if x equals y, -1 if x is less than y, 1 if x is greater than y.</returns>
        public static int CompareTo(float x, float y, double epsilon)
        {
            if (Precision.Equals(x, y, epsilon))
            {
                return 0;
            }

            return x < y
                ? -1
                : 1;
        }

        /// <summary>
        /// Compares two numbers given some amount of allowed error.
        /// </summary>
        /// <param name="x">The first number.</param>
        /// <param name="y">The second number.</param>
        /// <param name="epsilon">The amount of error allowed when checking for equality.</param>
        /// <returns>0 if x equals y, -1 if x is less than y, 1 if x is greater than y.</returns>
        public static int CompareTo(double x, double y, double epsilon)
        {
            if (Precision.Equals(x, y, epsilon))
            {
                return 0;
            }

            return x < y
                ? -1
                : 1;
        }

        /// <summary>
        /// Compares two numbers given some amount of allowed distance.
        /// https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
        /// </summary>
        /// <param name="x">The first number.</param>
        /// <param name="y">The second number.</param>
        /// <param name="maxUlp">The number of discreet floating point values that are allowed between the two values.</param>
        /// <returns>0 if x equals y, -1 if x is less than y, 1 if x is greater than y.</returns>
        public static int CompareTo(float x, float y, int maxUlp)
        {
            if (Precision.Equals(x, y, maxUlp))
            {
                return 0;
            }

            return x < y
                ? -1
                : 1;
        }

        /// <summary>
        /// Compares two numbers given some amount of allowed distance.
        /// https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
        /// </summary>
        /// <param name="x">The first number.</param>
        /// <param name="y">The second number.</param>
        /// <param name="maxUlp">The number of discreet floating point values that are allowed between the two values.</param>
        /// <returns>0 if x equals y, -1 if x is less than y, 1 if x is greater than y.</returns>
        public static int CompareTo(double x, double y, int maxUlp)
        {
            if(Precision.Equals(x, y, maxUlp))
            {
                return 0;
            }

            return x < y
                ? -1
                : 1;
        }

        /// <summary>
        /// Compares two numbers.
        /// https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
        /// </summary>
        /// <param name="x">The first number.</param>
        /// <param name="y">The second number.</param>
        /// <returns><c>true</c> if the two values are equal, otherwise false.</returns>
        /// <remarks>
        /// This will check if the two numbers are adjacent or equal to each other. This is equivalent to
        /// calling Equals(x, y, 1).
        /// </remarks>
        public static bool Equals(float x, float y)
        {
            return Precision.Equals(x, y, 1);
        }

        /// <summary>
        /// Compares two numbers.
        /// https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
        /// </summary>
        /// <param name="x">The first number.</param>
        /// <param name="y">The second number.</param>
        /// <returns><c>true</c> if the two values are equal, otherwise false.</returns>
        /// <remarks>
        /// This will check if the two numbers are adjacent or equal to each other. This is equivalent to
        /// calling Equals(x, y, 1).
        /// </remarks>
        public static bool Equals(double x, double y)
        {
            return Precision.Equals(x, y, 1);
        }

        /// <summary>
        /// Compares two numbers given some amount of allowed error.
        /// </summary>
        /// <param name="x">The first number.</param>
        /// <param name="y">The second number.</param>
        /// <param name="epsilon">The amount of error allowed when checking for equality.</param>
        /// <returns><c>true</c> if the two values are equal, otherwise false.</returns>
        public static bool Equals(float x, float y, float epsilon)
        {
            if (epsilon <= 0)
            {
                throw new ArgumentOutOfRangeException("Epsilon must be greater than 0.");
            }

            // ReSharper disable once CompareOfFloatsByEqualityOperator
            return x == y || Math.Abs(x - y) <= epsilon;
        }

        /// <summary>
        /// Compares two numbers given some amount of allowed error.
        /// </summary>
        /// <param name="x">The first number.</param>
        /// <param name="y">The second number.</param>
        /// <param name="epsilon">The amount of error allowed when checking for equality.</param>
        /// <returns><c>true</c> if the two values are equal, otherwise false.</returns>
        public static bool Equals(double x, double y, double epsilon)
        {
            if (epsilon <= 0)
            {
                throw new ArgumentOutOfRangeException("Epsilon must be greater than 0.");
            }

            // ReSharper disable once CompareOfFloatsByEqualityOperator
            return x == y || Math.Abs(x - y) <= epsilon;
        }

        /// <summary>
        /// Compares two numbers given some amount of allowed distance.
        /// https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
        /// </summary>
        /// <param name="x">The first number.</param>
        /// <param name="y">The second number.</param>
        /// <param name="maxUlp">The number of discreet floating point values that are allowed between the two values.</param>
        /// <returns><c>true</c> if the two values are equal, otherwise false.</returns>
        public static bool Equals(float x, float y, int maxUlp)
        {
            if(maxUlp <= 0)
            {
                throw new ArgumentOutOfRangeException("Max Ulp must be greater than 0.");
            }

            FloatIntUnion xUnion = new FloatIntUnion
            {
                Float = x
            };
            FloatIntUnion yUnion = new FloatIntUnion
            {
                Float = y
            };

            // Convert to 2s complement if negative.
            uint xSignMask = xUnion.UInt >> Precision.FLOAT_SHIFT_BITS;
            uint ySignMask = yUnion.UInt >> Precision.FLOAT_SHIFT_BITS;

            uint xTemp = ((Precision.FLOAT_BIT_MASK - xUnion.UInt) & xSignMask);
            xUnion.UInt = xTemp | (xUnion.UInt & ~xSignMask);

            // Convert to 2s complement if negative.
            uint yTemp = ((Precision.FLOAT_BIT_MASK - yUnion.UInt) & ySignMask);
            yUnion.UInt = yTemp | (yUnion.UInt & ~ySignMask);

            // Return if the difference <= maxUlp
            return Math.Abs(xUnion.Int - yUnion.Int) <= maxUlp;
        }

        /// <summary>
        /// Compares two numbers given some amount of allowed distance.
        /// https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
        /// </summary>
        /// <param name="x">The first number.</param>
        /// <param name="y">The second number.</param>
        /// <param name="maxUlp">The number of discreet floating point values that are allowed between the two values.</param>
        /// <returns><c>true</c> if the two values are equal, otherwise false.</returns>
        public static bool Equals(double x, double y, int maxUlp)
        {
            if (maxUlp <= 0)
            {
                throw new ArgumentOutOfRangeException("Max Ulp must be greater than 0.");
            }

            DoubleLongUnion xUnion = new DoubleLongUnion
            {
                Double = x
            };
            DoubleLongUnion yUnion = new DoubleLongUnion
            {
                Double = y
            };

            // Convert to 2s complement if negative.
            ulong xSignMask = xUnion.ULong >> Precision.DOUBLE_SHIFT_BITS;
            ulong ySignMask = yUnion.ULong >> Precision.DOUBLE_SHIFT_BITS;

            ulong xTemp = ((Precision.DOUBLE_BIT_MASK - xUnion.ULong) & xSignMask);
            xUnion.ULong = xTemp | (xUnion.ULong & ~xSignMask);

            // Convert to 2s complement if negative.
            ulong yTemp = ((Precision.DOUBLE_BIT_MASK - yUnion.ULong) & ySignMask);
            yUnion.ULong = yTemp | (yUnion.ULong & ~ySignMask);

            // Return if the difference <= maxUlp
            return Math.Abs(xUnion.Long - yUnion.Long) <= maxUlp;
        }
    }
}


text:
var imageHeight = 0;

/**
 * @function addFrame
 * @private
 * @since 3.0.0
 */
var addFrame = function (texture, sourceIndex, name, frame)
{
    //  The frame values are the exact coordinates to cut the frame out of the atlas from

    var y = imageHeight - frame.y - frame.height;

    texture.add(name, sourceIndex, frame.x, y, frame.width, frame.height);

    //  These are the original (non-trimmed) sprite values
    /*
    if (src.trimmed)
    {
        newFrame.setTrim(
            src.sourceSize.w,
            src.sourceSize.h,
            src.spriteSourceSize.x,
            src.spriteSourceSize.y,
            src.spriteSourceSize.w,
            src.spriteSourceSize.h
        );
    }
    */
};

/**
 * Parses a Unity YAML File and creates Frames in the Texture.
 * For more details about Sprite Meta Data see https://docs.unity3d.com/ScriptReference/SpriteMetaData.html
 *
 * @function Phaser.Textures.Parsers.UnityYAML
 * @memberOf Phaser.Textures.Parsers
 * @private
 * @since 3.0.0
 *
 * @param {Phaser.Textures.Texture} texture - The Texture to add the Frames to.
 * @param {integer} sourceIndex - The index of the TextureSource.
 * @param {object} yaml - The YAML data.
 *
 * @return {Phaser.Textures.Texture} The Texture modified by this parser.
 */
var UnityYAML = function (texture, sourceIndex, yaml)
{
    //  Add in a __BASE entry (for the entire atlas)
    var source = texture.source[sourceIndex];

    texture.add('__BASE', sourceIndex, 0, 0, source.width, source.height);

    imageHeight = source.height;

    var data = yaml.split('\n');

    var lineRegExp = /^[ ]*(- )*(\w+)+[: ]+(.*)/;

    var prevSprite = '';
    var currentSprite = '';
    var rect = { x: 0, y: 0, width: 0, height: 0 };

    // var pivot = { x: 0, y: 0 };
    // var border = { x: 0, y: 0, z: 0, w: 0 };

    for (var i = 0; i < data.length; i++)
    {
        var results = data[i].match(lineRegExp);

        if (!results)
        {
            continue;
        }

        var isList = (results[1] === '- ');
        var key = results[2];
        var value = results[3];

        if (isList)
        {
            if (currentSprite !== prevSprite)
            {
                addFrame(texture, sourceIndex, currentSprite, rect);

                prevSprite = currentSprite;
            }

            rect = { x: 0, y: 0, width: 0, height: 0 };
        }

        if (key === 'name')
        {
            //  Start new list
            currentSprite = value;
            continue;
        }

        switch (key)
        {
            case 'x':
            case 'y':
            case 'width':
            case 'height':
                rect[key] = parseInt(value, 10);
                break;

            // case 'pivot':
            //     pivot = eval('var obj = ' + value);
            //     break;

            // case 'border':
            //     border = eval('var obj = ' + value);
            //     break;
        }
    }

    if (currentSprite !== prevSprite)
    {
        addFrame(texture, sourceIndex, currentSprite, rect);
    }

    return texture;
};

module.exports = UnityYAML;

/*
Example data:

TextureImporter:
  spritePivot: {x: .5, y: .5}
  spriteBorder: {x: 0, y: 0, z: 0, w: 0}
  spritePixelsToUnits: 100
  spriteSheet:
    sprites:
    - name: asteroids_0
      rect:
        serializedVersion: 2
        x: 5
        y: 328
        width: 65
        height: 82
      alignment: 0
      pivot: {x: 0, y: 0}
      border: {x: 0, y: 0, z: 0, w: 0}
    - name: asteroids_1
      rect:
        serializedVersion: 2
        x: 80
        y: 322
        width: 53
        height: 88
      alignment: 0
      pivot: {x: 0, y: 0}
      border: {x: 0, y: 0, z: 0, w: 0}
  spritePackingTag: Asteroids
*/

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Threading.Tasks;

namespace Typewriter.Tests.CodeModel.Support
{
    public class MethodInfo
    {
        /// <summary>
        /// summary
        /// </summary>
        /// <returns>returns</returns>
        /// <param name="parameter">param</param>
        [AttributeInfo]
        public void Method([AttributeInfo]string parameter)
        {
        }

        public T Generic<T>(T parameter)
        {
            return default(T);
        }

        public Task Task()
        {
            return null;
        }

        public Task<string> TaskString()
        {
            return null;
        }

        public Task<Nullable<int>> TaskNullableInt()
        {
            return null;
        }

        public void ArrayParameter(byte[] byteArray)
        {

        }
    }

    public class GenericMethodInfo<T>
    {
        public T Method(T parameter)
        {
            return default(T);
        }

        public T1 Generic<T1>(T1 parameter1, T parameter2)
        {
            return default(T1);
        }
    }
}


text:
'use strict';

var path       = require('path');
var fs         = require('fs-extra');

var runCommand          = require('../helpers/run-command');
var acceptance          = require('../helpers/acceptance');
var copyFixtureFiles    = require('../helpers/copy-fixture-files');
var createTestTargets   = acceptance.createTestTargets;
var teardownTestTargets = acceptance.teardownTestTargets;
var linkDependencies    = acceptance.linkDependencies;
var cleanupRun          = acceptance.cleanupRun;

var chai = require('../chai');
var expect = chai.expect;
var file = chai.file;
var dir = chai.dir;

var appName = 'some-cool-app';
var appRoot;

describe('Acceptance: nested-addons-smoke-test', function() {
  this.timeout(360000);

  before(function() {
    return createTestTargets(appName);
  });

  after(teardownTestTargets);

  beforeEach(function() {
    appRoot = linkDependencies(appName);
  });

  afterEach(function() {
    cleanupRun(appName);
    expect(dir(appRoot)).to.not.exist;
  });

  it('addons with nested addons compile correctly', function() {
    return copyFixtureFiles('addon/with-nested-addons')
      .then(function() {
        var packageJsonPath = path.join(appRoot, 'package.json');
        var packageJson = fs.readJsonSync(packageJsonPath);
        packageJson.devDependencies['ember-top-addon'] = 'latest';

        return fs.writeJsonSync(packageJsonPath, packageJson);
      })
      .then(function() {
        return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build');
      })
      .then(function() {
        expect(file('dist/assets/vendor.js')).to.contain('INNER_ADDON_IMPORT_WITH_APP_IMPORT');
        expect(file('dist/assets/vendor.js')).to.contain('INNER_ADDON_IMPORT_WITH_THIS_IMPORT');
      });
  });
});


text:
#if !defined(lint) && !defined(DOS)
static char rcsid[] = "$Id: signal.c 1025 2008-04-08 22:59:38Z hubert@u.washington.edu $";
#endif

/*======================================================================
     Different signal handlers for different signals
       - Catches all the abort signals, cleans up tty modes and then coredumps
       - Not much to do for SIGHUP
       - Not much to do for SIGTERM
       - turn SIGWINCH into a KEY_RESIZE command
       - No signals for ^Z/suspend, but do it here anyway
       - Also set up the signal handlers, and hold signals for
         critical imap sections of code.
 ====*/

#include "headers.h"
#include "alpine.h"
#include "signal.h"
#include "status.h"
#include "dispfilt.h"
#include "keymenu.h"
#include "titlebar.h"
#include "mailcmd.h"
#include "../pith/state.h"
#include "../pith/conf.h"
#include "../pith/detach.h"
#include "../pith/pipe.h"
#include "../pith/util.h"
#include "../pith/icache.h"
#include "../pith/newmail.h"
#include "../pith/imap.h"
#include "../pith/adrbklib.h"
#include "../pith/remote.h"
#include "../pith/osdep/pipe.h"

/*
 * Internal Prototypes
 */
static RETSIGTYPE auger_in_signal(int);
void		  init_sighup(void);
void		  end_sighup(void);
RETSIGTYPE	  term_signal(void);
void		  fast_clean_up(void);
static RETSIGTYPE usr2_signal(int);
static RETSIGTYPE winch_signal(int);
static RETSIGTYPE intr_signal(int);
void		  suspend_notice(char *);
void		  suspend_warning(void);

static  int cleanup_called_from_sig_handler;

/*----------------------------------------------------------------------
    Install handlers for all the signals we care to catch
  ----------------------------------------------------------------------*/
void
init_signals(void)
{
    dprint((9, "init_signals()\n"));
    init_sighup();

#ifdef	_WINDOWS
#else
# ifdef DEBUG
#  define CUSHION_SIG	(debug < 7)
# else
#  define CUSHION_SIG	(1)
# endif

    if(CUSHION_SIG){
	signal(SIGILL,  auger_in_signal);
	signal(SIGTRAP, auger_in_signal);
#   ifdef	SIGEMT
	signal(SIGEMT,  auger_in_signal);
#   endif
	signal(SIGBUS,  auger_in_signal);
	signal(SIGSEGV, auger_in_signal);
	signal(SIGSYS,  auger_in_signal);
	signal(SIGQUIT, auger_in_signal);
	/* Don't catch SIGFPE cause it's rare and we use it in a hack below*/
    }

    init_sigwinch();

    /*
     * Set up SIGUSR2 to catch signal from other software using the
     * c-client to tell us that other access to the folder is being
     * attempted.  THIS IS A TEST: if it turns out that simply
     * going R/O when another pine is started or the same folder is opened,
     * then we may want to install a smarter handler that uses idle time
     * or even prompts the user to see if it's ok to give up R/O access...
     */
    signal(SIGUSR2, usr2_signal);

    signal(SIGPIPE, SIG_IGN);
    signal(SIGINT, SIG_IGN);

#   ifdef SIGTSTP
    /* Some unexplained behaviour on Ultrix 4.2 (Hardy) seems to be
       resulting in Pine getting sent a SIGTSTP. Ignore it here.
       probably better to ignore it than let it happen in any case
     */
    signal(SIGTSTP, SIG_IGN);
#   endif /* SIGTSTP */

#   ifdef	SIGCHLD
    signal(SIGCHLD,  child_signal);
#   endif
#endif	/* !_WINDOWS */
}

/*----------------------------------------------------------------------
    Return all signal handling back to normal
  ----------------------------------------------------------------------*/
void
end_signals(int blockem)
{
#ifdef	_WINDOWS

    signal(SIGHUP,  blockem ? SIG_IGN : SIG_DFL);

#else
#ifndef	SIG_ERR
#define	SIG_ERR	(RETSIGTYPE (*)())-1
#endif

    dprint((5, "end_signals(%d)\n", blockem));
    if(signal(SIGILL,  blockem ? SIG_IGN : SIG_DFL) == SIG_ERR){
        fprintf(stderr, "Error resetting signals: %s\n",
                error_description(errno));
        exit(-1);
    }

    signal(SIGTRAP, blockem ? SIG_IGN : SIG_DFL);
#ifdef	SIGEMT
    signal(SIGEMT,  blockem ? SIG_IGN : SIG_DFL);
#endif
    signal(SIGBUS,  blockem ? SIG_IGN : SIG_DFL);
    signal(SIGSEGV, blockem ? SIG_IGN : SIG_DFL);
    signal(SIGSYS,  blockem ? SIG_IGN : SIG_DFL);
#if	defined(SIGWINCH) && defined(TIOCGWINSZ)
    signal(SIGWINCH, blockem ? SIG_IGN : SIG_DFL);
#endif
    signal(SIGQUIT, blockem ? SIG_IGN : SIG_DFL);
#ifdef SIGTSTP
    signal(SIGTSTP, blockem ? SIG_IGN : SIG_DFL);
#endif /* SIGTSTP */
    signal(SIGHUP,  blockem ? SIG_IGN : SIG_DFL);
    signal(SIGTERM, blockem ? SIG_IGN : SIG_DFL);
    signal(SIGINT,  blockem ? SIG_IGN : SIG_DFL);

#endif	/* !_WINDOWS */
}

/*----------------------------------------------------------------------
     Handle signals caused by aborts -- SIGSEGV, SIGILL, etc

Call panic which cleans up tty modes and then core dumps
  ----------------------------------------------------------------------*/
static RETSIGTYPE
auger_in_signal(int sig)
{
    char buf[100];

    end_signals(1);			/* don't catch any more signals */
    imap_flush_passwd_cache(FALSE);

    snprintf(buf, sizeof(buf), "Received abort signal(sig=%d)", sig);
    buf[sizeof(buf)-1] = '\0';

    alpine_panic(buf);				/* clean up and get out */

    exit(-1);				/* in case panic doesn't kill us */
}

/*----------------------------------------------------------------------
   Install signal handler to deal with hang up signals -- SIGHUP, SIGTERM

  ----------------------------------------------------------------------*/
void
init_sighup(void)
{
#if	!(defined(DOS) && !defined(_WINDOWS))
#if	defined(_WINDOWS) || defined(OS2)
    signal(SIGHUP, (void *) hup_signal);
#else
    signal(SIGHUP, hup_signal);
#endif
#endif
#if	!(defined(DOS) || defined(OS2))
    signal(SIGTERM, term_signal);
#endif
}

/*----------------------------------------------------------------------
   De-Install signal handler to deal with hang up signals -- SIGHUP, SIGTERM

  ----------------------------------------------------------------------*/
void
end_sighup(void)
{
#if	!(defined(DOS) && !defined(_WINDOWS))
    signal(SIGHUP, SIG_IGN);
#endif
#if	!(defined(DOS) || defined(OS2))
    signal(SIGTERM, SIG_IGN);
#endif
}

/*----------------------------------------------------------------------
      handle hang up signal -- SIGHUP

Not much to do. Rely on periodic mail file check pointing.
  ----------------------------------------------------------------------*/
RETSIGTYPE
hup_signal(void)
{
    if(ps_global)
      ps_global->signal_in_progress = 1;
    end_signals(1);			/* don't catch any more signals */
    dprint((1, "\n\n** Received SIGHUP **\n\n\n\n"));
    cleanup_called_from_sig_handler = 1;
    fast_clean_up();
#if	defined(DEBUG)
    if(debugfile)
      fclose(debugfile);
#endif

    _exit(0);				/* cleaning up can crash */
}

/*----------------------------------------------------------------------
      Timeout when no user input for a long, long time.
      Treat it pretty much the same as if we got a HUP.
      Only difference is we sometimes turns the timeout off (when composing).
  ----------------------------------------------------------------------*/
void
user_input_timeout_exit(int to_hours)
{
    char msg[80];

    dprint((1,
	   "\n\n** Exiting: user input timeout (%d hours) **\n\n\n\n",
	   to_hours));
    snprintf(msg, sizeof(msg), _("\n\nAlpine timed out (No user input for %d %s)\n"), to_hours,
	    to_hours > 1 ? "hours" : "hour");
    msg[sizeof(msg)-1] = '\0';
    fast_clean_up();
    end_screen(msg, 0);
    end_titlebar();
    end_keymenu();
    end_keyboard(F_ON(F_USE_FK,ps_global));
    end_tty_driver(ps_global);
    end_signals(0);
#if	defined(DEBUG) && (!defined(DOS) || defined(_WINDOWS))
    if(debugfile)
      fclose(debugfile);
#endif
    exit(0);
}

/*----------------------------------------------------------------------
      handle terminate signal -- SIGTERM

Not much to do. Rely on periodic mail file check pointing.
  ----------------------------------------------------------------------*/
RETSIGTYPE
term_signal(void)
{
#if !defined(DOS) && !defined(OS2)
    end_signals(1);			/* don't catch any more signals */
    dprint((1, "\n\n** Received SIGTERM **\n\n\n\n"));
    cleanup_called_from_sig_handler = 1;
    fast_clean_up();
#if	defined(DEBUG) && (!defined(DOS) || defined(_WINDOWS))
    if(debugfile)
      fclose(debugfile);
#endif
    printf(_("\n\nAlpine finished. Received terminate signal\n\n"));
#endif	/* !DOS */
    exit(0);
}

/*----------------------------------------------------------------------
     Handle cleaning up mail streams and tty modes...
Not much to do. Rely on periodic mail file check pointing.  Don't try
cleaning up screen or flushing output since stdout is likely already
gone.  To be safe, though, we'll at least restore the original tty mode.
Also delete any remnant _DATAFILE_ from sending-filters.
  ----------------------------------------------------------------------*/
void
fast_clean_up(void)
{
#if !defined(DOS) && !defined(OS2)
    int         i;
    MAILSTREAM *m;
#endif

    dprint((1, "fast_clean_up()\n"));

    if(ps_global->expunge_in_progress){
	PineRaw(0);
	return;
    }

    /*
     * This gets rid of temporary cache files for remote addrbooks.
     */
    completely_done_with_adrbks();

    /*
     * This flushes out deferred changes and gets rid of temporary cache
     * files for remote config files.
     */
    if(ps_global->prc){
	if(ps_global->prc->outstanding_pinerc_changes)
	  write_pinerc(ps_global, Main,
		       cleanup_called_from_sig_handler ? WRP_NOUSER : WRP_NONE);

	if(ps_global->prc->rd)
	  rd_close_remdata(&ps_global->prc->rd);

	free_pinerc_s(&ps_global->prc);
    }

    /* as does this */
    if(ps_global->post_prc){
	if(ps_global->post_prc->outstanding_pinerc_changes)
	  write_pinerc(ps_global, Post,
		       cleanup_called_from_sig_handler ? WRP_NOUSER : WRP_NONE);

	if(ps_global->post_prc->rd)
	  rd_close_remdata(&ps_global->post_prc->rd);

	free_pinerc_s(&ps_global->post_prc);
    }

    /*
     * Can't figure out why this section is inside the ifdef, but no
     * harm leaving it that way, I guess.
     */
#if !defined(DOS) && !defined(OS2)
    for(i = 0; i < ps_global->s_pool.nstream; i++){
	m = ps_global->s_pool.streams[i];
	if(m && !m->lock)
	  pine_mail_actually_close(m);
    }

    PineRaw(0);

#endif	/* !DOS */

    imap_flush_passwd_cache(TRUE);

    dprint((1, "done with fast_clean_up\n"));
}

#if !defined(DOS) && !defined(OS2)
/*----------------------------------------------------------------------
      handle hang up signal -- SIGUSR2

Not much to do. Rely on periodic mail file check pointing.
  ----------------------------------------------------------------------*/
static RETSIGTYPE
usr2_signal(int sig)
{
    char        c, *mbox, mboxbuf[20];
    int         i;
    MAILSTREAM *stream;
    NETMBX      mb;

    for(i = 0; i < ps_global->s_pool.nstream; i++){
	stream = ps_global->s_pool.streams[i];
	if(stream
	   && sp_flagged(stream, SP_LOCKED)
	   && !sp_dead_stream(stream)
	   && !stream->lock
	   && !stream->rdonly
	   && stream->mailbox
	   && (c = *stream->mailbox) != '{' && c != '*'){
	    pine_mail_check(stream);		/* write latest state   */
	    stream->rdonly = 1;			/* and become read-only */
	    (void) pine_mail_ping(stream);
	    mbox = stream->mailbox;
	    if(!strucmp(stream->mailbox, ps_global->inbox_name)
	       || !strcmp(stream->mailbox, ps_global->VAR_INBOX_PATH)
	       || !strucmp(stream->original_mailbox, ps_global->inbox_name)
	       || !strcmp(stream->original_mailbox, ps_global->VAR_INBOX_PATH))
	      mbox = "INBOX";
	    else if(mail_valid_net_parse(stream->mailbox, &mb) && mb.mailbox)
	      mbox = mb.mailbox;

	    q_status_message1(SM_ASYNC, 3, 7,
	     _("Another email program is accessing %s. Session now Read-Only."),
	     short_str((mbox && *mbox) ? mbox : "folder",
		       mboxbuf, sizeof(mboxbuf), 19, FrontDots));
	    dprint((1, "** folder %s went read-only **\n\n",
			stream->mailbox));
	}
    }
}
#endif

/*----------------------------------------------------------------------
   Install signal handler to deal with window resize signal -- SIGWINCH

  ----------------------------------------------------------------------*/
void
init_sigwinch (void)
{
#if	defined(SIGWINCH) && defined(TIOCGWINSZ)
    signal(SIGWINCH, winch_signal);
#endif
}

#if	defined(SIGWINCH) && defined(TIOCGWINSZ)
/*----------------------------------------------------------------------
   Handle window resize signal -- SIGWINCH

   The planned strategy is just force a redraw command. This is similar
  to new mail handling which forces a noop command. The signals are
  help until pine reads input. Then a KEY_RESIZE is forced into the command
  stream .
   Note that ready_for_winch is only non-zero inside the read_char function,
  so the longjmp only ever happens there, and it is really just a jump
  from lower down in the function up to the top of that function.  Its
  purpose is to return a KEY_RESIZE from read_char when interrupted
  out of the select lower down in read_char.
  ----------------------------------------------------------------------*/
extern jmp_buf  winch_state;
extern int      ready_for_winch, winch_occured;

static RETSIGTYPE
winch_signal(int sig)
{
    clear_cursor_pos();
    init_sigwinch();
    winch_cleanup();
}
#endif

/*
 * winch_cleanup -
 */
void
winch_cleanup(void)
{
#if	defined(SIGWINCH) && defined(TIOCGWINSZ)
    if(ready_for_winch)
      longjmp(winch_state, 1);
    else
      winch_occured = 1;
#endif
}

#ifdef	SIGCHLD
/*----------------------------------------------------------------------
   Handle child status change -- SIGCHLD

   The strategy here is to install the handler when we spawn a child, and
   to let the system tell us when the child's state has changed.  In the
   mean time, we can do whatever.  Typically, "whatever" is spinning in a
   loop alternating between sleep and new_mail calls intended to keep the
   IMAP stream alive.

  ----------------------------------------------------------------------*/
static short    child_signalled, child_jump;
static jmp_buf  child_state;

RETSIGTYPE
child_signal(int sig)
{
#ifdef	BACKGROUND_POST
    /*
     * reap background posting process
     */
    if(ps_global->post && ps_global->post->pid){
	pid_t pid;
	int   es;

	pid = process_reap(ps_global->post->pid, &es, PR_NOHANG);
	if(pid == ps_global->post->pid){
	    ps_global->post->status = es;
	    ps_global->post->pid = 0;
	    return;
	}
	else if(pid < 0 && errno != EINTR){
	    fs_give((void **) &ps_global->post);
	}
    }
#endif /* BACKGROUND_POST */

    child_signalled = 1;
    if(child_jump)
      longjmp(child_state, 1);
}
#endif /* SIGCHLD */

/*
 * pipe_callback - handle pine-specific pipe setup like child
 *		   signal handler and possibly any display stuff
 * BUG: this function should probably be in a "alpine/pipe.c"
 */
void
pipe_callback(PIPE_S *syspipe, int flags, void *data)
{
#ifdef _WINDOWS
    bitmap_t bitmap;
#endif
    if(flags & OSB_PRE_OPEN){
	dprint((5, "Opening pipe: (%s%s%s%s%s%s)\n",
		   (syspipe->mode & PIPE_WRITE)   ? "W":"", (syspipe->mode & PIPE_READ)  ? "R":"",
		   (syspipe->mode & PIPE_NOSHELL) ? "N":"", (syspipe->mode & PIPE_PROT)  ? "P":"",
		   (syspipe->mode & PIPE_USER)    ? "U":"", (syspipe->mode & PIPE_RESET) ? "T":""));

#ifdef	_WINDOWS
	q_status_message(SM_ORDER, 0, 0,
			 "Waiting for called program to finish...");

	flush_status_messages(1);
	setbitmap(bitmap);
	draw_keymenu(&pipe_cancel_keymenu, bitmap, ps_global->ttyo->screen_cols,
		     1-FOOTER_ROWS(ps_global), 0, FirstMenu);
#else  /* UNIX */

	if(!(syspipe->mode & (PIPE_WRITE | PIPE_READ)) && !(syspipe->mode & PIPE_SILENT)){
	    flush_status_messages(0);		/* just clean up display */
	    ClearScreen();
	    fflush(stdout);
	}

	if(syspipe->mode & PIPE_RESET)
	  ttyfix(0);

#ifdef	SIGCHLD
	/*
	 * Prepare for demise of child.  Use SIGCHLD if it's available so
	 * we can do useful things, like keep the IMAP stream alive, while
	 * we're waiting on the child. The handler may have been changed by
	 * something in the composer, in particular, by an alt_editor call.
	 * So we need to re-set it to child_signal and then set it back
	 * when we're done.
	 */
	child_signalled = child_jump = 0;
	syspipe->chld   = signal(SIGCHLD, child_signal);
#endif
#endif /* UNIX */
    }
    else if(flags & OSB_POST_OPEN){
#ifdef	_WINDOWS

	clearfooter(ps_global);
	ps_global->mangled_footer = 1;

	if((int) data == -2)
	  q_status_message1(SM_ORDER, 2, 3, "Ignoring completion of %s", syspipe->command);

#else  /* UNIX */
	if(!(syspipe->mode & (PIPE_WRITE | PIPE_READ)) && !(syspipe->mode & PIPE_SILENT)){
	    ClearScreen();
	    ps_global->mangled_screen = 1;
	}

	if(syspipe->mode & PIPE_RESET){
	  ttyfix(1);
	  ps_global->mangled_screen = 1;
	}

#ifdef	SIGCHLD
	(void) signal(SIGCHLD,  SIG_DFL);
#endif
#endif /* UNIX */
    }
    else if(flags & OSB_PRE_CLOSE){
#ifdef	SIGCHLD
	/*
	 * this is here so close_system_pipe so it has something
	 * to do while we're waiting on the other end of the
	 * pipe to complete.  When we're in the background for
	 * a shell, the the side effect is pinging
	 */
	RETSIGTYPE (*alarm_sig)();
	int	old_cue = F_ON(F_SHOW_DELAY_CUE, ps_global);

	/*
	 * remember the current SIGALRM handler, and make sure it's
	 * installed when we're finished just in case the longjmp
	 * out of the SIGCHLD handler caused sleep() to lose it.
	 * Don't pay any attention to that man behind the curtain.
	 */
	alarm_sig = signal(SIGALRM, SIG_IGN);
	(void) F_SET(F_SHOW_DELAY_CUE, ps_global, 0);
	ps_global->noshow_timeout = 1;
	while(!child_signalled){
	    /* wake up and prod server */
	    if(!(syspipe->mode & PIPE_NONEWMAIL))
	      new_mail(0, 2,
		       (syspipe->mode & PIPE_RESET) ? NM_NONE : NM_DEFER_SORT);

	    if(!child_signalled){
		if(setjmp(child_state) == 0){
		    child_jump = 1;	/* prepare to wake up */
		    sleep(600);		/* give it 5mins to happend */
		}
		else
		  our_sigunblock(SIGCHLD);
	    }

	    child_jump = 0;
	}

	ps_global->noshow_timeout = 0;
	F_SET(F_SHOW_DELAY_CUE, ps_global, old_cue);
	(void) signal(SIGALRM, alarm_sig);
	(void) signal(SIGCHLD, syspipe->chld);
#endif
    }
    else if(flags & OSB_POST_CLOSE){
	if(syspipe->mode & PIPE_RESET){		/* restore our tty modes */
	  ttyfix(1);
	  ps_global->mangled_screen = 1;
	}

	if(!(syspipe->mode & (PIPE_WRITE | PIPE_READ | PIPE_SILENT))){
	    ClearScreen();			/* No I/O to forked child */
	    ps_global->mangled_screen = 1;
	}
    }
}

/*
 * Command interrupt support.
 */

static RETSIGTYPE
intr_signal(int sig)
{
    ps_global->intr_pending = 1;
}

int
intr_handling_on(void)
{
#ifdef	_WINDOWS
    return 0;				/* No interrupts in Windows */
#else  /* UNIX */
    if(signal(SIGINT, intr_signal) == intr_signal)
      return 0;				/* already installed */

    intr_proc(1);
    if(ps_global && ps_global->ttyo)
      draw_cancel_keymenu();

    return 1;
#endif /* UNIX */
}

void
intr_handling_off(void)
{
#ifdef	_WINDOWS
#else  /* UNIX */
    if(signal(SIGINT, SIG_IGN) == SIG_IGN)	/* already off! */
      return;

    ps_global->intr_pending = 0;
    intr_proc(0);
    if(ps_global && ps_global->ttyo)
      blank_keymenu(ps_global->ttyo->screen_rows - 2, 0);

    ps_global->mangled_footer = 1;
#endif /* UNIX */
}

/*----------------------------------------------------------------------
     Set or reset what needs to be set when coming out of pico to run
     an alternate editor.

   Args:   come_back -- If come_back is 0 we're going out of our environment
		          to set up for an external editor.
		        If come_back is 1 we're coming back into pine.
  ----------------------------------------------------------------------*/
int
ttyfix(int come_back)
{
#if	defined(DEBUG) && (!defined(DOS) || defined(_WINDOWS))
    if(debugfile)
      fflush(debugfile);
#endif

    if(come_back){
#ifdef OS2
	enter_text_mode(NULL);
#endif
	init_screen();
	init_tty_driver(ps_global);
	init_keyboard(F_ON(F_USE_FK,ps_global));
#ifdef OS2
	dont_interrupt();
#endif
	fix_windsize(ps_global);
    }
    else{
	EndInverse();
	end_keyboard(F_ON(F_USE_FK,ps_global));
	end_tty_driver(ps_global);
	end_screen(NULL, 0);
#ifdef OS2
	interrupt_ok();
#endif
    }

    return(0);
}

/*----------------------------------------------------------------------
     Suspend Pine. Reset tty and suspend. Suspend is finished when this returns

   Args:  The pine structure

 Result:  Execution suspended for a while. Screen will need redrawing
          after this is done.

 Instead of the usual handling of ^Z by catching a signal, we actually read
the ^Z and then clean up the tty driver, then kill ourself to stop, and
pick up where we left off when execution resumes.
  ----------------------------------------------------------------------*/
UCS
do_suspend(void)
{
    struct pine *pine = ps_global;
    time_t now;
    UCS retval;
#if defined(DOS) || defined(OS2)
    int   result, orig_cols, orig_rows;
#else
    int   isremote;
#endif
#ifdef	DOS
    static char *shell = NULL;
#define	STD_SHELL	"COMMAND.COM"
#else
#ifdef	OS2
    static char *shell = NULL;
#define	STD_SHELL	"CMD.EXE"
#endif
#endif

    if(!have_job_control()){
	bogus_command(ctrl('Z'), F_ON(F_USE_FK, pine) ? "F1" : "?");
	return(NO_OP_COMMAND);
    }

    if(F_OFF(F_CAN_SUSPEND, pine)){
	q_status_message(SM_ORDER | SM_DING, 3, 3,
			 _("Alpine suspension not enabled - see help text"));
	return(NO_OP_COMMAND);
    }

#ifdef	_WINDOWS
    mswin_minimize();
    return(NO_OP_COMMAND);
#else

    isremote = (ps_global->mail_stream && ps_global->mail_stream->mailbox
		&& (*ps_global->mail_stream->mailbox == '{'
		    || (*ps_global->mail_stream->mailbox == '*'
			&& *(ps_global->mail_stream->mailbox + 1) == '{')));

    now = time((time_t *)0);
    dprint((1, "\n\n --- %s - SUSPEND ----  %s",
	       isremote ? "REMOTE" : "LOCAL", ctime(&now)));
    ttyfix(0);

#if defined(DOS) || defined(OS2)
    suspend_notice("exit");
    if (!shell){
	char *p;

	if (!((shell = getenv("SHELL")) || (shell = getenv("COMSPEC"))))
	  shell = STD_SHELL;

	shell = cpystr(shell);			/* copy in free storage */
	for(p = shell; (p = strchr(p, '/')); p++)
	  *p = '\\';
    }

    result = system(shell);
#else
    if(F_ON(F_SUSPEND_SPAWNS, ps_global)){
	PIPE_S *syspipe;
	int flag = some_stream_is_locked() ? PIPE_NONEWMAIL : 0;

	flag |= PIPE_USER|PIPE_RESET;
	if((syspipe = open_system_pipe(NULL, NULL, NULL, flag,
				      0, pipe_callback, pipe_report_error)) != NULL){
	    suspend_notice("exit");
#ifndef	SIGCHLD
	    if(isremote)
	      suspend_warning();
#endif
	    (void) close_system_pipe(&syspipe, NULL, pipe_callback);
	}
    }
    else{
	suspend_notice("fg");

	if(isremote)
	  suspend_warning();

	stop_process();
    }
#endif	/* DOS */

    now = time((time_t *)0);
    dprint((1, "\n\n ---- RETURN FROM SUSPEND ----  %s",
               ctime(&now)));

    ttyfix(1);

#if defined(DOS) || defined(OS2)
    orig_cols = pine->ttyo->screen_cols;
    orig_rows = pine->ttyo->screen_rows;
#endif

    fix_windsize(pine);

#if defined(DOS) || defined(OS2)
    if(orig_cols != pine->ttyo->screen_cols ||
       orig_rows != pine->ttyo->screen_rows)
	retval = KEY_RESIZE;
    else
#endif
      retval = ctrl('L');;

#if	defined(DOS) || defined(OS2)
    if(result == -1)
      q_status_message1(SM_ORDER | SM_DING, 3, 4,
			_("Error loading \"%s\""), shell);
#endif

    if(isremote && !ps_global->mail_stream->lock
		&& !pine_mail_ping(ps_global->mail_stream))
      q_status_message(SM_ORDER | SM_DING, 4, 9,
		       _("Suspended for too long, IMAP connection broken"));

    return(retval);
#endif	/* !_WINDOWS */
}

/*----------------------------------------------------------------------
 ----*/
void
suspend_notice(char *s)
{
    printf(_("\nAlpine suspended. Give the \"%s\" command to come back.\n"), s);
    fflush(stdout);
}

/*----------------------------------------------------------------------
 ----*/
void
suspend_warning(void)
{
    puts(_("Warning: Your IMAP connection will be closed if Alpine"));
    puts(_("is suspended for more than 30 minutes\n"));
    fflush(stdout);
}

/*----------------------------------------------------------------------
 ----*/
void
fix_windsize(struct pine *pine)
{
    int old_width = pine->ttyo->screen_cols;

    dprint((9, "fix_windsize()\n"));
    mark_keymenu_dirty();
    mark_status_dirty();
    mark_titlebar_dirty();
    clear_cursor_pos();
    get_windsize(pine->ttyo);

    if(old_width != pine->ttyo->screen_cols)
      clear_index_cache(pine->mail_stream, 0);
}


text:
include $(GOROOT)/src/Make.inc

export XBPS_SRCPKGDIR:=/home/strings/vanilla/srcpkgs

TARG=xbps
GOFILES=xbps.go masterdir.go template.go common.go
GOFMT=gofmt -l -w
include $(GOROOT)/src/Make.pkg

format:
	    ${GOFMT} .


text:
require 'spec_helper'

describe 'bareos::director::counter' do
  let(:title) { 'name' }

  filename = '/etc/bareos/bareos-dir.d/counter/name.conf'

  context 'with default values for all parameters' do
    it { is_expected.to compile.with_all_deps }
    it { is_expected.to contain_class('bareos::director') }
    it { is_expected.to contain_file(filename).with_content(%r{^Counter \{$}) }
    it { is_expected.to contain_file(filename).with_content(%r{Name = "name"$}) }
    it { is_expected.to contain_file(filename).with_tag(['bareos', 'bareos_director']) }
  end

  context 'with all params set' do
    res = BareosResourceHelper.new('Counter')
    res.param('name', 'Name', 'name').
      param('description', 'Description', 'string').
      param('catalog', 'Catalog', 'res').
      param('maximum', 'Maximum', 'pint32').
      param('minimum', 'Minimum', 'int32').
      param('wrap_counter', 'Wrap Counter', 'res')

    let(:params) { res.params }
    # required resources
    let(:pre_condition) do
      '
      bareos::director::catalog { "name":
        db_driver => "sqlite3",
        db_name   => "test",
      }
      '
    end

    it { is_expected.to compile.with_all_deps }
    it { is_expected.to contain_file(filename).with_content(res.content) }
    it do
      is_expected.to contain_file(filename).
        that_notifies('Service[bareos-dir]').
        that_requires('Bareos::Director::Catalog[name]')
    end
  end

  context 'with ensure absent' do
    let(:params) { { 'ensure' => 'absent' } }

    it { is_expected.to contain_file(filename).with_ensure('absent') }
  end
end


text:
"use strict";

var React = require('react');

var Modal = require('react-bootstrap').Modal;
var Button = require('react-bootstrap').Button;

var Form = require('react-bootstrap').Form;
var FormControl = require('react-bootstrap').FormControl;
var FormGroup = require('react-bootstrap').FormGroup;

var config = require('../../configuration');
var log = require('../../logger');
var Eventer = require('../../eventer');

var Blink1Service = require('../../server/blink1Service');
var PatternsService = require('../../server/patternsService');

var ButtonToolbar = require('react-bootstrap').ButtonToolbar;

var BigButton = require('./bigButton');

var buttonsUserDefault = [
  { name: "Available", type: "color", color: "#00FF00", millis: 100, ledn: 0 },
  { name: "Busy", type: "color", color: "#ffFF00", millis: 100, ledn: 0},
  { name: "Away", type: "color", color: "#ff0000", millis: 100, ledn: 0 },
  { name: "Meeting", type: "color", color: "#0000ff", millis: 100, ledn: 0 },
  { name: "Out of Office", type: "color", color: "#FFBF00", millis:100, ledn: 0 }
];

var BigButtonSet = React.createClass({
  getInitialState: function() {
    // var self = this;
    var buttonsUser = config.readSettings('bigButtons');
    if( !buttonsUser ) {
      buttonsUser = buttonsUserDefault;
    }
    Eventer.on('playBigButtonUser', this.playBigButtonUser );
    Eventer.on('playBigButtonSys', this.playBigButtonSys );

    // fill out 'millis' field on any buttons that don't have it
    buttonsUser = buttonsUser.map((b) => { if( b.millis == undefined) { b.millis = 100;} return b});

    return {
      buttonsSys: [
        { name: "Color Cycle",  type: "sys", iconClass:"fa fa-spinner fa-2x" },
        { name: "Mood Light",   type: "sys", iconClass:"fa fa-asterisk fa-2x" },
        { name: "Party",        type: "sys", iconClass:"fa fa-bullhorn fa-2x" },
        { name: "Strobe Light", type: "sys", iconClass:"fa fa-bullseye fa-2x" },
        { name: "White",        type: "sys", iconClass:"fa fa-sun-o fa-2x" },
        // { name: "Reset",        type: "sys", iconClass:"fa fa-undo fa-2x" },
        { name: "Off",          type: "sys", iconClass:"fa fa-power-off fa-2x" }
      ],
      buttonsUser: buttonsUser,
      tempname: '',
      tmpidx:-1
    };
  },
  saveButtons: function(buttonsUserNew) {
    this.setState( {buttonsUser: buttonsUserNew });
    config.saveSettings("bigButtons", buttonsUserNew);
    Eventer.emit('bigButtonsUpdated');
  },
  addBigButton: function() { // FIXME: this is hacky
    var blink1id = Blink1Service.getCurrentBlink1Id();
    var newbut = {
      name: "Big Button "+this.state.buttonsUser.length,
      type: "color",
      color: Blink1Service.getCurrentColor(blink1id).toHexString(),
      ledn: Blink1Service.getCurrentLedN(blink1id),
      millis: Blink1Service.getCurrentMillis(blink1id),
      blink1Id: blink1id
    };
    log.msg("addBigButton: ", newbut);
    var newbuttons = this.state.buttonsUser.concat( newbut );
    this.saveButtons( newbuttons );
  },
  onEdit: function(cmd, idx, arg) {
    var mybuttons = this.state.buttonsUser.concat(); // clone;
    // var mybuttons = Object.assign({}, this.state.buttonsUser );
    if( cmd === 'delete' ) {
      mybuttons.splice( idx,1 );
    }
    else if( cmd === 'moveleft') {
      if( idx > 0 ) {
        var tmpbutton = mybuttons[idx-1];
        mybuttons[idx-1] = mybuttons[idx];
        mybuttons[idx] = tmpbutton;
      }
    }
    else if( cmd === 'setcolor') {
      mybuttons[idx] = {
        name: mybuttons[idx].name,
        type:'color',
        color: Blink1Service.getCurrentColor().toHexString(),
        ledn: Blink1Service.getCurrentLedN(),
        millis: Blink1Service.getCurrentMillis(),
        blink1Id: Blink1Service.getCurrentBlink1Id()
      };
    }
    else if( cmd === 'setserial' ) {
      var button = mybuttons[idx];
      // why do I have to re-create the object?
      // Why can't I just "mybuttons[idx].blink1Id = arg"
      mybuttons[idx] = {
        name: button.name,
        type: button.type,
        color: button.color,
        patternId: button.patternId,
        millis: button.millis,
        ledn: button.ledn,
        blink1Id: arg
      };
    }
    else if( cmd === 'setpattern') {
      var patt = PatternsService.getPatternById(arg);
      var name = patt.name;
      // log.msg("setpattern:",patt.colors[0].rgb);
      mybuttons[idx] = {
        name: name,
        type:'pattern',
        color: patt.colors[0].rgb,
        patternId: arg
      };
    }
    else if( cmd === 'rename' ) {
      // this.state.buttonsUser[idx].name = arg;
      mybuttons[idx].name = arg;
    }
    this.saveButtons( mybuttons );
  },
  handleEditName: function(idx) {
    var button = this.state.buttonsUser[idx];
    this.setState({showEditMenu:true, tempname: button.name, tempidx:idx});
  },
  handleEditClose: function(e) {
    e.preventDefault(); // prevent Enter key from reloading page
    // log.msg("BigButtonSet.handleEditNameClose:",this.state.tempname, this.state.tempidx);
    this.onEdit('rename', this.state.tempidx, this.state.tempname);
    this.hideEditMenu();
  },
  hideEditMenu: function() {
    this.setState({showEditMenu:false});
  },

  // internal function used by differnt kinds of buttons
  setBlink1Color: function(color, millis, ledn, blink1id) {
    ledn = ledn || 0; // 0 means all
    // if( blink1id === undefined ) {
    //   Blink1Service.getAllSerials().map( function(serial,idx) {
    //     Blink1Service.fadeToColor( 100, color, ledn, serial );  // FIXME: millis
    //   });
    // } else {
    Blink1Service.fadeToColor( millis, color, ledn, blink1id );
    // }
  },
  // playPattern: function(patternid) {
  //     PatternsService.playPatternFrom( patternid );
  // },
  // can be called outside of this class
  playBigButtonUser: function(buttonindex,evt) {
    var button = this.state.buttonsUser[buttonindex];
    if( button ) {
      log.msg("bigButtonSet.playBigButtonUser:", buttonindex, button.name, button.blink1Id, button.ledn);
      if( button.type === 'color' ) {
        this.setBlink1Color( button.color, button.millis, button.ledn, button.blink1Id );
      }
      else if( button.type === 'pattern' ) {
        PatternsService.playPatternFrom( button.name, button.patternId, button.blink1Id );
      }
      Eventer.addStatus( {type:'trigger', source:'button', id:button.name, text:button.name} );
    }
    else {
      log.msg("bigButtonSet.playBigButtonUser: no button ", buttonindex);
    }
  },
  playBigButtonSys: function(buttonname) {
    var button = this.state.buttonsSys.find( function(b) { return b.name === buttonname; });
    if( !button ) {
      log.msg("bigButtonSet.playBigButtonSys: no button ", buttonname);
      return;
    }
    if( button.name === "White" ) {
      this.setBlink1Color( "#FFFFFF" );
    }
    else if( button.name === "Reset" ) {
      Blink1Service.off();  // FIXME: what is reset?
    }
    else if( button.name === "Off" ) {
      PatternsService.stopAllPatterns();
      Blink1Service.off();
    }
    else if( button.name === "Color Cycle" ) {
      Blink1Service.toyStart('colorcycle');
    }
    else if( button.name === "Mood Light" ) {
      Blink1Service.toyStart('moodlight');
    }
    else if( button.name === "Party" ) {
      Blink1Service.toyStart('party');
    }
    else if( button.name === "Strobe Light" ) {
      Blink1Service.toyStart('strobe');
    }
    Eventer.addStatus( {type:'trigger', source:'button', id:button.name, text:button.name} );
  },
  handleInputChange: function(event) {
    var target = event.target;
    var value = target.type === 'checkbox' ? target.checked : target.value;
    var name = target.name;
    this.setState({ [name]: value });
  },

  render: function() {
    var self = this;
    var patterns = PatternsService.getAllPatterns();
    var serials = Blink1Service.getAllSerials();

    var createBigButtonSys = function(button, index) { // FIXME: understand bind()
      return (
            <BigButton key={index} name={button.name} type='sys'  iconClass={button.iconClass}
              onClick={this.playBigButtonSys.bind(null, button.name)} idx={index} />
      );
    };
    var createBigButtonUser = function(button, index) { // FIXME: understand bind()
      return (
            <BigButton key={index} idx={index} name={button.name} type={button.type}
                color={button.color} millis={button.millis} patterns={patterns} serials={serials} serial={button.blink1Id}
                onClick={this.playBigButtonUser.bind(this,index)}
                onEdit={this.onEdit} onEditName={this.handleEditName.bind(this,index)}
                />
      );
    };

    return (

        <ButtonToolbar style={{padding: 5}}>
          {this.state.buttonsSys.map(createBigButtonSys, this)}
        </ButtonToolbar>

          <ButtonToolbar style={{width:1500}}>
            {this.state.buttonsUser.map(createBigButtonUser, this)}
            <BigButton key="add" name="add button" type="sys" onClick={this.addBigButton} iconClass="fa fa-eyedropper fa-2x" />
          </ButtonToolbar>

        <Modal show={this.state.showEditMenu} onHide={this.handleEditClose} bsSize="small" >
          <Modal.Header closeButton>
          <Modal.Title>Edit Button Name</Modal.Title>
          </Modal.Header>
          <Modal.Body>
            <Form inline onSubmit={this.handleEditClose} >
              <FormControl type="text" placeholder="Enter name"
                 name="tempname" value={this.state.tempname} onChange={this.handleInputChange} />
            </Form>
          </Modal.Body>
          <Modal.Footer>
            <Button onClick={this.hideEditMenu}>Cancel</Button>
            <Button onClick={this.handleEditClose}>OK</Button>
          </Modal.Footer>
        </Modal>

    );
  }
});

module.exports = BigButtonSet;


text:
The library makes extensive use of Pandas data frames representing measurements.
The data frames typically have the following columns:

`benchmark, fuzzer, trial_id, time, edges_covered, ...`

We can differentiate three types of data frames described below.

### Experiment

An "experiment" represents a data frame that includes measurements on multiple benchmarks, multiple fuzzers, and multiple trials.

Functions taking experiment data have parameter name `experiment_df`.

### Benchmark

A "benchmark" represents a data frame that includes measurements on _single_ benchmark. (It can still have multiple fuzzers, and multiple trials.)

Functions taking benchmark data have parameter name `benchmark_df`.

### Snapshot

To compare fuzzers, e.g., based on the coverage they reached, we need to select a point in time along the course of the (typically 24 hours long) experiment, to take the coverage measurements from.
We call this time the _snapshot time_.
Typically we are interested in the maximum coverage reachable by a fuzzer, in which case the best is to pick the latest possible time.
The measurements taken at that selected snapshot time will be the input of most of our analysis (e.g., for ranking, statistical tests).
Therefore a "snapshot" represents a data frame where all `time` values are the same for a given `benchmark`.

Functions taking a snapshot of a benchmark have parameter name `benchmark_snapshot_df`.
Functions taking the snapshot of all benchmarks in an experiment have parameter name `experiment_snapshot_df`.


text:
//----------------------------------------------------------------------------------------------
// <copyright file="ListProcessesOperation.cs" company="Microsoft Corporation">
//     Licensed under the MIT License. See LICENSE.TXT in the project root license information.
// </copyright>
//----------------------------------------------------------------------------------------------

using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Tools.WindowsDevicePortal;
using static Microsoft.Tools.WindowsDevicePortal.DevicePortal;

namespace XboxWdpDriver
{
    /// <summary>
    /// Helper for Listing processes
    /// </summary>
    public class ListProcessesOperation
    {
        /// <summary>
        /// Main entry point for handling listing processes
        /// </summary>
        /// <param name="portal">DevicePortal reference for communicating with the device.</param>
        /// <param name="parameters">Parsed command line parameters.</param>
        public static void HandleOperation(DevicePortal portal, ParameterHelper parameters)
        {
            RunningProcesses runningProcesses = null;
            if (parameters.HasFlag(ParameterHelper.Listen))
            {
                ManualResetEvent runningProcessesReceived = new ManualResetEvent(false);

                WebSocketMessageReceivedEventHandler<RunningProcesses> runningProcessesReceivedHandler =
                    delegate(DevicePortal sender, WebSocketMessageReceivedEventArgs<RunningProcesses> runningProccesesArgs)
                    {
                        if (runningProccesesArgs.Message != null)
                        {
                            runningProcesses = runningProccesesArgs.Message;
                            runningProcessesReceived.Set();
                        }
                    };

                portal.RunningProcessesMessageReceived += runningProcessesReceivedHandler;

                Task startListeningForProcessesTask = portal.StartListeningForRunningProcessesAsync();
                startListeningForProcessesTask.Wait();

                runningProcessesReceived.WaitOne();

                Task stopListeningForProcessesTask = portal.StopListeningForRunningProcessesAsync();
                stopListeningForProcessesTask.Wait();

                portal.RunningProcessesMessageReceived -= runningProcessesReceivedHandler;
            }
            else
            {
                Task<DevicePortal.RunningProcesses> getRunningProcessesTask = portal.GetRunningProcessesAsync();
                runningProcesses = getRunningProcessesTask.Result;
            }

            foreach (DeviceProcessInfo process in runningProcesses.Processes)
            {
                if (!string.IsNullOrEmpty(process.Name))
                {
                    Console.WriteLine(process.Name);
                }
            }
        }
    }
}


text:
macroopt
  * 1 .h file
  * written in C macro language + C
  * it's a command line argument processor
  * easy to use, almost scripting-language-like syntax
  * read source code for more information


text:
var chai = require('chai');
var should = chai.should();

var checker = require('../lib/validateinput');
var ValidateInput = new checker();

describe('check ValidateInput from lib/validateinput.js', function(){

  it('should check if validate_mail returns true', function(){
    ValidateInput.validate_mail('test@test.de').should.be.true;
  });

  it('should check if validate_mail returns false with ;', function(){
    ValidateInput.validate_mail('test@tes;t.de').should.be.false;
  });

  xit('should check if validate_mail returns false without @', function(){
    ValidateInput.validate_mail('testtest.de').should.be.false;
  });

  it('should check if validate_name returns true', function(){
    ValidateInput.validate_name('paulchen').should.be.true;
  });

  it('should check if validate_name returns false with ;', function(){
    ValidateInput.validate_name('testes;t.de').should.be.false;
  });

  it('should check if validate_password returns true', function(){
    ValidateInput.validate_password('adshfdf').should.be.true;
  });

  it('should check if validate_password returns false with ;', function(){
    ValidateInput.validate_password('fhjds;jdf').should.be.false;
  });

  it('should check if validate_activationlink returns true', function(){
    ValidateInput.validate_activationlink('32890_9876').should.be.true;
  });

  it('should check if validate_activationlink returns false with wrong chars', function(){
    ValidateInput.validate_activationlink('r43r43r_ddsa').should.be.false;
  });

  it('should check if validate_activationlink returns false with ;', function(){
    ValidateInput.validate_activationlink('3289;0_9876').should.be.false;
  });

  var user1 = {
    mail: 'bla@bla.de',
    name: 'paule',
    pass: 'pwhash'
  };
  var user2 = {
    mail: 'bla2@bla;2.de',
    name: 'paule2',
    pass: 'pwhash2'
  };

  it('should check if checkInputUserData returns true with correct data', function(){
    ValidateInput.checkInputUserData(user1).should.be.true;
  });

  it('should check if checkInputUserData returns false with wrong data', function(){
    ValidateInput.checkInputUserData(user2).should.be.false;
  });

});


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <dimen name="analog_hand_stroke">3dp</dimen>
    <dimen name="digital_watch_text_size">40dp</dimen>
    <dimen name="digital_watch_y_offset">62dp</dimen>
    <dimen name="digital_text_size_round">28dp</dimen>

    <dimen name="date_text_size">20dp</dimen>
    <dimen name="temp_text_size">28dp</dimen>

    <dimen name="date_y_offset">88dp</dimen>
    <dimen name="digital_x_offset">4dp</dimen>
    <dimen name="digital_x_offset_round">8dp</dimen>
    <dimen name="digital_y_offset">24dp</dimen>

    <dimen name="page_row_margin">100dp</dimen>
    <dimen name="page_column_margin_round">50dp</dimen>
    <dimen name="page_column_margin">10dp</dimen>
</resources>


text:
<!-- build:css(app) /css/vendor.css -->
<!-- bower:css -->
<link rel="stylesheet" href="/_bower_components/normalize-css/normalize.css" />
<!-- endbower -->
<!-- endbuild -->

<!-- build:css(.tmp) /css/main.css -->
<!-- injector:css -->
<link rel="stylesheet" href="/css/application.css">
<link rel="stylesheet" href="/css/delete_me.css">
<!-- endinjector -->
<!-- endbuild -->


text:
from parlai.core.build_data import DownloadableFile
import parlai.core.build_data as build_data
import os

RESOURCES = [
    DownloadableFile(
        'http://parl.ai/downloads/babi/babi.tar.gz',
        'babi.tar.gz',
        'f7f0bee187efca0d81c3daac1b162cda4eb7f9505dee5ad6846eabbed3dbf92e',
    )
]

def build(opt):
    dpath = os.path.join(opt['datapath'], 'bAbI')
    version = 'None'

    if not build_data.built(dpath, version_string=version):
        print('[building data: ' + dpath + ']')
        if build_data.built(dpath):
            # An older version exists, so remove these outdated files.
            build_data.remove_dir(dpath)
        build_data.make_dir(dpath)

        # Download the data.
        for downloadable_file in RESOURCES:
            downloadable_file.download_file(dpath)

        # Mark the data as built.
        build_data.mark_done(dpath, version_string=version)


text:
<?php

namespace Google\Service\Contentwarehouse;

class HtmlrenderWebkitHeadlessProtoInitialLoadEvent extends \Google\Model
{
  /**
   * @var string
   */
  public $url;

  /**
   * @param string
   */
  public function setUrl($url)
  {
    $this->url = $url;
  }
  /**
   * @return string
   */
  public function getUrl()
  {
    return $this->url;
  }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(HtmlrenderWebkitHeadlessProtoInitialLoadEvent::class, 'Google_Service_Contentwarehouse_HtmlrenderWebkitHeadlessProtoInitialLoadEvent');


text:
package org.mockserver.model;

import com.fasterxml.jackson.annotation.JsonIgnore;

import java.util.concurrent.TimeUnit;

/**
 * @author jamesdbloom
 */
public class HttpForward extends Action<HttpForward> {

    private String host;
    private Integer port = 80;
    private Scheme scheme = Scheme.HTTP;

    /**
     * Static builder to create a forward.
     */
    public static HttpForward forward() {
        return new HttpForward();
    }

    @Override
    @JsonIgnore
    public Type getType() {
        return Type.FORWARD;
    }

    public String getHost() {
        return host;
    }

    /**
     * The host or ip address to forward the request to i.e. "www.mock-server.com"
     *
     * @param host a hostname or ip address as a string
     */
    public HttpForward withHost(String host) {
        this.host = host;
        return this;
    }

    public Integer getPort() {
        return port;
    }

    /**
     * The port to forward the request to i.e. 80.  If not specified the port defaults to 80.
     *
     * @param port a port as an integer
     */
    public HttpForward withPort(Integer port) {
        this.port = port;
        return this;
    }

    public Scheme getScheme() {
        return scheme;
    }

    /**
     * The scheme to use when forwarded the request, either HTTP or HTTPS.  If not specified the scheme defaults to HTTP.
     *
     * @param scheme the scheme as a HttpForward.Scheme value
     */
    public HttpForward withScheme(Scheme scheme) {
        this.scheme = scheme;
        return this;
    }

    public enum Scheme {
        HTTP,
        HTTPS
    }
}


text:
class msVC6_4786WorkAround {
public:
     msVC6_4786WorkAround() {}
     };

static msVC6_4786WorkAround
WowIWonderWhatCrapCodeMustBeInTheCompilerToMakeThisWorkaroundWork;

// End of File


text:
<?php

/**
 * @namespace
 */
namespace Pop\Feed\Format\Rss;

/**
 * Flickr RSS feed reader class
 *
 * @category   Pop
 * @package    Pop_Feed
 * @author     Nick Sagona, III <nick@popphp.org>
 * @copyright  Copyright (c) 2009-2014 Moc 10 Media, LLC. (http://www.moc10media.com)
 * @license    http://www.popphp.org/license     New BSD License
 * @version    1.7.0
 */
class Flickr extends \Pop\Feed\Format\Rss
{

    /**
     * Feed URLs templates
     * @var array
     */
    protected $urls = array(
        'id'   => 'http://api.flickr.com/services/feeds/photos_public.gne?id=[{id}]&format=rss_100'
    );

    /**
     * Method to create a Flickr RSS feed object
     *
     * @param  mixed  $options
     * @param  int    $limit
     * @return \Pop\Feed\Format\Rss\Flickr
     */
    public function __construct($options, $limit = 0)
    {
        // Attempt to get the correct URL to parse
        if (is_array($options)) {
            if (isset($options['id'])) {
                $this->url = str_replace('[{id}]', $options['id'], $this->urls['id']);
            }
        }

        parent::__construct($options, $limit);
    }

    /**
     * Method to parse a Flickr RSS feed object
     *
     * @return void
     */
    public function parse()
    {
        parent::parse();

        if (null === $this->feed['author']) {
            $this->feed['author'] = str_replace('Uploads from ', '', $this->feed['title']);
        }

        if (null === $this->feed['date']) {
            $this->feed['date'] = date('D, d M Y H:i:s O');
        }

        if (null === $this->feed['generator']) {
            $this->feed['generator'] = 'Flickr';
        }

        $namespaces = $this->obj->getDocNamespaces(true);

        $items = $this->feed['items'];
        foreach ($items as $key => $item) {
            $entry = $this->obj->item[0];
            $dc = $entry->children($namespaces['dc']);

            $image = substr($item['content'], (strpos($item['content'], '<img src="') + 10));
            $image = substr($image, 0, strpos($image, '"'));
            $items[$key]['published'] = (string)$dc->{'date.Taken'};
            $items[$key]['time'] = self::calculateTime($items[$key]['published']);
            $items[$key]['image_thumb']  = str_replace('_m', '_s', $image);
            $items[$key]['image_medium'] = $image;
            $items[$key]['image_large']  = str_replace('_m', '', $image);
            $items[$key]['image_orig']  = str_replace('_m', '_b', $image);
        }

        $this->feed['items'] = $items;
    }

}


text:
package bpmntoconstant.generator.annotations.util;

import bpmntoconstant.generator.annotations.plugin.BpmMetadataLogger;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

public class GeneratorUtils {

    public static boolean verifyPackage(String stringPath) {
        Path path = Paths.get(stringPath);
        if (!path.toFile().exists()) {
            try {
                Files.createDirectories(path);
                return true;
            } catch (IOException e) {
                BpmMetadataLogger.addError(String.format("Could not create directory: %s ", stringPath) + e.getMessage());
                return false;
            }
        }
        return true;
    }

}


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
null

#### Original name
Anerincleistus sublepidotus King

### Remarks
null


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

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

   Unless required by applicable law or agreed to in writing,
   software distributed under the License is distributed on an
   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   KIND, either express or implied.  See the License for the
   specific language governing permissions and limitations
   under the License.

.. _routines.array-creation:

Array creation routines
=======================

.. currentmodule:: mxnet.np

Ones and zeros
--------------
.. autosummary::
   :toctree: generated/

   eye
   empty
   full
   identity
   ones
   ones_like
   zeros
   zeros_like

.. code::

   full_like
   empty_like

From existing data
------------------
.. autosummary::
   :toctree: generated/

   array
   copy

.. code::

   frombuffer
   fromfunction
   fromiter
   fromstring
   loadtxt

.. _routines.array-creation.rec:

Creating record arrays (:mod:`np.rec`)
-----------------------------------------

.. note:: :mod:`np.rec` is the preferred alias for
   :mod:`np.core.records`.

.. autosummary::
   :toctree: generated/

.. code::

   core.records.array
   core.records.fromarrays
   core.records.fromrecords
   core.records.fromstring
   core.records.fromfile

.. _routines.array-creation.char:

Creating character arrays (:mod:`np.char`)
---------------------------------------------

.. note:: :mod:`np.char` is the preferred alias for
   :mod:`np.core.defchararray`.

.. autosummary::
   :toctree: generated/

.. code::

   core.defchararray.array
   core.defchararray.asarray

Numerical ranges
----------------
.. autosummary::
   :toctree: generated/

   arange
   linspace
   logspace
   meshgrid

.. code::

   geomspace
   mgrid
   ogrid

Building matrices
-----------------
.. autosummary::
   :toctree: generated/

   tril

.. code::

   diag
   diagflat
   tri
   triu
   vander