text:
package gnu.CORBA.GIOP;

import gnu.CORBA.Minor;
import gnu.CORBA.Version;
import gnu.CORBA.CDR.BigEndianInputStream;
import gnu.CORBA.CDR.BigEndianOutputStream;
import gnu.CORBA.CDR.LittleEndianInputStream;
import gnu.CORBA.CDR.LittleEndianOutputStream;
import gnu.CORBA.CDR.AbstractDataInput;
import gnu.CORBA.CDR.AbstractDataOutput;

import org.omg.CORBA.MARSHAL;
import org.omg.CORBA.portable.IDLEntity;

import java.io.ByteArrayOutputStream;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.util.Arrays;

/**
 * The GIOP message header.
 *
 * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
 */
public class MessageHeader
  implements IDLEntity
{
  /**
   * Use serialVersionUID for interoperability.
   */
  private static final long serialVersionUID = 1;

  /**
   * Request message.
   */
  public static final byte REQUEST = 0;

  /**
   * Reply message
   */
  public static final byte REPLY = 1;

  /**
   * Cancel request message.
   */
  public static final byte CANCEL_REQUEST = 2;

  /**
   * Locate request message, used to check the server ability to process
   * requests for the object reference. This message is also used to get the
   * address where the object reference should be sent.
   */
  public static final byte LOCATE_REQUEST = 3;

  /**
   * Locate reply message, sent in response to the {@link #LocateRequest}
   * message.
   */
  public static final byte LOCATE_REPLY = 4;

  /**
   * Instruction to close the connection.
   */
  public static final byte CLOSE_CONNECTION = 5;

  /**
   * Error report.
   */
  public static final byte MESSAGE_ERROR = 6;

  /**
   * The fragment messge, following the previous message that has more fragments
   * flag set. Added in GIOP 1.1
   */
  public static final byte FRAGMENT = 7;

  /**
   * This must always be "GIOP".
   */
  public static final byte[] MAGIC = new byte[] { 'G', 'I', 'O', 'P' };

  /**
   * The message type names.
   */
  protected static String[] types = new String[] { "Request", "Reply",
    "Cancel", "Locate request", "Locate reply", "Close connection", "Error",
    "Fragment" };

  /**
   * The GIOP version. Initialised to 1.0 .
   */
  public Version version;

  /**
   * The flags field, introduced since GIOP 1.1.
   */
  public byte flags = 0;

  /**
   * The message type.
   */
  public byte message_type = REQUEST;

  /**
   * The message size, excluding the message header.
   */
  public int message_size = 0;

  /**
   * Create an empty message header, corresponding version 1.0.
   */
  public MessageHeader()
  {
    version = new Version(1, 0);
  }

  /**
   * Create an empty message header, corresponding the given version.
   *
   * @param major the major message header version.
   * @param minor the minot message header version.
   */
  public MessageHeader(int major, int minor)
  {
    version = new Version(major, minor);
  }

  /**
   * Checks if the message is encoded in the Big Endian, most significant byte
   * first.
   */
  public boolean isBigEndian()
  {
    return (flags & 0x1) == 0;
  }

  /**
   * Checks if the message is partial, and more subsequent fragments follow.
   */
  public boolean moreFragmentsFollow()
  {
    return (flags & 0x2) != 0;
  }

  /**
   * Set the encoding to use.
   *
   * @param use_big_endian if true (default), the Big Endian encoding is used.
   * If false, the Little Endian encoding is used.
   */
  public void setBigEndian(boolean use_big_endian)
  {
    if (use_big_endian)
      flags = (byte) (flags & ~1);
    else
      flags = (byte) (flags | 1);
  }

  /**
   * Get the size of the message header itself. So far, it is always 12 bytes.
   */
  public int getHeaderSize()
  {
    return 12;
  }

  /**
   * Get the message type as string.
   *
   * @param type the message type as int (the field {@link message_type}).
   *
   * @return the message type as string.
   */
  public String getTypeString(int type)
  {
    try
      {
        return types[type];
      }
    catch (ArrayIndexOutOfBoundsException ex)
      {
        return "unknown type (" + type + ")";
      }
  }

  /**
   * Creates reply header, matching the message header version number.
   *
   * @return one of {@link gnu.CORBA.GIOP.v1_0.ReplyHeader},
   * {@link gnu.CORBA.GIOP.v1_2.ReplyHeader}, etc - depending on the version
   * number in this header.
   */
  public ReplyHeader create_reply_header()
  {
    if (version.since_inclusive(1, 2))
      return new gnu.CORBA.GIOP.v1_2.ReplyHeader();
    else
      return new gnu.CORBA.GIOP.v1_0.ReplyHeader();
  }

  /**
   * Creates request header, matching the message header version number.
   *
   * @return one of {@link gnu.CORBA.GIOP.v1_0.RequestHeader},
   * {@link gnu.CORBA.GIOP.v1_2.RequestHeader}, etc - depending on the version
   * number in this header.
   */
  public RequestHeader create_request_header()
  {
    if (version.since_inclusive(1, 2))
      return new gnu.CORBA.GIOP.v1_2.RequestHeader();
    else
      return new gnu.CORBA.GIOP.v1_0.RequestHeader();
  }

  /**
   * Create the cancel header, matching the message header version number.
   */
  public CancelHeader create_cancel_header()
  {
    return new gnu.CORBA.GIOP.v1_0.CancelHeader();
  }

  /**
   * Create the error message.
   */
  public ErrorMessage create_error_message()
  {
    return new ErrorMessage(version);
  }

  /**
   * Read the header from the stream.
   *
   * @param istream a stream to read from.
   * @throws MARSHAL if this is not a GIOP 1.0 header.
   */
  public void read(java.io.InputStream istream)
    throws MARSHAL, EOFException
  {
    try
      {
        byte[] xMagic = new byte[MAGIC.length];
        int r = istream.read(xMagic);
        int minor;
        if (! Arrays.equals(xMagic, MAGIC))
          {
            StringBuffer b = new StringBuffer();
            if (r == - 1)
              {
                b.append("Immediate EOF");
                minor = Minor.EOF;
              }
            else
              {
                minor = Minor.Giop;
                b.append(r + " bytes: ");
                for (int i = 0; i < xMagic.length; i++)
                  {
                    b.append(Integer.toHexString(xMagic[i] & 0xFF));
                    b.append(' ');
                  }
              }
            MARSHAL m = new MARSHAL("Not a GIOP message: " + b);
            m.minor = minor;
            throw m;
          }

        version = Version.read_version(istream);

        AbstractDataInput din;

        flags = (byte) istream.read();

        // This checks the bit in the byte we have just received.
        if (isBigEndian())
          din = new BigEndianInputStream(istream);
        else
          din = new LittleEndianInputStream(istream);

        message_type = (byte) din.read();

        message_size = din.readInt();
      }
    catch (IOException ex)
      {
        MARSHAL t = new MARSHAL();
        t.minor = Minor.Header;
        t.initCause(ex);
        throw t;
      }
  }

  /**
   * Get the short string summary of the message.
   *
   * @return a short message summary.
   */
  public String toString()
  {
    return "GIOP " + version + ", " + (isBigEndian() ? "Big" : "Little")
      + " endian, " + getTypeString(message_type) + ", " + message_size
      + " bytes. ";
  }

  /**
   * Write the header to stream.
   *
   * @param out a stream to write into.
   */
  public void write(java.io.OutputStream out)
  {
    try
      {
        AbstractDataOutput dout;

        if (isBigEndian())
          dout = new BigEndianOutputStream(out);
        else
          dout = new LittleEndianOutputStream(out);

        // Write magic sequence.
        dout.write(MAGIC);

        // Write version number.
        version.write((OutputStream) dout);
        dout.write(flags);
        dout.write(message_type);
        dout.writeInt(message_size);
      }
    catch (IOException ex)
      {
        MARSHAL t = new MARSHAL(ex.getMessage());
        t.minor = Minor.Header;
        t.initCause(ex);
        throw t;
      }
  }

  /**
   * Read data, followed by the message header. Handle fragmented messages.
   *
   * @param source the data source to read from.
   * @param service the socket on that the time outs are set. Can be null (no
   * timeouts are set).
   * @param to_read the timeout while reading the message.
   * @param to_pause the timeout for pauses between the message parts.
   */
  public byte[] readMessage(InputStream source, Socket service, int to_read,
    int to_pause)
  {
    try
      {
        byte[] r = new byte[message_size];

        int n = 0;
        if (service != null)
          service.setSoTimeout(to_read);

        reading: while (n < r.length)
          {
            n += source.read(r, n, r.length - n);
          }
        if (service != null)
          service.setSoTimeout(to_pause);

        // Read the message remainder if the message is fragmented.
        if (moreFragmentsFollow())
          {
            ByteArrayOutputStream buffer = new ByteArrayOutputStream(
              2 * r.length);
            buffer.write(r);

            if (r.length < 10)
              // Increase the buffer size if the default value (size of the
              // previous message) is really too small.
              r = new byte[1024];

            MessageHeader h2 = new MessageHeader();

            do
              {
                h2.read(source);

                int dn;

                n = 0;
                reading: while (n < h2.message_size)
                  {
                    dn = source.read(r, 0, h2.message_size - n);

                    if (n == 0 && service != null)
                      service.setSoTimeout(to_read);

                    if (n == 0 && version.since_inclusive(1, 2))
                      {
                        // Skip the four byte request id.
                        buffer.write(r, 4, dn - 4);
                      }
                    else
                      buffer.write(r, 0, dn);
                    n = +dn;
                  }

                if (service != null)
                  service.setSoTimeout(to_pause);
              }
            while (h2.moreFragmentsFollow());
            return buffer.toByteArray();
          }
        else
          return r;
      }
    catch (IOException ioex)
      {
        MARSHAL m = new MARSHAL("Unable to read the message continuation.");
        m.minor = Minor.Header;
        m.initCause(ioex);
        throw m;
      }
  }
}


text:
package org.jivesoftware.openfire.archive;

import org.jivesoftware.openfire.XMPPServer;
import org.jivesoftware.util.cache.ClusterTask;
import org.jivesoftware.util.cache.ExternalizableUtil;

import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.time.Duration;
import java.time.Instant;

/**
 * A task that retrieves a time estimation on the time it takes for data to have been written to persistent storage.
 *
 * @author Guus der Kinderen, guus.der.kinderen@gmail.com
 */
public class GetArchiveWriteETATask implements ClusterTask<Duration>
{
    private Instant instant;
    private String id;
    private Duration result;

    public GetArchiveWriteETATask() {}

    public GetArchiveWriteETATask( Instant instant, String id )
    {
        this.instant = instant;
        this.id = id;
    }

    @Override
    public void run()
    {
        final ArchiveManager manager = XMPPServer.getInstance().getArchiveManager();
        result = manager.availabilityETAOnLocalNode( id, instant );
    }

    @Override
    public Duration getResult()
    {
        return result;
    }

    @Override
    public void writeExternal( ObjectOutput out ) throws IOException
    {
        ExternalizableUtil.getInstance().writeSerializable( out, instant );
        ExternalizableUtil.getInstance().writeSafeUTF( out, id );
    }

