text:
<!doctype html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="Command console for performing updates to the FabMo engine and dashboard">
    <title>FabMo Update Console</title>
    <link rel="stylesheet" href="css/fonts.css">
    <link rel="stylesheet" href="css/font-awesome.min.css">
    <link rel="stylesheet" href="css/style.css">

<form style="display:none;" id="fileform">
  <input type="file" id="file" multiple>
</form>

FabMo Updater

 FabMo System Info

 Software Updates

 Settings

 Simple Updater

 Goto Dashboard

 Factory Reset

 Console

 Logout

           Unknown

  FabMo System Information

Platform:

Machine ID:

OS Version:

Wifi Network

Wifi Network ID:

Wifi Network Mode:

Updater

Updater Repository:

Updater Version:

Updater State:

Engine

Engine Repository:

Engine Version:

Engine State:

Firmware

forked at Synthetos-G2:

Firmware Version:

Firmware Default Settings:

 Software Update

There are no software updates available.

        <button id="btn-check-for-updates" class="btn">  Check for Updates</button>

A software update is available!

          <button id="btn-update-apply" class="btn-green disabled">  Update</button>

 Manual Update

Click the button below to apply an update from an .fmu or .fmp file.

        <button id="btn-update-manual" class="btn-blue">  Update With File...</button>

 Wireless Network

Wifi

Below is a list of available wireless networks.  Enter an SSID and key at the bottom of the table to join a network.  You can click a network in the list to fill in that network's SSID.  Note that when you join a network, you will lose your connection to the updater and will need to reconnect from the chosen network.

No wireless networks are currently visible.

If you know a nearby network is active but not listed here, you can enter its SSID and network key in the form below, and an attempt will be made to join it anyway.

              SSID
              Security
              Strength

        <form id="form-join-wifi-network" class="form-horizontal">
          <fieldset>
            Network ID:
            <input id="wifi-network-ssid" type="text" placeholder="SSID" />
            <input id="wifi-network-key" type="password" placeholder="Wifi Network Key" />
            <button id="btn-wifi-network-join" class="btn-green"> Join Wifi Network</button>
          </fieldset>
        </form>

AP Mode

In AP mode, the system acts as its own wireless access point, which can be connected to by any wifi-capable device.  In this mode, no internet access is available, so updates and other operations that require an internet connection cannot be performed. Switching to AP mode will disconnect you from the updater.  You will have to change to the AP network once the operation is complete.

        <button id="btn-wifi-network-ap-mode" class="btn-blue"> Switch to AP Mode</button>

Disable Wifi

Clicking this button will disable the Wifi for this session (if you reboot your machine, wifi will come back). Be carefull, if you press this button while connected through wifi, you will loose the connnection !

        <button id="btn-wifi-network-disable" class="btn-blue"> Disable Wifi</button>

Ethernet

        <form id="form-ethernet-network" class="form-vertical">
          <fieldset>
            Mode :
            <select id="ethernet-network-mode">
              <option value="magic">Magic</option>
              <option value="dhcp">DHCP</option>
              <option value="static">Static</option>
              <option value="off">Off</option>
            </select>

Default Configuration

            Ip Address :
            <input id="ethernet-network-ip-address" type="text" placeholder="ip address" />
            Netmask :
            <input id="ethernet-network-netmask" type="text" placeholder="netmask" />

            Gateway :
            <input id="ethernet-network-gateway" type="text" placeholder="gateway" />
            DNS :
            <input id="ethernet-network-dns" type="text" placeholder="dns seperated by comma" />

DHCP range

            start :
            <input id="ethernet-network-dhcp-range-start" type="text" placeholder="dhcp range start" />
            end :
            <input id="ethernet-network-dhcp-range-end" type="text" placeholder="dhcp range end" />

            <button id="btn-ethernet-network-save" class="btn-green"> Change ethernet configuration</button>
          </fieldset>
        </form>

 Settings

System Identity

The name selected here will be used both as the system hostname as well as the SSID when in AP mode.  The password will be used both as the root password as well as the network key for AP mode.  You do not need to enter both values.  Only non-blank values will be changed.

      <form class="form-horizontal" id="form-wifi-network-id">
        <fieldset>
         System ID:
         <input id="wifi-network-name" type="text" placeholder="Name" />
         <input id="wifi-network-password" type="password" placeholder="Root Password" />
         <button id="btn-wifi-network-id" class="btn-green">Set System ID</button>
        </fieldset>
      </form>

Configuration

      <fieldset>

            Packages URL:
            <input class="config-input long" id="config-packages_url" type="text" placeholder="URL for update packages file" />

      </fieldset>

 Factory Reset

The button below will reset all system software to its factory state.  This is not a reversible operation, and you will lose all software settings, history and user data.  Do not proceed unless you know what you are doing.

When a factory reset is performed, you will temporarily lose contact with the updater.  Please be patient.  Factory updates take about 5 minutes, and you may need to refresh this page to restore your connection.  The system will try to re-establish the current wireless configuration after the reset, but after a system power-cycle, all wireless settings will be forgotten.  The system will be in AP mode and you will need to reconnect and re-enter wireless credentials.

In other words, a factory reset is a little weird, and you really shouldn't do it unless you're absolutely sure you have to.

      <button id="btn-factory-reset" class="btn-red"> Factory Reset</button>

      Updater Console

      <button class="btn-red" id="btn-modal-cancel">Cancel</button>
      <button class="btn-green" id="btn-modal-ok">OK</button>


text:
<?php

namespace GraphAware\Neo4j\GraphUnit;

interface GraphDatabaseServiceInterface
{
    /**
     * @return \Neoxygen\NeoClient\Client
     */
    public function getConnection();
}

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Nette\Config\Extensions;

use Nette,
	Nette\DI\ContainerBuilder;

/**
 * Constant definitions.
 *
 * @author     David Grudl
 */
class ConstantsExtension extends Nette\Config\CompilerExtension
{

	public function afterCompile(Nette\Utils\PhpGenerator\ClassType $class)
	{
		foreach ($this->getConfig() as $name => $value) {
			$class->methods['initialize']->addBody('define(?, ?);', array($name, $value));
		}
	}

}


text:
package com.ea.orbit.actors.cluster;

import java.io.Serializable;

/**
 * The actual implementation of INodeAddress. Should not be used directly by the application.
 */
public class NodeAddressImpl implements NodeAddress, Serializable
{
	private static final long serialVersionUID = 1L;

	private java.util.UUID address;

    public NodeAddressImpl(final java.util.UUID address)
    {
        this.address = address;
    }

    @Override
    public java.util.UUID asUUID()
    {
        return address;
    }

    @Override
    public boolean equals(final Object o)
    {
        return this == o || ((o instanceof NodeAddressImpl)
                && address.equals(((NodeAddressImpl) o).address));
    }

    @Override
    public int hashCode()
    {
        return address.hashCode();
    }

    @Override
    public String toString()
    {
        return address.toString();
    }
}


text:
package com.graphhopper.http;

import org.eclipse.jetty.http.HttpStatus.Code;

public class InvalidParameterException extends APIException {

    public InvalidParameterException(String message) {
        super(Code.BAD_REQUEST, message);
    }

    /**
     *
     */
    private static final long serialVersionUID = 1L;

}


text:
package resources

import "github.com/cloudfoundry/cli/cf/models"

type ServiceKeyResource struct {
	Resource
	Entity ServiceKeyEntity
}

type ServiceKeyEntity struct {
	Name                string                 `json:"name"`
	ServiceInstanceGuid string                 `json:"service_instance_guid"`
	ServiceInstanceUrl  string                 `json:"service_instance_url"`
	Credentials         map[string]interface{} `json:"credentials"`
}

func (resource ServiceKeyResource) ToFields() models.ServiceKeyFields {
	return models.ServiceKeyFields{
		Name: resource.Entity.Name,
		Url:  resource.Metadata.Url,
		Guid: resource.Metadata.Guid,
	}
}

func (resource ServiceKeyResource) ToModel() models.ServiceKey {
	return models.ServiceKey{
		Fields: models.ServiceKeyFields{
			Name: resource.Entity.Name,
			Guid: resource.Metadata.Guid,
			Url:  resource.Metadata.Url,

			ServiceInstanceGuid: resource.Entity.ServiceInstanceGuid,
			ServiceInstanceUrl:  resource.Entity.ServiceInstanceUrl,
		},
		Credentials: resource.Entity.Credentials,
	}
}


text:
SS::Application.routes.draw do
  Gws::Schedule::Initializer

  concern :plans do
    get :events, on: :collection
    get :print, on: :collection
    get :popup, on: :member
    get :copy, on: :member
    match :soft_delete, on: :member, via: [:get, :post]
  end

  concern :export do
    get :download, on: :collection
  end

  concern :deletion do
    get :delete, on: :member
    delete :destroy_all, on: :collection, path: ''
  end

  gws "schedule" do
    get 'all_groups' => 'groups#index'
    get 'facilities' => 'facilities#index'
    get 'facilities/print' => 'facilities#print'
    get 'search' => redirect { |p, req| "#{req.path}/users" }, as: :search
    get 'search/users' => 'search/users#index', as: :search_users
    get 'search/times' => 'search/times#index', as: :search_times
    get 'search/reservations' => 'search/reservations#index', as: :search_reservations
    get 'csv' => 'csv#index', as: :csv
    post 'import_csv' => 'csv#import', as: :import_csv

    get '/' => redirect { |p, req| "#{req.path}/plans" }, as: :main
    resources :plans, concerns: [:plans, :export], except: [:destroy]
    resources :list_plans, concerns: :plans
    resources :user_plans, path: 'users/:user/plans', concerns: :plans
    resources :group_plans, path: 'groups/:group/plans', concerns: :plans
    resources :custom_group_plans, path: 'custom_groups/:group/plans', concerns: :plans
    resources :facility_plans, path: 'facilities/:facility/plans', concerns: [:plans, :export]
    resources :trashes, concerns: [:deletion], except: [:new, :create, :edit, :update] do
      match :undo_delete, on: :member, via: [:get, :post]
    end
    resources :holidays, concerns: [:plans, :deletion]
    resources :comments, path: ':plan_id/comments', only: [:create, :edit, :update, :destroy], concerns: :deletion
    resource :attendance, path: ':plan_id/:user_id/attendance', only: [:edit, :update]
    resource :approval, path: ':plan_id/:user_id/approval', only: [:edit, :update]

    namespace 'todo' do
      get '/' => redirect { |p, req| "#{req.path}/readables" }, as: :main
      resources :readables, concerns: :plans do
        match :finish, on: :member, via: %i[get post]
        match :revert, on: :member, via: %i[get post]
        post :finish_all, on: :collection
        post :revert_all, on: :collection
        post :soft_delete_all, on: :collection
      end
      resources :trashes, concerns: :deletion do
        match :undo_delete, on: :member, via: %i[get post]
        post :undo_delete_all, on: :collection
      end
    end

    resources :categories, concerns: :deletion
    resource :user_setting, only: [:show, :edit, :update]
  end
