text:
/*!@addtogroup Dexter_Industries
* @{
* @defgroup NXTCHUCK NXTChuck Sensor
* Dexter Industries NXTChuck Sensor driver
* @{
*/
/*
 * $Id: dexterind-nxtchuck.h 112 2012-10-04 17:44:38Z xander $
 */

#ifndef __NXTCHUCK_H__
#define __NXTCHUCK_H__
/** \file dexterind-nxtchuck.h
 * \brief Dexter Industries NXTChuck Sensor driver
 *
 * dexterind-nxtchuck.h provides an API for the Dexter Industries NXTChuck Sensor.
 *
 * Changelog:
 * - 0.1: Initial release
 *
 * Credits:
 * - Big thanks to Dexter Industries for providing me with the hardware necessary to write and test this.
 *
 * License: You may use this code as you wish, provided you give credit where its due.
 *
 * THIS CODE WILL ONLY WORK WITH ROBOTC VERSION 3.54 AND HIGHER.
 * \author Xander Soldaat (xander_at_botbench.com)
 * \date 02 November 2012
 * \version 0.1
 * \example dexterind-nxtchuck-test1.c
 */

#pragma systemFile

#ifndef __COMMON_H__
#include "common.h"
#endif

#define NXTCHUCK_COM_ERROR                        0
#define NXTCHUCK_COM_SUCCESS                      1

#define NXTCHUCK_I2C_ADDRESS                      0xA4

#define NXTCHUCK_DEVICE_UNKNOWN                   1
#define NXTCHUCK_DEVICE_NUNCHUK                   2
#define NXTCHUCK_DEVICE_CLASSIC_CONTROLLER        3
#define NXTCHUCK_DEVICE_GH_GUITAR                 4
#define NXTCHUCK_DEVICE_GH_DRUMS                  5
#define NXTCHUCK_DEVICE_DJH_TURNTABLE             6
#define NXTCHUCK_DEVICE_BALANCE_BOARD             7
#define NXTCHUCK_DEVICE_MOTION_PLUS_ACTIVE        8
#define NXTCHUCK_DEVICE_MOTION_PLUS_ACTIVE_N_PT   9
#define NXTCHUCK_DEVICE_MOTION_PLUS_ACTIVE_CC_PT  10
#define NXTCHUCK_DEVICE_MOTION_PLUS_INACTIVE      11
#define NXTCHUCK_DEVICE_MOTION_PLUS_NL_ACTIVE     12
#define NXTCHUCK_DEVICE_MOTION_PLUS_NL_N_PT       13
#define NXTCHUCK_DEVICE_MOTION_PLUS_NL_CC_PT      14
#define NXTCHUCK_DEVICE_NUNCHUK_BLACK             15

#define NXTCHUCK_N_BTN_Z                          0x01
#define NXTCHUCK_N_BTN_C                          0x02

#define NXTCHUCK_CC_BTN_RT 0x0002 // Right shoulder button
#define NXTCHUCK_CC_BTN_P  0x0004 // Start button
#define NXTCHUCK_CC_BTN_H  0x0008 // Home button
#define NXTCHUCK_CC_BTN_M  0x0010 // Select button
#define NXTCHUCK_CC_BTN_LT 0x0020 // Left Shoulder button
#define NXTCHUCK_CC_BTN_DD 0x0040 // d-pad down
#define NXTCHUCK_CC_BTN_DR 0x0080 // d-pad right
#define NXTCHUCK_CC_BTN_DU 0x0100 // d-pad up
#define NXTCHUCK_CC_BTN_DL 0x0200 // d-pad left
#define NXTCHUCK_CC_BTN_ZR 0x0400 // Right-Z button
#define NXTCHUCK_CC_BTN_X  0x0800 // x button
#define NXTCHUCK_CC_BTN_A  0x1000 // a button
#define NXTCHUCK_CC_BTN_Y  0x2000 // y button
#define NXTCHUCK_CC_BTN_B  0x4000 // b button
#define NXTCHUCK_CC_BTN_ZL 0x8000 // Left-Z button

tByteArray NXTCHUCK_I2CRequest;        /*!< Array to hold I2C command data */
tByteArray NXTCHUCK_I2CReply;          /*!< Array to hold I2C reply data */

bool NXTCHUCKinitialised[] = {false, false, false, false};  /*!< Has the NXTChuck been initialised yet? */

typedef struct
{
  ubyte ident;
  ubyte stickX;
  ubyte stickY;
  int accelX;
  int accelY;
  int accelZ;
  bool buttonC;
  bool buttonZ;
  ubyte buttons;
} tNunchuck;

typedef struct
{
  byte stickLX;
  byte stickLY;
  byte stickRX;
  byte stickRY;
  byte triggerR;
  byte triggerL;
  bool buttonTriggerR;
  bool buttonTriggerL;
  bool buttonDPadU;
  bool buttonDPadD;
  bool buttonDPadL;
  bool buttonDPadR;
  bool buttonX;
  bool buttonA;
  bool buttonY;
  bool buttonB;
  bool buttonHome;
  bool buttonSelect;
  bool buttonStart;
  bool buttonZL;
  bool buttonZR;
  unsigned int buttons;
} tClassicCtrl;

ubyte NXTChuckIdentLookup[][] = {
  {0x00,0x00,0xA4,0x20,0x00,0x00}, // Nunchuk
  {0x00,0x00,0xA4,0x20,0x01,0x01}, // Classic Controller
  {0x00,0x00,0xA4,0x20,0x01,0x03}, // GH3 or GHWT Guitar
  {0x01,0x00,0xA4,0x20,0x01,0x03}, // Guitar Hero World Tour Drums
  {0x03,0x00,0xA4,0x20,0x01,0x03}, // DJ Hero Turntable
  {0x00,0x00,0xA4,0x20,0x04,0x02}, // Wii Balance Board
  {0x00,0x00,0xA4,0x20,0x04,0x05}, // Activated Wii Motion Plus
  {0x00,0x00,0xA4,0x20,0x05,0x05}, // Activated Wii Motion Plus in Nunchuck passthrought mode
  {0x00,0x00,0xA4,0x20,0x07,0x05}, // Activated Wii Motion Plus in Classic Controller passthrought mode
  {0x00,0x00,0xA6,0x20,0x00,0x05}, // Inactive Wii Motion Plus
  {0x00,0x00,0xA6,0x20,0x04,0x05}, // No-longer active Wii Motion Plus
  {0x00,0x00,0xA6,0x20,0x05,0x05}, // No-longer nunchuk-passthrough Wii Motion Plus
  {0x00,0x00,0xA6,0x20,0x07,0x05}, // No-longer classic-passthrough Wii Motion Plus
  {0xFF,0x00,0xA4,0x20,0x00,0x00}  // Seems to the ID of a black nunchuck
};

ubyte _NXTChuckDataInit1[] = {3, 0xA4, 0xF0, 0x55}; /*!< First of two arrays written to the extension to initialize */
ubyte _NXTChuckDataInit2[] = {3, 0xA4, 0xFB, 0x00}; /*!< Second of two arrays written to the extension to initialize */

/**
 * It's a nunchuck, innit? Initialise the nunchuck sensor.
 *
 * Please note that this is an internal function and should not called directly.
 * @param link the NXTChuck port number
 * @return true if no error occured, false if it did
 */
bool _NXTChuckInit(tSensors link){
  writeDebugStreamLine("initialising");
    memcpy(NXTCHUCK_I2CRequest, _NXTChuckDataInit1, sizeof(_NXTChuckDataInit1));
    if (!writeI2C(link, NXTCHUCK_I2CRequest))
      return false;

    memcpy(NXTCHUCK_I2CRequest, _NXTChuckDataInit2, sizeof(_NXTChuckDataInit2));
    return writeI2C(link, NXTCHUCK_I2CRequest);
}

/**
 * Read 6 bytes from the nunchuck and return it.
 *
 * Please note this is an internal function and should not be used directly.
 * @param link the nunchuck port number
 * @param _reg the register to read
 * @param data the tByteArray to hold the returned data
 * @return true if no error occured, false if it did
 */
bool __NXTChuckReadRaw(tSensors link, ubyte _reg, tByteArray &data){
  if (!NXTCHUCKinitialised[link])
  {
    if (!_NXTChuckInit(link))
      return false;

    NXTCHUCKinitialised[link] = true;
  }

  NXTCHUCK_I2CRequest[0] = 2;
  NXTCHUCK_I2CRequest[1] = NXTCHUCK_I2C_ADDRESS;
  NXTCHUCK_I2CRequest[2] = _reg;

  if (!writeI2C(link, NXTCHUCK_I2CRequest))
    return false;

  NXTCHUCK_I2CRequest[0] = 1;
  NXTCHUCK_I2CRequest[1] = NXTCHUCK_I2C_ADDRESS;

  return writeI2C(link, NXTCHUCK_I2CRequest, data, 6);
}

/**
 * Identify the type of nunchuck sensor connected to the NXT.
 * @param link the nunchuck port number
 * @param nunchuck the tNunchuck that holds the nunchuck related data.
 * @return true if no error occured, false if it did
 */
bool NXTChuckreadIdent(tSensors link, tNunchuck &nunchuck){
  if(__NXTChuckReadRaw(link, 0xFA, NXTCHUCK_I2CReply)){

#ifdef __NUNHUCK__DEBUG__
    for (int i = 0; i < 6; i++)
    {
      writeDebugStream("0x%02X ", NXTCHUCK_I2CReply[i]);
    }

    writeDebugStreamLine(" ");
#endif // __NUNHUCK__DEBUG__

    for(byte i = 0; i < 14; i++){

#ifdef __NUNHUCK__DEBUG__
      writeDebugStream("Comparing: ");
      for (int j = 0; j < 6; j++)
      {
        writeDebugStream("0x%02X ", NXTCHUCK_I2CReply[j]);
      }
      writeDebugStream("   and   ");
      for (int j = 0; j < 6; j++)
      {
        writeDebugStream("0x%02X ", NXTChuckIdentLookup[i][j]);
      }
      writeDebugStreamLine(": %d", memcmp(&NXTChuckIdentLookup[i][0], &NXTCHUCK_I2CReply[0], 6));
#endif // __NUNHUCK__DEBUG__

      if (memcmp(&NXTChuckIdentLookup[i][0], &NXTCHUCK_I2CReply[0], 6) == 0)
      {
        nunchuck.ident = i + 2;
        return true;
      }
    }
    nunchuck.ident = NXTCHUCK_DEVICE_UNKNOWN;
    return true;
  }
  return false;                                                    // Communication error
}

/**
 * Read the data from the nunchuck.
 * @param link the nunchuck port number
 * @param nunchuck the tNunchuck that holds the nunchuck related data.
 * @return true if no error occured, false if it did
 */
bool NXTChuckreadSensor(tSensors link, tNunchuck &nunchuck){
  if(__NXTChuckReadRaw(link, 0x00, NXTCHUCK_I2CReply))
  {
    nunchuck.stickX = NXTCHUCK_I2CReply[0];
    nunchuck.stickY = NXTCHUCK_I2CReply[1];

    nunchuck.accelX = (NXTCHUCK_I2CReply[2] << 2) | ((NXTCHUCK_I2CReply[5] >> 2) & 0x03);
    nunchuck.accelY = (NXTCHUCK_I2CReply[3] << 2) | ((NXTCHUCK_I2CReply[5] >> 4) & 0x03);
    nunchuck.accelZ = (NXTCHUCK_I2CReply[4] << 2) | ((NXTCHUCK_I2CReply[5] >> 6) & 0x03);

    nunchuck.buttons = (~NXTCHUCK_I2CReply[5]) & 0x03;
    nunchuck.buttonC = (nunchuck.buttons & NXTCHUCK_N_BTN_C) ? true : false;
    nunchuck.buttonZ = (nunchuck.buttons & NXTCHUCK_N_BTN_Z) ? true : false;

    return true;                                            // Return success
  }
  return false;                                                  // Return error
}