    @Override
    public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException
    {
        instant = (Instant) ExternalizableUtil.getInstance().readSerializable( in );
        id = ExternalizableUtil.getInstance().readSafeUTF( in );
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Symfony\Component\HttpKernel\Tests\Exception;

use Symfony\Component\HttpKernel\Exception\FlattenException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;

class FlattenExceptionTest extends \PHPUnit_Framework_TestCase
{
    public function testStatusCode()
    {
        $flattened = FlattenException::create(new \RuntimeException(), 403);
        $this->assertEquals('403', $flattened->getStatusCode());

        $flattened = FlattenException::create(new \RuntimeException());
        $this->assertEquals('500', $flattened->getStatusCode());

        $flattened = FlattenException::create(new NotFoundHttpException());
        $this->assertEquals('404', $flattened->getStatusCode());
    }

    public function testHeadersForHttpException()
    {
        $flattened = FlattenException::create(new MethodNotAllowedHttpException(array('POST')));
        $this->assertEquals(array('Allow' => 'POST'), $flattened->getHeaders());
    }

    /**
     * @dataProvider flattenDataProvider
     */
    public function testFlattenHttpException(\Exception $exception, $statusCode)
    {
        $flattened = FlattenException::create($exception);
        $flattened2 = FlattenException::create($exception);

        $flattened->setPrevious($flattened2);

        $this->assertEquals($exception->getMessage(), $flattened->getMessage(), 'The message is copied from the original exception.');
        $this->assertEquals($exception->getCode(), $flattened->getCode(), 'The code is copied from the original exception.');
        $this->assertEquals(get_class($exception), $flattened->getClass(), 'The class is set to the class of the original exception');

    }

    /**
     * @dataProvider flattenDataProvider
     */
    public function testPrevious(\Exception $exception, $statusCode)
    {
        $flattened = FlattenException::create($exception);
        $flattened2 = FlattenException::create($exception);

        $flattened->setPrevious($flattened2);

        $this->assertSame($flattened2,$flattened->getPrevious());

        $this->assertSame(array($flattened2),$flattened->getAllPrevious());
    }

    /**
     * @dataProvider flattenDataProvider
     */
    public function testLine(\Exception $exception)
    {
        $flattened = FlattenException::create($exception);
        $this->assertSame($exception->getLine(), $flattened->getLine());
    }

    /**
     * @dataProvider flattenDataProvider
     */
    public function testFile(\Exception $exception)
    {
        $flattened = FlattenException::create($exception);
        $this->assertSame($exception->getFile(), $flattened->getFile());
    }

    /**
     * @dataProvider flattenDataProvider
     */
    public function testToArray(\Exception $exception, $statusCode)
    {
        $flattened = FlattenException::create($exception);
        $flattened->setTrace(array(),'foo.php',123);

        $this->assertEquals(array(
            array(
                'message'=> 'test',
                'class'=>'Exception',
                'trace'=>array(array(
                    'namespace'   => '', 'short_class' => '', 'class' => '','type' => '','function' => '', 'file' => 'foo.php','line' => 123,
                    'args'        => array()
                )),
            )
        ),$flattened->toArray());
    }

    public function flattenDataProvider()
    {
        return array(
            array(new \Exception('test', 123), 500),
        );
    }

    public function testRecursionInArguments()
    {
        $a = array('foo', array(2, &$a));
        $exception = $this->createException($a);

        $flattened = FlattenException::create($exception);
        $trace = $flattened->getTrace();
        $this->assertContains('*DEEP NESTED ARRAY*', serialize($trace));
    }

    private function createException($foo)
    {
        return new \Exception();
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <!-- News details -->
    <style name="NewsDetailAnchor">
        <item name="android:layout_alignTop">@id/article_illustration_container</item>
    </style>

</resources>


text:
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe Lolita::Mapping do

	it "should store options" do
		mapping=Lolita::Mapping.new(:posts)
		mapping.to.should == Post
		mapping.plural.should == :posts
		mapping.singular.should == :post
		mapping.path.should == "lolita"
		mapping.controllers[:posts].should == "lolita/posts"
	end

	context "url_name" do
		it "should start with lolita when no path is given" do
			mapping=Lolita::Mapping.new(:posts)
			mapping.url_name.should=="lolita_posts"
		end

		it "should start with given path" do
			mapping=Lolita::Mapping.new(:posts,:path=>"my_admin")
			mapping.url_name.should == "my_admin_posts"
		end
	end

  it 'should add headless navigation items to tree' do
    tree = Lolita::Navigation::Tree.new(:"left_side_navigation")
    Lolita::Navigation::Tree.remember(tree)

    described_class.new(:dashboard).add_to_navigation_tree
    described_class.new(:data_import).add_to_navigation_tree
    expect(Lolita.navigation.branches.size).to eq(2)
  end
end


text:
        Let's use Lift's LiftScreen to build complex
        simple screen input forms.

        Put your form here


text:
#pragma once
#include <Windows.h>
#include <d3d9.h>
#include <d3dx9.h>
#include <string.h>
#include <string>
#include <stdlib.h>
#include <time.h>
#include <dinput.h>
#include "Text.h"
#include "MyRectangle.h"
#include "resource.h"
#include "Text.h"
#include "Collision.h"
#include "Buffer.h"

#define APP_CLASS "Collision"
#define APP_TITLE "Check Collision"

#define KEYBOARD_BUFFER_SIZE 1024
#define KEY_DOWN(code) ( IsKeyDown(code) )
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480
#define FRAME_RATE 10
#define GRAVITY 1.5f
#define VELOCITY 20

LPDIRECT3D9 d3d = NULL;
LPDIRECT3DDEVICE9 d3ddv = NULL;
LPDIRECT3DSURFACE9 back_buffer = NULL;

DWORD _DeltaTime;

LPD3DXSPRITE SpriteHandler = NULL;
LPDIRECTINPUT8 di = NULL;

LPDIRECTINPUTDEVICE8 _keyboard;
BYTE  _keyStates[256];
DIDEVICEOBJECTDATA _KeyEvents[KEYBOARD_BUFFER_SIZE];

LRESULT WINAPI WinProc(HWND, UINT, WPARAM, LPARAM);
ATOM MyRegisterClass(HINSTANCE);
HWND InitWindow(HINSTANCE, int);
int GameInit(HWND);
void GameRun(HWND);
void GameEnd(HWND);
LPDIRECT3DTEXTURE9 LoadTexture(char*, D3DCOLOR);
void RenderFrame(DWORD);

int InitKeyBoard(HINSTANCE hInstance, HWND hWnd);
int IsKeyDown(int KeyCode);
void OnKeyDown(int KeyCode);
void OneKeyPress(int Delta);
void OnKeyUp(int KeyCode);
void ProcessInput(int Delta);
void ProcessKeyBoard(HWND hWnd);

Collision *collision = new Collision();
MyRectangle *groundRECT = new MyRectangle();
MyRectangle *boxRECT = new MyRectangle();
LPDIRECT3DTEXTURE9 ground = NULL;
LPDIRECT3DTEXTURE9 box = NULL;

int _vpx = 0;
int _vpy = SCREEN_HEIGHT;
D3DXIMAGE_INFO info;

Text *text = new Text();
Buffer *buffer = new Buffer();

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	// declare variables
	MSG msg;
	// register the class
	MyRegisterClass(hInstance);
	// initialize application
	HWND hWnd = InitWindow(hInstance, nCmdShow);
	//initialize the game
	if (!GameInit(hWnd))
		return 0;
	InitKeyBoard(hInstance, hWnd);
	// main message loop
	int done = 0;
	DWORD frame_start = GetTickCount();
	DWORD tick_per_frame = 1000 / FRAME_RATE;
	while (!done)
	{
		if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
		{
			//look for quit message
			if (msg.message == WM_QUIT)
				done = 1;
			//decode and pass messages on to WndProc
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
		else
		{
			//process game loop (else prevents running after window is closed)
			DWORD now = GetTickCount();
			_DeltaTime = now - frame_start;
			if (_DeltaTime >= tick_per_frame)
			{
				frame_start = now;
				GameRun(hWnd);
			}
			ProcessKeyBoard(hWnd);
			ProcessInput(_DeltaTime);
		}

	}
	return msg.wParam;
}

//window event callback function
LRESULT CALLBACK WinProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message) {
	case WM_DESTROY:
		PostQuitMessage(0);
		GameEnd(hWnd);
		break;
	default:
		return DefWindowProc(hWnd, message, wParam, lParam);
	}

	return 0;
}

//initialize
HWND InitWindow(HINSTANCE hInstance, int nCmdShow)
{

	HWND hWnd;
	//create a new window

	hWnd = CreateWindow(
		APP_TITLE, //window class
		APP_TITLE, //title bar
		WS_OVERLAPPEDWINDOW, //window style
		CW_USEDEFAULT, //x position of window
		CW_USEDEFAULT, //y position of window
		SCREEN_WIDTH, //width of the window
		SCREEN_HEIGHT, //height of the window
		NULL, //parent window
		NULL, //menu
		hInstance, //application instance
		NULL); //window parameters
			   //was there an error creating the window?
	if (!hWnd)
		return FALSE;

	//set position window center screen
	RECT rc;
	GetWindowRect(hWnd, &rc);
	int xPos = (GetSystemMetrics(SM_CXSCREEN) - rc.right) / 2;
	int yPos = (GetSystemMetrics(SM_CYSCREEN) - rc.bottom) / 2;
	SetWindowPos(hWnd, 0, xPos, yPos, 0, 0, SWP_NOZORDER | SWP_NOSIZE);

	//display the window
	ShowWindow(hWnd, nCmdShow);
	UpdateWindow(hWnd);
	return hWnd;
}

//helper function to set up the window properties
ATOM MyRegisterClass(HINSTANCE hInstance)
{
	//create the window class structure
	WNDCLASSEX wc;
	wc.cbSize = sizeof(WNDCLASSEX);
	//fill the struct with info
	wc.style = CS_HREDRAW | CS_VREDRAW;
	wc.lpfnWndProc = (WNDPROC)WinProc;
	wc.cbClsExtra = 0;
	wc.cbWndExtra = 0;
	wc.hInstance = hInstance;
	wc.hIcon = NULL;
	wc.hCursor = LoadCursor(NULL, IDC_ARROW);
	wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
	wc.lpszMenuName = NULL;
	wc.lpszClassName = APP_TITLE;
	wc.hIconSm = NULL;
	//set up the window with the class info
	return RegisterClassEx(&wc);
}

int GameInit(HWND hwnd)
{
	HRESULT result;
	//initialize Direct3D
	d3d = Direct3DCreate9(D3D_SDK_VERSION);
	if (d3d == NULL)
	{
		MessageBox(hwnd, "Error initializing Direct3D", "Error", MB_OK);
		return 0;
	}

	//set Direct3D presentation parameters
	D3DPRESENT_PARAMETERS d3dpp;
	ZeroMemory(&d3dpp, sizeof(d3dpp));
	d3dpp.Windowed = TRUE;
	d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
	d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;
	d3dpp.BackBufferCount = 1;
	d3dpp.BackBufferWidth = SCREEN_WIDTH;
	d3dpp.BackBufferHeight = SCREEN_HEIGHT;
	d3dpp.hDeviceWindow = hwnd;

	//create Direct3D device
	d3d->CreateDevice(
		D3DADAPTER_DEFAULT,
		D3DDEVTYPE_HAL,
		hwnd,
		D3DCREATE_SOFTWARE_VERTEXPROCESSING,
		&d3dpp,
		&d3ddv);

	if (d3ddv == NULL)
	{
		MessageBox(hwnd, "Error creating Direct3D device", "Error", MB_OK);
		return 0;
	}
	//set random number seed
	srand(time(NULL));

	result = D3DXCreateSprite(d3ddv, &SpriteHandler);
	if (result != D3D_OK)
		return 0;

	//clear the backbuffer to black
	d3ddv->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(255, 255, 255), 1.0f, 0);

	//create pointer to the back buffer
	d3ddv->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &back_buffer);

	text->CreateFront(d3ddv);

	ground = LoadTexture("ground.png", D3DCOLOR_XRGB(0, 0, 0));
	box = LoadTexture("box.png", D3DCOLOR_XRGB(0, 0, 0));

	groundRECT->CreateRectangle(new Box(new Point(SCREEN_WIDTH / 2, 200), 400, 50), NULL);
	boxRECT->CreateRectangle(new Box(new Point(150, 250), 100, 100), NULL);

	//return okay
	return 1;
}

RECT r;

void GameRun(HWND hwnd)
{

	//make sure the Direct3D device is valid
	if (d3ddv == NULL)
		return;
	//start rendering
	if (d3ddv->BeginScene())
	{

		// Clear back buffer with BLACK
		d3ddv->ColorFill(back_buffer, NULL, D3DCOLOR_XRGB(0, 0, 0));

		SpriteHandler->Begin(D3DXSPRITE_ALPHABLEND);

		SetRect(&r, 10, 10, 200, 200);
		if ((collision->CheckCollision(boxRECT, groundRECT)))
		{
			text->DisplayText("Collision", NULL, r);
			//collision->UpdateDynamicPosition(boxRECT, groundRECT);

			SetRect(&r, 10, 52, 200, 200);
			boxRECT->box->CurrentPosition = collision->UpdateDynamicPosition(boxRECT, groundRECT);
			text->DisplayText((char*)(buffer->ConvertToString(boxRECT->box->CurrentPosition)).c_str(), D3DCOLOR_XRGB(255, 255, 255), r);
		}
		else
			text->DisplayText("Not Collision", NULL, r);
		RenderFrame(_DeltaTime);

		SpriteHandler->End();
		//stop rendering
		d3ddv->EndScene();
	}
	//display the back buffer on the screen
	d3ddv->Present(NULL, NULL, NULL, NULL);
}