end


text:
package org.springframework.cloud.stream.binder;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.messaging.MessageChannel;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;

/**
 * @author Marius Bogoevici
 * @author Janne Valkealahti
 */
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = ArbitraryInterfaceWithDefaultsTests.TestFooChannels.class,
				properties = "spring.cloud.stream.default-binder=mock")
public class ArbitraryInterfaceWithDefaultsTests {

	@Autowired
	public FooChannels fooChannels;

	@Autowired
	private BinderFactory binderFactory;

	@SuppressWarnings({"rawtypes", "unchecked"})
	@Test
	public void testArbitraryInterfaceChannelsBound() {
		final Binder binder = this.binderFactory.getBinder(null, MessageChannel.class);
		verify(binder).bindConsumer(eq("foo"), isNull(), eq(this.fooChannels.foo()),
				Mockito.any());
		verify(binder).bindConsumer(eq("bar"), isNull(), eq(this.fooChannels.bar()),
				Mockito.any());
		verify(binder).bindProducer(eq("baz"), eq(this.fooChannels.baz()),
				Mockito.any());
		verify(binder).bindProducer(eq("qux"), eq(this.fooChannels.qux()),
				Mockito.any());
		verifyNoMoreInteractions(binder);
	}

	@EnableBinding(FooChannels.class)
	@EnableAutoConfiguration
	public static class TestFooChannels {

	}

}


text:
from __future__ import division, print_function
import os
import sys
import re

# TODO Use `begins` library to provide a CLI

pathvar = os.environ['PATH']
paths = pathvar.split(';')
searchterm = sys.argv[1]
csearchterm = re.compile(searchterm)

for p in paths:
    if not os.path.exists(p):
        print('Skipping invalid path entry "{}"'.format(p))
        continue
    filenames = [x for x in os.listdir(p) if csearchterm.match(x)]
    if filenames:
        print()
        print('In "{}"...'.format(p))
        for f in filenames:
            print('    {}'.format(f))


text:
/*
 * Error reporting functions for the assembler
 */

#ifndef NASM_ERROR_H
#define NASM_ERROR_H 1

#include "compiler.h"

/*
 * File pointer for error messages
 */
extern FILE *error_file;        /* Error file descriptor */

/*
 * Typedef for the severity field
 */
typedef uint32_t errflags;

/*
 * An error reporting function should look like this.
 */
void printf_func(2, 3) nasm_error(errflags severity, const char *fmt, ...);
void printf_func(1, 2) nasm_listmsg(const char *fmt, ...);
void printf_func(2, 3) nasm_listmsgf(errflags flags, const char *fmt, ...);
void printf_func(1, 2) nasm_debug(const char *fmt, ...);
void printf_func(2, 3) nasm_debugf(errflags flags, const char *fmt, ...);
void printf_func(1, 2) nasm_info(const char *fmt, ...);
void printf_func(2, 3) nasm_infof(errflags flags, const char *fmt, ...);
void printf_func(2, 3) nasm_warn(errflags flags, const char *fmt, ...);
void printf_func(1, 2) nasm_nonfatal(const char *fmt, ...);
void printf_func(2, 3) nasm_nonfatalf(errflags flags, const char *fmt, ...);
fatal_func printf_func(1, 2) nasm_fatal(const char *fmt, ...);
fatal_func printf_func(2, 3) nasm_fatalf(errflags flags, const char *fmt, ...);
fatal_func printf_func(1, 2) nasm_critical(const char *fmt, ...);
fatal_func printf_func(2, 3) nasm_criticalf(errflags flags, const char *fmt, ...);
fatal_func printf_func(1, 2) nasm_panic(const char *fmt, ...);
fatal_func printf_func(2, 3) nasm_panicf(errflags flags, const char *fmt, ...);
fatal_func nasm_panic_from_macro(const char *file, int line);
#define panic() nasm_panic_from_macro(__FILE__, __LINE__);

void vprintf_func(2) nasm_verror(errflags severity, const char *fmt, va_list ap);
fatal_func vprintf_func(2) nasm_verror_critical(errflags severity, const char *fmt, va_list ap);

/*
 * These are the error severity codes which get passed as the first
 * argument to an efunc.
 */
#define ERR_LISTMSG		0x00000000      /* for the listing file only */
#define ERR_DEBUG		0x00000001	/* debugging message */
#define ERR_INFO		0x00000002	/* information for the list file */
#define ERR_WARNING		0x00000003	/* warn only: no further action */
#define ERR_NONFATAL		0x00000004	/* terminate assembly after phase */
#define ERR_FATAL		0x00000005	/* instantly fatal: exit with error */
#define ERR_CRITICAL		0x00000006      /* fatal, but minimize code before exit */
#define ERR_PANIC		0x00000007	/* internal error: panic instantly
						 * and dump core for reference */
#define ERR_MASK		0x00000007	/* mask off the above codes */
#define ERR_UNDEAD		0x00000008      /* skip if we already have errors */
#define ERR_NOFILE		0x00000010	/* don't give source file name/line */
#define ERR_HERE		0x00000020      /* point to a specific source location */
#define ERR_USAGE		0x00000040	/* print a usage message */
#define ERR_PASS2		0x00000100	/* ignore unless on pass_final */

#define ERR_NO_SEVERITY		0x00000200	/* suppress printing severity */
#define ERR_PP_PRECOND		0x00000400	/* for preprocessor use */
#define ERR_PP_LISTMACRO	0x00000800	/* from pp_error_list_macros() */
#define ERR_HOLD		0x00001000      /* this error/warning can be held */

/*
 * These codes define specific types of suppressible warning.
 * They are assumed to occupy the most significant bits of the
 * severity code.
 */
#define WARN_SHR		16              /* how far to shift right */
#define WARN_IDX(x)		(((errflags)(x)) >> WARN_SHR)
#define WARN_MASK		((~(errflags)0) << WARN_SHR)

/* This is a bitmask */
#define WARN_ST_ENABLED		1 /* Warning is currently enabled */
#define WARN_ST_ERROR		2 /* Treat this warning as an error */

/* Possible initial state for warnings */
#define WARN_INIT_OFF		0
#define WARN_INIT_ON		WARN_ST_ENABLED
#define WARN_INIT_ERR		(WARN_ST_ENABLED|WARN_ST_ERROR)

/* Process a warning option or directive */
bool set_warning_status(const char *value);

/* Warning stack management */
void push_warnings(void);
void pop_warnings(void);
void init_warnings(void);
void reset_warnings(void);

/*
 * Tentative error hold for warnings/errors indicated with ERR_HOLD.
 *
 * This is a stack; the "hold" argument *must*
 * match the value returned from nasm_error_hold_push().
 * If "issue" is true the errors are committed (or promoted to the next
 * higher stack level), if false then they are discarded.
 *
 * Errors stronger than ERR_NONFATAL cannot be held.
 */
struct nasm_errhold;
typedef struct nasm_errhold *errhold;
errhold nasm_error_hold_push(void);
void nasm_error_hold_pop(errhold hold, bool issue);

/* Should be included from within error.h only */
#include "warnings.h"

/* By defining MAX_DEBUG, we can compile out messages entirely */
#ifndef MAX_DEBUG
# define MAX_DEBUG (~0U)
#endif

/* Debug level checks */
static inline bool debug_level(unsigned int level)
{
    extern unsigned int debug_nasm;
    if (is_constant(level) && level > MAX_DEBUG)
        return false;
    return unlikely(level <= debug_nasm);
}

#endif /* NASM_ERROR_H */


text:
require 'iparser/state'
require 'iparser/machine'
require 'iparser/version'

module Iparser
end


text:
<?php

namespace PixelPolishers\Resolver\Adapter\Pdo\Entity;

use PixelPolishers\Resolver\Entity\Vendor;
use PixelPolishers\Resolver\Adapter\Pdo\Pdo;

class PdoVendor extends Vendor
{
    private $pdo;

    public function __construct(Pdo $pdo)
    {
        parent::__construct();
        $this->pdo = $pdo;
    }
}


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

namespace Communication.Interface
{
    public delegate void OnWriteEvent(ICommunicationInterface CommunicationInterface, string WriteBuffer);
    public delegate void OnBufferUpdatedEvent(ICommunicationInterface CommunicationInterface, string ReadBuffer);

    /// <summary>
    /// Communication interface defination
    /// </summary>
    public interface ICommunicationInterface
    {
        /// <summary>
        /// Return whether current interface instance is opened or not.
        /// </summary>
        bool IsOpened { get; }

        /// <summary>
        /// Stop token used by methods WriteWaitToken, WriteWaitTokenUntil, WriteLineWaitToken, WriteLineWaitTokenUntil,
        /// those methods will stop reading operation when Stop Token is out come from interface.
        /// Usually this is the command line prompt.
        /// </summary>
        string StopToken { get; set; }

        /// <summary>
        /// Write Byte by Byte when this field set to True, usual you can specify delay between each byte by set ByteWriteInterval
        /// </summary>
        bool ByteWriteMode { get; set; }

        /// <summary>
        /// Internal delay(seconds) between write each byte when ByteWriteMode set to true
        /// </summary>
        double ByteWriteInterval { get; set; }

        /// <summary>
        /// Echo write content in communication viewr window
        /// </summary>
        bool WriteEcho { get; set; }

        /// <summary>
        /// Internal delay(seconds) between write and read operation
        /// </summary>
        double WriteReadInterval { get; set; }

        /// <summary>
        /// Internal delay(seconds) between WriteRead loop
        /// </summary>
        double WriteReadLoopInterval { get; set; }

        /// <summary>
        /// Characters for write line operation
        /// </summary>
        string LineFeed { get; set; }

        /// <summary>
        /// Default timeout(seconds) for all read operation when timeout is not specified
        /// </summary>
        double ReadTimeout { get; set; }

        /// <summary>
        /// Default timeout(seconds) for all write operation
        /// </summary>
        double WriteTimeout { get; set; }

        /// <summary>
        /// Friendly Name for represent current interface instance
        /// </summary>
        string FriendlyName { get; }

        /// <summary>
        /// Configuration string used for interface initialization
        /// </summary>
        string ConfigString { get; }

        /// <summary>
        /// Buffer for last read operation
        /// </summary>
        IBuffer ReadBuffer { get; }

        /// <summary>
        /// Buffer for fragment communcition content controlable through StartFragmentBufferRecord and StopFragmentBufferRecord method
        /// </summary>
        IBuffer FragmentBuffer { get; }

        /// <summary>
        /// Buffer for global read operation, contains all read content since interface opened
        /// </summary>
        IBuffer GlobalBuffer { get; }

        /// <summary>
        /// Cancellation Token Source
        /// </summary>
        CancellationTokenSource CancellationToken { get; set; }

        /// <summary>
        /// Read buffer content change event, trigger when read buffer changed/
        /// Used by communication indicator to display trace information
        /// </summary>
        event OnBufferUpdatedEvent BufferUpdatedHandler;