/**
 * Read the data from the classic controller.
 * @param link the nunchuck port number
 * @param controller the tClassicCtrl that holds the Classic Controller related data.
 * @return true if no error occured, false if it did
 */
bool NXTChuckReadClassicController(tSensors link, tClassicCtrl &controller){
  if(__NXTChuckReadRaw(link, 0x00, NXTCHUCK_I2CReply))
  {
    controller.stickLX = NXTCHUCK_I2CReply[0] & 0x3F;                                        // Unpack the data into usable values
    controller.stickLY = NXTCHUCK_I2CReply[1] & 0x3F;
    controller.triggerL = ((NXTCHUCK_I2CReply[2] >> 2) & 0x18) | ((NXTCHUCK_I2CReply[3] >> 5) & 0x07);

    controller.stickRX = ((NXTCHUCK_I2CReply[0] >> 3) & 0x18) | ((NXTCHUCK_I2CReply[1] >> 5) & 0x06) | ((NXTCHUCK_I2CReply[2] >> 7) & 0x01);
    controller.stickRY = NXTCHUCK_I2CReply[2] & 0x1F;
    controller.triggerR = NXTCHUCK_I2CReply[3] & 0x1F;

    controller.buttons = ~(NXTCHUCK_I2CReply[4] | (NXTCHUCK_I2CReply[5] << 8)) & 0xFFFE;

    controller.buttonTriggerR = (controller.buttons & NXTCHUCK_CC_BTN_RT) ? true : false;
    controller.buttonTriggerL = (controller.buttons & NXTCHUCK_CC_BTN_LT) ? true : false;

    controller.buttonDPadU =    (controller.buttons & NXTCHUCK_CC_BTN_DU) ? true : false;
    controller.buttonDPadD =    (controller.buttons & NXTCHUCK_CC_BTN_DD) ? true : false;
    controller.buttonDPadL =    (controller.buttons & NXTCHUCK_CC_BTN_DL) ? true : false;
    controller.buttonDPadR =    (controller.buttons & NXTCHUCK_CC_BTN_DR) ? true : false;

    controller.buttonX =        (controller.buttons & NXTCHUCK_CC_BTN_X)  ? true : false;
    controller.buttonA =        (controller.buttons & NXTCHUCK_CC_BTN_A)  ? true : false;
    controller.buttonY =        (controller.buttons & NXTCHUCK_CC_BTN_Y)  ? true : false;
    controller.buttonB =        (controller.buttons & NXTCHUCK_CC_BTN_B)  ? true : false;

    controller.buttonHome =     (controller.buttons & NXTCHUCK_CC_BTN_H)  ? true : false;
    controller.buttonSelect =   (controller.buttons & NXTCHUCK_CC_BTN_RT) ? true : false;
    controller.buttonStart =    (controller.buttons & NXTCHUCK_CC_BTN_P)  ? true : false;

    controller.buttonZL =       (controller.buttons & NXTCHUCK_CC_BTN_RT) ? true : false;
    controller.buttonZR =       (controller.buttons & NXTCHUCK_CC_BTN_RT) ? true : false;

    return true;
  }
  return false;
}

#endif // __NXTCHUCK_H__

/*
 * $Id: dexterind-nxtchuck.h 112 2012-10-04 17:44:38Z xander $
 */
/* @} */
/* @} */


text:
import {Directive} from '@angular/core';

/**
 * The placeholder text for an `MatFormField`.
 * @deprecated Use `<mat-label>` to specify the label and the `placeholder` attribute to specify the
 *     placeholder.
 * @deletion-target 8.0.0
 */
@Directive({
  selector: 'mat-placeholder'
})
export class MatPlaceholder {}

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace TransformCore\PHE\HayApi\PersistenceBundle\Tests\Service;

use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use TransformCore\PHE\HayApi\PersistenceBundle\Entity\Person;
use TransformCore\PHE\HayApi\PersistenceBundle\Entity\Questionnaire;
use TransformCore\PHE\HayApi\PersistenceBundle\Entity\Questions\Drinking;
use TransformCore\PHE\HayApi\PersistenceBundle\Repository\DrinkingRepository;
use TransformCore\PHE\HayApi\PersistenceBundle\Service\DrinkingService;
use TransformCore\PHE\HayApi\PersistenceBundle\Service\RestfulService;

/**
 * Class DrinkingServiceTest
 * @package TransformCore\PHE\HayApi\PersistenceBundle\Tests\Service
 */
class DrinkingServiceTest extends ServiceTestBase
{
    /** @var  DrinkingService */
    protected $instance;

    public function setUp()
    {
        $this->instance = new DrinkingService($this->getEntityManager());
        $this->mockRepository('TransformCore\PHE\HayApi\PersistenceBundle\Repository\DrinkingRepository');
        parent::setUp();
    }

    public function testSetUp()
    {
        $this->assertInstanceOf(DrinkingService::class, $this->instance);
    }

    public function testUpdateDrinkingReturns404()
    {
        $result = $this->instance->updateDrinking(PHP_INT_MAX, $this->paramFetcher);
        $this->assertEquals(RestfulService::STATUS_ENTITY_NOT_FOUND, $result->getStatusCode());
    }

    protected function mockRepositoryCommands()
    {
        /** @var \Mockery\MockInterface $repo */
        $repo = $this->repository;

        $repo
            ->shouldReceive('getDrinking')
            ->with(PHP_INT_MAX)
            ->andReturn(
                new Drinking(new Questionnaire(new Person()))
            );

        $repo
            ->shouldReceive('getDrinking')
            ->with(PHP_INT_SIZE)
            ->andThrow(
                new BadRequestHttpException()
            );
    }

    protected function mockEntityManagerCommands()
    {
        /** @var \Mockery\MockInterface $em */
        $em = $this->entityManager;

        $em
            ->shouldReceive('getDrinking')
            ->with(PHP_INT_SIZE)
            ->andThrow(new BadRequestHttpException());
    }
}


text:
#include "condor_common.h"
#include "parallel_proc.h"
#include "condor_attributes.h"
#include "condor_config.h"
#include "env.h"

ParallelProc::ParallelProc( ClassAd * jobAd ) : VanillaProc( jobAd )
{
    dprintf ( D_FULLDEBUG, "Constructor of ParallelProc::ParallelProc\n" );
	Node = -1;
}

ParallelProc::~ParallelProc()  {}

int
ParallelProc::StartJob()
{
	dprintf(D_FULLDEBUG,"in ParallelProc::StartJob()\n");

	if ( !JobAd ) {
		dprintf ( D_ALWAYS, "No JobAd in ParallelProc::StartJob()!\n" );
		return 0;
	}
		// Grab ATTR_NODE out of the job ad and stick it in our
		// protected member so we can insert it back on updates, etc.
	if( JobAd->LookupInteger(ATTR_NODE, Node) != 1 ) {
		dprintf( D_ALWAYS, "ERROR in ParallelProc::StartJob(): "
				 "No %s in job ad, aborting!\n", ATTR_NODE );
		return 0;
	} else {
		dprintf( D_FULLDEBUG, "Found %s = %d in job ad\n", ATTR_NODE,
				 Node );
	}

	if ( ! addEnvVars() ) {
		dprintf( D_ALWAYS, "ERROR adding environment variable to job");
		return 0;
	}

    dprintf(D_PROTOCOL, "#11 - Parallel_proc starting up....\n" );

        // special args already in ad; simply start it up
    return VanillaProc::StartJob();
}

int
ParallelProc::addEnvVars()
{
   dprintf ( D_FULLDEBUG, "ParallelProc::addEnvVars()\n" );

	   // Pull the environment out of the job ad...
	Env env;
	MyString env_errors;
	if ( !env.MergeFrom(JobAd,&env_errors) ) {
		dprintf( D_ALWAYS, "Failed to read environment from JobAd: %s\n",
				 env_errors.Value() );
		return 0;
	}

		// Add the remote spool dir, the "server" directory for
		// condor_chirp to stage files to/from
    MyString spool;
	if ( JobAd->LookupString( ATTR_REMOTE_SPOOL_DIR, spool ) < 1 ) {
		dprintf( D_ALWAYS, "%s not found in JobAd.  Aborting.\n",
				 ATTR_REMOTE_SPOOL_DIR);
		return 0;
	}

    env.SetEnv( "_CONDOR_REMOTE_SPOOL_DIR", spool.Value() );

		// Add this node's number to CONDOR_PROCNO
	char buf[128];
	sprintf(buf, "%d", Node);
	env.SetEnv("_CONDOR_PROCNO", buf);

		// And put the total number of nodes into CONDOR_NPROC
	int machine_count;
	if ( JobAd->LookupInteger( ATTR_CURRENT_HOSTS, machine_count ) !=  1 ) {
		dprintf( D_ALWAYS, "%s not found in JobAd.  Aborting.\n",
				 ATTR_CURRENT_HOSTS);
		return 0;
	}

	sprintf(buf, "%d", machine_count);
	env.SetEnv("_CONDOR_NPROCS", buf);

		// Now stick the condor bin directory in front of the path,
		// so user scripts can call condor_config_val
    char *bin = param( "BIN" );
    if ( !bin ) {
        dprintf ( D_ALWAYS, "Can't find BIN "
                  "in config file! Aborting!\n" );
        return 0;
    }

	MyString path;
	MyString new_path;
	char *tmp;

	new_path = bin;
	new_path += ":";

	if(env.GetEnv("PATH",path)) {
        // The user gave us a path in env.  Find & alter:
        dprintf ( D_FULLDEBUG, "$PATH in ad:%s\n", path.Value() );

		new_path += path;
	}
	else {
        // User did not specify any env, or there is no 'PATH'
        // in env sent along.  We get $PATH and alter it.

        tmp = getenv( "PATH" );
        if ( tmp ) {
            dprintf ( D_FULLDEBUG, "No Path in ad, $PATH in env\n" );
            dprintf ( D_FULLDEBUG, "before: %s\n", tmp );
			new_path += tmp;
        }
        else {   // no PATH in env.  Make one.
            dprintf ( D_FULLDEBUG, "No Path in ad, no $PATH in env\n" );
			new_path = bin;
        }
    }
	free(bin);
	env.SetEnv("PATH",new_path.Value());

	char *condor_config = getenv( "CONDOR_CONFIG");
	if (condor_config) {
		env.SetEnv("CONDOR_CONFIG", condor_config);
	}

	if(DebugFlags & D_FULLDEBUG) {
		MyString env_str;
		env.getDelimitedStringForDisplay(&env_str);
		dprintf ( D_FULLDEBUG, "New env: %s\n", env_str.Value() );
	}

        // now put the env back into the JobAd:
	if(!env.InsertEnvIntoClassAd(JobAd,&env_errors)) {
		dprintf( D_ALWAYS, "Unable to update env! Aborting: %s\n",
				 env_errors.Value());
		return 0;
	}

	return 1;
}

bool
ParallelProc::JobReaper( int pid, int status )
{
	return VanillaProc::JobReaper( pid, status );
}

void
ParallelProc::Suspend() {
        /* We Comrades don't ever want to be suspended.  We
           take it as a violation of our basic rights.  Therefore,
           we walk off the job and notify the shadow immediately! */
	dprintf(D_FULLDEBUG,"in ParallelProc::Suspend()\n");
		// must do this so that we exit...
	daemonCore->Send_Signal( daemonCore->getpid(), SIGQUIT );
}