void RenderFrame(DWORD DeltaTime)
{
	SetRect(&r, 10, 38, 200, 200);
	text->DisplayText((char*)("Ground: " + buffer->ConvertToString(groundRECT->box->CurrentPosition)).c_str(), D3DCOLOR_XRGB(255, 255, 255), r);

	//ground
	D3DXVECTOR3 groundPosition(groundRECT->box->CurrentPosition->X, groundRECT->box->CurrentPosition->Y, 0);
	D3DXMATRIX groundMatrix;
	D3DXMatrixIdentity(&groundMatrix);
	groundMatrix._22 = -1.0f;
	groundMatrix._41 = -_vpx;
	groundMatrix._42 = _vpy;// SCREEN_HEIGHT;
	D3DXVECTOR4 vp_ground;
	D3DXVec3Transform(&vp_ground, &groundPosition, &groundMatrix);
	D3DXVECTOR3 pos_ground = D3DXVECTOR3(vp_ground.x, vp_ground.y, 0);
	D3DXVECTOR3 bottomCenterGround((float)groundRECT->box->Width / 2, groundRECT->box->Height, 0);
	SpriteHandler->Draw(
		ground,
		NULL,//if null display all
		&bottomCenterGround,
		&pos_ground,
		D3DCOLOR_XRGB(255, 255, 255)	// Hardcode!
	);

	SetRect(&r, 10, 24, 200, 200);
	text->DisplayText(
		(char*)("Box: " + buffer->ConvertToString(boxRECT->box->CurrentPosition) + " LastPos: " + buffer->ConvertToString(boxRECT->LastPosition)).c_str(),
		D3DCOLOR_XRGB(255, 255, 255), r);
	//box

	D3DXVECTOR3 boxPosition(boxRECT->box->CurrentPosition->X, boxRECT->box->CurrentPosition->Y, 0);
	D3DXMATRIX boxMatrix;
	D3DXMatrixIdentity(&boxMatrix);
	boxMatrix._22 = -1.0f;
	boxMatrix._41 = -_vpx;
	boxMatrix._42 = _vpy;// SCREEN_HEIGHT;
	D3DXVECTOR4 vp_box;
	D3DXVec3Transform(&vp_box, &boxPosition, &boxMatrix);
	D3DXVECTOR3 pos_box = D3DXVECTOR3(vp_box.x, vp_box.y, 0);
	D3DXVECTOR3 bottomCenterBox((float)boxRECT->box->Width / 2, boxRECT->box->Height, 0);
	SpriteHandler->Draw(
		box,
		NULL,//if null display all
		&bottomCenterBox,
		&pos_box,
		D3DCOLOR_XRGB(255, 255, 255)	// Hardcode!
	);

}

LPDIRECT3DTEXTURE9 LoadTexture(char *filename, D3DCOLOR transcolor)
{
	//the texture pointer
	LPDIRECT3DTEXTURE9 texture = NULL;
	//the struct for reading bitmap file info
	D3DXIMAGE_INFO info;
	//standard Windows return value
	HRESULT result;
	//get width and height from bitmap file
	result = D3DXGetImageInfoFromFile(filename, &info);
	if (result != D3D_OK)
		return NULL;
	//create the new texture by loading a bitmap image file
	D3DXCreateTextureFromFileEx(
		d3ddv, //Direct3D device object
		filename, //bitmap filename
		info.Width, //bitmap image width
		info.Height, //bitmap image height
		1, //mip-map levels (1 for no chain)
		D3DPOOL_DEFAULT, //the type of surface (standard)
		D3DFMT_UNKNOWN, //surface format (default)
		D3DPOOL_DEFAULT, //memory class for the texture
		D3DX_DEFAULT, //image filter
		D3DX_DEFAULT, //mip filter
		transcolor, //color key for transparency
		&info, //bitmap file info (from loaded file)
		NULL, //color palette
		&texture); //destination texture

				   //make sure the bitmap texture was loaded correctly
	if (result != D3D_OK)
		return NULL;

	return texture;
}

void GameEnd(HWND hwnd)
{

	ground->Release();
	box->Release();

	if (d3ddv != NULL)
		d3ddv->Release();
	//release the Direct3D object
	if (d3d != NULL)
		d3d->Release();
	if (_keyboard)
	{
		_keyboard->Unacquire();
		_keyboard->Release();
	}

	if (di) di->Release();
}

int InitKeyBoard(HINSTANCE hInstance, HWND hWnd)
{
	HRESULT _hResult;
	_hResult = DirectInput8Create(hInstance, DIRECTINPUT_VERSION, IID_IDirectInput8, (VOID**)&di, NULL);
	if (_hResult != D3D_OK)
		return 0;
	_hResult = di->CreateDevice(GUID_SysKeyboard, &_keyboard, NULL);
	if (_hResult != D3D_OK)
		return 0;
	_hResult = _keyboard->SetDataFormat(&c_dfDIKeyboard);
	_hResult = _keyboard->SetCooperativeLevel(hWnd, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE);
	DIPROPDWORD dipdw;

	dipdw.diph.dwSize = sizeof(DIPROPDWORD);
	dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER);
	dipdw.diph.dwObj = 0;
	dipdw.diph.dwHow = DIPH_DEVICE;
	dipdw.dwData = KEYBOARD_BUFFER_SIZE; // Arbitary buffer size

	_hResult = _keyboard->SetProperty(DIPROP_BUFFERSIZE, &dipdw.diph);
	if (_hResult != DI_OK) return 0;

	_hResult = _keyboard->Acquire();
	if (_hResult != DI_OK) return 0;
	return 1;
}

int IsKeyDown(int KeyCode)
{
	return (_keyStates[KeyCode] & 0x80) > 0;
}

void OnKeyDown(int KeyCode)
{
	//
	switch (KeyCode)
	{
	case DIK_SPACE:
		break;
	case DIK_LEFT:
		boxRECT->LastPosition = new Point(boxRECT->box->CurrentPosition);
		boxRECT->box->SetPositionVelocityX(-VELOCITY);
		break;
	case DIK_RIGHT:
		boxRECT->LastPosition = new Point(boxRECT->box->CurrentPosition);
		boxRECT->box->SetPositionVelocityX(VELOCITY);
		break;
	case DIK_UP:
		boxRECT->LastPosition = new Point(boxRECT->box->CurrentPosition);
		boxRECT->box->SetPositionVelocityY(VELOCITY);
		break;
	case DIK_DOWN:
		boxRECT->LastPosition = new Point(boxRECT->box->CurrentPosition);
		boxRECT->box->SetPositionVelocityY(-VELOCITY);
		break;
	}
}

void OneKeyPress(int Delta)
{
	//

	//if (IsKeyDown(DIK_LEFT))
	//{
	//	boxRECT->box->SetPositionVelocityX(-VELOCITY);
	//	float x = boxRECT->box->Position->X;
	//}
	//if (IsKeyDown(DIK_RIGHT))
	//{
	//	boxRECT->box->SetPositionVelocityX(VELOCITY);
	//}
	//if (IsKeyDown(DIK_UP))
	//{
	//	boxRECT->box->SetPositionVelocityY(VELOCITY);
	//}
	//if (IsKeyDown(DIK_DOWN))
	//{
	//	boxRECT->box->SetPositionVelocityY(-VELOCITY);
	//}
}

void OnKeyUp(int KeyCode)
{

}

void ProcessInput(int Delta)
{
	OneKeyPress(Delta);
}

void ProcessKeyBoard(HWND hWnd)
{
	_keyboard->GetDeviceState(sizeof(_keyStates), _keyStates);
	// trang thay cua phim tai thoi diem chung ta goi ham
	// nếu như bắn đạn thì phải dùng công cụ khác sử dung buffer sác định từng phím

	if (IsKeyDown(DIK_ESCAPE))
	{
		PostMessage(hWnd, WM_QUIT, 0, 0);
	}

	// Collect all buffered events
	DWORD dwElements = KEYBOARD_BUFFER_SIZE;
	HRESULT hr = _keyboard->GetDeviceData(sizeof(DIDEVICEOBJECTDATA), _KeyEvents, &dwElements, 0);

	// Scan through all data, check if the key is pressed or released
	for (DWORD i = 0; i < dwElements; i++)
	{
		int KeyCode = _KeyEvents[i].dwOfs;
		int KeyState = _KeyEvents[i].dwData;
		if ((KeyState & 0x80) > 0)
			OnKeyDown(KeyCode);
		else
			OnKeyUp(KeyCode);
	}
}


text:
<?php
namespace Chamilo\Core\Repository\Implementation\Matterhorn\Stream;

use Chamilo\Core\Repository\Implementation\Matterhorn\ExternalObject;
use Chamilo\Libraries\Architecture\Application\Application;
use Chamilo\Libraries\File\Properties\FileProperties;

/**
 *
 * @package core\repository\implementation\matterhorn
 * @author Hans De Bisschop <hans.de.bisschop@ehb.be>
 * @author Magali Gillard <magali.gillard@ehb.be>
 * @author Eduard Vossen <eduard.vossen@ehb.be>
 */
abstract class Stream
{
    // Parameters
    const PARAM_TYPE = 'stream_type';

    // Types
    const TYPE_PREVIEW = 'Preview';
    const TYPE_TRACK = 'Track';

    /**
     *
     * @var \libraries\architecture\application\Application
     */
    private $application;

    /**
     *
     * @var ExternalObject
     */
    private $external_object;

    /**
     *
     * @param \libraries\architecture\application\Application $application
     * @param ExternalObject $external_object
     */
    public function __construct(Application $application, ExternalObject $external_object)
    {
        $this->application = $application;
        $this->external_object = $external_object;
    }

    /**
     *
     * @return \libraries\architecture\application\Application
     */
    public function get_application()
    {
        return $this->application;
    }

    /**
     *
     * @param \libraries\architecture\application\Application $application
     */
    public function set_application($application)
    {
        $this->application = $application;
    }

    /**
     *
     * @return \core\repository\implementation\matterhorn\ExternalObject
     */
    public function get_external_object()
    {
        return $this->external_object;
    }

    /**
     *
     * @param \core\repository\implementation\matterhorn\ExternalObject $external_object
     */
    public function set_external_object($external_object)
    {
        $this->external_object = $external_object;
    }

    /**
     *
     * @return string
     */
    abstract public function get_url();

    /**
     *
     * @return string
     */
    abstract public function get_mimetype();

    /**
     *
     * @return int
     */
    public function get_size()
    {
        $properties = FileProperties::from_url($this->get_url());
        return $properties->get_size();
    }

    /**
     *
     * @return string
     */
    public function get_filename()
    {
        return basename($this->get_url());
    }

    public function read()
    {
        header('Content-Description: File Transfer');
        header('Content-Type: ' . $this->get_mimetype());
        header('Content-Disposition: inline; filename=' . $this->get_filename());
        header('Content-Length: ' . $this->get_size());
        readfile($this->get_url());
        exit();
    }

    /**
     *
     * @param string $type
     * @param Application $application
     * @param ExternalObject $external_object
     * @return Stream
     */
    public static function factory($type, Application $application, ExternalObject $external_object)
    {
        $class_name = __NAMESPACE__ . '\\' . $type . 'Stream';
        return new $class_name($application, $external_object);
    }
}


text:
<head>

  <title>
    {% if page.title == "Home" %}
      {{ site.title }} | {{ site.tagline }}
    {% else %}
      {{ page.title }} | {{ site.title }}
    {% endif %}
  </title>

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

  <link rel="stylesheet" href="{{ site.github.url }}/css/main.css">
  <link rel="stylesheet" href="{{ site.github.url }}/css/syntax.css">
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=PT+Serif:400,400italic,700%7CPT+Sans:400">
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Code+Pro">
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Quattrocento+Sans">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css">

  <script type="text/javascript" async
    src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
  </script>

  {% include google_analytics.html %}

</head>