        /// <summary>
        /// Interface write event, trigger when write operation performed
        /// </summary>
        event OnWriteEvent WriteEventHandler;

        /// <summary>
        /// Open interface, various between different interface
        /// For serial port it means port open operation, for telnel it means establish socket connection
        /// </summary>
        void Open();

        /// <summary>
        /// Close interface
        /// </summary>
        void Close();

        /// <summary>
        /// Flushes data from interface
        /// </summary>
        void Flush();

        /// <summary>
        /// Read all output from interface, stop reading if no more out come from interface
        /// </summary>
        /// <returns>All content read from interface</returns>
        string ReadAll();

        /// <summary>
        /// Read all output from interface with specific time span
        /// </summary>
        /// <param name="Timespan">Timespan specific how long the reading operation will performed</param>
        /// <returns></returns>
        string ReadAll(double Timespan);

        /// <summary>
        /// Keep reading until the specific output present from interface, read operation will stop when default timeout reached
        /// </summary>
        /// <param name="StopFlag">Stop flag for current read operation</param>
        /// <returns></returns>
        string ReadUntil(string StopFlag);

        /// <summary>
        /// Write single byte to interface
        /// </summary>
        /// <param name="Data">Data to write</param>
        void Write(byte Data);

        /// <summary>
        /// Write byte array to interface
        /// </summary>
        /// <param name="Data">Data to write</param>
        void Write(byte[] Data);

        /// <summary>
        /// Write string to interface
        /// </summary>
        /// <param name="Command">command string to write</param>
        void Write(string Command);

        /// <summary>
        /// Write string to interface, line feed will append to command stirng
        /// </summary>
        /// <param name="Command">command string to write</param>
        void WriteLine(string Command);

        /// <summary>
        /// Write string to interface and read after specific delay time
        /// </summary>
        /// <param name="Command">command string to write</param>
        /// <param name="Delay">delay time for read operation</param>
        void WriteRead(string Command, double Delay);

        /// <summary>
        /// Write string with line feed to interface and read after specific delay time
        /// </summary>
        /// <param name="Command">command string to write</param>
        /// <param name="Delay">delay time for read operation</param>
        void WriteLineRead(string Command, double Delay);

        /// <summary>
        /// Write string to interface and wait for stop token output from interface
        /// Read operation will stop when default timeout reached
        /// </summary>
        /// <param name="Command">command string to write</param>
        /// <returns>Indicate if the Stop Token is present or not</returns>
        bool WriteWaitToken(string Command);

        /// <summary>
        /// Repeat write string to interface and wait for stop token output from interface
        /// </summary>
        /// <param name="Command">command string to write</param>
        /// <param name="Pattern">read operation will stop if this pattern string output from interface</param>
        /// <param name="Timeout">Read operation will stop when specific timeout reached</param>
        /// <returns>Indicate if the pattern string is present or not</returns>
        bool WriteWaitTokenUntil(string Command, string Pattern, double Timeout);

        /// <summary>
        /// Write string with line feed to interface and wait for stop token output from interface
        /// Read operation will stop when default timeout reached
        /// </summary>
        /// <param name="Command">command string to write</param>
        /// <returns>Indicate if the Stop Token is present or not</returns>
        bool WriteLineWaitToken(string Command);

        /// <summary>
        /// Repeat write string with line feed to interface and wait for stop token output from interface
        /// </summary>
        /// <param name="Command">command string to write</param>
        /// <param name="Pattern">read operation will stop if this pattern string output from interface</param>
        /// <param name="Timeout">read operation will stop when specific timeout reached</param>
        /// <returns>Indicate if the pattern string is present or not</returns>
        bool WriteLineWaitTokenUntil(string Command, string Pattern, double Timeout);

        /// <summary>
        /// Keep read operation until specific pattern output from interface or timeout reached
        /// </summary>
        /// <param name="Pattern">read operation will stop if this pattern string output from interface</param>
        /// <param name="Timeout">read operation will stop when specific timeout reached</param>
        /// <returns>Indicate if the pattern string is present or not</returns>
        bool WaitForString(string Pattern, double Timeout);

        /// <summary>
        /// Keep read operation until no output from interface within specific quiet time
        /// </summary>
        /// <param name="QuietTime">quiet time for this operation</param>
        /// <param name="Timeout">read operation will stop when specific timeout reached</param>
        /// <returns>Indicate if quite is reached or not</returns>
        bool WaitForQuiet(double QuietTime, double Timeout);

        /// <summary>
        /// Start reacord communication content into fragment buffer, previous content will be cleared.
        /// </summary>
        void StartFragmentBufferRecord();

        /// <summary>
        /// Stop reacord communication content into fragment buffer
        /// </summary>
        /// <returns>Return the fragment buffer object</returns>
        IBuffer StopFragmentBufferRecord();

    }
}


text:
require 'net/https'
require 'yaml'
require 'date'
require 'time'

begin
  require 'xmlsimple'
rescue LoadError
  begin
    require 'rubygems'
    require 'xmlsimple'
  rescue LoadError
    abort <<-ERROR
The 'xml-simple' library could not be loaded. If you have RubyGems installed
you can install xml-simple by doing "gem install xml-simple".
ERROR
  end
end

begin
  require 'active_resource'
rescue LoadError
  begin
    require 'rubygems'
    require 'active_resource'
  rescue LoadError
    abort <<-ERROR
The 'activeresource' library could not be loaded. If you have RubyGems
installed you can install ActiveResource by doing "gem install activeresource".
ERROR
  end
end