void
ParallelProc::Continue() {
	dprintf(D_FULLDEBUG,"in ParallelProc::Continue() (!)\n");
        // really should never get here, but just in case.....
    VanillaProc::Continue();
}

bool
ParallelProc::ShutdownFast() {
	return VanillaProc::ShutdownGraceful();
}

bool
ParallelProc::PublishUpdateAd( ClassAd* ad )
{
	dprintf( D_FULLDEBUG, "In ParallelProc::PublishUpdateAd()\n" );
	char buf[64];
	sprintf( buf, "%s = %d", ATTR_NODE, Node );
	ad->Insert( buf );

		// Now, call our parent class's version
	return VanillaProc::PublishUpdateAd( ad );
}


text:
package org.cohorte.herald;

import java.util.Collection;

/**
 * Specification of the Herald core services
 *
 * @author Thomas Calmant
 */
public interface IHerald {

    /**
     * Fires (and forget) a message to the given peer
     *
     * @param aPeer
     *            The peer to send the message to
     * @param aMessage
     *            The message to send
     * @return The UID of the message
     * @throws NoTransport
     *             No transport found to send the message
     */
    String fire(Peer aPeer, Message aMessage) throws NoTransport;

    /**
     * Fires (and forget) a message to the given peer
     *
     * @param aPeerUid
     *            The UID of the peer to send the message to
     * @param aMessage
     *            The message to send
     * @return The UID of the message
     * @throws NoTransport
     *             No transport found to send the message
     * @throws UnknownPeer
     *             Unknown peer UID
     */
    String fire(String aPeerUid, Message aMessage) throws NoTransport,
            UnknownPeer;

    /**
     * Fires (and forget) the given message to the given group of peers
     *
     * @param aGroupName
     *            The name of a group of peers
     * @param aMessage
     *            The message to send
     * @return The list of peers the message has been sent to
     * @throws NoTransport
     *             No transport found to send the message
     */
    Collection<Peer> fireGroup(String aGroupName, Message aMessage)
            throws NoTransport;

    /**
     * Tells Herald to forget informations about the given message UIDs.
     *
     * This can be used to clean up references to a component being invalidated.
     *
     * @param aMessageUid
     *            The UID of the message to forget
     * @return True if there was a reference about this message
     */
    boolean forget(final String aMessageUid);

    /**
     * Posts a message. The given methods will be called back as soon as a
     * result is given, or in case of error
     *
     * @param aPeer
     *            The peer to send the message to
     * @param aMessage
     *            The message to send
     * @param aCallback
     *            Object to call back when a reply is received
     * @param aErrback
     *            Object to call back when an error occurs
     * @return The UID of the message
     * @throws NoTransport
     *             No transport found to send the message
     */
    String post(Peer aPeer, Message aMessage, IPostCallback aCallback,
            IPostErrback aErrback) throws NoTransport;

    /**
     * Posts a message. The given methods will be called back as soon as a
     * result is given, or in case of error
     *
     * @param aPeer
     *            The peer to send the message to
     * @param aMessage
     *            The message to send
     * @param aCallback
     *            Object to call back when a reply is received
     * @param aErrback
     *            Object to call back when an error occurs
     * @param aTimeout
     *            Time after which the message will be forgotten
     * @return The UID of the message
     * @throws NoTransport
     *             No transport found to send the message
     */
    String post(Peer aPeer, Message aMessage, IPostCallback aCallback,
            IPostErrback aErrback, Long aTimeout) throws NoTransport;

    /**
     * Posts a message. The given methods will be called back as soon as a
     * result is given, or in case of error
     *
     * @param aPeer
     *            The peer to send the message to
     * @param aMessage
     *            The message to send
     * @param aCallback
     *            Object to call back when a reply is received
     * @param aErrback
     *            Object to call back when an error occurs
     * @param aTimeout
     *            Time after which the message will be forgotten
     * @param aForgetOnFirst
     *            Forget the message after the first answer
     * @return The UID of the message
     * @throws NoTransport
     *             No transport found to send the message
     */
    String post(Peer aPeer, Message aMessage, IPostCallback aCallback,
            IPostErrback aErrback, Long aTimeout, boolean aForgetOnFirst)
            throws NoTransport;

    /**
     * Posts a message. The given methods will be called back as soon as a
     * result is given, or in case of error
     *
     * @param aPeerUid
     *            The UID of the peer to send the message to
     * @param aMessage
     *            The message to send
     * @param aCallback
     *            Object to call back when a reply is received
     * @param aErrback
     *            Object to call back when an error occurs
     * @return The UID of the message
     * @throws NoTransport
     *             No transport found to send the message
     */
    String post(String aPeerUid, Message aMessage, IPostCallback aCallback,
            IPostErrback aErrback) throws UnknownPeer, NoTransport;

    /**
     * Posts a message. The given methods will be called back as soon as a
     * result is given, or in case of error
     *
     * @param aPeerUid
     *            The UID of the peer to send the message to
     * @param aMessage
     *            The message to send
     * @param aCallback
     *            Object to call back when a reply is received
     * @param aErrback
     *            Object to call back when an error occurs
     * @param aTimeout
     *            Time after which the message will be forgotten
     * @return The UID of the message
     * @throws NoTransport
     *             No transport found to send the message
     */
    String post(String aPeerUid, Message aMessage, IPostCallback aCallback,
            IPostErrback aErrback, Long aTimeout) throws UnknownPeer,
            NoTransport;

    /**
     * Posts a message. The given methods will be called back as soon as a
     * result is given, or in case of error
     *
     * @param aPeerUid
     *            The UID of the peer to send the message to
     * @param aMessage
     *            The message to send
     * @param aCallback
     *            Object to call back when a reply is received
     * @param aErrback
     *            Object to call back when an error occurs
     * @param aTimeout
     *            Time after which the message will be forgotten
     * @param aForgetOnFirst
     *            Forget the message after the first answer
     * @return The UID of the message
     * @throws NoTransport
     *             No transport found to send the message
     */
    String post(String aPeerUid, Message aMessage, IPostCallback aCallback,
            IPostErrback aErrback, Long aTimeout, boolean aForgetOnFirst)
            throws UnknownPeer, NoTransport;

    /**
     * Posts a message to a group of peers
     *
     * @param aGroupName
     *            The name of a group of peers
     * @param aMessage
     *            A Message bean
     * @param aCallback
     *            Method to call back when a reply is received
     * @param aErrback
     *            Method to call back if an error occurs
     * @param aTimeout
     *            Time after which the message will be forgotten
     * @return The message UID
     * @throws ValueError
     *             Unknown group
     * @throws NoTransport
     *             No transport found to send the message
     */
    String postGroup(String aGroupName, Message aMessage,
            IPostCallback aCallback, IPostErrback aErrback, Long aTimeout)
            throws ValueError, NoTransport;

    /**
     * Replies to a message. The subject will be the one of the original
     * message, prefixed with "reply/"
     *
     * @param aMessage
     *            Message to reply to
     * @param aContent
     *            Content of the response
     * @throws HeraldException
     *             Error sending the reply
     */
    void reply(MessageReceived aMessage, Object aContent)
            throws HeraldException;

    /**
     * Replies to a message. If no subject is given, it will be the one of the
     * original message, prefixed with "reply/"
     *
     * @param aMessage
     *            Message to reply to
     * @param aContent
     *            Content of the response
     * @param aSubject
     *            Subject of the response message
     * @throws HeraldException
     *             Error sending the reply
     */
    void reply(MessageReceived aMessage, Object aContent, String aSubject)
            throws HeraldException;

    /**
     * Sends a message, and waits for its reply
     *
     * @param aPeer
     *            The peer to send the message to
     * @param aMessage
     *            The message to send
     * @return The UID of the message
     * @throws HeraldException
     *             Error sending the message
     */
    Object send(Peer aPeer, Message aMessage) throws HeraldException;

    /**
     * Sends a message, and waits for its reply
     *
     * @param aPeer
     *            The peer to send the message to
     * @param aMessage
     *            The message to send
     * @param aTimeout
     *            Maximum time to wait for an answer
     * @return The content of the reply
     * @throws HeraldException
     *             Error sending the message
     * @throws HeraldTimeout
     *             Timeout raised before getting an answer
     */
    Object send(Peer aPeer, Message aMessage, Long aTimeout)
            throws HeraldException;

    /**
     * Sends a message, and waits for its reply
     *
     * @param aPeerUid
     *            The UID of the peer to send the message to
     * @param aMessage
     *            The message to send
     * @return The content of the reply
     * @throws HeraldException
     *             Error sending the message
     * @throws UnknownPeer
     *             Unknown peer UID
     */
    Object send(String aPeerUid, Message aMessage) throws HeraldException;

    /**
     * Sends a message, and waits for its reply
     *
     * @param aPeerUid
     *            The UID of the peer to send the message to
     * @param aMessage
     *            The message to send
     * @param aTimeout
     *            Maximum time to wait for an answer
     * @return The content of the reply
     * @throws HeraldException
     *             Error sending the message
     * @throws HeraldTimeout
     *             Timeout raised before getting an answer
     * @throws UnknownPeer
     *             Unknown peer UID
     */
    Object send(String aPeerUid, Message aMessage, Long aTimeout)
            throws HeraldException;
}


text:
package com.oracle.truffle.llvm.types.memory;

import com.oracle.truffle.llvm.types.LLVMAddress;

public final class LLVMHeap extends LLVMMemory {

    public static LLVMAddress allocateCString(String string) {
        LLVMAddress baseAddress = LLVMHeap.allocateMemory(string.length() + 1);
        LLVMAddress currentAddress = baseAddress;
        for (int i = 0; i < string.length(); i++) {
            byte c = (byte) string.charAt(i);
            LLVMMemory.putI8(currentAddress, c);
            currentAddress = currentAddress.increment(1);
        }
        LLVMMemory.putI8(currentAddress, (byte) 0);
        return baseAddress;
    }

    public static LLVMAddress allocateMemory(long size) {
        long allocateMemory = UNSAFE.allocateMemory(size);
        return LLVMAddress.fromLong(allocateMemory);
    }

    public static LLVMAddress allocateZeroedMemory(long l) {
        long allocateMemory = UNSAFE.allocateMemory(l);
        UNSAFE.setMemory(allocateMemory, l, (byte) 0);
        return LLVMAddress.fromLong(allocateMemory);
    }

    public static void freeMemory(LLVMAddress addr) {
        UNSAFE.freeMemory(extractAddrNullPointerAllowed(addr));
    }

    public static void memCopy(LLVMAddress target, LLVMAddress source, long length) {
        long targetAddress = extractAddrNullPointerAllowed(target);
        long sourceAddress = extractAddrNullPointerAllowed(source);
        assert length == 0 || targetAddress != 0 && sourceAddress != 0;
        UNSAFE.copyMemory(sourceAddress, targetAddress, length);
    }

    public static void memCopy(LLVMAddress target, LLVMAddress source, long length, @SuppressWarnings("unused") int align, @SuppressWarnings("unused") boolean isVolatile) {
        memCopy(target, source, length);
    }

    public static void memSet(LLVMAddress target, byte value, long length) {
        long targetAddress = LLVMMemory.extractAddr(target);
        UNSAFE.setMemory(targetAddress, length, value);
    }

    public static void memSet(LLVMAddress target, byte value, long length, @SuppressWarnings("unused") int align, @SuppressWarnings("unused") boolean isVolatile) {
        memSet(target, value, length);
    }

    public static void memMove(LLVMAddress dest, LLVMAddress source, long length, @SuppressWarnings("unused") int align, @SuppressWarnings("unused") boolean isVolatile) {
        memMove(dest, source, length);
    }