text:
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/search_deck_incentive"
    android:layout_width="match_parent"
    android:layout_height="@dimen/card_size"
    android:layout_alignParentEnd="true"
    android:layout_alignParentRight="true"
    android:background="@drawable/search_incentive"
    android:gravity="center"
    android:textColor="@color/colorDarkBlue">

</TextView>


text:
<?php

use Phalcon\DI;
use Vegas\Db\Mapping\Json;
use Vegas\Db\MappingManager;

class Bootstrap extends \Vegas\Application\Bootstrap
{
    public function setup()
    {
        parent::setup();
        $this->initDbMappings();

        return $this;
    }

    protected function initDbMappings()
    {
        $mappingManager = new MappingManager();
        $mappingManager->add(new Json());
    }

    /**
     * Start handling MVC requests
     *
     * @param null $uri
     * @return string
     */
    public function run($uri = null)
    {
        return $this->application->handle($uri)->getContent();
    }
}


text:
package org.hollowcraft.server.net.packet;

/*
 * OpenCraft License
 *
 * Copyright (c) 2009 Graham Edgecombe, Søren Enevoldsen and Brett Russell.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *     * Redistributions of source code must retain the above copyright notice,
 *       this list of conditions and the following disclaimer.
 *
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *
 *     * Neither the name of the OpenCraft nor the names of its
 *       contributors may be used to endorse or promote products derived from
 *       this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

import java.util.HashMap;
import java.util.Map;

/**
 * A utility class for creating Packet objects.
 * @author Graham Edgecombe
 * @author Caleb Champlin
 */
public final class PacketBuilder {

	/**
	 * The packet definition.
	 */
	private PacketDefinition definition;

	/**
	 * The values.
	 */
	private Map<String, Object> values = new HashMap<String, Object>();

	/**
	 * Creates the packet builder.
	 * @param definition The packet definition.
	 */
	public PacketBuilder(PacketDefinition definition) {
		this.definition = definition;
	}

	/**
	 * Creates a packet object based on this builder.
	 * @return The packet object.
	 */
	public Packet toPacket() {
		return new Packet(definition, values);
	}

	/**
	 * Validates that a field has been used correctly.
	 * @param name The field name.
	 * @param type The data type.
	 */
	private void validateField(String name, DataType type) {
		for (PacketField f : definition.getFields()) {
			if (f.getName().equals(name)) {
				if (f.getType().equals(type)) {
					return;
				} else {
					throw new IllegalArgumentException("Incorrect data type - expecting " + f.getType() + ".");
				}
			}
		}
		throw new IllegalArgumentException("No field named " + name + ".");
	}

	/**
	 * Puts a byte.
	 * @param name The name.
	 * @param value The value.
	 */
	public PacketBuilder putByte(String name, int value) {
		validateField(name, DataType.BYTE);
		values.put(name, (byte) value);
		return this;
	}

	/**
	 * Puts a short.
	 * @param name The name.
	 * @param value The value.
	 */
	public PacketBuilder putShort(String name, int value) {
		validateField(name, DataType.SHORT);
		values.put(name, (short) value);
		return this;
	}

	/**
	 * Puts an integer.
	 * @param name The name.
	 * @param value The value.
	 */
	public PacketBuilder putInt(String name, int value) {
		validateField(name, DataType.INT);
		values.put(name, value);
		return this;
	}

	/**
	 * Puts a long.
	 * @param name The name.
	 * @param value The value.
	 */
	public PacketBuilder putLong(String name, long value) {
		validateField(name, DataType.LONG);
		values.put(name, value);
		return this;
	}

	/**
	 * Puts a string.
	 * @param name The name.
	 * @param value The string.
	 */
	public PacketBuilder putString(String name, String value) {
		validateField(name, DataType.STRING);
		values.put(name, value);
		return this;
	}

	/**
	 * Puts a byte array.
	 * @param name The name.
	 * @param value The byte array.
	 */
	public PacketBuilder putByteArray(String name, byte[] value) {
		validateField(name, DataType.BYTE_ARRAY);
		values.put(name, value);
		return this;
	}

	/**
	 * Puts an inventory byte array.
	 * @param name The name.
	 * @param value The byte array.
	 */
	public PacketBuilder putInventory(String name, byte[] value) {
		validateField(name, DataType.INVENTORY);
		values.put(name, value);
		return this;
	}

	/**
	 * Puts a double.
	 * @param name The name.
	 * @param value The value.
	 */
	public PacketBuilder putDouble(String name, double value) {
		validateField(name, DataType.DOUBLE);
		values.put(name, value);
		return this;
	}

	/**
	 * Puts a float.
	 * @param name The name.
	 * @param value The value.
	 */
	public PacketBuilder putFloat(String name, float value) {
		validateField(name, DataType.FLOAT);
		values.put(name, value);
		return this;
	}

}


text: Configuration files to make to computer look and behave just so


text:
const raw = cpf => cpf.replace(/[^\d]+/g, '')

export default raw


text:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.github.andrzejtokarski.klog">

    <application android:allowBackup="true" android:label="@string/app_name">

    </application>

</manifest>


text:
require 'spec_helper'

describe Booker::V4::Models::TreatmentTimeSlot do
  it { is_expected.to be_a Booker::V4::Models::AvailableTime }
end


text:
package de.iritgo.aktera.model;

import java.util.Map;

/**
 * Give the user a navigation option. This allows the model to provide
 * navigation options to the UI. Note that implementations of this interface
 * should be serializable
 *
 *  @version      $Revision: 1.1 $  $Date: 2003/12/29 07:01:33 $
 */
public interface Command extends ResponseElement
{
	public void setParameter(String paramName, Object paramValue);

	public void setModel(String model);

	/**
	 * Return the name of the model specified for this command, in the form it would appear
	 * in the configuration file
	 */
	public String getModel();

	/**
	 * Return a map of any parameter specified for this command
	 */
	public Map getParameters();

	/**
	 * Convenience method, equivilant to execute(req, res, false, false)
	 */
	public ModelResponse execute(ModelRequest req, ModelResponse res) throws ModelException;

	/**
	 * Execute the model specified by this command and return the model
	 * response.
	 * @param req The previous request. The model being will have this request available via
	 * it's getPreviousRequest method
	 * @param res The current response. The new response will always include any errors stored in this response,
	 * but will not include any response elements already generated unless includeResponseElements is true
	 * @param includeParams Include request parameters from the old request when building the new request. Normally,
	 * a command has it's parameters set via "setParameter", just like a request, and these are the only parameters
	 * used in the new request. If this flag is true, however, any parameters that exist in the current request
	 * and that have not been specified via setParameter are populated from the current request.
	 * @param includeResponseElements Include any response elements from the current response (res) in the newly
	 * generated response. If an element in the new response has the same name as an element in the current response,
	 * use the new one only.
	 */
	public ModelResponse execute(ModelRequest req, ModelResponse res, boolean includeParams,
					boolean includeResponseElements) throws ModelException;

	public void setLabel(String newLabel);

	public String getLabel();

	public void setRelativeMovement(int numberOfSteps);

	public int getRelativeMovement();

	public void setBean(String bean);

	public String getBean();
}


text:
package cmwell.analytics.util

import scala.concurrent.duration.Duration

object ConsistencyThreshold {

  /**
    * The default consistency threshold for an analysis, if one is not supplied by the caller.y
    * If the lastModified for an inconsistent infoton falls on or after this time, then it is ignored.
    * This gives CM-Well some time for an infoton to reach consistency.
    *
    * This default should probably not ever be used for analysis where extracts are done and then they are
    * analyzed, since the extracts are done serially. In this case, the caller should calculate an instant
    * relative to when the extracts start and pass it as the --consistency-threshold parameter.
    */
  def defaultConsistencyThreshold: Long = System.currentTimeMillis - Duration("10 min").toMillis
}


text:
package net

import (
	"os"
	"sync"
	"syscall"
	"unsafe"
)

var (
	protoentLock sync.Mutex
	hostentLock  sync.Mutex
	serventLock  sync.Mutex
)

// lookupProtocol looks up IP protocol name and returns correspondent protocol number.
func lookupProtocol(name string) (proto int, err error) {
	protoentLock.Lock()
	defer protoentLock.Unlock()
	p, err := syscall.GetProtoByName(name)
	if err != nil {
		return 0, os.NewSyscallError("GetProtoByName", err)
	}
	return int(p.Proto), nil
}

func lookupHost(name string) (addrs []string, err error) {
	ips, err := LookupIP(name)
	if err != nil {
		return
	}
	addrs = make([]string, 0, len(ips))
	for _, ip := range ips {
		addrs = append(addrs, ip.String())
	}
	return
}

func lookupIP(name string) (addrs []IP, err error) {
	hostentLock.Lock()
	defer hostentLock.Unlock()
	h, err := syscall.GetHostByName(name)
	if err != nil {
		return nil, os.NewSyscallError("GetHostByName", err)
	}
	switch h.AddrType {
	case syscall.AF_INET:
		i := 0
		addrs = make([]IP, 100) // plenty of room to grow
		for p := (*[100](*[4]byte))(unsafe.Pointer(h.AddrList)); i < cap(addrs) && p[i] != nil; i++ {
			addrs[i] = IPv4(p[i][0], p[i][1], p[i][2], p[i][3])
		}
		addrs = addrs[0:i]
	default: // TODO(vcc): Implement non IPv4 address lookups.
		return nil, os.NewSyscallError("LookupHost", syscall.EWINDOWS)
	}
	return addrs, nil
}

func lookupPort(network, service string) (port int, err error) {
	switch network {
	case "tcp4", "tcp6":
		network = "tcp"
	case "udp4", "udp6":
		network = "udp"
	}
	serventLock.Lock()
	defer serventLock.Unlock()
	s, err := syscall.GetServByName(service, network)
	if err != nil {
		return 0, os.NewSyscallError("GetServByName", err)
	}
	return int(syscall.Ntohs(s.Port)), nil
}

func lookupCNAME(name string) (cname string, err error) {
	var r *syscall.DNSRecord
	e := syscall.DnsQuery(name, syscall.DNS_TYPE_CNAME, 0, nil, &r, nil)
	if e != nil {
		return "", os.NewSyscallError("LookupCNAME", e)
	}
	defer syscall.DnsRecordListFree(r, 1)
	if r != nil && r.Type == syscall.DNS_TYPE_CNAME {
		v := (*syscall.DNSPTRData)(unsafe.Pointer(&r.Data[0]))
		cname = syscall.UTF16ToString((*[256]uint16)(unsafe.Pointer(v.Host))[:]) + "."
	}
	return
}

func lookupSRV(service, proto, name string) (cname string, addrs []*SRV, err error) {
	var target string
	if service == "" && proto == "" {
		target = name
	} else {
		target = "_" + service + "._" + proto + "." + name
	}
	var r *syscall.DNSRecord
	e := syscall.DnsQuery(target, syscall.DNS_TYPE_SRV, 0, nil, &r, nil)
	if e != nil {
		return "", nil, os.NewSyscallError("LookupSRV", e)
	}
	defer syscall.DnsRecordListFree(r, 1)
	addrs = make([]*SRV, 0, 10)
	for p := r; p != nil && p.Type == syscall.DNS_TYPE_SRV; p = p.Next {
		v := (*syscall.DNSSRVData)(unsafe.Pointer(&p.Data[0]))
		addrs = append(addrs, &SRV{syscall.UTF16ToString((*[256]uint16)(unsafe.Pointer(v.Target))[:]), v.Port, v.Priority, v.Weight})
	}
	byPriorityWeight(addrs).sort()
	return name, addrs, nil
}

func lookupMX(name string) (mx []*MX, err error) {
	var r *syscall.DNSRecord
	e := syscall.DnsQuery(name, syscall.DNS_TYPE_MX, 0, nil, &r, nil)
	if e != nil {
		return nil, os.NewSyscallError("LookupMX", e)
	}
	defer syscall.DnsRecordListFree(r, 1)
	mx = make([]*MX, 0, 10)
	for p := r; p != nil && p.Type == syscall.DNS_TYPE_MX; p = p.Next {
		v := (*syscall.DNSMXData)(unsafe.Pointer(&p.Data[0]))
		mx = append(mx, &MX{syscall.UTF16ToString((*[256]uint16)(unsafe.Pointer(v.NameExchange))[:]) + ".", v.Preference})
	}
	byPref(mx).sort()
	return mx, nil
}