# = A Ruby library for working with the Basecamp web-services API.
#
# For more information about the Basecamp web-services API, visit:
#
#   http://developer.37signals.com/basecamp
#
# NOTE: not all of Basecamp's web-services are accessible via REST. This
# library provides access to RESTful services via ActiveResource. Services not
# yet upgraded to REST are accessed via the Basecamp class. Continue reading
# for more details.
#
#
# == Establishing a Connection
#
# The first thing you need to do is establish a connection to Basecamp. This
# requires your Basecamp site address and your login credentials. Example:
#
#   Basecamp.establish_connection!('you.grouphub.com', 'username', 'password')
#
# This is the same whether you're accessing using the ActiveResource interface,
# or the legacy interface.
#
#
# == Using the REST interface via ActiveResource
#
# The REST interface is accessed via ActiveResource, a popular Ruby library
# that implements object-relational mapping for REST web-services. For more
# information on working with ActiveResource, see:
#
#  * http://api.rubyonrails.org/files/activeresource/README.html
#  * http://api.rubyonrails.org/classes/ActiveResource/Base.html
#
#
# === Finding a Resource
#
# Find a specific resource using the +find+ method. Attributes of the resource
# are available as instance methods on the resulting object. For example, to
# find a message with the ID of 8675309 and access its title attribute, you
# would do the following:
#
#   m = Basecamp::Message.find(8675309)
#   m.title # => 'Jenny'
#
# To find all messages for a given project, use find(:all), passing the
# project_id as a parameter to find. Example:
#
#   messages = Basecamp::Message.find(:all, params => { :project_id => 1037 })
#   messages.size # => 25
#
#
# === Creating a Resource
#
# Create a resource by making a new instance of that resource, setting its
# attributes, and saving it. If the resource requires a prefix to identify
# it (as is the case with resources that belong to a sub-resource, such as a
# project), it should be specified when instantiating the object. Examples:
#
#   m = Basecamp::Message.new(:project_id => 1037)
#   m.category_id = 7301
#   m.title = 'Message in a bottle'
#   m.body = 'Another lonely day, with no one here but me'
#   m.save # => true
#
#   c = Basecamp::Comment.new(:post_id => 25874)
#   c.body = 'Did you get those TPS reports?'
#   c.save # => true
#
# You can also create a resource using the +create+ method, which will create
# and save it in one step. Example:
#
#   Basecamp::TodoItem.create(:todo_list_id => 3422, :contents => 'Do it')
#
#
# === Updating a Resource
#
# To update a resource, first find it by its id, change its attributes, and
# save it. Example:
#
#   m = Basecamp::Message.find(8675309)
#   m.body = 'Changed'
#   m.save # => true
#
#
# === Deleting a Resource
#
# To delete a resource, use the +delete+ method with the ID of the resource
# you want to delete. Example:
#
#   Basecamp::Message.delete(1037)
#
#
# === Attaching Files to a Resource
#
# If the resource accepts file attachments, the +attachments+ parameter should
# be an array of Basecamp::Attachment objects. Example:
#
#   a1 = Basecamp::Attachment.create('primary', File.read('primary.doc'))
#   a2 = Basecamp::Attachment.create('another', File.read('another.doc'))
#
#   m = Basecamp::Message.new(:project_id => 1037)
#   ...
#   m.attachments = [a1, a2]
#   m.save # => true
#
#
# = Using the non-REST inteface
#
# The non-REST interface is accessed via instance methods on the Basecamp
# class. Ensure you've established a connection, then create a new Basecamp
# instance and call methods on it. Object attributes are accessible as methods.
# Example:
#
#   session = Basecamp.new
#   person = session.person(93832) # => #<Record(person)..>
#   person.first_name # => "Jason"
#
class Basecamp
  class Connection #:nodoc:
    def initialize(master)
      @master = master
      @connection = Net::HTTP.new(master.site, master.use_ssl ? 443 : 80)
      @connection.use_ssl = master.use_ssl
      @connection.verify_mode = OpenSSL::SSL::VERIFY_NONE if master.use_ssl
    end

    def post(path, body, headers = {})
      request = Net::HTTP::Post.new(path, headers.merge('Accept' => 'application/xml'))
      request.basic_auth(@master.user, @master.password)
      @connection.request(request, body)
    end
  end

  class Resource < ActiveResource::Base #:nodoc:
    class << self
      def parent_resources(*parents)
        @parent_resources = parents
      end

      def element_name
        name.split(/::/).last.underscore
      end

      def prefix_source
        if @parent_resources
          @parent_resources.map { |resource| "/#{resource.to_s.pluralize}/:#{resource}_id" }.join + '/'
        else
          '/'
        end
      end

      def prefix(options = {})
        if options.any?
          options.map { |name, value| "/#{name.to_s.chomp('_id').pluralize}/#{value}" }.join + '/'
        else
          '/'
        end
      end
    end

    def prefix_options
      id ? {} : super
    end
  end

  class Project < Resource
  end

  class Company < Resource
    parent_resources :project

    def self.on_project(project_id, options = {})
      find(:all, :params => options.merge(:project_id => project_id))
    end
  end

  # == Creating different types of categories
  #
  # The type parameter is required when creating a category. For exampe, to
  # create an attachment category for a particular project:
  #
  #   c = Basecamp::Category.new(:project_id => 1037)
  #   c.type = 'attachment'
  #   c.name = 'Pictures'
  #   c.save # => true
  #
  class Category < Resource
    parent_resources :project

    def self.all(project_id, options = {})
      find(:all, :params => options.merge(:project_id => project_id))
    end

    def self.post_categories(project_id, options = {})
      find(:all, :params => options.merge(:project_id => project_id, :type => 'post'))
    end

    def self.attachment_categories(project_id, options = {})
      find(:all, :params => options.merge(:project_id => project_id, :type => 'attachment'))
    end
  end

  class Message < Resource
    parent_resources :project
    set_element_name 'post'

    # Returns the most recent 25 messages in the given project (and category,
    # if specified). If you need to retrieve older messages, use the archive
    # method instead. Example:
    #
    #   Basecamp::Message.recent(1037)
    #   Basecamp::Message.recent(1037, :category_id => 7301)
    #
    def self.recent(project_id, options = {})
      find(:all, :params => options.merge(:project_id => project_id))
    end

    # Returns a summary of all messages in the given project (and category, if
    # specified). The summary is simply the title and category of the message,
    # as well as the number of attachments (if any). Example:
    #
    #   Basecamp::Message.archive(1037)
    #   Basecamp::Message.archive(1037, :category_id => 7301)
    #
    def self.archive(project_id, options = {})
      find(:all, :params => options.merge(:project_id => project_id), :from => :archive)
    end

    def comments(options = {})
      @comments ||= Comment.find(:all, :params => options.merge(:post_id => id))
    end
  end

  # == Creating comments for multiple resources
  #
  # Comments can be created for messages, milestones, and to-dos, identified
  # by the <tt>post_id</tt>, <tt>milestone_id</tt>, and <tt>todo_item_id</tt>
  # params respectively.
  #
  # For example, to create a comment on the message with id #8675309:
  #
  #   c = Basecamp::Comment.new(:post_id => 8675309)
  #   c.body = 'Great tune'
  #   c.save # => true
  #
  # Similarly, to create a comment on a milestone:
  #
  #   c = Basecamp::Comment.new(:milestone_id => 8473647)
  #   c.body = 'Is this done yet?'
  #   c.save # => true
  #
  class Comment < Resource
    parent_resources :post, :milestone, :todo_item
  end

  class TodoList < Resource
    parent_resources :project

    # Returns all lists for a project. If complete is true, only completed lists
    # are returned. If complete is false, only uncompleted lists are returned.
    def self.all(project_id, complete = nil)
      filter = case complete
        when nil   then "all"
        when true  then "finished"
        when false then "pending"
        else raise ArgumentError, "invalid value for `complete'"
      end

      find(:all, :params => { :project_id => project_id, :filter => filter })
    end

    def todo_items(options = {})
      @todo_items ||= TodoItem.find(:all, :params => options.merge(:todo_list_id => id))
    end
  end

  class TodoItem < Resource
    parent_resources :todo_list

    def todo_list(options = {})
      @todo_list ||= TodoList.find(todo_list_id, options)
    end

    def time_entries(options = {})
      @time_entries ||= TimeEntry.find(:all, :params => options.merge(:todo_item_id => id))
    end

    def comments(options = {})
      @comments ||= Comment.find(:all, :params => options.merge(:todo_item_id => id))
    end

    def complete!
      put(:complete)
    end

    def uncomplete!
      put(:uncomplete)
    end
  end

  class TimeEntry < Resource
    parent_resources :project, :todo_item

    def self.all(project_id, page = 0)
      find(:all, :params => { :project_id => project_id, :page => page })
    end

    def self.report(options={})
      find(:all, :from => :report, :params => options)
    end
  end

  class Category < Resource
    parent_resources :project
  end

  class Attachment
    attr_accessor :id, :filename, :content

    def self.create(filename, content)
      returning new(filename, content) do |attachment|
        attachment.save
      end
    end

    def initialize(filename, content)
      @filename, @content = filename, content
    end

    def attributes
      { :file => id, :original_filename => filename }
    end

    def to_xml(options = {})
      { :file => attributes }.to_xml(options)
    end

    def inspect
      to_s
    end

    def save
      response = Basecamp.connection.post('/upload', content, 'Content-Type' => 'application/octet-stream')

      if response.code == '200'
        self.id = Hash.from_xml(response.body)['upload']['id']
        true
      else
        raise "Could not save attachment: #{response.message} (#{response.code})"
      end
    end
  end

  class Record #:nodoc:
    attr_reader :type

    def initialize(type, hash)
      @type, @hash = type, hash
    end

    def [](name)
      name = dashify(name)

      case @hash[name]
      when Hash then
        @hash[name] = if (@hash[name].keys.length == 1 && @hash[name].values.first.is_a?(Array))
          @hash[name].values.first.map { |v| Record.new(@hash[name].keys.first, v) }
        else
          Record.new(name, @hash[name])
        end
      else
        @hash[name]
      end
    end

    def id
      @hash['id']
    end

    def attributes
      @hash.keys
    end

    def respond_to?(sym)
      super || @hash.has_key?(dashify(sym))
    end

    def method_missing(sym, *args)
      if args.empty? && !block_given? && respond_to?(sym)
        self[sym]
      else
        super
      end
    end

    def to_s
      "\#<Record(#{@type}) #{@hash.inspect[1..-2]}>"
    end

    def inspect
      to_s
    end

    private

      def dashify(name)
        name.to_s.tr("_", "-")
      end
  end

  attr_accessor :use_xml

  class << self
    attr_reader :site, :user, :password, :use_ssl

    def establish_connection!(site, user, password, use_ssl = false)
      @site     = site
      @user     = user
      @password = password
      @use_ssl  = use_ssl

      Resource.user = user
      Resource.password = password
      Resource.site = (use_ssl ? "https" : "http") + "://" + site

      @connection = Connection.new(self)
    end

    def connection
      @connection || raise('No connection established')
    end
  end

  def initialize
    @use_xml = false
  end

  # ==========================================================================
  # PEOPLE
  # ==========================================================================

  # Return an array of the people in the given company. If the project-id is
  # given, only people who have access to the given project will be returned.
  def people(company_id, project_id=nil)
    url = project_id ? "/projects/#{project_id}" : ""
    url << "/contacts/people/#{company_id}"
    records "person", url
  end

  # Return information about the person with the given id
  def person(id)
    record "/contacts/person/#{id}"
  end

  # ==========================================================================
  # MILESTONES
  # ==========================================================================

  # Returns a list of all milestones for the given project, optionally filtered
  # by whether they are completed, late, or upcoming.
  def milestones(project_id, find = 'all')
    records "milestone", "/projects/#{project_id}/milestones/list", :find => find
  end

  # Create a new milestone for the given project. +data+ must be hash of the
  # values to set, including +title+, +deadline+, +responsible_party+, and
  # +notify+.
  def create_milestone(project_id, data)
    create_milestones(project_id, [data]).first
  end

  # As #create_milestone, but can create multiple milestones in a single
  # request. The +milestones+ parameter must be an array of milestone values as
  # described in #create_milestone.
  def create_milestones(project_id, milestones)
    records "milestone", "/projects/#{project_id}/milestones/create", :milestone => milestones
  end

  # Updates an existing milestone.
  def update_milestone(id, data, move = false, move_off_weekends = false)
    record "/milestones/update/#{id}", :milestone => data,
      :move_upcoming_milestones => move,
      :move_upcoming_milestones_off_weekends => move_off_weekends
  end

  # Destroys the milestone with the given id.
  def delete_milestone(id)
    record "/milestones/delete/#{id}"
  end

  # Complete the milestone with the given id
  def complete_milestone(id)
    record "/milestones/complete/#{id}"
  end

  # Uncomplete the milestone with the given id
  def uncomplete_milestone(id)
    record "/milestones/uncomplete/#{id}"
  end

  private

    # Make a raw web-service request to Basecamp. This will return a Hash of
    # Arrays of the response, and may seem a little odd to the uninitiated.
    def request(path, parameters = {})
      response = Basecamp.connection.post(path, convert_body(parameters), "Content-Type" => content_type)

      if response.code.to_i / 100 == 2
        result = XmlSimple.xml_in(response.body, 'keeproot' => true, 'contentkey' => '__content__', 'forcecontent' => true)
        typecast_value(result)
      else
        raise "#{response.message} (#{response.code})"
      end
    end

    # A convenience method for wrapping the result of a query in a Record
    # object. This assumes that the result is a singleton, not a collection.
    def record(path, parameters={})
      result = request(path, parameters)
      (result && !result.empty?) ? Record.new(result.keys.first, result.values.first) : nil
    end

    # A convenience method for wrapping the result of a query in Record
    # objects. This assumes that the result is a collection--any singleton
    # result will be wrapped in an array.
    def records(node, path, parameters={})
      result = request(path, parameters).values.first or return []
      result = result[node] or return []
      result = [result] unless Array === result
      result.map { |row| Record.new(node, row) }
    end

    def convert_body(body)
      body = use_xml ? body.to_legacy_xml : body.to_yaml
    end

    def content_type
      use_xml ? "application/xml" : "application/x-yaml"
    end

    def typecast_value(value)
      case value
      when Hash
        if value.has_key?("__content__")
          content = translate_entities(value["__content__"]).strip
          case value["type"]
          when "integer"  then content.to_i
          when "boolean"  then content == "true"
          when "datetime" then Time.parse(content)
          when "date"     then Date.parse(content)
          else                 content
          end
        # a special case to work-around a bug in XmlSimple. When you have an empty
        # tag that has an attribute, XmlSimple will not add the __content__ key
        # to the returned hash. Thus, we check for the presense of the 'type'
        # attribute to look for empty, typed tags, and simply return nil for
        # their value.
        elsif value.keys == %w(type)
          nil
        elsif value["nil"] == "true"
          nil
        # another special case, introduced by the latest rails, where an array
        # type now exists. This is parsed by XmlSimple as a two-key hash, where
        # one key is 'type' and the other is the actual array value.
        elsif value.keys.length == 2 && value["type"] == "array"
          value.delete("type")
          typecast_value(value)
        else
          value.empty? ? nil : value.inject({}) do |h,(k,v)|
            h[k] = typecast_value(v)
            h
          end
        end
      when Array
        value.map! { |i| typecast_value(i) }
        case value.length
        when 0 then nil
        when 1 then value.first
        else value
        end
      else
        raise "can't typecast #{value.inspect}"
      end
    end

    def translate_entities(value)
      value.gsub(/</, "<").
            gsub(/>/, ">").
            gsub(/"/, '"').
            gsub(/'/, "'").
            gsub(/&/, "&")
    end
end

# A minor hack to let Xml-Simple serialize symbolic keys in hashes
class Symbol
  def [](*args)
    to_s[*args]
  end
end

class Hash
  def to_legacy_xml
    XmlSimple.xml_out({:request => self}, 'keeproot' => true, 'noattr' => true)
  end
end


text:
use alloc::boxed::Box;
use alloc::vec::Vec;

use crate::capability::FromClientHook;
use crate::private::capability::{ClientHook, PipelineHook, PipelineOp};
use crate::private::layout::{PointerReader, PointerBuilder};
use crate::traits::{FromPointerReader, FromPointerBuilder, SetPointerBuilder};
use crate::Result;

#[derive(Copy, Clone)]
pub struct Owned(());

impl <'a> crate::traits::Owned<'a> for Owned {
    type Reader = Reader<'a>;
    type Builder = Builder<'a>;
}

impl crate::traits::Pipelined for Owned {
    type Pipeline = Pipeline;
}

#[derive(Copy, Clone)]
pub struct Reader<'a> {
    reader: PointerReader<'a>
}

impl <'a> Reader<'a> {
    pub fn new<'b>(reader: PointerReader<'b>) -> Reader<'b> {
        Reader { reader: reader }
    }

    #[inline]
    pub fn is_null(&self) -> bool {
        self.reader.is_null()
    }

    /// Gets the total size of the target and all of its children. Does not count far pointer overhead.
    pub fn target_size(&self) -> Result<crate::MessageSize> {
        self.reader.total_size()
    }

    #[inline]
    pub fn get_as<T: FromPointerReader<'a>>(&self) -> Result<T> {
        FromPointerReader::get_from_pointer(&self.reader, None)
    }

    pub fn get_as_capability<T: FromClientHook>(&self) -> Result<T> {
        Ok(FromClientHook::new(self.reader.get_capability()?))
    }

    //# Used by RPC system to implement pipelining. Applications
    //# generally shouldn't use this directly.
    pub fn get_pipelined_cap(&self, ops: &[PipelineOp]) -> Result<Box<dyn ClientHook>> {
        let mut pointer = self.reader;

        for op in ops {
            match *op {
                PipelineOp::Noop =>  { }
                PipelineOp::GetPointerField(idx) => {
                    pointer = pointer.get_struct(None)?.get_pointer_field(idx as usize);
                }
            }
        }

        pointer.get_capability()
    }
}