    private static void memMove(LLVMAddress dest, LLVMAddress source, long length) {
        byte[] bytes = new byte[(int) length];
        for (int i = 0; i < length; i++) {
            bytes[i] = LLVMMemory.getI8(source.increment(i));
        }
        for (int i = 0; i < length; i++) {
            LLVMMemory.putI8(dest.increment(i), bytes[i]);
        }
    }

    // current hack: we cannot directly store the LLVMFunction in the native memory due to GC
    public static final int FUNCTION_PTR_SIZE_BYTE = 8;

    public static void putFunctionIndex(LLVMAddress address, int functionIndex) {
        UNSAFE.putInt(LLVMMemory.extractAddr(address), functionIndex);
    }

    public static int getFunctionIndex(LLVMAddress addr) {
        int functionIndex = UNSAFE.getInt(LLVMMemory.extractAddr(addr));
        return functionIndex;
    }

}


text:
package org.cinnamon.core.web.restController;

import javax.validation.Valid;

import org.cinnamon.core.config.SystemConfigureService;
import org.cinnamon.core.vo.UserJoinVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 *
 * created date: 2015. 9. 16.
 * @author 신동성
 */
@RestController
@RequestMapping("/rest/configuration/initWizard")
public class InitWizardRestController {
	private Logger logger = LoggerFactory.getLogger(getClass());

	@Autowired
	private SystemConfigureService systemConfigurerService;

	/**
	 *
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value="baseData", method=RequestMethod.POST)
	ResponseEntity<Void> baseData() throws Exception {
		logger.info("start");

		systemConfigurerService.createBaseData();

		return new ResponseEntity<Void>(HttpStatus.CREATED);
	}

	/**
	 *
	 * @param userVo
	 * @return
	 */
	@RequestMapping(value="firstUser", method=RequestMethod.POST)
	ResponseEntity<Void> firstUser(@RequestBody @Valid UserJoinVo userVo) {
		logger.info("start");

		systemConfigurerService.joinFirstSystemMaster(userVo);

		return new ResponseEntity<Void>(HttpStatus.CREATED);
	}
}


text:
<?php

require_once _CENTREON_PATH_ . "/www/class/centreonDB.class.php";
require_once __DIR__ . "/centreon_configuration_objects.class.php";

class CentreonConfigurationService extends CentreonConfigurationObjects
{
    /**
     * @var CentreonDB
     */
    protected $pearDBMonitoring;

    /**
     * CentreonConfigurationService constructor.
     */
    public function __construct()
    {
        global $pearDBO;
        parent::__construct();
        $this->pearDBMonitoring = new CentreonDB('centstorage');
        $pearDBO = $this->pearDBMonitoring;
    }

    /**
     * @return array
     * @throws RestBadRequestException
     */
    public function getList()
    {

        global $centreon;

        $userId = $centreon->user->user_id;
        $isAdmin = $centreon->user->admin;
        $aclServices = '';
        $aclMetaServices = '';
        $range = array();

        /* Get ACL if user is not admin */
        if (!$isAdmin) {
            $acl = new CentreonACL($userId, $isAdmin);
            $aclServices .= 'AND s.service_id IN (' . $acl->getServicesString('ID', $this->pearDBMonitoring) . ') ';
            $aclMetaServices .= 'AND ms.service_id IN (' .
                $acl->getMetaServiceString('ID', $this->pearDBMonitoring) . ') ';
        }

        // Check for select2 'q' argument
        if (isset($this->arguments['q'])) {
            $q = (string)$this->arguments['q'];
        } else {
            $q = '';
        }

        // Check for service enable
        if (isset($this->arguments['e'])) {
            $enableList = array('enable', 'disable');
            if (in_array(strtolower($this->arguments['e']), $enableList)) {
                $e = $this->arguments['e'];
            } else {
                throw new \RestBadRequestException('Error, bad enable status');
            }
        } else {
            $e = '';
        }

        // Check for service type
        if (isset($this->arguments['t'])) {
            $typeList = array('hostgroup', 'host');
            if (in_array(strtolower($this->arguments['t']), $typeList)) {
                $t = $this->arguments['t'];
            } else {
                throw new \RestBadRequestException('Error, bad service type');
            }
        } else {
            $t = 'host';
        }

        // Check for service with graph
        $g = false;
        if (isset($this->arguments['g'])) {
            $g = $this->arguments['g'];
            if ($g == '1') {
                $g = true;
            }
        }

        // Check for service type
        if (isset($this->arguments['s'])) {
            $sTypeList = array('s', 'm', 'all');
            if (in_array(strtolower($this->arguments['s']), $sTypeList)) {
                $s = $this->arguments['s'];
            } else {
                throw new \RestBadRequestException('Error, bad service type');
            }
        } else {
            $s = 'all';
        }

        if (isset($this->arguments['page_limit']) && isset($this->arguments['page'])) {
            if (
                !is_numeric($this->arguments['page'])
                || !is_numeric($this->arguments['page_limit'])
                || $this->arguments['page_limit'] < 1
            ) {
                throw new \RestBadRequestException('Error, limit must be an integer greater than zero');
            }
            $offset = ($this->arguments['page'] - 1) * $this->arguments['page_limit'];
            $range[] = (int)$offset;
            $range[] = (int)$this->arguments['page_limit'];
        }

        switch ($t) {
            default:
            case 'host':
                $serviceList = $this->getServicesByHost($q, $aclServices, $range, $g, $aclMetaServices, $s, $e);
                break;
            case 'hostgroup':
                $serviceList = $this->getServicesByHostgroup($q, $aclServices, $range);
                break;
        }
        return $serviceList;
    }

    /**
     * @param $q
     * @param $aclServices
     * @param array $range
     * @param bool $hasGraph
     * @param $aclMetaServices
     * @param $s
     * @param $e
     * @return array
     * @throws Exception
     */
    private function getServicesByHost(
        $q,
        $aclServices,
        $range = array(),
        $hasGraph = false,
        $aclMetaServices = '',
        $s = 'all',
        $e = 'enable'
    ) {
        $queryValues = array();
        if ($e == 'enable') {
            $enableQuery = 'AND s.service_activate = \'1\' AND h.host_activate = \'1\' ';
            $enableQueryMeta = 'AND ms.service_activate = \'1\' AND mh.host_activate = \'1\' ';
        } elseif ($e == 'disable') {
            $enableQuery = 'AND ( s.service_activate = \'0\' OR h.host_activate = \'0\' ) ';
            $enableQueryMeta = 'AND ( ms.service_activate = \'0\' OR mh.host_activate = \'0\') ';
        } else {
            $enableQuery = '';
            $enableQueryMeta = '';
        }

        switch ($s) {
            case 'all':
                $queryService = 'SELECT SQL_CALC_FOUND_ROWS DISTINCT fullname, service_id, host_id, service_activate ' .
                    'FROM ( ' .
                    '( SELECT DISTINCT CONCAT(h.host_name, " - ", s.service_description) ' .
                    'as fullname, s.service_id, h.host_id, s.service_activate ' .
                    'FROM host h, service s, host_service_relation hsr ' .
                    'WHERE hsr.host_host_id = h.host_id ' .
                    'AND hsr.service_service_id = s.service_id ' .
                    'AND h.host_register = "1" ' .
                    'AND (s.service_register = "1" OR s.service_register = "3") ' .
                    'AND CONCAT(h.host_name, " - ", s.service_description) LIKE :description ' .
                    $enableQuery . $aclServices . ') ' .
                    'UNION ALL ( ' .
                    'SELECT DISTINCT CONCAT("Meta - ", ms.display_name) as fullname, ms.service_id, mh.host_id, ms.service_activate ' .
                    'FROM host mh, service ms ' .
                    'WHERE mh.host_name = "_Module_Meta" ' .
                    'AND mh.host_register = "2" ' .
                    'AND ms.service_register = "2" ' .
                    'AND CONCAT("Meta - ", ms.display_name) LIKE :description ' .
                    $enableQueryMeta . $aclMetaServices . ') ' .
                    ')  as t_union ' .
                    'ORDER BY fullname ';
                if (!empty($range)) {
                    $queryService .= 'LIMIT :offset, :limit';
                    $queryValues['offset'] = $range[0];
                    $queryValues['limit'] = $range[1];
                }
                $queryValues['description'] = '%' . $q . '%';
                $stmt = $this->pearDB->prepare($queryService);
                $stmt->bindValue(':description', $queryValues['description'], PDO::PARAM_STR);
                if (isset($queryValues['offset'])) {
                    $stmt->bindValue(':offset', $queryValues["offset"], PDO::PARAM_INT);
                    $stmt->bindValue(':limit', $queryValues["limit"], PDO::PARAM_INT);
                }
                $dbResult = $stmt->execute();
                break;
            case 's':
                $queryService = 'SELECT SQL_CALC_FOUND_ROWS DISTINCT CONCAT(h.host_name, " - ", ' .
                    's.service_description) as fullname, s.service_id, h.host_id, s.service_activate ' .
                    'FROM host h, service s, host_service_relation hsr ' .
                    'WHERE hsr.host_host_id = h.host_id ' .
                    'AND hsr.service_service_id = s.service_id ' .
                    'AND h.host_register = "1" ' .
                    'AND (s.service_register = "1" OR s.service_register = "3") ' .
                    'AND CONCAT(h.host_name, " - ", s.service_description) LIKE :description ' .
                    $enableQuery . $aclServices .
                    'ORDER BY fullname ';

                if (!empty($range)) {
                    $queryService .= 'LIMIT :offset, :limit';
                    $queryValues['offset'] = $range[0];
                    $queryValues['limit'] = $range[1];
                }
                $queryValues['description'] = '%' . $q . '%';
                $stmt = $this->pearDB->prepare($queryService);
                $stmt->bindValue(':description', $queryValues['description'], PDO::PARAM_STR);
                if (isset($queryValues['offset'])) {
                    $stmt->bindValue(':offset', $queryValues["offset"], PDO::PARAM_INT);
                    $stmt->bindValue(':limit', $queryValues["limit"], PDO::PARAM_INT);
                }
                $dbResult = $stmt->execute();
                break;
            case 'm':
                $queryService = 'SELECT SQL_CALC_FOUND_ROWS DISTINCT CONCAT("Meta - ", ms.display_name) ' .
                    'as fullname, ms.service_id, mh.host_id, ms.service_activate ' .
                    'FROM host mh, service ms ' .
                    'WHERE mh.host_name = "_Module_Meta" ' .
                    'AND mh.host_register = "2" ' .
                    'AND ms.service_register = "2" ' .
                    'AND CONCAT("Meta - ", ms.display_name) LIKE :description ' .
                    $enableQueryMeta . $aclMetaServices .
                    'ORDER BY fullname ';
                if (!empty($range)) {
                    $queryService .= 'LIMIT :offset, :limit';
                    $queryValues['offset'] = $range[0];
                    $queryValues['limit'] = $range[1];
                }
                $queryValues['description'] = '%' . $q . '%';
                $stmt = $this->pearDB->prepare($queryService);
                $stmt->bindValue(':description', $queryValues['description'], PDO::PARAM_STR);
                if (isset($queryValues['offset'])) {
                    $stmt->bindValue(':offset', $queryValues["offset"], PDO::PARAM_INT);
                    $stmt->bindValue(':limit', $queryValues["limit"], PDO::PARAM_INT);
                }
                $dbResult = $stmt->execute();
                break;
        }
        if (!$dbResult) {
            throw new \Exception("An error occured");
        }

        $serviceList = array();
        while ($data = $stmt->fetch()) {
            if ($hasGraph) {
                if (service_has_graph($data['host_id'], $data['service_id'], $this->pearDBMonitoring)) {
                    $serviceCompleteName = $data['fullname'];
                    $serviceCompleteId = $data['host_id'] . '-' . $data['service_id'];
                    $serviceList[] = [
                        'id' => htmlentities($serviceCompleteId),
                        'text' => $serviceCompleteName,
                        'status' => (bool) $data['service_activate'],
                    ];
                }
            } else {
                $serviceCompleteName = $data['fullname'];
                $serviceCompleteId = $data['host_id'] . '-' . $data['service_id'];
                $serviceList[] = [
                    'id' => htmlentities($serviceCompleteId),
                    'text' => $serviceCompleteName,
                    'status' => (bool) $data['service_activate'],
                ];
            }
        }

        return array(
            'items' => $serviceList,
            'total' => (int) $this->pearDB->numberRows()
        );
    }