func lookupTXT(name string) (txt []string, err error) {
	var r *syscall.DNSRecord
	e := syscall.DnsQuery(name, syscall.DNS_TYPE_TEXT, 0, nil, &r, nil)
	if e != nil {
		return nil, os.NewSyscallError("LookupTXT", e)
	}
	defer syscall.DnsRecordListFree(r, 1)
	txt = make([]string, 0, 10)
	if r != nil && r.Type == syscall.DNS_TYPE_TEXT {
		d := (*syscall.DNSTXTData)(unsafe.Pointer(&r.Data[0]))
		for _, v := range (*[1 << 10]*uint16)(unsafe.Pointer(&(d.StringArray[0])))[:d.StringCount] {
			s := syscall.UTF16ToString((*[1 << 20]uint16)(unsafe.Pointer(v))[:])
			txt = append(txt, s)
		}
	}
	return
}

func lookupAddr(addr string) (name []string, err error) {
	arpa, err := reverseaddr(addr)
	if err != nil {
		return nil, err
	}
	var r *syscall.DNSRecord
	e := syscall.DnsQuery(arpa, syscall.DNS_TYPE_PTR, 0, nil, &r, nil)
	if e != nil {
		return nil, os.NewSyscallError("LookupAddr", e)
	}
	defer syscall.DnsRecordListFree(r, 1)
	name = make([]string, 0, 10)
	for p := r; p != nil && p.Type == syscall.DNS_TYPE_PTR; p = p.Next {
		v := (*syscall.DNSPTRData)(unsafe.Pointer(&p.Data[0]))
		name = append(name, syscall.UTF16ToString((*[256]uint16)(unsafe.Pointer(v.Host))[:]))
	}
	return name, nil
}


text:
package org.wildfly.swarm.microprofile.metrics.runtime;

import io.undertow.server.HttpHandler;
import io.undertow.server.HttpServerExchange;
import io.undertow.util.HeaderValues;
import io.undertow.util.Headers;
import io.undertow.util.HttpString;
import org.eclipse.microprofile.metrics.Metric;
import org.eclipse.microprofile.metrics.MetricRegistry;
import org.jboss.logging.Logger;
import org.wildfly.swarm.microprofile.metrics.runtime.exporters.Exporter;
import org.wildfly.swarm.microprofile.metrics.runtime.exporters.JsonExporter;
import org.wildfly.swarm.microprofile.metrics.runtime.exporters.PrometheusExporter;
import org.wildfly.swarm.microprofile.metrics.runtime.exporters.JsonMetadataExporter;

import java.util.Map;
import java.util.concurrent.CountDownLatch;

/**
 * @author hrupp
 */
@SuppressWarnings("unused")
public class MetricsHttpHandler implements HttpHandler {

    private static Logger LOG = Logger.getLogger("org.wildfly.swarm.microprofile.metrics");
    private ThreadLocal<CountDownLatch> dispatched = new ThreadLocal<>();

    private HttpHandler next;

    public MetricsHttpHandler(HttpHandler next) {

        this.next = next;
    }

    @Override
    public void handleRequest(HttpServerExchange exchange) throws Exception {

        String requestPath = exchange.getRequestPath();

        if (dispatched.get() != null && dispatched.get().getCount() == 1) {
            next.handleRequest(exchange);
            dispatched.set(null);
            return;
        }

        if (!requestPath.startsWith("/metrics")) {
            next.handleRequest(exchange);
            return;
        }

        // request is for us, so let's handle it

        Exporter exporter = obtainExporter(exchange);
        if (exporter == null) {
            exchange.setStatusCode(406);
            exchange.setReasonPhrase("No exporter found for method " + exchange.getRequestMethod() + " and media type");
            return;
        }

        String scopePath = requestPath.substring(8);
        if (scopePath.startsWith("/")) {
            scopePath = scopePath.substring(1);
        }
        if (scopePath.endsWith("/")) {
            scopePath = scopePath.substring(0, scopePath.length() - 1);
        }

        StringBuilder sb;

        if (scopePath.isEmpty()) {
            // All metrics

            sb = exporter.exportAllScopes();

        } else if (scopePath.contains("/")) {
            // One metric in a scope

            String attribute = scopePath.substring(scopePath.indexOf('/') + 1);

            MetricRegistry.Type scope = getScopeFromPath(exchange, scopePath.substring(0, scopePath.indexOf('/')));
            if (scope == null) {
                exchange.setStatusCode(404);
                exchange.setReasonPhrase("Scope " + scopePath + " not found");
                return;
            }

            MetricRegistry registry = MetricRegistryFactory.get(scope);
            Map<String, Metric> metricValuesMap = registry.getMetrics();

            if (metricValuesMap.containsKey(attribute)) {
                sb = exporter.exportOneMetric(scope, attribute);
            } else {
                exchange.setStatusCode(404);
                exchange.setReasonPhrase("Metric " + scopePath + " not found");
                return;
            }
        } else {
            // A single scope

            MetricRegistry.Type scope = getScopeFromPath(exchange, scopePath);
            if (scope == null) {
                exchange.setStatusCode(404);
                exchange.setReasonPhrase("Scope " + scopePath + " not found");
                return;
            }

            MetricRegistry reg = MetricRegistryFactory.get(scope);
            if (reg.getMetadata().size() == 0) {
                exchange.setStatusCode(204);
                exchange.setReasonPhrase("No data in scope " + scopePath);
            }

            sb = exporter.exportOneScope(scope);
        }

        exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, exporter.getContentType());
        provideCorsHeaders(exchange);
        exchange.getResponseHeaders().put(new HttpString("Access-Control-Max-Age"), "1209600");
        exchange.getResponseSender().send(sb.toString());

    }

    private void provideCorsHeaders(HttpServerExchange exchange) {
        exchange.getResponseHeaders().put(new HttpString("Access-Control-Allow-Origin"), "*");
        exchange.getResponseHeaders().put(new HttpString("Access-Control-Allow-Headers"), "origin, content-type, accept, authorization");
        exchange.getResponseHeaders().put(new HttpString("Access-Control-Allow-Credentials"), "true");
        exchange.getResponseHeaders().put(new HttpString("Access-Control-Allow-Methods"), "GET, POST, PUT, DELETE, OPTIONS, HEAD");
    }

    private MetricRegistry.Type getScopeFromPath(HttpServerExchange exchange, String scopePath) {
        MetricRegistry.Type scope;
        try {
            scope = MetricRegistry.Type.valueOf(scopePath.toUpperCase());
        } catch (IllegalArgumentException iae) {
            exchange.setStatusCode(404);
            exchange.setReasonPhrase("Bad scope requested: " + scopePath);
            return null;
        }
        return scope;
    }

    /**
     * Determine which exporter we want.
     * @param exchange The http exchange coming in
     * @return An exporter instance or null in case no matching exporter existed.
     */
    private Exporter obtainExporter(HttpServerExchange exchange) {
        HeaderValues acceptHeaders = exchange.getRequestHeaders().get(Headers.ACCEPT);
        Exporter exporter;

        String method = exchange.getRequestMethod().toString();

        if (acceptHeaders == null) {
            if (method.equals("GET")) {
                exporter = new PrometheusExporter();
            } else {
                return null;
            }
        } else {
            // Header can look like "application/json, text/plain, */*"
            if (acceptHeaders.getFirst() != null && acceptHeaders.getFirst().startsWith("application/json")) {

                if (method.equals("GET")) {
                    exporter = new JsonExporter();
                } else if (method.equals("OPTIONS")) {
                    exporter = new JsonMetadataExporter();
                } else {
                    return null;
                }
            } else {
                // This is the fallback, but only for GET, as Prometheus does not support OPTIONS
                if (method.equals("GET")) {
                    exporter = new PrometheusExporter();
                } else {
                    return null;
                }
            }
        }
        return exporter;
    }

}


text:
/**
 * Created by Moajs on July 1st 2015, 11:54:42 pm.
 */

var $models = require('mount-models')(__dirname);

var Topic = $models.topic;

exports.list = function (req, res, next) {
  console.log(req.method + ' /topics => list, query: ' + JSON.stringify(req.query));

  Topic.getAll(function(err, topics){
    console.log(topics);
    res.render('topics/index', {
      topics : topics
    })
  });
};

exports.new = function (req, res, next) {
  console.log(req.method + ' /topics/new => new, query: ' + JSON.stringify(req.query));

  res.render('topics/new', {
    topic : {
      "_action" : "new"
    }
  })
};

exports.show = function (req, res, next) {
  console.log(req.method + ' /topics/:id => show, query: ' + JSON.stringify(req.query) +
    ', params: ' + JSON.stringify(req.params));
  var id = req.params.id;

  Topic.getById(id, function(err, topic) {
    console.log(topic);
    res.render('topics/show', {
      topic : topic
    })
  });
};

exports.edit = function (req, res, next) {
  console.log(req.method + ' /topics/:id/edit => edit, query: ' + JSON.stringify(req.query) +
    ', params: ' + JSON.stringify(req.params));

  var id = req.params.id;

  Topic.getById(id, function (err, topic) {
    console.log(topic);
    topic._action = 'edit';

    res.render('topics/edit', {
      topic : topic
    })
  });
};

exports.create = function (req, res, next) {
  console.log(req.method + ' /topics => create, query: ' + JSON.stringify(req.query) +
    ', params: ' + JSON.stringify(req.params) + ', body: ' + JSON.stringify(req.body));

  Topic.create({title: req.body.title,body: req.body.body}, function (err, topic) {
    console.log(topic);
    res.render('topics/show', {
      topic : topic
    })
  });
};

exports.update = function (req, res, next) {
  console.log(req.method + ' /topics/:id => update, query: ' + JSON.stringify(req.query) +
    ', params: ' + JSON.stringify(req.params) + ', body: ' + JSON.stringify(req.body));

  var id = req.params.id;

  Topic.updateById(id,{title: req.body.title,body: req.body.body}, function (err, topic) {
    console.log(topic);

    res.json({
      data: {
        redirect : '/topics/' + id
      },
      status: {
        code : 0,
        msg  : 'delete success!'
      }
    });
  });
};

exports.destroy = function (req, res, next) {
  var id = req.params.id;
  Topic.deleteById(id, function (err) {
    if (err) {
      throw new Error(err);
    }

    res.json({
      data: {},
      status: {
        code : 0,
        msg  : 'delete success!'
      }
    });
  });
};

// -- custom api

exports.api = {
  list: function (req, res, next) {
    var user_id = req.api_user._id;

    Topic.query({}, function (err, topics) {
      if (err) {
        return res.api_error(err);
      }

      res.api({
        topics : topics
      })
    });
  },
  show: function (req, res, next) {
    var user_id = req.api_user._id;
    var id = req.params.topic_id;

    Topic.getById(id, function (err, topic) {
      if (err) {
        return res.api_error(err);
      }

      res.api({
        topic : topic
      });
    });
  },
  create: function (req, res, next) {
    var user_id = req.api_user._id;

    Topic.create({title: req.body.title,body: req.body.body}, function (err, topic) {
      if (err) {
        return res.api_error(err);
      }

      res.json({
        topic : topic
      })
    });
  },
  update: function (req, res, next) {
    var user_id = req.api_user._id;
    var id = req.params.topic_id;
    Topic.updateById(id, {title: req.body.title,body: req.body.body}, function (err, topic) {
      if (err) {
        return res.api_error(err);
      }

      res.api({
        topic : topic,
        redirect : '/topics/' + id
      })
    });
  },
  delete: function (req, res, next) {
    var user_id = req.api_user._id;
    var id = req.params.topic_id;

    Topic.deleteById(id, function (err) {
      if (err) {
        return res.api_error(err);
      }

      res.api({id: id})
    });
  }
}


text:
namespace GafferImageBindings
{

void bindImageWriter();

} // namespace GafferImageBindings

#endif // GAFFERIMAGEBINDINGS_IMAGEWRITERBINDING_H


text:
Plugin.define "Red-Lion-HMI" do
author "Brendan Coles <bcoles@gmail.com>" # 2011-05-17
version "0.1"
description "Red Lion's G3 operator interface panels give you complete HMI (Human Machine Interface) functionality for PLCs, motor drives and other communications-capable devices. With Ethernet as standard on all G3 models, you can network-enable any serial devices connected to the panel."
website "http://www.redlion.net/"