impl <'a> FromPointerReader<'a> for Reader<'a> {
    fn get_from_pointer(reader: &PointerReader<'a>, default: Option<&'a [crate::Word]>) -> Result<Reader<'a>> {
        if default.is_some() {
            panic!("Unsupported: any_pointer with a default value.");
        }
        Ok(Reader { reader: *reader })
    }
}

impl <'a> crate::traits::SetPointerBuilder for Reader<'a> {
    fn set_pointer_builder<'b>(mut pointer: crate::private::layout::PointerBuilder<'b>,
                               value: Reader<'a>,
                               canonicalize: bool) -> Result<()> {
        pointer.copy_from(value.reader, canonicalize)
    }
}

impl <'a> crate::traits::Imbue<'a> for Reader<'a> {
    fn imbue(&mut self, cap_table: &'a crate::private::layout::CapTable) {
        self.reader.imbue(crate::private::layout::CapTableReader::Plain(cap_table));
    }
}

pub struct Builder<'a> {
    builder: PointerBuilder<'a>
}

impl <'a> Builder<'a> {
    pub fn new(builder: PointerBuilder<'a>) -> Builder<'a> {
        Builder { builder: builder }
    }

    pub fn reborrow<'b>(&'b mut self) -> Builder<'b> {
        Builder { builder: self.builder.reborrow() }
    }

    pub fn is_null(&self) -> bool {
        self.builder.is_null()
    }

    /// Gets the total size of the target and all of its children. Does not count far pointer overhead.
    pub fn target_size(&self) -> Result<crate::MessageSize> {
        self.builder.into_reader().total_size()
    }

    pub fn get_as<T : FromPointerBuilder<'a>>(self) -> Result<T> {
        FromPointerBuilder::get_from_pointer(self.builder, None)
    }

    pub fn init_as<T : FromPointerBuilder<'a>>(self) -> T {
        FromPointerBuilder::init_pointer(self.builder, 0)
    }

    pub fn initn_as<T: FromPointerBuilder<'a>>(self, size: u32) -> T {
        FromPointerBuilder::init_pointer(self.builder, size)
    }

    pub fn set_as<From: SetPointerBuilder>(self, value: From) -> Result<()> {
        SetPointerBuilder::set_pointer_builder(self.builder, value, false)
    }

    // XXX value should be a user client.
    pub fn set_as_capability(&mut self, value: Box<dyn ClientHook>) {
        self.builder.set_capability(value);
    }

    #[inline]
    pub fn clear(&mut self) {
        self.builder.clear()
    }

    pub fn into_reader(self) -> Reader<'a> {
        Reader { reader: self.builder.into_reader() }
    }
}

impl <'a> FromPointerBuilder<'a> for Builder<'a> {
    fn init_pointer(mut builder: PointerBuilder<'a>, _len: u32) -> Builder<'a> {
        if !builder.is_null() {
            builder.clear();
        }
        Builder { builder: builder }
    }
    fn get_from_pointer(builder: PointerBuilder<'a>, default: Option<&'a [crate::Word]>) -> Result<Builder<'a>> {
        if default.is_some() {
            panic!("AnyPointer defaults are unsupported")
        }
        Ok(Builder { builder: builder })
    }
}

impl <'a> crate::traits::ImbueMut<'a> for Builder<'a> {
    fn imbue_mut(&mut self, cap_table: &'a mut crate::private::layout::CapTable) {
        self.builder.imbue(crate::private::layout::CapTableBuilder::Plain(cap_table));
    }
}

pub struct Pipeline {
    // XXX this should not be public
    pub hook: Box<dyn PipelineHook>,

    ops: Vec<PipelineOp>,
}

impl Pipeline {
    pub fn new(hook: Box<dyn PipelineHook>) -> Pipeline {
        Pipeline { hook: hook, ops: Vec::new() }
    }

    pub fn noop(&self) -> Pipeline {
        Pipeline { hook: self.hook.add_ref(), ops: self.ops.clone() }
    }

    pub fn get_pointer_field(&self, pointer_index: u16) -> Pipeline {
        let mut new_ops = Vec::with_capacity(self.ops.len() + 1);
        for op in &self.ops {
            new_ops.push(*op)
        }
        new_ops.push(PipelineOp::GetPointerField(pointer_index));
        Pipeline { hook : self.hook.add_ref(), ops: new_ops }
    }

    pub fn as_cap(&self) -> Box<dyn ClientHook> {
        self.hook.get_pipelined_cap(&self.ops)
    }
}

impl crate::capability::FromTypelessPipeline for Pipeline {
    fn new(typeless: Pipeline) -> Pipeline {
        typeless
    }
}

#[test]
fn init_clears_value() {
    let mut message = crate::message::Builder::new_default();
    {
        let root: crate::any_pointer::Builder = message.init_root();
        let mut list: crate::primitive_list::Builder<u16> = root.initn_as(10);
        for idx in 0..10 {
            list.set(idx, idx as u16);
        }
    }

    {
        let root: crate::any_pointer::Builder = message.init_root();
        assert!(root.is_null());
    }

    let mut output: Vec<u8> = Vec::new();
    crate::serialize::write_message(&mut output, &mut message).unwrap();
    assert_eq!(output.len(), 40);
    for byte in &output[8..] {
        // Everything not in the message header is zero.
        assert_eq!(*byte, 0u8);
    }
}


text:
<?php

namespace MobileCart\FedexBundle\Api\RateV10\ComplexType;

use MobileCart\FedexBundle\Api\RateV10\SimpleType;

/**
 * Defines additional data to print in the Configurable portion of the label, this allows you
 * to print the same type information on the label that can also be printed on the doc tab.
 *
 *
 *
 */
class ConfigurableLabelReferenceEntry extends ComplexTypeAbstract
{
    const CLASS_NAME = 'ConfigurableLabelReferenceEntry';

    /**
     * 1 of 12 possible zones to  position data.
     * minOccurs = 0
     * maxOccurs = 1
     *
     * @var integer|null $ZoneNumber
     */
    protected $ZoneNumber;

    /**
     * The identifiying text for the data in this zone.
     * minOccurs = 0
     * maxOccurs = 1
     *
     * @var string|null $Header
     */
    protected $Header;

    /**
     * A reference to a field in either the request or reply to print in this zone following
     * the header.
     * minOccurs = 0
     * maxOccurs = 1
     *
     * @var string|null $DataField
     */
    protected $DataField;

    /**
     * A literal value to print after the header in this zone.
     * minOccurs = 0
     * maxOccurs = 1
     *
     * @var string|null $LiteralValue
     */
    protected $LiteralValue;

    /**
     * @param integer|null $zoneNumber
     * @return ConfigurableLabelReferenceEntry
     */
    public function setZoneNumber($zoneNumber)
    {
        $this->ZoneNumber = $zoneNumber;

        return $this;
    }

    /**
     * @return integer|null
     */
    public function getZoneNumber()
    {
        return $this->ZoneNumber;
    }

    /**
     * @param string|null $header
     * @return ConfigurableLabelReferenceEntry
     */
    public function setHeader($header)
    {
        $this->Header = $header;

        return $this;
    }

    /**
     * @return string|null
     */
    public function getHeader()
    {
        return $this->Header;
    }

    /**
     * @param string|null $dataField
     * @return ConfigurableLabelReferenceEntry
     */
    public function setDataField($dataField)
    {
        $this->DataField = $dataField;

        return $this;
    }

    /**
     * @return string|null
     */
    public function getDataField()
    {
        return $this->DataField;
    }

    /**
     * @param string|null $literalValue
     * @return ConfigurableLabelReferenceEntry
     */
    public function setLiteralValue($literalValue)
    {
        $this->LiteralValue = $literalValue;

        return $this;
    }

    /**
     * @return string|null
     */
    public function getLiteralValue()
    {
        return $this->LiteralValue;
    }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2009-2011 Ansgar Konermann
  ~
  ~ This file is part of the "Maven 3 Drools Support" Package.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<project xmlns="http://maven.apache.org/POM/4.0.0" 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>

  <parent>
    <groupId>de.lightful.maven.drools.plugin.its.execution</groupId>
    <artifactId>common-execution-behaviour</artifactId>
    <version>0.3.2-SNAPSHOT</version>
    <relativePath>../common-execution-behaviour/pom.xml</relativePath>
  </parent>

  <groupId>de.lightful.maven.drools.plugin.its.execution</groupId>
  <artifactId>target-drools-5.4.0.Final</artifactId>
  <packaging>pom</packaging>

  <name>Maven Drools Support :: Plugin :: Integration Testing :: Test Executions :: Drools ${drools.runtime.version}</name>

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

  <properties>
    <drools.runtime.version>5.4.0.Final</drools.runtime.version>
  </properties>