    /**
     * @param $q
     * @param $aclServices
     * @param array $range
     * @return array
     * @throws Exception
     */
    private function getServicesByHostgroup($q, $aclServices, $range = array())
    {
        $queryValues = array();
        $queryService = 'SELECT SQL_CALC_FOUND_ROWS DISTINCT CONCAT(hg.hg_name, " - ", s.service_description) ' .
            'as fullname, s.service_id, hg.hg_id ' .
            'FROM hostgroup hg, service s, host_service_relation hsr ' .
            'WHERE hsr.hostgroup_hg_id = hg.hg_id ' .
            'AND hsr.service_service_id = s.service_id ' .
            'AND s.service_register = "1" ' .
            'AND CONCAT(hg.hg_name, " - ", s.service_description) LIKE :description ' .
            $aclServices . 'ORDER BY fullname ';
        if (!empty($range)) {
            $queryService .= 'LIMIT :offset,:limit';
            $queryValues['offset'] = $range[0];
            $queryValues['limit'] = $range[1];
        }
        $queryValues['description'] = '%' . $q . '%';

        $stmt = $this->pearDB->prepare($queryService);
        $stmt->bindValue(':description', $queryValues['description'], PDO::PARAM_STR);
        if (isset($queryValues['offset'])) {
            $stmt->bindValue(':offset', $queryValues["offset"], PDO::PARAM_INT);
            $stmt->bindValue(':limit', $queryValues["limit"], PDO::PARAM_INT);
        }
        $dbResult = $stmt->execute();
        if (!$dbResult) {
            throw new \Exception("An error occured");
        }
        $serviceList = array();
        while ($data = $stmt->fetch()) {
            $serviceCompleteName = $data['fullname'];
            $serviceCompleteId = $data['hg_id'] . '-' . $data['service_id'];
            $serviceList[] = array('id' => htmlentities($serviceCompleteId), 'text' => $serviceCompleteName);
        }

        return array(
            'items' => $serviceList,
            'total' => (int) $this->pearDB->numberRows()
        );
    }

    /**
     * @return array
     * @throws Exception
     * @throws RestBadRequestException
     */
    public function getDefaultEscalationValues()
    {
        $defaultValues = array();
        // Get Object targeted
        if (isset($this->arguments['id']) && !empty($this->arguments['id'])) {
            $id = $this->arguments['id'];
        } else {
            throw new RestBadRequestException("Bad parameters id");
        }

        $queryService = 'SELECT distinct host_host_id, host_name, service_service_id, service_description ' .
            'FROM service s, escalation_service_relation esr, host h ' .
            'WHERE s.service_id = esr.service_service_id ' .
            'AND esr.host_host_id = h.host_id ' .
            'AND h.host_register = "1" ' .
            'AND esr.escalation_esc_id = :id';
        $stmt = $this->db->prepare($queryService);
        $stmt->bindValue(':id', $id, PDO::PARAM_INT);
        $dbResult = $stmt->execute();
        if (!$dbResult) {
            throw new \Exception("An error occured");
        }
        while ($data = $stmt->fetch()) {
            $serviceCompleteName = $data['host_name'] . ' - ' . $data['service_description'];
            $serviceCompleteId = $data['host_host_id'] . '-' . $data['service_service_id'];
            $defaultValues[] = array('id' => htmlentities($serviceCompleteId), 'text' => $serviceCompleteName);
        }
        return $defaultValues;
    }
}


text:
<!DOCTYPE html>

	<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
	<meta charset="UTF-8" />
	<title>Omiu Link</title>

Base

		<o-link target="_blank" href="https://tencent.github.io/omi/">Default</o-link>
		<o-link type="primary">Primary</o-link>
		<o-link type="danger">Danger</o-link>
		<o-link type="primary">
			<o-icon-ac-unit-outlined></o-icon-ac-unit-outlined> Icon
		</o-link>
		<o-link type="danger">Icon <o-icon-accessible-rounded></o-icon-accessible-rounded>
		</o-link>

Disabled

		<o-link disabled>Default</o-link>
		<o-link disabled type="primary">Primary</o-link>
		<o-link disabled type="danger">Danger</o-link>
		<o-link disabled type="primary">
			<o-icon-ac-unit-outlined></o-icon-ac-unit-outlined> Icon
		</o-link>
		<o-link disabled type="danger">Icon <o-icon-accessible-rounded></o-icon-accessible-rounded>
		</o-link>

Underline False

		<o-link underline='0'>Default</o-link>
		<o-link underline='0' type="primary">Primary</o-link>
		<o-link underline='0' type="danger">Danger</o-link>


text:
<?php

namespace ForkCMS\Modules\Pages\Backend\Actions;

use ForkCMS\Modules\Backend\Domain\Action\AbstractFormActionController;
use ForkCMS\Modules\Pages\Domain\ModuleSettings\ModuleSettingsType;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

final class ModuleSettings extends AbstractFormActionController
{
    protected function addBreadcrumbForRequest(Request $request): void
    {
        // no action specific breadcrumb needed
    }

    protected function getFormResponse(Request $request): ?Response
    {
        return $this->handleModuleSettingsForm(
            $request,
            ModuleSettingsType::class,
        );
    }
}


text:
import pytest

from zfssnap import autotype

class TestZFSSnap(object):
    def test_autotype_to_int(self):
        assert isinstance(autotype('123'), int)

    def test_autotype_to_str(self):
        assert isinstance(autotype('12f'), str)


text:
package com.sequenceiq.cloudbreak.structuredevent.rest.urlparsers;

import static com.sequenceiq.cloudbreak.structuredevent.event.CloudbreakEventService.DATAHUB_RESOURCE_TYPE;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import java.util.Arrays;
import java.util.regex.Matcher;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

@RunWith(Parameterized.class)
public class DistroXV1RestUrlParserTest {

    @Parameterized.Parameter
    public String url;

    @Parameterized.Parameter(1)
    public boolean match;

    @Parameterized.Parameter(2)
    public String resourceCrn;

    @Parameterized.Parameter(3)
    public String resourceName;

    @Parameterized.Parameter(4)
    public String resourceType;

    @Parameterized.Parameter(5)
    public String resourceEvent;

    private DistroXV1RestUrlParser underTest;

    @Before
    public void init() {
        underTest = new DistroXV1RestUrlParser();
    }

    @Test
    public void testMatch() {
        Matcher matcher = underTest.getPattern().matcher(url);
        if (match) {
            assertTrue(matcher.matches());
            assertEquals(resourceName, underTest.getResourceName(matcher));
            assertEquals(resourceCrn, underTest.getResourceCrn(matcher));
            assertEquals(resourceType, underTest.getResourceType(matcher));
            assertEquals(resourceEvent, underTest.getResourceEvent(matcher));
        } else {
            assertFalse(matcher.matches());
        }
    }

    @Parameterized.Parameters(name
            = "{index}: testMatch(url: {0}, should match {1}, resourceCrn: {2}, resourceName: {3}, resourceType: {4}, resourceEvent: {5}")
    public static Iterable<Object[]> data() {
        return Arrays.asList(new Object[][]{
                {"v1/distrox/name/asdf", true, null, "asdf", DATAHUB_RESOURCE_TYPE, "asdf"},
                {"v1/distrox/random/asdf", false, null, null, DATAHUB_RESOURCE_TYPE, null},
                {"v1/distrox/name/asdf/event", true, null, "asdf", DATAHUB_RESOURCE_TYPE, "event"},
                {"v1/name/asdf", false, null, null, DATAHUB_RESOURCE_TYPE, null},
                {"distrox", false, null, null, DATAHUB_RESOURCE_TYPE, null},
                {"v2/distrox", false, null, null, DATAHUB_RESOURCE_TYPE, null},
                {"v1/distrox", true, null, null, DATAHUB_RESOURCE_TYPE, null},
                {"v1/distrox/name/event", true, null, "event", DATAHUB_RESOURCE_TYPE, "event"},
                {"v1/distrox/crn/event", true, "event", null, DATAHUB_RESOURCE_TYPE, "event"},
                {"v1/distrox/crn/test:crn:blabla", true, "test:crn:blabla", null, DATAHUB_RESOURCE_TYPE, "test:crn:blabla"},
                {"v1/distrox/crn/test:crn:blabla/extrastuff", true, "test:crn:blabla", null, DATAHUB_RESOURCE_TYPE, "extrastuff"},
                {"v1/distrox/crn/test:crn:blabla/extrastuff/andmore", true, "test:crn:blabla", null, DATAHUB_RESOURCE_TYPE, "extrastuff/andmore"}
        });
    }
}