# Google results as at 2011-05-17 #
# 2 for "Powered by Red Lion." "Display a view of the HMI's display and keyboard."

# Dorks #
dorks [
'"Powered by Red Lion." "Display a view of the HMI\'s display and keyboard."'
]

# Matches #
matches [

# Display menu option
{ :text=>'Display a view of the HMI\'s display and keyboard.   	' },

# Powered by text
{ :text=>'
Powered by Red Lion.
' },

]

end


text:
require 'spec_helper'

describe "question/update.html.erb" do
  pending "add some examples to (or delete) #{__FILE__}"
end


text:
from django.contrib.gis.geos.base import GEOSBase
from django.contrib.gis.geos.geometry import GEOSGeometry
from django.contrib.gis.geos.prototypes import prepared as capi

class PreparedGeometry(GEOSBase):
    """
    A geometry that is prepared for performing certain operations.
    At the moment this includes the contains covers, and intersects
    operations.
    """
    ptr_type = capi.PREPGEOM_PTR

    def __init__(self, geom):
        # Keeping a reference to the original geometry object to prevent it
        # from being garbage collected which could then crash the prepared one
        # See #21662
        self._base_geom = geom
        if not isinstance(geom, GEOSGeometry):
            raise TypeError
        self.ptr = capi.geos_prepare(geom.ptr)

    def __del__(self):
        if self._ptr: capi.prepared_destroy(self._ptr)

    def contains(self, other):
        return capi.prepared_contains(self.ptr, other.ptr)

    def contains_properly(self, other):
        return capi.prepared_contains_properly(self.ptr, other.ptr)

    def covers(self, other):
        return capi.prepared_covers(self.ptr, other.ptr)

    def intersects(self, other):
        return capi.prepared_intersects(self.ptr, other.ptr)


text:
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'payrollee_cz'

include PayrolleeCz

CAPTURE_MONEY = Transform /^(CZK) (\d+)$/ do |currency_symbol, money|
  money.to_i
end

CAPTURE_HOURS = Transform /^(\d+)$/ do |hours|
  hours.to_i
end

CAPTURE_COUNT = Transform /^(\d+)$/ do |count|
  count.to_i
end

CAPTURE_BOOL = Transform /^(YES|NO)$/ do |flag|
  if flag=='YES'
    1
  else
    0
  end
end

CAPTURE_TAXES = Transform /^(DECLARE|YES|NO)$/ do |flag|
  if flag=='DECLARE'
    3
  elsif flag=='YES'
    1
  else
    0
  end
end

CAPTURE_3BOOL = Transform /^(YES|NO)\:(YES|NO)\:(YES|NO)$/ do |flag1, flag2, flag3|
  flags = 0
  if flag1=='YES'
    flags += 1
  end
  if flag2=='YES'
    flags += 10
  end
  if flag3=='YES'
    flags += 100
  end
  flags
end

module PayrollProcessTest

  def my_payroll_period
    @my_payroll_period  ||= PayrollPeriod.new(2013, 1, 'january 2013')
  end

  def my_payroll_process
    @my_payroll_process ||= init_payroll_process(my_payroll_period)
  end

  def init_payroll_process(period)
    payroll_tags = PayTagGateway.new
    payroll_concepts = PayConceptGateway.new
    payroll_process = PayrollProcess.new(payroll_tags, payroll_concepts, period)
    return payroll_process
  end

  def calculate_payroll_process
    empty_value = {}
    gross_tag = @my_payroll_process.add_term(PayTagGateway::REF_INCOME_GROSS, empty_value)
    netto_tag = @my_payroll_process.add_term(PayTagGateway::REF_INCOME_NETTO, empty_value)
    @my_payroll_process.evaluate(netto_tag)
  end

  def get_result_income_base(result_ref)
    results = @my_payroll_process.get_results

    result_select = results.select do |key, _|
      key.code == result_ref.code
    end
    result_value = result_select.inject (0)  do |agr, item|
      agr + item.last.income_base
    end
  end

  def get_result_employee_base(result_ref)
    results = @my_payroll_process.get_results

    result_select = results.select do |key, _|
      key.code == result_ref.code
    end
    result_value = result_select.inject (0)  do |agr, item|
      agr + item.last.employee_base
    end
  end

  def get_result_payment(result_ref)
    results = @my_payroll_process.get_results

    result_select = results.select do |key, _|
      key.code == result_ref.code
    end
    result_value = result_select.inject (0)  do |agr, item|
      agr + item.last.payment
    end
  end

  def get_result_tax_relief(result_ref)
    results = @my_payroll_process.get_results

    result_select = results.select do |key, _|
      key.code == result_ref.code
    end
    result_value = result_select.inject (0)  do |agr, item|
      agr + item.last.tax_relief
    end
  end

  def get_result_after_reliefA(result_ref)
    results = @my_payroll_process.get_results

    result_select = results.select do |key, _|
      key.code == result_ref.code
    end
    result_value = result_select.inject (0)  do |agr, item|
      agr + item.last.after_reliefA
    end
  end

  def get_result_after_reliefC(result_ref)
    results = @my_payroll_process.get_results

    result_select = results.select do |key, _|
      key.code == result_ref.code
    end
    result_value = result_select.inject (0)  do |agr, item|
      agr + item.last.after_reliefC
    end
  end

  def get_result_amount(result_ref)
    results = @my_payroll_process.get_results

    result_select = results.select do |key, _|
      key.code == result_ref.code
    end
    result_value = result_select.inject (0)  do |agr, item|
      agr + item.last.amount
    end
  end
end
World(PayrollProcessTest)

Given /^Payroll process for payroll period (\d+) (\d+)$/ do |arg1, arg2|
  my_payroll_process
end

And /^Employee works in Weekly schedule (#{CAPTURE_HOURS}) hours$/ do |hours|
  schedule_work_value = {hours_weekly: hours}
  schedule_term_value = {date_from: nil, date_end: nil}

  my_payroll_process.add_term(PayTagGateway::REF_SCHEDULE_WORK, schedule_work_value)
  my_payroll_process.add_term(PayTagGateway::REF_SCHEDULE_TERM, schedule_term_value)
end

And /^Employee has (#{CAPTURE_HOURS}) hours of absence$/ do |hours|
  absence_hours_value = {hours: hours}
  my_payroll_process.add_term(PayTagGateway::REF_HOURS_ABSENCE, absence_hours_value)
end

And /^Employee Salary is (#{CAPTURE_MONEY}) monthly$/ do |salary|
  salary_amount_value = {amount_monthly: salary}
  my_payroll_process.add_term(PayTagGateway::REF_SALARY_BASE, salary_amount_value)
end

And /^Employee Contract is (#{CAPTURE_MONEY}) monthly$/ do |contract|
  pending # express the regexp above with the code you wish you had
end

And /^(#{CAPTURE_TAXES}) Employee is Regular Tax payer$/ do |yes_no|
  tax_interest = yes_no!=0 ? 1 : 0
  tax_declare  = yes_no==3 ? 1 : 0
  interest_value = {interest_code: tax_interest, declare_code: tax_declare}
  my_payroll_process.add_term(PayTagGateway::REF_TAX_INCOME_BASE, interest_value)
end

And /^(#{CAPTURE_BOOL}) Employee is Regular Health insurance payer with (#{CAPTURE_BOOL})$/ do |yes_no, minim|
  interest_value = {interest_code: yes_no, minimum_asses: minim}
  my_payroll_process.add_term(PayTagGateway::REF_INSURANCE_HEALTH_BASE, interest_value)
  my_payroll_process.add_term(PayTagGateway::REF_INSURANCE_HEALTH, interest_value)
end

And /^(#{CAPTURE_BOOL}) Employee is Regular Social insurance payer$/ do |yes_no|
  interest_value = {interest_code: yes_no}
  my_payroll_process.add_term(PayTagGateway::REF_INSURANCE_SOCIAL_BASE, interest_value)
  my_payroll_process.add_term(PayTagGateway::REF_INSURANCE_SOCIAL, interest_value)
end

And /^(#{CAPTURE_BOOL}) Employee is Regular Pension savings payer$/ do |yes_no|
  interest_value = {interest_code: yes_no}
  my_payroll_process.add_term(PayTagGateway::REF_SAVINGS_PENSIONS, interest_value)
end

And /^(#{CAPTURE_BOOL}) Employee claims tax benefit on tax payer$/ do |yes_no|
  relief_value = {relief_code: yes_no}
  my_payroll_process.add_term(PayTagGateway::REF_TAX_CLAIM_PAYER, relief_value)
end

And /^Employee claims tax benefit on (#{CAPTURE_COUNT}) child$/ do |count|
  relief_value = {relief_code: 1}
  count.times do
    my_payroll_process.add_term(PayTagGateway::REF_TAX_CLAIM_CHILD, relief_value)
  end
end

And /^(#{CAPTURE_3BOOL}) Employee claims tax benefit on disability$/ do |yes_no|
  relief_value = {
      relief_code_1: (yes_no % 10),
      relief_code_2: ((yes_no/10) % 10),
      relief_code_3: ((yes_no/100) % 10)
  }
  my_payroll_process.add_term(PayTagGateway::REF_TAX_CLAIM_DISABILITY, relief_value)
end

And /^(#{CAPTURE_BOOL}) Employee claims tax benefit on preparing by studying$/ do |yes_no|
  relief_value = {relief_code: yes_no}
  my_payroll_process.add_term(PayTagGateway::REF_TAX_CLAIM_STUDYING, relief_value)
end

And /^(#{CAPTURE_BOOL}) Employee is Employer contribution for Health insurance payer$/ do |yes_no|
  interest_value = {interest_code: yes_no}
  my_payroll_process.add_term(PayTagGateway::REF_TAX_EMPLOYERS_HEALTH, interest_value)
end

And /^(#{CAPTURE_BOOL}) Employee is Employer contribution for Social insurance payer$/ do |yes_no|
  interest_value = {interest_code: yes_no}
  my_payroll_process.add_term(PayTagGateway::REF_TAX_EMPLOYERS_SOCIAL, interest_value)
end

When /^Payroll process calculate results$/ do
  calculate_payroll_process
end

Then /^Accounted tax income should be (#{CAPTURE_MONEY})$/ do |amount|
  result_value = get_result_income_base(PayTagGateway::REF_TAX_INCOME_BASE)
  result_value.should == amount
end

And /^Premium insurance should be (#{CAPTURE_MONEY})$/ do |amount|
  result_health = get_result_payment(PayTagGateway::REF_TAX_EMPLOYERS_HEALTH)
  result_social = get_result_payment(PayTagGateway::REF_TAX_EMPLOYERS_SOCIAL)
  result_value = result_health + result_social
  result_value.should == amount
end

And /^Tax base should be (#{CAPTURE_MONEY})$/ do |amount|
  result_value = get_result_income_base(PayTagGateway::REF_TAX_ADVANCE_BASE)
  result_value.should == amount
end

And /^Accounted income for Health insurance should be (#{CAPTURE_MONEY})$/ do |amount|
  result_value = get_result_employee_base(PayTagGateway::REF_INSURANCE_HEALTH_BASE)
  result_value.should == amount
end

And /^Accounted income for Social insurance should be (#{CAPTURE_MONEY})$/ do |amount|
  result_value = get_result_employee_base(PayTagGateway::REF_INSURANCE_SOCIAL_BASE)
  result_value.should == amount
end

And /^Contribution to Health insurance should be (#{CAPTURE_MONEY})$/ do |amount|
  result_value = get_result_payment(PayTagGateway::REF_INSURANCE_HEALTH)
  result_value.should == amount
end

And /^Contribution to Social insurance should be (#{CAPTURE_MONEY})$/ do |amount|
  result_value = get_result_payment(PayTagGateway::REF_INSURANCE_SOCIAL)
  result_value.should == amount
end

And /^Tax advance before tax relief on payer should be (#{CAPTURE_MONEY})$/ do |amount|
  result_value = get_result_payment(PayTagGateway::REF_TAX_ADVANCE)
  result_value.should == amount
end

And /^Tax relief on payer should be (#{CAPTURE_MONEY})$/ do |amount|
  result_value = get_result_tax_relief(PayTagGateway::REF_TAX_RELIEF_PAYER)
  result_value.should == amount
end

And /^Tax advance after relief on payer should be (#{CAPTURE_MONEY})$/ do |amount|
  result_value = get_result_after_reliefA(PayTagGateway::REF_TAX_ADVANCE_FINAL)
  result_value.should == amount
end

And /^Tax relief on child should be (#{CAPTURE_MONEY})$/ do |amount|
  result_value = get_result_tax_relief(PayTagGateway::REF_TAX_RELIEF_CHILD)
  result_value.should == amount
end

And /^Tax advance after relief on child should be (#{CAPTURE_MONEY})$/ do |amount|
  result_value = get_result_after_reliefC(PayTagGateway::REF_TAX_ADVANCE_FINAL)
  result_value.should == amount
end

And /^Tax advance should be (#{CAPTURE_MONEY})$/ do |amount|
  result_value = get_result_payment(PayTagGateway::REF_TAX_ADVANCE_FINAL)
  result_value.should == amount
end

And /^Tax bonus should be (#{CAPTURE_MONEY})$/ do |amount|
  result_value = get_result_payment(PayTagGateway::REF_TAX_BONUS_CHILD)
  result_value.should == amount
end

And /^Gross income should be (#{CAPTURE_MONEY})$/ do |amount|
  result_value = get_result_amount(PayTagGateway::REF_INCOME_GROSS)
  result_value.should == amount
end

And /^Netto income should be (#{CAPTURE_MONEY})$/ do |amount|
  result_value = get_result_amount(PayTagGateway::REF_INCOME_NETTO)
  result_value.should == amount
end

And /^Employee works in employment with:$/ do |specs_table|
  # table is a Cucumber::Ast::Table
  @payroll_specs = specs_table
  absence_hours_value = {hours: hours}
  my_payroll_process.add_term(PayTagGateway::REF_HOURS_ABSENCE, absence_hours_value)
  salary_amount_value = {amount_monthly: salary}
  my_payroll_process.add_term(PayTagGateway::REF_SALARY_BASE, salary_amount_value)
  interest_value = {interest_code: yes_no}
  my_payroll_process.add_term(PayTagGateway::REF_TAX_INCOME_BASE, interest_value)
  interest_value = {interest_code: yes_no}
  my_payroll_process.add_term(PayTagGateway::REF_INSURANCE_HEALTH_BASE, interest_value)
  my_payroll_process.add_term(PayTagGateway::REF_INSURANCE_HEALTH, interest_value)
  interest_value = {interest_code: yes_no}
  my_payroll_process.add_term(PayTagGateway::REF_INSURANCE_SOCIAL_BASE, interest_value)
  my_payroll_process.add_term(PayTagGateway::REF_INSURANCE_SOCIAL, interest_value)
  interest_value = {interest_code: yes_no}
  my_payroll_process.add_term(PayTagGateway::REF_SAVINGS_PENSIONS, interest_value)
  relief_value = {relief_code: yes_no}
  my_payroll_process.add_term(PayTagGateway::REF_TAX_CLAIM_PAYER, relief_value)
  relief_value = {relief_code: (count if yes_no==1)}
  my_payroll_process.add_term(PayTagGateway::REF_TAX_CLAIM_CHILD, relief_value)
  relief_value = {relief_code: yes_no.mod(10)}
  my_payroll_process.add_term(PayTagGateway::REF_TAX_CLAIM_DISABILITY, relief_value)
  relief_value = {relief_code: yes_no}
  my_payroll_process.add_term(PayTagGateway::REF_TAX_CLAIM_STUDYING, relief_value)
  interest_value = {interest_code: yes_no}
  my_payroll_process.add_term(PayTagGateway::REF_TAX_EMPLOYERS_HEALTH, interest_value)
  interest_value = {interest_code: yes_no}
  my_payroll_process.add_term(PayTagGateway::REF_TAX_EMPLOYERS_SOCIAL, interest_value)
end

Then /^Payroll results should be:$/ do |result_table|
  # table is a Cucumber::Ast::Table
end


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.isc.todo.manager</groupId>
    <artifactId>todo-manager</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <java.version>1.8</java.version>
        <spring.boot.version>1.4.0.RELEASE</spring.boot.version>
    </properties>

    <build>
        <finalName>todo-manager</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>${spring.boot.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5.1</version>
                <configuration>
                    <target>${java.version}</target>
                    <source>${java.version}</source>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <version>1.3</version>
                <executions>
                    <execution>
                        <id>exec-install-node-and-npm</id>
                        <goals>
                            <goal>install-node-and-npm</goal>
                        </goals>
                        <configuration>
                            <nodeVersion>v6.9.1</nodeVersion>
                            <npmVersion>3.5.2</npmVersion>
                            <workingDirectory>src/frontend</workingDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>npm-install</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <configuration>
                            <workingDirectory>src/frontend</workingDirectory>
                            <arguments>install</arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>npm-run-build</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <configuration>
                            <workingDirectory>src/frontend</workingDirectory>
                            <arguments>run build</arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
            <version>${spring.boot.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <version>${spring.boot.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-log4j2</artifactId>
            <version>${spring.boot.version}</version>
        </dependency>
    </dependencies>
</project>


text:
"""

Copyright (c) 2008  Dustin Sallings <dustin@spy.net>
Copyright (c) 2009  Bogdano Arendartchuk <debogdano@gmail.com>
"""

import sys

from twisted.internet import reactor, defer

from twittytwister import twitter

fetchCount = 0

@defer.deferredGenerator
def getSome(tw, list_user, list_name):
    global fetchCount
    fetchCount = 0

    def gotEntry(msg):
        global fetchCount
        fetchCount += 1
        sys.stdout.write(msg.text.encode("utf8") + "\n")

    page = 1
    while True:
        fetchCount = 0
        sys.stderr.write("Fetching page %d for %s/%s\n" % (page, list_user,
            list_name))
        d = tw.list_timeline(gotEntry, list_user, list_name,
                {'count': '200', 'page': str(page)})
        page += 1
        wfd = defer.waitForDeferred(d)
        yield wfd
        wfd.getResult()

        if fetchCount == 0:
            reactor.stop()

user = sys.argv[1]
list_user = sys.argv[3]
list_name = sys.argv[4]

tw = twitter.Twitter(sys.argv[1], sys.argv[2])

defer.maybeDeferred(getSome, tw, list_user, list_name)

reactor.run()


text:
<?php
namespace app\models;

use yii\base\InvalidParamException;
use yii\base\Model;
use Yii;

/**
 * Password reset form
 */
class ResetPasswordForm extends Model
{
    public $password;
    private $_user;

    /**
     * Creates a form model given a token.
     *
     * @param  string                          $token
     * @param  array                           $config name-value pairs that will be used to initialize the object properties
     * @throws \yii\base\InvalidParamException if token is empty or not valid
     */
    public function __construct($token, $config = [])
    {
        if (empty($token) || !is_string($token)) {
            throw new InvalidParamException('Password reset token cannot be blank.');
        }
        $this->_user = User::findByPasswordResetToken($token);
        if (!$this->_user) {
            throw new InvalidParamException('Wrong password reset token.');
        }
        parent::__construct($config);
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            ['password', 'required'],
            ['password', 'string', 'min' => 6],
        ];
    }

    /**
     * Resets password.
     *
     * @return boolean if password was reset.
     */
    public function resetPassword()
    {
        $user = $this->_user;
        $user->setPassword($this->password);
        $user->removePasswordResetToken();

        return $user->save(false);
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Econom.Web.Infrastructure.Activators
{
    public interface IRecipeSuggestionsHubActivator
    {
    }
}


text:
import random
import numpy as np
import scipy

from numba import jit

from ibex.utilities.constants import *

@jit(nopython=True)
def GenerateExampleFromSegment(segment, width, indices):
    nchannels, zres, yres, xres = width

    example = np.zeros((nchannels, zres, yres, xres), dtype=np.float32)

    # go through every element and set the appropriate channel values
    for iz in range(zres):
        for iy in range(yres):
            for ix in range(xres):
                if nchannels == 1:
                    if segment[iz,iy,ix]:
                        example[0,iz,iy,ix] = 1
                else:
                    # use indices array to avoid learning label one and label two differences
                    if segment[iz,iy,ix] == 1:
                        example[0,iz,iy,ix] = 1
                        example[indices[0],iz,iy,ix] = 1
                    elif segment[iz,iy,ix] == 2:
                        example[0,iz,iy,ix] = 1
                        example[indices[1],iz,iy,ix] = 1

    # subtract 0.5 so that the values are {-0.5, 0.5}
    return example - 0.5

def AugmentFeature(segment, width):
    # to randomize the first and second channels (ordering of label one and label two)
    # need this outside of GenerateExampleFromSegment for @jit(nopython) to work
    indices = [1, 2]
    random.shuffle(indices)

    # generate the example from the segment by creating nchannels binary channels
    example = GenerateExampleFromSegment(segment, width, indices)

    # expand the first dimension
    example = np.expand_dims(example, 0)

    # randomly flip the angle
    if random.random() > 0.5: example = np.flip(example, IB_Z + 2)

    # randomly rotate the example
    angle = random.uniform(0, 360)
    example = scipy.ndimage.interpolation.rotate(example, angle, axes=(IB_X + 2, IB_Y + 2), reshape=False, order=0, mode='constant', cval=-0.5)

    return example


text:
const fs = require('fs');
const path = require('path');
const webpack = require('webpack');

const babelrc = fs.readFileSync('./.babelrc');
const babelLoaderQuery = JSON.parse(babelrc);
babelLoaderQuery.plugins = babelLoaderQuery.plugins || [];
babelLoaderQuery.plugins.push('react-transform');
babelLoaderQuery.extra = babelLoaderQuery.extra || {};
babelLoaderQuery.extra['react-transform'] = {
  transforms: [{
    transform: 'react-transform-hmr',
    imports: ['react'],
    locals: ['module'],
  }],
};

module.exports = {
  devtool: 'cheap-module-eval-source-map',
  entry: {
    seller: [
      'webpack-hot-middleware/client',
      './react/client',
    ],
  },
  output: {
    path: path.join(__dirname, 'dist'),
    filename: '[name].bundle.js',
  },
  plugins: [
    new webpack.HotModuleReplacementPlugin(),
    new webpack.NoErrorsPlugin(),
    new webpack.DefinePlugin({
      'process.env': {
        // Useful to reduce the size of client-side libraries, e.g. react
        NODE_ENV: JSON.stringify('development'),
      },
    }),
  ],
  module: {
    loaders: [
      {
        test: /\.js$/,
        loaders: [`babel?${JSON.stringify(babelLoaderQuery)}`],
        exclude: /node_modules/,
      },
      {
        test: /\.scss$/,
        loaders: ['style', 'css', 'sass'],
      },
    ],
  },
  resolve: {
  },
};


text:
var Row = function(cells, uri, line) {
  var Cucumber = require('../../../cucumber');

  self = {
    raw: function raw() {
      return cells;
    }
  };
  return self;
}
module.exports = Row;


text:
typedef char SByte;
typedef unsigned char Byte;
typedef char Int8;
typedef unsigned char UInt8;
typedef short Int16;
typedef unsigned short UInt16;
typedef int Int32;
typedef unsigned int UInt32;
typedef long long Int64;
typedef unsigned long long UInt64;

// Portable pointer-casting types.
typedef UInt64 PtrInt;		// An unsigned integer type that is the same size as a pointer.
typedef Int64 Int;			// A signed integer type that matches the native platform's "best" register size.
typedef UInt64 UInt;		// An unsigned integer type that matches the native platform's "best" register size.

#define SizeofPtrInt 8
#define SizeofInt 8

// Portable binary floating-point types.
typedef float Float32;
typedef double Float64;
typedef struct __attribute__((aligned(16))) { UInt64 value[2]; } Float128;

// Portable decimal floating-point types.
typedef struct __attribute__((aligned(4))) { UInt32 value; } Real32;
typedef struct __attribute__((aligned(8))) { UInt64 value; } Real64;
typedef struct __attribute__((aligned(16))) { UInt64 value[2]; } Real128;

// Needed for Linux to support 64-bit system calls.
#define _LARGEFILE64_SOURCE

// If we have support for __int128, enable it.
#if __SIZEOF_INT128__ == 16
#	undef SMILE_COMPILER_HAS_INT128
#	define SMILE_COMPILER_HAS_INT128 1
	typedef __int128 Int128;

#	undef SMILE_COMPILER_HAS_UINT128
#	define SMILE_COMPILER_HAS_UINT128 1
	typedef unsigned __int128 UInt128;
#endif

//------------------------------------------------------------------------------------------------
//  GC needs to know what platform we're on.

#define GC_THREADS
#define GC_LINUX_THREADS

//------------------------------------------------------------------------------------------------
//  Declaration prefixes.

// How to make functions behave as 'inline' in this compiler.
#undef Inline
#define Inline static __inline__

// How to declare thread-local data.
#define SMILE_HAS_THREAD_LOCAL True
#define SMILE_THREAD_LOCAL __thread

// How to align data structures in memory.
#undef SMILE_ALIGN
#define SMILE_ALIGN(__n__) __attribute__((aligned(n)))

#if __GNUC__ >= 4
	#undef SMILE_API_FUNC
	#define SMILE_API_FUNC extern
	#undef SMILE_API_DATA
	#define SMILE_API_DATA extern

	#undef SMILE_INTERNAL_FUNC
	#define SMILE_INTERNAL_FUNC __attribute__ ((visibility ("hidden")))
	#undef SMILE_INTERNAL_DATA
	#define SMILE_INTERNAL_DATA __attribute__ ((visibility ("hidden")))
#endif

// Compatibility macros.
#undef SMILE_NO_RETURN
#define SMILE_NO_RETURN __attribute((noreturn))
#define SMILE_IGNORE_UNUSED_VARIABLES _Pragma("GCC diagnostic ignored \"-Wunused-variable\"")
#undef SMILE_UNREACHABLE
#define SMILE_UNREACHABLE __builtin_unreachable();

//------------------------------------------------------------------------------------------------
//  Entropy.

// Get a reasonable degree of entropy from wherever this platform keeps it, as quickly as possible.
// This doesn't need to be crypto-secure; it just needs to be suitably semi-random.
Inline UInt64 GetBaselineEntropy(void)
{
	UInt32 hi, lo;
	__asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi));
	return ((UInt64)lo) | (((UInt64)hi) << 32);
}

//------------------------------------------------------------------------------------------------
//  Optimized bit-search functions.

Inline UInt32 UInt32_CountLeadingZeros(UInt32 value)
{
	return value ? (UInt32)__builtin_clz((unsigned int)value) : 32;
}

Inline UInt32 UInt32_CountTrailingZeros(UInt32 value)
{
	return value ? (UInt32)__builtin_ctz((unsigned int)value) : 32;
}

Inline UInt64 UInt64_CountLeadingZeros(UInt64 value)
{
	return value ? (UInt64)__builtin_clzll((unsigned long long)value) : 64;
}

Inline UInt64 UInt64_CountTrailingZeros(UInt64 value)
{
	return value ? (UInt64)__builtin_ctzll((unsigned long long)value) : 64;
}

#endif


text:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using RRLab.PhysiologyWorkbench.Data;

namespace RRLab.PhysiologyWorkbench.GUI
{
    public partial class BreakInTimerControl : UserControl
    {
        private DataManager _DataManager;
        public DataManager DataManager
        {
            get
            {
                return _DataManager;
            }
            set
            {
                if (DataManager != null)
                {
                    DataManager.CurrentCellChanged -= new EventHandler(OnCellChanged);
                }
                _DataManager = value;
                if (DataManager != null)
                {
                    DataManager.CurrentCellChanged += new EventHandler(OnCellChanged);
                }
            }
        }

        private TimeSpan _WarningTime = new TimeSpan(0, 10, 0);
        public TimeSpan WarningTime
        {
            get { return _WarningTime; }
            set { _WarningTime = value; }
        }

        private Color _WarningColor = Color.Maroon;
        public Color WarningColor
        {
            get { return _WarningColor; }
            set { _WarningColor = value; }
        }

        public BreakInTimerControl()
        {
            InitializeComponent();
        }

        private void Timer_Tick(object sender, EventArgs e)
        {
            if ((DataManager == null) || (DataManager.CurrentCell == null)) return;

            if (InvokeRequired)
            {
                Invoke(new EventHandler(Timer_Tick), sender, e);
                return;
            }

            if (!DataManager.CurrentCell.IsBreakInTimeNull() && DataManager.CurrentCell.BreakInTime != DateTime.MinValue)
            {
                try
                {
                    TimeSpan breakInLength = DateTime.Now - DataManager.CurrentCell.BreakInTime;
                    BreakInLabel.Text = breakInLength.Minutes + ":" + breakInLength.Seconds;
                    // Check if the break-in length surpasses the warning time and apply formatting
                    if (breakInLength >= WarningTime)
                    {
                        BreakInLabel.ForeColor = WarningColor;
                    }
                    else
                    {
                        BreakInLabel.ForeColor = Color.Black;
                    }
                }
                catch (Exception x) { BreakInLabel.Text = "Error"; }
            }
            else
            {
                BreakInLabel.Text = "Not Broke In";
            }
        }

        protected virtual void OnCellChanged(object sender, EventArgs e)
        {
            if (DataManager == null) return;

            if (InvokeRequired)
            {
                Invoke(new EventHandler(OnCellChanged), sender, e);
                return;
            }
            if (DataManager.CurrentCell == null) Enabled = false;
            else Enabled = true;
        }
    }
}


text:
<template>
   <v-grid style="width:100%;height:100%" v-row-height="25" v-header-height="50" v-multi-select="true" v-data-binder.bind="gridConnector"
        v-grid-context.bind=gridContext v-row-ondblclick.delegate="rowDblClick($event.detail)">

        <v-grid-col col-width="80" col-add-row-attributes="disabled" col-type="checkbox" col-field="__isModified" col-header-name="unsaved"></v-grid-col>

        <v-grid-col col-width="80" col-type="text" col-field="ID" col-sort="ID" col-header-name="ID" col-filter="ID|>" col-filter-top="true"></v-grid-col>

   <!--
                killing the cpu, only use i detail view
           <v-grid-col col-width="60" col-type="image" col-field="photo" col-sort="firstname" col-header-name="photo"
            col-add-filter-attributes="v-header-menu='photo'" col-add-row-attributes="v-header-menu='photo' v-row-menu='photo' v-key-move"
            col-filter-top="false"></v-grid-col>-->

        <v-grid-col col-width="80" col-type="checkbox" col-field="woman" col-sort="woman" col-header-name="woman" col-filter="woman"
            col-add-filter-attributes="v-header-menu='woman'" col-add-row-attributes="v-header-menu='woman' v-row-menu='woman' v-key-move"></v-grid-col>

        <v-grid-col col-width="80" col-type="checkbox" col-field="isManager" col-sort="isManager" col-header-name="isManager" col-filter="isManager"
            col-add-filter-attributes="v-header-menu='isManager'" col-add-row-attributes="v-header-menu='isManager' v-row-menu='isManager' v-key-move"></v-grid-col>

        <v-grid-col col-width="120" col-type="text" col-field="firstname" col-sort="firstname" col-header-name="firstname" col-filter="firstname|*="
            col-add-filter-attributes="v-header-menu='firstname'" col-add-row-attributes="v-header-menu='firstname' v-row-menu='firstname' v-key-move"
            col-filter-top="false"></v-grid-col>

        <v-grid-col col-width="120" col-type="text" col-field="lastname" col-sort="lastname" col-header-name="lastname" col-filter="lastname|*="
            col-add-filter-attributes="v-header-menu='lastname'" col-add-row-attributes="v-header-menu='lastname' v-row-menu='lastname' v-key-move"
            col-filter-top="false"></v-grid-col>

        <v-grid-col col-width="120" col-type="text" col-add-row-attributes="readonly" col-field="companyName" col-sort="companyName"
            col-header-name="companyName" col-filter="companyName|*=" col-add-filter-attributes="v-header-menu='companyName'"
            col-add-row-attributes="v-header-menu='company' v-row-menu='companyName' v-key-move" col-filter-top="false"></v-grid-col>

        <v-grid-col col-width="120" col-type="text" col-field="age" col-sort="age" col-header-name="Age" col-filter="age|*=" col-add-filter-attributes="v-header-menu='age'"
            col-add-row-attributes="v-header-menu='age' v-row-menu='age' v-key-move" col-filter-top="false"></v-grid-col>

        <v-grid-col col-width="120" col-type="text" col-field="taxes" col-sort="taxes" col-header-name="taxes" col-filter="salery|*="
            col-add-filter-attributes="v-header-menu='taxes'" col-add-row-attributes="v-header-menu='taxes' v-row-menu='taxes' v-key-move"
            col-filter-top="false"></v-grid-col>

    </v-grid>

</template>


text:
: ${JETS3T_HOME:-""}
: ${JAVA_HOME:-""}

# Check the JETS3T_HOME directory

if [ -z "$JETS3T_HOME" ]; then
  # Try to find the home directory, assuming this script is in $JETS3T_HOME/bin
  SCPT_DIR=`dirname $0`
  if [ "$SCPT_DIR" = "." ]; then
    JETS3T_HOME=..
  else
    JETS3T_HOME=`dirname $SCPT_DIR`
  fi
fi

if [ ! -d $JETS3T_HOME/jars ]; then
  echo "Please set the environment variable JETS3T_HOME"
  exit 1
fi

# Check the JAVA_HOME directory
if [ -z "$JAVA_HOME" ]; then
  # Test whether the 'java' program is available in the system path.
  java -version 2> /dev/null
  if [ $? -gt 0 ]; then
    echo "Please set the environment variable JAVA_HOME"
    exit 1
  else
    EXEC=java
  fi
else
  EXEC=$JAVA_HOME/bin/java
fi

# echo "JetS3t path: $JETS3T_HOME"
# echo "Java path: $EXEC"

# -------------------------------------------------------------------

# Include configurations directory in classpath
CP=$JETS3T_HOME/configs

# Include resources directory in classpath
CP=$CP:$JETS3T_HOME/resources

# Include libraries in classpath
CP=$CP:$JETS3T_HOME/jars/jets3t-{jets3t-version}.jar
CP=$CP:$JETS3T_HOME/jars/synchronize-{jets3t-version}.jar
CP=$CP:$JETS3T_HOME/libs/commons-logging/commons-logging-1.1.1.jar
CP=$CP:$JETS3T_HOME/libs/commons-codec/commons-codec-1.3.jar
CP=$CP:$JETS3T_HOME/libs/commons-httpclient/commons-httpclient-3.1.jar
CP=$CP:$JETS3T_HOME/libs/logging-log4j/log4j-1.2.15.jar
CP=$CP:$JETS3T_HOME/libs/bouncycastle/bcprov-jdk14-138.jar

# OutOfMemory errors? Increase the memory available by changing -Xmx128M

"$EXEC" -Xmx128M -classpath "$CP" org.jets3t.apps.synchronize.Synchronize "$@"


text:
import { browser, by, element } from 'protractor';
import { isLoaded } from './utils';
import * as chai from 'chai';
import * as chaiAsPromised from 'chai-as-promised';

chai.use(chaiAsPromised);
const expect = chai.expect;

describe('Server Status', () => {

  it(`should have docker installed`, () => {
    return browser.get('/setup')
      .then(() => isLoaded())
      .then(() => element(by.css('[name="docker-installed-icon"]')))
      .then(el => el.getAttribute('src'))
      .then(attr => expect(attr).to.includes('images/icons/check-true.svg'));
  });

  it(`should have docker running`, () => {
    return browser.get('/setup')
      .then(() => isLoaded())
      .then(() => element(by.css('[name="docker-running-icon"]')))
      .then(el => el.getAttribute('src'))
      .then(attr => expect(attr).to.includes('/images/icons/check-true.svg'));
  });

  it(`should have sqlite3 installed`, () => {
    return browser.get('/setup')
      .then(() => isLoaded())
      .then(() => element(by.css('[name="sqlite3-installed-icon"]')))
      .then(el => el.getAttribute('src'))
      .then(attr => expect(attr).to.includes('images/icons/check-true.svg'));
  });

  it(`should have git installed`, () => {
    return browser.get('/setup')
      .then(() => isLoaded())
      .then(() => element(by.css('[name="git-installed-icon"]')))
      .then(el => el.getAttribute('src'))
      .then(attr => expect(attr).to.includes('images/icons/check-true.svg'));
  });
});