  <dependencies>
    <!-- Drools Dependencies: -->
    <dependency>
      <groupId>org.drools</groupId>
      <artifactId>knowledge-api</artifactId>
      <version>[${drools.runtime.version}]</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.drools</groupId>
      <artifactId>drools-core</artifactId>
      <version>[${drools.runtime.version}]</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.drools</groupId>
      <artifactId>drools-compiler</artifactId>
      <version>[${drools.runtime.version}]</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <executions>
          <execution>
            <id>integration-tests</id>
            <goals>
              <goal>test</goal>
              <!-- IDEA needs this, see IDEA-76857 -->
            </goals>
            <configuration>
              <excludes>
                <exclude>**/*$*</exclude>

                <!--
                  This test depends on Drools' ability to serialize and de-serialize knowledge packages
                  with inter-dependencies. Drools 5.4.0.Final does not support this. See this JIRA issue
                  for details: https://issues.jboss.org/browse/JBRULES-3225
                -->
                <exclude>**/CanPerformMultiplePassesTest.class</exclude>

                <!-- vvv depends on drools-fruit-types, which is not yet available as a Knowledge-IO 0.1.6 artifact -->
                <!--<exclude>**/CanResolveTransitiveKnowledgeModulesTest.class</exclude>-->

                <!-- vvv depends on drools-fruit-types, which is not yet available as a Knowledge-IO 0.1.6 artifact -->
                <!--<exclude>**/CanUseExistingDroolsPackageTest.class</exclude>-->
              </excludes>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>properties-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
      </plugin>
    </plugins>
  </build>

</project>


text:
namespace Scada.Admin.App.Forms.Tools
{
    partial class FrmCnlMap
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.gbCnlKind = new System.Windows.Forms.GroupBox();
            this.chkOutCnls = new System.Windows.Forms.CheckBox();
            this.chkInCnls = new System.Windows.Forms.CheckBox();
            this.gbGroupBy = new System.Windows.Forms.GroupBox();
            this.rbGroupByObjects = new System.Windows.Forms.RadioButton();
            this.rbGroupByDevices = new System.Windows.Forms.RadioButton();
            this.btnOK = new System.Windows.Forms.Button();
            this.btnCancel = new System.Windows.Forms.Button();
            this.gbCnlKind.SuspendLayout();
            this.gbGroupBy.SuspendLayout();
            this.SuspendLayout();
            //
            // gbCnlKind
            //
            this.gbCnlKind.Controls.Add(this.chkOutCnls);
            this.gbCnlKind.Controls.Add(this.chkInCnls);
            this.gbCnlKind.Location = new System.Drawing.Point(12, 12);
            this.gbCnlKind.Name = "gbCnlKind";
            this.gbCnlKind.Padding = new System.Windows.Forms.Padding(10, 3, 10, 10);
            this.gbCnlKind.Size = new System.Drawing.Size(310, 49);
            this.gbCnlKind.TabIndex = 0;
            this.gbCnlKind.TabStop = false;
            this.gbCnlKind.Text = "Channel Kind";
            //
            // chkOutCnls
            //
            this.chkOutCnls.AutoSize = true;
            this.chkOutCnls.Checked = true;
            this.chkOutCnls.CheckState = System.Windows.Forms.CheckState.Checked;
            this.chkOutCnls.Location = new System.Drawing.Point(158, 20);
            this.chkOutCnls.Name = "chkOutCnls";
            this.chkOutCnls.Size = new System.Drawing.Size(104, 17);
            this.chkOutCnls.TabIndex = 1;
            this.chkOutCnls.Text = "Output channels";
            this.chkOutCnls.UseVisualStyleBackColor = true;
            this.chkOutCnls.CheckedChanged += new System.EventHandler(this.chkCnls_CheckedChanged);
            //
            // chkInCnls
            //
            this.chkInCnls.AutoSize = true;
            this.chkInCnls.Checked = true;
            this.chkInCnls.CheckState = System.Windows.Forms.CheckState.Checked;
            this.chkInCnls.Location = new System.Drawing.Point(13, 19);
            this.chkInCnls.Name = "chkInCnls";
            this.chkInCnls.Size = new System.Drawing.Size(96, 17);
            this.chkInCnls.TabIndex = 0;
            this.chkInCnls.Text = "Input channels";
            this.chkInCnls.UseVisualStyleBackColor = true;
            this.chkInCnls.CheckedChanged += new System.EventHandler(this.chkCnls_CheckedChanged);
            //
            // gbGroupBy
            //
            this.gbGroupBy.Controls.Add(this.rbGroupByObjects);
            this.gbGroupBy.Controls.Add(this.rbGroupByDevices);
            this.gbGroupBy.Location = new System.Drawing.Point(12, 67);
            this.gbGroupBy.Name = "gbGroupBy";
            this.gbGroupBy.Padding = new System.Windows.Forms.Padding(10, 3, 10, 10);
            this.gbGroupBy.Size = new System.Drawing.Size(310, 49);
            this.gbGroupBy.TabIndex = 1;
            this.gbGroupBy.TabStop = false;
            this.gbGroupBy.Text = "Group By";
            //
            // rbGroupByObjects
            //
            this.rbGroupByObjects.AutoSize = true;
            this.rbGroupByObjects.Location = new System.Drawing.Point(158, 19);
            this.rbGroupByObjects.Name = "rbGroupByObjects";
            this.rbGroupByObjects.Size = new System.Drawing.Size(61, 17);
            this.rbGroupByObjects.TabIndex = 1;
            this.rbGroupByObjects.Text = "Objects";
            this.rbGroupByObjects.UseVisualStyleBackColor = true;
            //
            // rbGroupByDevices
            //
            this.rbGroupByDevices.AutoSize = true;
            this.rbGroupByDevices.Checked = true;
            this.rbGroupByDevices.Location = new System.Drawing.Point(13, 19);
            this.rbGroupByDevices.Name = "rbGroupByDevices";
            this.rbGroupByDevices.Size = new System.Drawing.Size(64, 17);
            this.rbGroupByDevices.TabIndex = 0;
            this.rbGroupByDevices.TabStop = true;
            this.rbGroupByDevices.Text = "Devices";
            this.rbGroupByDevices.UseVisualStyleBackColor = true;
            //
            // btnOK
            //
            this.btnOK.Location = new System.Drawing.Point(166, 132);
            this.btnOK.Name = "btnOK";
            this.btnOK.Size = new System.Drawing.Size(75, 23);
            this.btnOK.TabIndex = 2;
            this.btnOK.Text = "OK";
            this.btnOK.UseVisualStyleBackColor = true;
            this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
            //
            // btnCancel
            //
            this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.btnCancel.Location = new System.Drawing.Point(247, 132);
            this.btnCancel.Name = "btnCancel";
            this.btnCancel.Size = new System.Drawing.Size(75, 23);
            this.btnCancel.TabIndex = 3;
            this.btnCancel.Text = "Cancel";
            this.btnCancel.UseVisualStyleBackColor = true;
            //
            // FrmCnlMap
            //
            this.AcceptButton = this.btnOK;
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.CancelButton = this.btnCancel;
            this.ClientSize = new System.Drawing.Size(334, 167);
            this.Controls.Add(this.btnCancel);
            this.Controls.Add(this.btnOK);
            this.Controls.Add(this.gbGroupBy);
            this.Controls.Add(this.gbCnlKind);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "FrmCnlMap";
            this.ShowInTaskbar = false;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            this.Text = "Channel Map";
            this.Load += new System.EventHandler(this.FrmCnlMap_Load);
            this.gbCnlKind.ResumeLayout(false);
            this.gbCnlKind.PerformLayout();
            this.gbGroupBy.ResumeLayout(false);
            this.gbGroupBy.PerformLayout();
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.GroupBox gbCnlKind;
        private System.Windows.Forms.GroupBox gbGroupBy;
        private System.Windows.Forms.RadioButton rbGroupByObjects;
        private System.Windows.Forms.RadioButton rbGroupByDevices;
        private System.Windows.Forms.Button btnOK;
        private System.Windows.Forms.Button btnCancel;
        private System.Windows.Forms.CheckBox chkInCnls;
        private System.Windows.Forms.CheckBox chkOutCnls;
    }
}


text:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys

from django.test import LiveServerTestCase
from profiles.models import SurmandlUser

class VisitorTest(LiveServerTestCase):
    def setUp(self):
        self.browser = webdriver.Firefox()
        self.browser.implicitly_wait(3)
        self.user = SurmandlUser.objects.create_user('test@test.com', 'test', 'user', 'self', password='Passw0rd')

    def tearDown(self):
        self.browser.quit()

    def send_keys_for_login(self, text, creds):

        # Jenny now logs into the site
        for i in range(len(text)):
            self.browser.get(self.live_server_url)
            username_inputbox = self.browser.find_element_by_id('id_username')
            password_inputbox = self.browser.find_element_by_id('id_password')
            username_inputbox.send_keys(creds[i].get('username'))
            username_inputbox.send_keys(Keys.TAB)
            password_inputbox.send_keys(creds[i].get('password'))
            password_inputbox.send_keys(Keys.ENTER)
            login_lst = self.browser.find_elements_by_class_name('login-alert')
            if text[i] == 'Success':
                team_surmandl = self.browser.find_element_by_tag_name('h1')
                self.assertEqual(team_surmandl.text, 'Team Surmandl Yeah!')
            else:
                self.assertEquals(login_lst[0].text, text[i])

    def test_login_page(self):
        # Jenny hears about a cool new family CMS.  She goes to check it out
        self.browser.get(self.live_server_url)
        # Jenny notices the word surmandl in the browser title and the please log in on the page
        self.assertIn('Surmandl', self.browser.title)
        signin_text = self.browser.find_element_by_class_name('form_signin-heading')
        self.assertEqual('Please sign in', signin_text.text)
        # She is invited to enter a login right away
        username_inputbox = self.browser.find_element_by_id('id_username')
        password_inputbox = self.browser.find_element_by_id('id_password')
        self.assertEqual(username_inputbox.get_attribute('placeholder'), 'Email address')
        self.assertEqual(password_inputbox.get_attribute('placeholder'), 'Password')

        # Jenny tries the following actions:
        # 1. She trys to log in with no password or username
        # 2. Jenny now logs incorrectly into the site with an email present but not a password
        # 3. Jenny now logs incorrectly into the site with an email not present but a password present
        # 4. Jenny now tries to log in with an incorrect email address and password
        self.send_keys_for_login(['* Email address and password are required',
                                                                        '* Password is required', '* Email is required',
                                                                        '* Your email and password do not match', 'Success'],
                                    [{'username': '', 'password': ''},
                                        {'username': 'test@test.com', 'password': ''},
                                        {'username': '', 'password': 'Passw0rd'},
                                        {'username': 'test@test.com', 'password': 'Password'},
                                        {'username': 'test@test.com', 'password': 'Passw0rd'}]
                                 )