text:
namespace ash {
namespace system {

namespace {

void ErrorCallbackFunction(const std::string& error_name,
                           const std::string& error_message) {
  LOG(ERROR) << "Shill Error: " << error_name << " : " << error_message;
}

bool DeviceDisabledScreenShown() {
  WizardController* const wizard_controller =
      WizardController::default_controller();
  EXPECT_TRUE(wizard_controller);
  return wizard_controller &&
         wizard_controller->current_screen() ==
             wizard_controller->GetScreen(DeviceDisabledScreenView::kScreenId);
}

}  // namespace

class DeviceDisablingTest
    : public OobeBaseTest,
      public NetworkStateInformer::NetworkStateInformerObserver {
 public:
  DeviceDisablingTest() = default;

  DeviceDisablingTest(const DeviceDisablingTest&) = delete;
  DeviceDisablingTest& operator=(const DeviceDisablingTest&) = delete;

  // Sets up a device state blob that indicates the device is disabled.
  void SetDeviceDisabledPolicy();

  // Sets up a device state blob that indicates the device is disabled, triggers
  // a policy plus device state fetch and waits for it to succeed.
  void MarkDisabledAndWaitForPolicyFetch();

  std::string GetCurrentScreenName(content::WebContents* web_contents);

 protected:
  // OobeBaseTest:
  void SetUpOnMainThread() override;

  // NetworkStateInformer::NetworkStateInformerObserver:
  void UpdateState(NetworkError::ErrorReason reason) override;

  std::unique_ptr<base::RunLoop> network_state_change_wait_run_loop_;
  NetworkPortalDetectorMixin network_portal_detector_{&mixin_host_};

 private:
  DeviceStateMixin device_state_{
      &mixin_host_, DeviceStateMixin::State::OOBE_COMPLETED_CLOUD_ENROLLED};
};

void DeviceDisablingTest::SetDeviceDisabledPolicy() {
  // Prepare a policy fetch response that indicates the device is disabled.
  std::unique_ptr<ScopedDevicePolicyUpdate> policy_update =
      device_state_.RequestDevicePolicyUpdate();
  policy_update->policy_data()->mutable_device_state()->set_device_mode(
      enterprise_management::DeviceState::DEVICE_MODE_DISABLED);
}

void DeviceDisablingTest::MarkDisabledAndWaitForPolicyFetch() {
  base::RunLoop run_loop;
  // Set up an observer that will wait for the disabled setting to change.
  base::CallbackListSubscription subscription =
      CrosSettings::Get()->AddSettingsObserver(kDeviceDisabled,
                                               run_loop.QuitClosure());
  SetDeviceDisabledPolicy();
  // Trigger a policy fetch.
  FakeSessionManagerClient::Get()->OnPropertyChangeComplete(true);
  // Wait for the policy fetch to complete and the disabled setting to change.
  run_loop.Run();
}

void DeviceDisablingTest::SetUpOnMainThread() {
  network_state_change_wait_run_loop_ = std::make_unique<base::RunLoop>();

  OobeBaseTest::SetUpOnMainThread();

  // Set up fake networks.
  ShillManagerClient::Get()->GetTestInterface()->SetupDefaultEnvironment();
}

void DeviceDisablingTest::UpdateState(NetworkError::ErrorReason reason) {
  network_state_change_wait_run_loop_->Quit();
}

IN_PROC_BROWSER_TEST_F(DeviceDisablingTest, DisableDuringNormalOperation) {
  MarkDisabledAndWaitForPolicyFetch();
  // Check for WizardController state.
  OobeScreenWaiter(DeviceDisabledScreenView::kScreenId).Wait();

  EXPECT_TRUE(ash::LoginScreenTestApi::IsOobeDialogVisible());
}

// Verifies that device disabling works when the ephemeral users policy is
// enabled. This case warrants its own test because the UI behaves somewhat
// differently when the policy is set: A background job runs on startup that
// causes the UI to try and show the login screen after some delay. It must
// be ensured that the login screen does not show and does not clobber the
// disabled screen.
IN_PROC_BROWSER_TEST_F(DeviceDisablingTest, DisableWithEphemeralUsers) {
  // Connect to the fake Ethernet network. This ensures that Chrome OS will not
  // try to show the offline error screen.
  base::RunLoop connect_run_loop;
  ShillServiceClient::Get()->Connect(dbus::ObjectPath("/service/eth1"),
                                     connect_run_loop.QuitClosure(),
                                     base::BindOnce(&ErrorCallbackFunction));
  connect_run_loop.Run();

  // Skip to the login screen.
  OobeScreenWaiter(GetFirstSigninScreen()).Wait();

  // Mark the device as disabled and wait until cros settings update.
  MarkDisabledAndWaitForPolicyFetch();

  // Check for WizardController state.
  OobeScreenWaiter(DeviceDisabledScreenView::kScreenId).Wait();

  // Disconnect from the fake Ethernet network.
  const LoginDisplayHost* host = LoginDisplayHost::default_host();
  OobeUI* const oobe_ui = host->GetOobeUI();
  ASSERT_TRUE(oobe_ui);
  const scoped_refptr<NetworkStateInformer> network_state_informer =
      oobe_ui->network_state_informer_for_test();
  ASSERT_TRUE(network_state_informer);
  network_state_informer->AddObserver(this);
  SigninScreenHandler* const signin_screen_handler =
      oobe_ui->signin_screen_handler();
  ASSERT_TRUE(signin_screen_handler);
  signin_screen_handler->SetOfflineTimeoutForTesting(base::Seconds(0));
  network_portal_detector_.SimulateDefaultNetworkState(
      NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_OFFLINE);
  network_state_change_wait_run_loop_->Run();
  network_state_informer->RemoveObserver(this);
  base::RunLoop().RunUntilIdle();

  // Verify that the offline error screen was not shown and the device disabled
  // screen is still being shown instead.
  // Check for WizardController state.
  OobeScreenWaiter(DeviceDisabledScreenView::kScreenId).Wait();
}

class DeviceDisablingWithUsersTest : public DeviceDisablingTest {
 public:
  DeviceDisablingWithUsersTest() { login_manager_.AppendRegularUsers(2); }

 private:
  LoginManagerMixin login_manager_{&mixin_host_};
};

// Checks that OOBE dialog is not hidden when the device disabled screen is
// shown and "StartSignInScreen" is called.
IN_PROC_BROWSER_TEST_F(DeviceDisablingWithUsersTest, DialogNotHidden) {
  EXPECT_TRUE(ash::LoginScreenTestApi::ClickAddUserButton());
  EXPECT_TRUE(ash::LoginScreenTestApi::IsOobeDialogVisible());
  OobeScreenWaiter(GetFirstSigninScreen()).Wait();
  MarkDisabledAndWaitForPolicyFetch();
  OobeScreenWaiter(DeviceDisabledScreenView::kScreenId).Wait();
  LoginDisplayHost::default_host()->StartSignInScreen();

  // Dialog should not be hidden.
  EXPECT_TRUE(ash::LoginScreenTestApi::IsOobeDialogVisible());
}

// Sets the device disabled policy before the browser is started.
class PresetPolicyDeviceDisablingTest : public DeviceDisablingTest {
 public:
  PresetPolicyDeviceDisablingTest() {}

  PresetPolicyDeviceDisablingTest(const PresetPolicyDeviceDisablingTest&) =
      delete;
  PresetPolicyDeviceDisablingTest& operator=(
      const PresetPolicyDeviceDisablingTest&) = delete;

 protected:
  // DeviceDisablingTest:
  void SetUpInProcessBrowserTestFixture() override {
    DeviceDisablingTest::SetUpInProcessBrowserTestFixture();
    SetDeviceDisabledPolicy();
  }
};

// Same test as the one in DeviceDisablingTest, except the policy is being set
// before Chrome process is started. This test covers a crash (crbug.com/709518)
// in DeviceDisabledScreen where it would try to access DeviceDisablingManager
// even though it wasn't yet constructed fully.
IN_PROC_BROWSER_TEST_F(PresetPolicyDeviceDisablingTest,
                       DisableBeforeStartup) {
  EXPECT_TRUE(DeviceDisabledScreenShown());
  EXPECT_TRUE(ash::LoginScreenTestApi::IsOobeDialogVisible());
}

class DeviceDisablingBeforeLoginHostCreated
    : public PresetPolicyDeviceDisablingTest {
 public:
  DeviceDisablingBeforeLoginHostCreated() {
    // Start with user pods.
    login_mixin_.AppendManagedUsers(2);
  }

  bool SetUpUserDataDirectory() override {
    // LoginManagerMixin sets up command line in the SetUpUserDataDirectory.
    if (!PresetPolicyDeviceDisablingTest::SetUpUserDataDirectory())
      return false;
    // Postpone login host creation.
    base::CommandLine::ForCurrentProcess()->RemoveSwitch(
        switches::kForceLoginManagerInTests);
    return true;
  }

  bool ShouldWaitForOobeUI() override { return false; }

 protected:
  LoginManagerMixin login_mixin_{&mixin_host_};
};

// Sometimes LoginHost creation postponed (e.g. due to language switch
// https://crbug.com/1065569). This tests checks this flow.
IN_PROC_BROWSER_TEST_F(DeviceDisablingBeforeLoginHostCreated,
                       ShowsDisabledScreen) {
  EXPECT_TRUE(
      system::DeviceDisablingManager::IsDeviceDisabledDuringNormalOperation());
  EXPECT_EQ(nullptr, LoginDisplayHost::default_host());
  EXPECT_NE(nullptr,
            g_browser_process->platform_part()->device_disabling_manager());
  ShowLoginWizard(ash::OOBE_SCREEN_UNKNOWN);
  // Check for WizardController state.
  OobeScreenWaiter(DeviceDisabledScreenView::kScreenId).Wait();

  EXPECT_TRUE(ash::LoginScreenTestApi::IsOobeDialogVisible());
}

}  // namespace system
}  // namespace ash


text:
package main.java.Controller;

import main.java.Model.BeatModel;
import main.java.Model.BeatModelInterface;
import main.java.View.DJView;
import main.java.View.MultiplesView;

public class BeatController implements ControllerInterface {
	BeatModelInterface model;
	public DJView view;

	public BeatController(BeatModelInterface model) {
		this.model = model;
		view = new DJView(this, model);
        view.createView();
        view.createControls();
		view.disableStopMenuItem();
		view.enableStartMenuItem();
		model.initialize();
	}

	/**
	 * Constructor creado para el uso de MultiplesView
	 */
	public BeatController(BeatModel model, MultiplesView view) {

		this.view = view;

		this.view.disableStopMenuItem();

		this.view.enableStartMenuItem();

		this.model = model;

		this.model.initialize();

	}

	public void start() {
		model.on();
		view.disableStartMenuItem();
		view.enableStopMenuItem();
	}

	public void stop() {
		model.off();
		view.disableStopMenuItem();
		view.enableStartMenuItem();
	}

	public void increaseBPM() {
        int bpm = model.getBPM();
        model.setBPM(bpm + 1);
	}

	public void decreaseBPM() {
        int bpm = model.getBPM();
        model.setBPM(bpm - 1);
  	}

 	public void setBPM(int bpm) {
		model.setBPM(bpm);
	}
}


text:
<?php

namespace Mockery\Loader;

use Mockery\Generator\MockDefinition;
use Mockery\Loader\Loader;

class RequireLoader implements Loader
{
    protected $path;

    public function __construct($path = null)
    {
        $this->path = realpath($path) ?: sys_get_temp_dir();
    }

    public function load(MockDefinition $definition)
    {
        if (class_exists($definition->getClassName(), false)) {
            return;
        }

        $tmpfname = $this->path.DIRECTORY_SEPARATOR."Mockery_".uniqid().".php";
        file_put_contents($tmpfname, $definition->getCode());

        require $tmpfname;
    }
}


text:
Practicing Lean Startup

- Problem / Solution Fit
- Product / Market Fit
- Scale


text:
//*********************************************************//
//    Copyright (c) Microsoft. All rights reserved.
//
//    Apache 2.0 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.
//
//*********************************************************//

using System.Collections.Generic;
using System.Linq;
using Microsoft.NodejsTools.Parsing;
using Microsoft.VisualStudioTools;

namespace Microsoft.NodejsTools.Formatting {
    /// <summary>
    /// Provides formatting for JavaScript code
    /// </summary>
    internal static class Formatter {
        /// <summary>
        /// Returns a list of edits which should be applied to the specified code.
        /// </summary>
        public static Edit[] GetEditsForDocument(string code, FormattingOptions options = null) {
            using (new DebugTimer("FormatDocument")) {
                var edits = GetEdits(code, options);
                return edits.ToArray();
            }
        }

        public static Edit[] GetEditsAfterKeystroke(string code, int position, char ch, FormattingOptions options = null) {
            using (new DebugTimer("FormatKeyStroke")) {
                if (ch == ';' || ch == '}') {
                    var ast = new JSParser(code).Parse(new CodeSettings() { AllowShebangLine = true });
                    var visitor = new RangeVisitor(ch, position, ast);
                    ast.Walk(visitor);
                    if (visitor.Span != default(IndexSpan)) {
                        return FilterRange(
                            visitor.Span.Start,
                            visitor.Span.End,
                            GetEdits(code, options, ast)
                        );
                    }
                }
                return new Edit[0];
            }
        }

        public static Edit[] GetEditsAfterEnter(string code, int start, int end, FormattingOptions options = null) {
            using (new DebugTimer("FormatRange")) {
                var edits = GetEdits(code, options, true);
                return FilterRange(start, end, edits);
            }
        }

        public static Edit[] GetEditsForRange(string code, int start, int end, FormattingOptions options = null) {
            using (new DebugTimer("FormatRange")) {
                var edits = GetEdits(code, options);
                return FilterRange(start, end, edits);
            }
        }

        class RangeVisitor : AstVisitor {
            private readonly char _typedChar;
            private readonly int _position;
            private readonly JsAst _tree;
            public IndexSpan Span;

            public RangeVisitor(char typedChar, int position, JsAst tree) {
                _typedChar = typedChar;
                _position = position;
                _tree = tree;
            }

            public override bool Walk(ContinueNode node) {
                CheckStatement(node);
                return base.Walk(node);
            }