text:
CRM = [Customer Relationship Management](http://en.wikipedia.org/wiki/Customer_relationship_management)

Grails CRM is a set of [Grails Web Application Framework](http://www.grails.org/)
plugins that makes it easy to develop web application with CRM functionality.
With CRM we mean features like:

- Contact Management
- Task/Todo Lists
- Project Management

## Shiro Security Plugin
This plugin uses Apache Shiro to authenticate/authorize Grails CRM users.

## Documentation

Complete documentation can be found at [gr8crm.github.io](http://gr8crm.github.io/plugins/crm-security-shiro/crm-security-shiro.html)


text:
package blue.lapis.pore.impl.block;

import blue.lapis.pore.converter.data.block.BlockDataConverter;
import blue.lapis.pore.converter.type.material.MaterialConverter;
import blue.lapis.pore.converter.wrapper.WrapperConverter;
import blue.lapis.pore.impl.PoreWorld;
import blue.lapis.pore.util.PoreWrapper;

import org.apache.commons.lang3.NotImplementedException;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.material.MaterialData;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin;
import org.spongepowered.api.block.BlockState;
import org.spongepowered.api.block.tileentity.TileEntity;

import java.util.Collection;
import java.util.List;

public class PoreBlockState extends PoreWrapper<BlockState> implements org.bukkit.block.BlockState {

    private org.spongepowered.api.world.Location block;
    private TileEntity tileEntity;

    public static PoreBlockState of(org.spongepowered.api.world.Location block) {
        PoreBlockState state = WrapperConverter.of(PoreBlockState.class, block.getBlock());
        if (state != null) {
            state.setBlock(block);
        }
        return state;
    }

    public static PoreBlockState of(org.spongepowered.api.block.BlockState handle) {
        return WrapperConverter.of(PoreBlockState.class, handle);
    }

    protected PoreBlockState(BlockState handle) {
        super(handle);
    }

    protected PoreBlockState(TileEntity handle) {
        super(handle.getBlock());
        this.block = handle.getLocation();
        this.tileEntity = handle;
    }

    TileEntity getTileEntity() {
        return tileEntity;
    }

    protected void setBlock(org.spongepowered.api.world.Location block) {
        this.block = block;
    }

    @Override
    public Block getBlock() {
        return PoreBlock.of(block);
    }

    @Override
    public MaterialData getData() {
        throw new NotImplementedException("TODO");
    }

    @Override
    public Material getType() {
        return MaterialConverter.of(getHandle().getType());
    }

    @Override
    @SuppressWarnings("deprecation")
    public int getTypeId() {
        return getType().getId();
    }

    @Override
    public byte getLightLevel() {
        //noinspection ConstantConditions
        return isPlaced() ? getBlock().getLightLevel() : null;
    }

    @Override
    public World getWorld() {
        return PoreWorld.of(block.getExtent());
    }

    @Override
    public int getX() {
        //noinspection ConstantConditions
        return isPlaced() ? getBlock().getX() : null;
    }

    @Override
    public int getY() {
        //noinspection ConstantConditions
        return isPlaced() ? getBlock().getY() : null;
    }

    @Override
    public int getZ() {
        //noinspection ConstantConditions
        return isPlaced() ? getBlock().getZ() : null;
    }

    @Override
    public Location getLocation() {
        return isPlaced() ? getBlock().getLocation() : null;
    }

    @Override
    public Location getLocation(Location loc) {
        return isPlaced() ? getBlock().getLocation(loc) : null;
    }

    @Override
    public Chunk getChunk() {
        return isPlaced() ? getBlock().getChunk() : null;
    }

    @Override
    public void setData(MaterialData data) {
        throw new NotImplementedException("TODO");
    }

    @Override
    public void setType(Material type) {
        //TODO: this isn't right
        if (isPlaced()) {
            getBlock().setType(type);
        }
    }

    @Override
    @SuppressWarnings("deprecation")
    public boolean setTypeId(int type) {
        Material mat = Material.getMaterial(type);
        setType(mat);
        return getType() == mat;
    }

    @Override
    public boolean update() {
        throw new NotImplementedException("TODO");
    }

    @Override
    public boolean update(boolean force) {
        throw new NotImplementedException("TODO");
    }

    @Override
    public boolean update(boolean force, boolean applyPhysics) {
        throw new NotImplementedException("TODO");
    }

    @Override
    @SuppressWarnings("unchecked")
    public byte getRawData() {
        return BlockDataConverter.INSTANCE.getDataValue((Collection) getHandle().getManipulators(),
                getHandle().getType());
    }

    @Override
    public void setRawData(byte data) {
        throw new NotImplementedException("TODO");
    }

    @Override
    public boolean isPlaced() {
        return block != null;
    }

    @Override
    public void setMetadata(String metadataKey, MetadataValue newMetadataValue) {
        throw new NotImplementedException("TODO");
    }

    @Override
    public List<MetadataValue> getMetadata(String metadataKey) {
        throw new NotImplementedException("TODO");
    }

    @Override
    public boolean hasMetadata(String metadataKey) {
        throw new NotImplementedException("TODO");
    }

    @Override
    public void removeMetadata(String metadataKey, Plugin owningPlugin) {
        throw new NotImplementedException("TODO");
    }
}


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.worldpay.innovation.wpwithin.types;

/**
 *
 * @author worldpay
 */
public class WWServiceDetails {

//    	1: i32 serviceId
//	2: string serviceDescription

    int serviceId;
    String serviceDescription;

    public int getServiceId() {
        return serviceId;
    }

    public void setServiceId(int serviceId) {
        this.serviceId = serviceId;
    }

    public String getServiceDescription() {
        return serviceDescription;
    }

    public void setServiceDescription(String serviceDescription) {
        this.serviceDescription = serviceDescription;
    }

}


text:
<?php

namespace Prophets\DrupalJsonApi\Relations;

use Prophets\DrupalJsonApi\Contracts\BaseRelationHasOne;

class HasOne extends HasOneManySingle implements BaseRelationHasOne
{
    use Concerns\RelationModelResult;
}


text:
.class final Lcom/payu/android/sdk/shade/android/support/v4/media/MediaMetadataCompat$1;
.super Ljava/lang/Object;

# interfaces
.implements Landroid/os/Parcelable$Creator;

# annotations
.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x8
    name = null
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Ljava/lang/Object;Landroid/os/Parcelable$Creator<Lcom/payu/android/sdk/shade/android/support/v4/media/MediaMetadataCompat;>;"
    }
.end annotation

# direct methods
.method constructor <init>()V
    .locals 0

    .line 432
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

# virtual methods
.method public final synthetic createFromParcel(Landroid/os/Parcel;)Ljava/lang/Object;
    .locals 2

    .line 432
    new-instance v0, Lcom/payu/android/sdk/shade/android/support/v4/media/MediaMetadataCompat;

    const/4 v1, 0x0

    invoke-direct {v0, p1, v1}, Lcom/payu/android/sdk/shade/android/support/v4/media/MediaMetadataCompat;-><init>(Landroid/os/Parcel;Lcom/payu/android/sdk/shade/android/support/v4/media/MediaMetadataCompat$1;)V

    return-object v0
.end method

.method public final bridge synthetic newArray(I)[Ljava/lang/Object;
    .locals 1

    .line 432
    new-array v0, p1, [Lcom/payu/android/sdk/shade/android/support/v4/media/MediaMetadataCompat;

    return-object v0
.end method


text:
package com.github.kmizu.yapp.translator;

import java.util.Map;
import java.util.Set;

import com.github.kmizu.yapp.Ast;
import com.github.kmizu.yapp.DirectedGraph;
import com.github.kmizu.yapp.Regex;
import com.github.kmizu.yapp.Regex2DFA;
import com.github.kmizu.yapp.Symbol;
import com.github.kmizu.yapp.Ast.Action;
import com.github.kmizu.yapp.Ast.AndPredicate;
import com.github.kmizu.yapp.Ast.CharClass;
import com.github.kmizu.yapp.Ast.Cut;
import com.github.kmizu.yapp.Ast.Empty;
import com.github.kmizu.yapp.Ast.Expression;
import com.github.kmizu.yapp.Ast.Fail;
import com.github.kmizu.yapp.Ast.Grammar;
import com.github.kmizu.yapp.Ast.N_Alternation;
import com.github.kmizu.yapp.Ast.N_Sequence;
import com.github.kmizu.yapp.Ast.NonTerminal;
import com.github.kmizu.yapp.Ast.NotPredicate;
import com.github.kmizu.yapp.Ast.Optional;
import com.github.kmizu.yapp.Ast.Repetition;
import com.github.kmizu.yapp.Ast.RepetitionPlus;
import com.github.kmizu.yapp.Ast.Rule;
import com.github.kmizu.yapp.Ast.SemanticPredicate;
import com.github.kmizu.yapp.Ast.SetValueAction;
import com.github.kmizu.yapp.Ast.StringLiteral;
import com.github.kmizu.yapp.Ast.Wildcard;
import com.github.kmizu.yapp.Automata.DFA;
import com.github.kmizu.yapp.util.CollectionUtil;

public class PEG2DFATranslator extends Ast.Visitor<Regex.Expression, Void>
  implements Translator<Ast.Expression, DFA> {
  private final DirectedGraph<Symbol, Boolean> refGraph;
  private final Map<Symbol, Expression> mapping;

  public PEG2DFATranslator(
    DirectedGraph<Symbol, Boolean> refGraph,
    Map<Symbol, Expression> mapping) {
    this.refGraph = refGraph;
    this.mapping = mapping;
  }

  public DFA translate(Expression from) {
    Regex.Expression result = accept(from, null);
    if(result != Regex.ERROR) {
      result = new Regex.Sequence(
        result,
        new Regex.Repetition(new Regex.All())
      );
    }
    return Regex2DFA.INSTANCE.compile(result);
  }

  @Override
  protected Regex.Expression visit(Action node, Void context) {
    return node.body().accept(this, context);
  }

  @Override
  protected Regex.Expression visit(AndPredicate node, Void context) {
    return Regex.ERROR;
  }

  @Override
  protected Regex.Expression visit(CharClass node, Void context) {
    Set<Character> chars = CollectionUtil.set();
    for(CharClass.Element e:node.elements) {
      if(e instanceof CharClass.Char) {
        chars.add(((CharClass.Char)e).value);
      }else {
        char rangeS = ((CharClass.Range)e).start;
        char rangeE = ((CharClass.Range)e).end;
        for(int i = rangeS; i <= rangeE; i++) {
          chars.add((char)i);
        }
      }
    }
    return new Regex.CharClass(!node.positive, chars);
  }

  @Override
  protected Regex.Expression visit(Cut node, Void context) {
    return Regex.ERROR;
  }

  @Override
  protected Regex.Expression visit(Empty node, Void context) {
    return new Regex.Empty();
  }

  @Override
  protected Regex.Expression visit(Fail node, Void context) {
    return Regex.ERROR;
  }

  @Override
  protected Regex.Expression visit(Grammar node, Void context) {
    return unsupported("Grammar");
  }

  @Override
  protected Regex.Expression visit(N_Alternation node, Void context) {
    Regex.Expression result = node.body().get(0).accept(this, context);
    if(result == Regex.ERROR) return Regex.ERROR;
    for (Expression e : node.body().subList(1, node.body().size())) {
      Regex.Expression newE = e.accept(this, context);
      if(newE == Regex.ERROR) return Regex.ERROR;
      result = new Regex.Alternation(result, newE);
    }
    return result;
  }

  @Override
  protected Regex.Expression visit(N_Sequence node, Void context) {
    Regex.Expression result = node.body().get(0).accept(this, context);
    if(result == Regex.ERROR) return Regex.ERROR;
    for (Expression e : node.body().subList(1, node.body().size())) {
      Regex.Expression newE = e.accept(this, context);
      if(newE == Regex.ERROR) return Regex.ERROR;
      result = new Regex.Sequence(result, e.accept(this, context));
    }
    return result;
  }

  @Override
  protected Regex.Expression visit(NonTerminal node, Void context) {
    if(!refGraph.getInfo(node.name())) {
      return mapping.get(node.name()).accept(this, context);
    } else {
      return Regex.ERROR;
    }
  }

  @Override
  protected Regex.Expression visit(NotPredicate node, Void context) {
    return Regex.ERROR;
  }

  @Override
  protected Regex.Expression visit(Optional node, Void context) {
    Regex.Expression e = node.body().accept(this, context);
    return e == Regex.ERROR ? Regex.ERROR
                             : new Regex.Alternation(e, new Regex.Empty());
  }

  @Override
  protected Regex.Expression visit(Repetition node, Void context) {
    Regex.Expression e = node.body().accept(this, context);
    return e == Regex.ERROR ? Regex.ERROR : new Regex.Repetition(e);
  }

  @Override
  protected Regex.Expression visit(RepetitionPlus node, Void context) {
    return new N_Sequence(
      node.pos(),
      CollectionUtil.list(
        node.body(),
        new Repetition(node.pos(), node.body())
      )
    ).accept(this, context);
  }

  @Override
  protected Regex.Expression visit(Rule node, Void context) {
    return unsupported("Rule");
  }

  @Override
  protected Regex.Expression visit(SemanticPredicate node, Void context) {
    return Regex.ERROR;
  }

  @Override
  protected Regex.Expression visit(SetValueAction node, Void context) {
    return node.body().accept(this, context);
  }

  @Override
  protected Regex.Expression visit(StringLiteral node, Void context) {
    char[] content = node.value().toCharArray();
    if (content.length == 0)
      return new Regex.Empty();
    Regex.Expression e = new Regex.Char(content[0]);
    for (int i = 1; i < content.length; i++) {
      e = new Regex.Sequence(e, new Regex.Char(content[i]));
    }
    return e;
  }

  @Override
  protected Regex.Expression visit(Wildcard node, Void context) {
    return new Regex.All();
  }

  private <T> T unsupported(String type) {
    throw new UnsupportedOperationException("Peg2DfaTranslator#visit(" + type
        + ", " + "Void");
  }
}


text:
<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>wit.fcl.json2beanfiles</groupId>
  <artifactId>json2beanfiles</artifactId>
  <packaging>jar</packaging>
  <version>1.0</version>
  <name>json2beanfiles</name>
  <url>http://maven.apache.org</url>
  <build>
  <plugins>
    <plugin>
      <artifactId>maven-assembly-plugin</artifactId>
      <configuration>
        <archive>
          <manifest>
            <mainClass>wit.fcl.json2beanfiles.App2</mainClass>
          </manifest>
        </archive>
        <descriptorRefs>
          <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
      </configuration>
    </plugin>
  </plugins>
</build>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.8.1</version>
      <scope>test</scope>
    </dependency>
    		<dependency>
			<groupId>com.google.code.gson</groupId>
			<artifactId>gson</artifactId>
			<version>2.3</version>
		</dependency>
  </dependencies>
</project>


text:
All notable changes to this project will be documented in this file.
Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) principles.

## [Unreleased][unreleased]

## [4.0.1]
### Added
 - Support for symfony 6.x components (#243)
 - Support for PHP 8.1 (#242)

### Changed
 - Namespaced global functions and udpated usages (#245)

## [4.0.0]
### Added
 - Allow exercises to provide initial solution files (#183)
 - Framework logger (#188)
 - Abstract testing classes for easier testing: `BaseTest` & `ContainerAwareTest` (#188)
 - Abstract exercise test class for exercise integration tests (#189)
 - `findByClassName` to `ExerciseRepository` (#189)
 - `each` to `ArrayObject` (#193)
 - `collect` global function to create collection instance (#193)
 - More assertions to the workshop integration test base class (#194)
 - `pluralise` global function (#196)
 - `CodeExistsCheck` check (#197)
 - `ksort` to `ArrayObject` (#199)
 - `Path` util to join file system paths (#203)
 - `getTemporaryFile` to `BaseTest` (#204)
 - `System` util for realpath'ing and getting temp directory (#205)
 - `application.tear-down` event when workshop is shutting down (#212)
 - `any` global function (#213)
 - `--debug` flag to dump logs to console (#213)
 - Support for class based transformers (#220)
 - `ForceStrictTypes` transformer (#220)
 - `FileComparisonCheck` check for external files (#202)
 - Logging for when code patches fail (#222)
 - `WrapInTryCatch` transformer (#229)
 - Link to website on mac (#230)

### Changed
 - Center CLI menu by default (#184)
 - Improved exception handling for missing problem files (#190)
 - Copy solution files to temporary directory before running (#209)
 - Patch reference solutions as well as student solutions (#211)
 - Upgrade to `phpunt/phpunit` 8 (#216)
 - Disable Xdebug when verifying solutions (#225)
 - Log file patching & don't revert patch when in debug mode (#224)
 - Improve general error handling (#227)
 - Check solution file exists in run command (#231)

### Fixed
 - `FunctionVisitor` indexing issue when multiple functions are required and only some found (#192)
 - `CodePatcher` should retain the position of declare statements when patching code (#207)
 - Type error with code patches (#219)

## [3.0.1]
### Changed
 - Updated to `fakerphp/faker` package and new version to support PHP8 (#182)

## [3.0.0]
### Added
 - Add support for PHP 8.0 (#176)
 - Add support for PHP 7.4 (#164)
 - Docblock cleanup (#166)
 - Added phpstan on maximum level and improved type coverage (#167)
 - declared strict_types in all files (#180)

### Changed
 - Use symfony/phpunit-bridge to test on more versions of PHP then phpunit allows (#164)
 - Coding standards checks updated to use PSR-12 (#165)
 - Updated php-school/cli-menu (#169)
 - Swapped zendframework/zend-diactoros for guzzlehttp/guzzle (#172)
 - Updated internal composer to 2.0 (#173)
 - Switch to PSR-11 (#177)
 - Updated symfony components (#178)

### Removed
 - Removed support for PHP < 7.2 (#164)
 - Dropped beberlei/assert (#171)
 - All usages of prophecy (#174)

## [2.2.0]
### Added
 - Builds for PHP 7.1 & 7.2 (#160)

### Changed
 - Updated `kadet/keylighter` to `0.8.3` to fix an error on PHP 7.2 (#159)
 - Updated `aydin-hassan/cli-md-renderer` to `^2.3` (#162)

### Fixed
 - Fixed a bug where cli arguments added via events were not passed to the result objects (#157)
 - Fixed solution program syntax highlighting (#161)

### Removed
 - Removed support for symfony 2.x components and dropped builds from travis with different versions of symfony (#160)

## [2.1.0]
### Changed
 - Updated `nikic/php-parser` to `^3.0` (#154)
 - Dropped `php-school/psx` in favour of `kadet/keylighter` (#154)
 - Updated `aydin-hassan/cli-md-renderer` to `^2.2` which also uses `kadet/keylighter` instead of `php-school/psx` (#154)

## [2.0.0]
### Added
 - Added new exercise runner (Custom Runner) which allows for an exercise to not require a php solution. For example an exercise can now request the student install a piece of software and then the exercise will verify that it was installed. (#141)
 - Global function for specifying an event listener as lazy. Eg the listener is registered in the container and should be pulled at runtime (#138)
 - Exercise runners now return their required checks via getRequiredChecks (#137)
 - Each runner now requires a factory which implements `ExerciseRunnerFactoryInterface` which can add arguments to the command and create instances of the runner (#137)

### Changed
 - Refactor results and result renderers and improve the verification output (#142)
 - CLI exercises can now return an array of argument arrays which will run the program with each set of arguments, just like CGI exercises (BC is preserved here - 1 set of arguments is still accepted) (#142)
 - Event listener config format has changed. Listeners must be grouped under an arbitrary key (think name of the feature requiring the listeners - see PR for example) (#138)
 - Refactored some listeners to use more specific events and event objects (#140)
 - Extract getSolution to it's own interface `ProvidesSolution`. BC is preserved as CliExercise & CgiExercise now extend from it (#139)
 - Refactor everything dealing with the input file to use an `Input` object where the command line arguments can be retrieved from. This is BC break for checks, commands, self checking exercises and event listeners dealing with the `fileName` parameter (#135)

## [1.2.0]

### Added
 - Added ability to register event listeners via config as either callables or the name of a callable container entry (#133)
 - Added an event dispatch for whenever an exercise is selected via the menu (#134)

## [1.1.0]
### Fixed
 - Menu items now update the status when progress is reset (#131, #86)
 - Added tests for ResultRendererFactory and fixed the interface validation (#126)

### Changed
 - Improved message when a solution fails (#129)

### Added
 - Added feature to put workshop in tutorial mode where exercises must be completed one after another (#127)
 - Updated dependencies (5d16877)
 - Added list support to markdown problem files (#132)


text:
using FluentMigrator;

namespace Azimuth.Migrations
{
    [Migration(201409101200)]
    public class Migration_201409101200_RemoveListenedTableAndAddCounterToPlaylistTable: Migration
    {
        public override void Up()
        {
            if (Schema.Table("Listened").Exists())
            {
                Delete.Table("Listened");
            }
            Alter.Table("Playlists").AddColumn("Listened").AsInt64().WithDefaultValue(0);
        }

        public override void Down()
        {
            Create.Table("Listened")
                .WithColumn("Id").AsInt64().NotNullable().Identity().PrimaryKey()
                .WithColumn("PlaylistId").AsInt64().NotNullable().ForeignKey("Playlists", "PlaylistsId")
                .WithColumn("Amount").AsInt64().NotNullable();
            Delete.Column("Listened").FromTable("Playlists");
        }
    }
}


text:
Variables
Creating web apps, games, and search engines all involve storing and working with different types of data. They do so using variables. A variable stores a piece of data, and gives it a specific name.

For example:

spam = 5
The variable spam now stores the number 5.

Instructions

Set the variable my_variable equal to the value 10.
Click the Save & Submit button to run your code.


text:
require 'spec_helper'

describe 'Assets' do
  describe 'GET /asset_manager_assets' do
    it 'works! (now write some real specs)' do
      # Run the generator again with the --webrat flag if you want to use webrat methods/matchers
      get asset_manager_assets_path
      response.status.should be(200)
    end
  end
end