            public override bool Walk(Break node) {
                CheckStatement(node);
                return base.Walk(node);
            }

            public override bool Walk(ExpressionStatement node) {
                CheckStatement(node);
                return base.Walk(node);
            }

            public override bool Walk(Var node) {
                CheckStatement(node);
                return base.Walk(node);
            }

            public override bool Walk(DebuggerNode node) {
                CheckStatement(node);
                return base.Walk(node);
            }

            public override bool Walk(ThrowNode node) {
                CheckStatement(node);
                return base.Walk(node);
            }

            public override bool Walk(ReturnNode node) {
                CheckStatement(node);
                return base.Walk(node);
            }

            private void CheckStatement(Statement node) {
                if (_typedChar == ';' && node.GetEndIndex(_tree.LocationResolver) == _position) {
                    // if(1)if(1)if(1)if(1)x+=2;
                    // We want to reformat all of the if statements that are nested
                    // so walk up the parent nodes as long as they are all terminated
                    // at the same semicolon.
                    Span = GetTargetStatement(node).GetSpan(_tree.LocationResolver);
                }
            }

            private Statement GetTargetStatement(Statement node) {
                Statement targetNode = node;
                while (targetNode.Parent != null &&
                    targetNode.Parent.GetEndIndex(_tree.LocationResolver) == node.GetEndIndex(_tree.LocationResolver)) {
                    if (targetNode.Parent != null && targetNode.Parent.Parent is JsAst) {
                        // https://nodejstools.codeplex.com/workitem/1102
                        // We don't want to reformat the entire document just because someone
                        // is doing something at the end of the document.
                        break;
                    }
                    targetNode = targetNode.Parent;
                }
                return targetNode;
            }

            public override bool Walk(Switch node) {
                if (_typedChar == '}' && node.GetEndIndex(_tree.LocationResolver) == _position) {
                    Span = GetTargetStatement(node).GetSpan(_tree.LocationResolver);
                    return false;
                }
                return base.Walk(node);
            }

            public override bool Walk(TryNode node) {
                if (CheckBlock(node.TryBlock) ||
                    CheckBlock(node.FinallyBlock) ||
                    CheckBlock(node.CatchBlock)) {
                        Span = GetTargetStatement(node).GetSpan(_tree.LocationResolver);
                    return false;
                }
                return base.Walk(node);
            }

            public override bool Walk(ForIn node) {
                if (CheckBlock(node.Body)) {
                    Span = GetTargetStatement(node).GetSpan(_tree.LocationResolver);
                    return false;
                }
                return base.Walk(node);
            }

            public override bool Walk(ForNode node) {
                if (CheckBlock(node.Body)) {
                    Span = GetTargetStatement(node).GetSpan(_tree.LocationResolver);
                    return false;
                }
                return base.Walk(node);
            }

            public override bool Walk(WhileNode node) {
                if (CheckBlock(node.Body)) {
                    Span = GetTargetStatement(node).GetSpan(_tree.LocationResolver);
                    return false;
                }
                return base.Walk(node);
            }

            public override bool Walk(WithNode node) {
                if (CheckBlock(node.Body)) {
                    Span = GetTargetStatement(node).GetSpan(_tree.LocationResolver);
                    return false;
                }
                return base.Walk(node);
            }

            public override bool Walk(Block block) {
                if (CheckBlock(block)) {
                    Span = GetTargetStatement(block).GetSpan(_tree.LocationResolver);
                    return false;
                }
                return true;
            }

            public override bool Walk(ObjectLiteral node) {
                if (_typedChar == '}' && node.GetEndIndex(_tree.LocationResolver) == _position) {
                    Span = node.GetSpan(_tree.LocationResolver);
                    return false;
                }
                return base.Walk(node);
            }

            private bool CheckBlock(Block block) {
                if (_typedChar == '}' &&
                    block != null &&
                    block.Braces != BraceState.None &&
                    block.GetEndIndex(_tree.LocationResolver) == _position) {
                    return true;
                }
                return false;
            }
        }

        private static Edit[] FilterRange(int start, int end, List<Edit> edits) {
            return edits.Where(edit => edit.Start + edit.Length >= start && edit.Start + edit.Length < end).ToArray();
        }

        private static List<Edit> GetEdits(string code, FormattingOptions options, bool onEnter = false) {
            var ast = new JSParser(code).Parse(new CodeSettings() { AllowShebangLine = true });
            return GetEdits(code, options, ast, onEnter);
        }

        private static List<Edit> GetEdits(string code, FormattingOptions options, JsAst ast, bool onEnter = false) {
            var visitor = new FormattingVisitor(code, ast, options, onEnter);
            visitor.Format(ast);
            return visitor.Edits;
        }
    }
}


text:
package at.diamonddogs.contentprovider;

import android.content.ContentProvider;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.net.Uri;

import at.diamonddogs.util.Log;

/**
 * A default {@link ContentProvider} that holds common functionality
 */
public abstract class AbstractDefaultContentProvider extends ContentProvider {

	private static final String TAG = AbstractDefaultContentProvider.class.getSimpleName();

	protected abstract SQLiteOpenHelper getDatabaseHelper();

	protected abstract String getDefaultTableName();

	@Override
	public int delete(Uri uri, String selection, String[] selectionArgs) {
		SQLiteDatabase db = getDatabaseHelper().getWritableDatabase();
		int rows = db.delete(getDefaultTableName(), selection, selectionArgs);
		getContext().getContentResolver().notifyChange(uri, null);
		return rows;
	}

	@Override
	public Uri insert(Uri uri, ContentValues values) {
		SQLiteDatabase db = getDatabaseHelper().getWritableDatabase();
		long rowId = db.insertWithOnConflict(getDefaultTableName(), null, values, SQLiteDatabase.CONFLICT_REPLACE);
		if (rowId > 0) {
			Uri newUri = Uri.withAppendedPath(uri, String.valueOf(rowId));
			getContext().getContentResolver().notifyChange(newUri, null);
			return newUri;
		}
		throw new SQLException("Failed to insert row into " + uri);
	}

	@Override
	public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
		SQLiteDatabase db = getDatabaseHelper().getReadableDatabase();
		return db.query(getDefaultTableName(), projection, selection, selectionArgs, null, null, sortOrder);
	}

	@Override
	public int bulkInsert(Uri uri, ContentValues[] values) {
		SQLiteDatabase db = getDatabaseHelper().getWritableDatabase();
		db.beginTransaction();
		int rows = 0;
		try {
			for (ContentValues cv : values) {
				long i = db.insertWithOnConflict(getDefaultTableName(), null, cv, SQLiteDatabase.CONFLICT_REPLACE);
				if (i == -1) {
					Log.e(TAG, "inserting " + cv + " failed");
				}
				rows++;
			}
			Log.i(TAG, "inserted - rows: " + rows);
			db.setTransactionSuccessful();
		} catch (Throwable tr) {
			Log.e(TAG, "Error while bulk inserting", tr);
		} finally {
			db.endTransaction();
		}
		getContext().getContentResolver().notifyChange(uri, null);
		return rows;
	}

	@Override
	public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
		SQLiteDatabase db = getDatabaseHelper().getWritableDatabase();
		int count = db.update(getDefaultTableName(), values, selection, selectionArgs);
		getContext().getContentResolver().notifyChange(uri, null);
		return count;
	}

	@Override
	public String getType(Uri uri) {
		return null;
	}

}


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

<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<TITLE>
org.apache.solr.search (Solr 4.3.0 API)
</TITLE>

<META NAME="date" CONTENT="2013-04-29">

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

      Overview
    Package
      Class
      Use
      Tree
      Deprecated
      Help

 PREV PACKAGE
 NEXT PACKAGE

  FRAMES
 NO FRAMES

  All Classes

Package org.apache.solr.search

APIs and classes for parsing and processing search requests

See:

          Description

Interface Summary

CacheRegenerator
Implementations of CacheRegenerator are used in autowarming to populate a new cache
 based on an old cache.

DocIterator
Simple Iterator of document Ids which may include score information.

DocList
DocList represents the result of a query: an ordered list of document ids with optional score.

DocSet
DocSet represents an unordered set of Lucene Document Ids.

ExtendedQuery
The ExtendedQuery interface provides extra metadata to a query.

PostFilter
The PostFilter interface provides a mechanism to further filter documents
 after they have already gone through the main query and other filters.

SolrCache<K,V>
Primary API for dealing with Solr's internal caches.

SolrSortField

Class Summary

BitDocSet
BitDocSet represents an unordered set of Lucene Document Ids
 using a BitSet.

BoostQParserPlugin
Create a boosted query from the input value.

CacheConfig
Contains the knowledge of how cache config is
 stored in the solrconfig.xml file, and implements a
 factory to create caches.

DelegatingCollector
A simple delegating collector where one can set the delegate after creation

DisMaxQParser
Query parser for dismax queries

DisMaxQParserPlugin
Create a dismax query from the input value.

DocListAndSet
A struct whose only purpose is to hold both a DocList and a DocSet
 so that both may be returned from a single method.

DocSetCollector

DocSetDelegateCollector

DocSlice
DocSlice implements DocList as an array of docids and optional scores.

ExtendedDismaxQParser
Query parser that generates DisjunctionMaxQueries based on user configuration.

ExtendedDismaxQParser.Clause

ExtendedDismaxQParser.ExtendedSolrQueryParser
A subclass of SolrQueryParser that supports aliasing fields for
 constructing DisjunctionMaxQueries.

ExtendedDismaxQParserPlugin
An advanced multi-field query parser based on the DisMax parser.

ExtendedQueryBase

FastLRUCache<K,V>
SolrCache based on ConcurrentLRUCache implementation.

FieldParams
A class to hold "phrase slop" and "boost" parameters for pf, pf2, pf3 parameters

FieldQParserPlugin
Create a field query from the input value, applying text analysis and constructing a phrase query if appropriate.

FunctionQParser

FunctionQParserPlugin
Create a function query from the input value.

FunctionRangeQParserPlugin
Create a range query over a function.

FunctionRangeQuery

Grouping
Basic Solr Grouping infrastructure.

HashDocSet
HashDocSet represents an unordered set of Lucene Document Ids
 using a primitive int hash table.

JoinQParserPlugin

LFUCache<K,V>
SolrCache based on ConcurrentLFUCache implementation.

LRUCache<K,V>

LuceneQParserPlugin
Parse Solr's variant on the Lucene QueryParser syntax.

MissingStringLastComparatorSource

NestedQParserPlugin
Create a nested query, with the ability of that query to redefine it's type via
 local parameters.

OldLuceneQParserPlugin
Parse Solr's variant of Lucene QueryParser syntax, including the
 deprecated sort specification after the query.

PrefixQParserPlugin
Create a prefix query from the input value.

QParser
Note: This API is experimental and may change in non backward-compatible ways in the future

QParserPlugin

QueryParsing
Collection of static utilities useful for query parsing.

QueryParsing.StrParser
Simple class to help with parsing a string.

QueryResultKey
A hash key encapsulating a query, a list of filters, and a sort

QueryUtils

RawQParserPlugin
Create a term query from the input value without any text analysis or transformation whatsoever.

ReturnFields
A class representing the return fields

SolrCacheBase
Common base class of reusable functionality for SolrCaches

SolrCacheBase.AutoWarmCountRef
Decides how many things to autowarm based on the size of another cache

SolrConstantScoreQuery
A query that wraps a filter and simply returns a constant score equal to the
 query boost for every document in the filter.

SolrFieldCacheMBean
A SolrInfoMBean that provides introspection of the Lucene FieldCache, this is NOT a cache that is managed by Solr.

SolrFilter
A SolrFilter extends the Lucene Filter and adds extra semantics such as passing on
 weight context info for function queries.

SolrIndexSearcher
SolrIndexSearcher adds schema awareness and caching functionality
 over the lucene IndexSearcher.

SolrIndexSearcher.DocsEnumState

SolrIndexSearcher.ProcessedFilter

SolrIndexSearcher.QueryCommand
A query request command to avoid having to change the method signatures
 if we want to pass additional information to the searcher.

SolrIndexSearcher.QueryResult
The result of a search.

SolrQueryParser
Solr's default query parser, a schema-driven superset of the classic lucene query parser.

SolrReturnFields
The default implementation of return fields parsing for Solr.

SortedIntDocSet
SortedIntDocSet represents a sorted set of Lucene Document Ids.

Sorting
Extra lucene sorting utilities & convenience methods

SortSpec
SortSpec encapsulates a Lucene Sort and a count of the number of documents
 to return.

SpatialBoxQParserPlugin

SpatialFilterQParser

SpatialFilterQParserPlugin
Creates a spatial Filter based on the type of spatial point used.

SpatialOptions

SurroundQParserPlugin
Plugin for lucene/contrib Surround query parser, bringing SpanQuery support
 to Solr.

SwitchQParserPlugin
A QParserPlugin that acts like a "switch/case" statement.

TermQParserPlugin
Create a single term query from the input value equivalent to readableToIndexed().

ValueSourceParser
A factory that parses user queries to generate ValueSource instances.

WrappedQuery
A simple query that wraps another query and implements ExtendedQuery.

Enum Summary

Grouping.Format

Grouping.TotalCount

SolrCache.State
Enumeration of possible States for cache instances.

Exception Summary

SyntaxError
Simple checked exception for parsing errors

Package org.apache.solr.search Description

APIs and classes for parsing and processing search requests

      Overview
    Package
      Class
      Use
      Tree
      Deprecated
      Help

 PREV PACKAGE
 NEXT PACKAGE

  FRAMES
 NO FRAMES

  All Classes

          Copyright © 2000-2013 Apache Software Foundation.  All Rights Reserved.


text:
class Abc
{
    private string DefGhi(float jkl)
    {
//


text:
<!--
  Copyright 2014 Parity authors

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

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

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  -->
<project xmlns="http://maven.apache.org/POM/4.0.0">

  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.sonatype.oss</groupId>
    <artifactId>oss-parent</artifactId>
    <version>7</version>
  </parent>

  <groupId>com.paritytrading.parity</groupId>
  <artifactId>parity-parent</artifactId>
  <version>0.7.1-SNAPSHOT</version>
  <packaging>pom</packaging>

  <name>Parity (Parent)</name>
  <description>An open source technology platform for trading venues.</description>
  <url>https://github.com/paritytrading/parity</url>

  <licenses>
    <license>
      <name>Apache License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
    </license>
  </licenses>

  <scm>
    <connection>scm:git:git@github.com:paritytrading/parity.git</connection>
    <developerConnection>scm:git:git@github.com:paritytrading/parity.git</developerConnection>
    <url>https://github.com/paritytrading/parity</url>
    <tag>HEAD</tag>
  </scm>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <java.version>1.8</java.version>
    <jmh.version>1.19</jmh.version>
    <nassau.version>0.13.0</nassau.version> <!-- (mentioned in documentation) -->
    <philadelphia.version>1.2.0</philadelphia.version>
  </properties>

  <modules>
    <module>libraries/book</module>
    <module>libraries/file</module>
    <module>libraries/match</module>
    <module>libraries/net</module>
    <module>libraries/util</module>
    <module>applications/client</module>
    <module>applications/fix</module>
    <module>applications/reporter</module>
    <module>applications/system</module>
    <module>applications/ticker</module>
    <module>tests/book-perf-test</module>
    <module>tests/match-perf-test</module>
  </modules>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.paritytrading.foundation</groupId>
        <artifactId>foundation</artifactId>
        <version>0.3.0</version> <!-- (mentioned in documentation) -->
      </dependency>
      <dependency>
        <groupId>com.paritytrading.nassau</groupId>
        <artifactId>nassau-core</artifactId>
        <version>${nassau.version}</version>
      </dependency>
      <dependency>
        <groupId>com.paritytrading.nassau</groupId>
        <artifactId>nassau-util</artifactId>
        <version>${nassau.version}</version>
      </dependency>
      <dependency>
        <groupId>com.paritytrading.philadelphia</groupId>
        <artifactId>philadelphia-core</artifactId>
        <version>${philadelphia.version}</version>
      </dependency>
      <dependency>
        <groupId>com.paritytrading.philadelphia</groupId>
        <artifactId>philadelphia-fix44</artifactId>
        <version>${philadelphia.version}</version>
      </dependency>
      <dependency>
        <groupId>com.typesafe</groupId>
        <artifactId>config</artifactId>
        <version>1.3.1</version>
      </dependency>
      <dependency>
        <groupId>it.unimi.dsi</groupId>
        <artifactId>fastutil</artifactId>
        <version>8.1.0</version> <!-- (mentioned in documentation) -->
      </dependency>
      <dependency>
        <groupId>joda-time</groupId>
        <artifactId>joda-time</artifactId>
        <version>2.10.6</version>
      </dependency>
      <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.12.0</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.jline</groupId>
        <artifactId>jline-reader</artifactId>
        <version>3.8.0</version>
      </dependency>
      <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter</artifactId>
        <version>5.7.0</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.jvirtanen.config</groupId>
        <artifactId>config-extras</artifactId>
        <version>0.2.0</version>
      </dependency>
      <dependency>
        <groupId>org.jvirtanen.util</groupId>
        <artifactId>util-extras</artifactId>
        <version>0.2.0</version>
      </dependency>
      <dependency>
        <groupId>org.openjdk.jmh</groupId>
        <artifactId>jmh-core</artifactId>
        <version>${jmh.version}</version>
      </dependency>
      <dependency>
        <groupId>org.openjdk.jmh</groupId>
        <artifactId>jmh-generator-annprocess</artifactId>
        <version>${jmh.version}</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-checkstyle-plugin</artifactId>
          <version>3.1.0</version>
          <dependencies>
            <dependency>
              <groupId>com.puppycrawl.tools</groupId>
              <artifactId>checkstyle</artifactId>
              <version>8.29</version>
            </dependency>
          </dependencies>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.8.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>3.1.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>2.8.2</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>3.0.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.5.3</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-shade-plugin</artifactId>
          <version>3.2.1</version>
          <configuration>
            <minimizeJar>true</minimizeJar>
          </configuration>
          <executions>
            <execution>
              <phase>package</phase>
              <goals>
                <goal>shade</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>3.0.0-M5</version>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <configuration>
          <configLocation>checkstyle.xml</configLocation>
          <includeTestSourceDirectory>true</includeTestSourceDirectory>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>${java.version}</source>
          <target>${java.version}</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <configuration>
          <excludePackageNames>com.paritytrading.parity.client:com.paritytrading.parity.fix:com.paritytrading.parity.reporter:com.paritytrading.parity.system:com.paritytrading.parity.ticker:*.perf</excludePackageNames>
          <links>
            <link>http://api.paritytrading.com/nassau/latest/</link>
            <link>http://fastutil.di.unimi.it/docs/</link>
            <link>http://typesafehub.github.io/config/latest/api/</link>
          </links>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <configuration>
          <addSchema>false</addSchema>
          <autoVersionSubmodules>true</autoVersionSubmodules>
          <tagNameFormat>@{project.version}</tagNameFormat>
        </configuration>
      </plugin>
    </plugins>
  </build>

</project>


text:
Download the example [or clone the repo](https://github.com/mui-org/material-ui):

```sh
curl https://codeload.github.com/mui-org/material-ui/tar.gz/master | tar -xz --strip=2 material-ui-master/examples/create-react-app-with-jss
cd create-react-app-with-jss
```

Install it and run:

```sh
npm install
npm run start
```

## The idea behind the example

This example demonstrate how you can use [Create React App](https://github.com/facebookincubator/create-react-app) with [JSS](https://github.com/cssinjs/jss).


text:
Litecoin Easy Check

Check the market price of Litecoin. Easy.

Version {{version}}

By Drake Emko

Your feedback is welcome. Email: drakee@gmail.com


text:
@implementation AppSettings

- (void)fetch:(CDVInvokedUrlCommand*)command
{
    CDVPluginResult* result = nil;
    @try {
        NSDictionary *appSettingsDictionary = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"AppSettings"];
        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary: [appSettingsDictionary copy]];
    } @catch (NSException * e) {
        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_NO_RESULT messageAsString:[e reason]];
    } @finally {
        [self.commandDelegate sendPluginResult:result callbackId:[command callbackId]];
    }
}

@end


text:
import React, { Component } from 'react'
import { connect } from 'react-redux'
import { PageHeader, Grid, Row, Col, Alert, Navbar } from 'react-bootstrap'

import './App.css'

import FileSelector from './FileSelector'
import ClaimReport from './ClaimReport'
import UsageReport from './UsageReport'

import { processFile } from '../processor'

function mapStateToProps(state) {
  return {
    processing: state.processing,
    result: state.result
  }
}

function mapDispatchToProps(dispatch) {
  return {
    onFileSelected: (file) => dispatch(processFile(file))
  }
}

class App extends Component {
  render() {
    const { processing, result, onFileSelected } = this.props

    let content
    if (processing) {
      content = <Row><Col xs={12} md={8} mdOffset={2}><Alert bsStyle="info">Loading...</Alert></Col></Row>
    }
    else if (result) {
      content = (
        <Row>
          <Col xs={12} md={8} mdOffset={2}><ClaimReport total={result.totalClaimAmount} periods={result.periods}/></Col>
          <Col xs={12} md={8} mdOffset={2}><UsageReport weeks={result.weeks} periods={result.periods}/></Col>
        </Row>
      )
    }

    return (

        <Grid fluid>
          <Row>
            <Col xs={12}>
              <PageHeader>CHANGO PRESTO Tax Claim Calculator</PageHeader>
            </Col>
          </Row>
          <Row>
            <Col xs={12} sm={6} smOffset={3} md={4} mdOffset={4}>
              <FileSelector onFileSelected={onFileSelected} />
            </Col>
          </Row>
          {content}
        </Grid>
        <Navbar fixedBottom fluid>
          <Navbar.Text>Website Copyright © 2017 Gordon Tyler. PRESTO Copyright © 2016 Metrolinx. This website is not sponsored, endorsed or produced by PRESTO.</Navbar.Text>
        </Navbar>

    )
  }
}

export default connect(mapStateToProps, mapDispatchToProps)(App)


text:
cask "opensong" do
  version "3.4.8"
  sha256 "d3058292e406402bb1a65c4ed10d1e9c77fc9656d07ff381ed5f7904e1cd81b3"

  url "https://downloads.sourceforge.net/opensong/OpenSong/V#{version}%20Beta/OpenSong%20#{version}.pkg",
      verified: "sourceforge.net/opensong/"
  name "OpenSong"
  desc "Presentation software"
  homepage "http://www.opensong.org/"

  # This regex has to match unstable versions until the cask uses a stable
  # version again.
  livecheck do
    url "https://sourceforge.net/projects/opensong/rss?path=/OpenSong"
    regex(/OpenSong[\s._-]*?v?(\d+(?:[._]\d+)+(?:[\s._-]?(?:B(?:eta)?|RC)\d*)?)(?:[._-][^"']+?)?\.(?:dmg|pkg)/i)
  end

  pkg "OpenSong%20#{version}.pkg"

  uninstall pkgutil: "org.opensong.opensong"

  zap trash: [
    "~/Library/Preferences/org.opensong.opensong.plist",
    "~/Library/Saved Application State/org.opensong.opensong.savedState",
  ]
end