text:
namespace
{
    const ConfigData cGizmoConfig(ConfigAPI::FILE_FRAMEWORK, "ECEditor", "show editing gizmo", true);
    const ConfigData cHighlightConfig(ConfigAPI::FILE_FRAMEWORK, "ECEditor", "highlight selected entities", true);
    const ConfigData cEditorPosConfig(ConfigAPI::FILE_FRAMEWORK, "ECEditor", "eceditor window pos", QPoint(50, 50));
}

ECEditorModule::ECEditorModule() :
    IModule("ECEditor"),
    gizmoEnabled(true),
    highlightingEnabled(true),
    toggleSelectAllEntities(false)
{
}

ECEditorModule::~ECEditorModule()
{
}

void ECEditorModule::Initialize()
{
    expandMemory = MAKE_SHARED(TreeWidgetItemExpandMemory, Name().toStdString().c_str(), framework_);

    ConfigAPI &cfg = *framework_->Config();
    gizmoEnabled = cfg.DeclareSetting(cGizmoConfig).toBool();
    highlightingEnabled = cfg.DeclareSetting(cHighlightConfig).toBool();

    framework_->Console()->RegisterCommand("doc", "Prints the class documentation for the given symbol."
        "Usage example: 'doc(EC_Placeable::WorldPosition)'.", this, SLOT(ShowDocumentation(const QString &)));

    inputContext = framework_->Input()->RegisterInputContext("ECEditorInput", 90);
    connect(inputContext.get(), SIGNAL(KeyPressed(KeyEvent *)), this, SLOT(HandleKeyPressed(KeyEvent *)));

    /// @todo Ideally we wouldn't do this, but this is needed for now in order to get OnScriptEngineCreated called
    /// (and ECEditorWindow registered to QtScript) without generating dependendy to the JavascriptModule.
    framework_->RegisterDynamicObject("ecEditorModule", this);
}

void ECEditorModule::Uninitialize()
{
    ConfigAPI &cfg = *framework_->Config();
    cfg.Write(cGizmoConfig, cGizmoConfig.key, gizmoEnabled);
    cfg.Write(cHighlightConfig, cHighlightConfig.key, highlightingEnabled);
    if (commonEditor)
        cfg.Write(cEditorPosConfig, cEditorPosConfig.key, commonEditor->pos());

    SAFE_DELETE(commonEditor);
    SAFE_DELETE_LATER(xmlEditor);
}

ECEditorWindow *ECEditorModule::ActiveEditor() const
{
    return activeEditor;
}

void ECEditorModule::SetGizmoEnabled(bool enabled)
{
    if (framework_->IsHeadless() || enabled == gizmoEnabled)
        return;

    gizmoEnabled = enabled;

    foreach(ECEditorWindow *editor, framework_->Ui()->MainWindow()->findChildren<ECEditorWindow *>())
        if (gizmoEnabled && editor == activeEditor) // if gizmoEnabled == true, show visual aids only for active editor.
            editor->SetGizmoVisible(gizmoEnabled);
        else
            editor->SetGizmoVisible(false);
}

void ECEditorModule::SetHighlightingEnabled(bool enabled)
{
    if (framework_->IsHeadless() || enabled == highlightingEnabled)
        return;

    highlightingEnabled = enabled;

    foreach(ECEditorWindow *editor, framework_->Ui()->MainWindow()->findChildren<ECEditorWindow *>())
        if (highlightingEnabled && editor == activeEditor) // if highlightingEnabled == true, show visual aids only for active editor.
            editor->SetHighlightingEnabled(highlightingEnabled);
        else
            editor->SetHighlightingEnabled(false);
}

void ECEditorModule::ECEditorFocusChanged(ECEditorWindow *editor)
{
    if (editor == activeEditor && !editor)
        return;

    // Unfocus previously active editor and disconnect all signals from that editor.
    if (activeEditor)
    {
        activeEditor->SetFocus(false);
        disconnect(activeEditor, SIGNAL(SelectionChanged(const QString&, const QString&, const QString&, const QString&)),
            this, SIGNAL(SelectionChanged(const QString&, const QString&, const QString&, const QString&)));
    }

    activeEditor = editor;
    activeEditor->SetFocus(true);
    connect(activeEditor, SIGNAL(SelectionChanged(const QString&, const QString&, const QString&, const QString&)),
        this, SIGNAL(SelectionChanged(const QString&, const QString&, const QString&, const QString&)), Qt::UniqueConnection);

    emit ActiveEditorChanged(activeEditor);
}

void ECEditorModule::ShowEditorWindow()
{
    if (framework_->IsHeadless())
        return;

    // Check null scene here, don't let it go to the ECEditorWindow ctor.
    if (!GetFramework()->Scene()->MainCameraScene())
    {
        LogError("ECEditorModule::ShowEditorWindow: Main camera scene is null.");
        return;
    }

    if (commonEditor)
    {
        commonEditor->setVisible(!commonEditor->isVisible());
        if (!commonEditor->isVisible())
        {
            framework_->Config()->Write(cEditorPosConfig, cEditorPosConfig.key, commonEditor->pos());
            commonEditor->close();
        }
        return;
    }

    activeEditor = new ECEditorWindow(GetFramework(), framework_->Ui()->MainWindow());
    commonEditor = activeEditor;
    activeEditor->setWindowFlags(Qt::Tool);
    activeEditor->setAttribute(Qt::WA_DeleteOnClose);
    // Load position from config
    QPoint pos = framework_->Config()->Read(cEditorPosConfig).toPoint();
    UiMainWindow::EnsurePositionWithinDesktop(activeEditor, pos);
    activeEditor->show();
    activeEditor->activateWindow();
}

void ECEditorModule::ShowDocumentation(const QString &symbol)
{
    QUrl styleSheetPath;
    QString documentation;
    DoxygenDocReader::GetSymbolDocumentation(symbol, &documentation, &styleSheetPath);
    if (documentation.length() == 0)
    {
        LogError("ECEditorModule::ShowDocumentation: Failed to find documentation for symbol \"" + symbol + "\"!");
        return;
    }

    QWebView *webview = new QWebView(framework_->Ui()->MainWindow());
    webview->setAttribute(Qt::WA_DeleteOnClose);
    webview->setWindowFlags(Qt::Tool);
    webview->setHtml(documentation, styleSheetPath);
    webview->show();
}

void ECEditorModule::CreateXmlEditor(EntityPtr entity)
{
    CreateXmlEditor(QList<EntityPtr>(QList<EntityPtr>() << entity));
}

void ECEditorModule::CreateXmlEditor(const QList<EntityPtr> &entities)
{
    if (framework_->IsHeadless())
        return;
    if (entities.empty())
        return;

    if (!xmlEditor)
    {
        xmlEditor = new EcXmlEditorWidget(framework_, GetFramework()->Ui()->MainWindow());
        xmlEditor->setAttribute(Qt::WA_DeleteOnClose);
        xmlEditor->setWindowFlags(Qt::Tool);
        if (activeEditor) // make sure the editing gizmo follow the entity when it's saved
            connect(xmlEditor, SIGNAL(Saved()), activeEditor.data(), SLOT(Refresh()), Qt::UniqueConnection);
    }

    xmlEditor->SetEntity(entities);
    xmlEditor->show();
    xmlEditor->activateWindow();
}

void ECEditorModule::CreateXmlEditor(ComponentPtr component)
{
    QList<ComponentPtr> components;
    components << component;
    CreateXmlEditor(components);
}

void ECEditorModule::CreateXmlEditor(const QList<ComponentPtr> &components)
{
    if (framework_->IsHeadless())
        return;
    if (components.empty())
        return;

    if (!xmlEditor)
    {
        xmlEditor = new EcXmlEditorWidget(framework_, GetFramework()->Ui()->MainWindow());
        xmlEditor->setAttribute(Qt::WA_DeleteOnClose);
        xmlEditor->setWindowFlags(Qt::Tool);
    }

    xmlEditor->SetComponent(components);
    xmlEditor->show();
    xmlEditor->activateWindow();
}

void ECEditorModule::HandleKeyPressed(KeyEvent *e)
{
    if (e->eventType != KeyEvent::KeyPressed || e->keyPressCount > 1)
        return;

    const QKeySequence showEcEditor = framework_->Input()->KeyBinding("ShowECEditor", QKeySequence(Qt::ShiftModifier + Qt::Key_E));
    const QKeySequence toggle = framework_->Input()->KeyBinding("ToggleVisualEditingAids", QKeySequence(Qt::Key_section));
    const QKeySequence toggleSelectAll = framework_->Input()->KeyBinding("ToggleSelectAllEntities", QKeySequence(Qt::ControlModifier + Qt::Key_A));
    if (e->sequence == showEcEditor)
    {
        ShowEditorWindow();
        e->Suppress();
    }
    else if (e->sequence == toggle)
    {
        /// @todo For now toggling both, but should be we have separate keyboard shortcuts for individual editing aid?
        SetGizmoEnabled(!IsGizmoEnabled());
        SetHighlightingEnabled(!IsHighlightingEnabled());
        e->Suppress();
    }
    else if (e->sequence == toggleSelectAll)
    {
        // Only if visual editing is enabled
        if ((gizmoEnabled || highlightingEnabled) && activeEditor)
        {
            // Select/deselect all entities for the current editor
            toggleSelectAllEntities = !toggleSelectAllEntities;
            if (toggleSelectAllEntities)
            {
                Scene *activeScene = framework_->Scene()->MainCameraScene();
                if (activeScene)
                {
                    // We can only manipulate entities that have placeable, but exclude temporaries (avatar, cameras etc.)
                    /// @todo Shouldn't "select all" select all, not exclude some entities with some random criteria?
                    /// Maybe add separate actions for the right-click context menu for each criteria (local, replicated, temprorary etc.)
                    EntityList selection = activeScene->EntitiesWithComponent<EC_Placeable>();
                    for(EntityList::iterator it = selection.begin(); it != selection.end();)
                        if ((*it)->IsTemporary())
                            it = selection.erase(it);
                        else
                            ++it;

                    if (!selection.empty())
                        activeEditor->AddEntities(selection, true);
                }
            }
            else
                activeEditor->ClearEntities();
        }
        e->Suppress();
    }
}

void ECEditorModule::OnScriptEngineCreated(QScriptEngine* engine)
{
    qScriptRegisterQObjectMetaType<ECEditorWindow *>(engine);
}


text:
module RubyProf
  # The Measurement class is a helper class used by RubyProf::MethodInfo to store information about the method.
  # You cannot create a CallTree object directly, they are generated while running a profile.
  class Measurement
    def children_time
      self.total_time - self.self_time - self.wait_time
    end

    def to_s
      "c: #{called}, tt: #{total_time}, st: #{self_time}"
    end

    def inspect
      super + "(#{self.to_s})"
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
package nodes

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"time"

	"github.com/go-openapi/errors"
	"github.com/go-openapi/runtime"
	cr "github.com/go-openapi/runtime/client"

	strfmt "github.com/go-openapi/strfmt"
)

// NewDeleteNodesIdentifierWorkflowsActiveParams creates a new DeleteNodesIdentifierWorkflowsActiveParams object
// with the default values initialized.
func NewDeleteNodesIdentifierWorkflowsActiveParams() *DeleteNodesIdentifierWorkflowsActiveParams {
	var ()
	return &DeleteNodesIdentifierWorkflowsActiveParams{

		timeout: cr.DefaultTimeout,
	}
}

// NewDeleteNodesIdentifierWorkflowsActiveParamsWithTimeout creates a new DeleteNodesIdentifierWorkflowsActiveParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewDeleteNodesIdentifierWorkflowsActiveParamsWithTimeout(timeout time.Duration) *DeleteNodesIdentifierWorkflowsActiveParams {
	var ()
	return &DeleteNodesIdentifierWorkflowsActiveParams{

		timeout: timeout,
	}
}

/*DeleteNodesIdentifierWorkflowsActiveParams contains all the parameters to send to the API endpoint
for the delete nodes identifier workflows active operation typically these are written to a http.Request
*/
type DeleteNodesIdentifierWorkflowsActiveParams struct {

	/*Identifier
	  Mac addresses and unique aliases to identify the node by, |
	expect a string or an array of strings.

	*/
	Identifier string

	timeout time.Duration
}

// WithIdentifier adds the identifier to the delete nodes identifier workflows active params
func (o *DeleteNodesIdentifierWorkflowsActiveParams) WithIdentifier(identifier string) *DeleteNodesIdentifierWorkflowsActiveParams {
	o.Identifier = identifier
	return o
}

// WriteToRequest writes these params to a swagger request
func (o *DeleteNodesIdentifierWorkflowsActiveParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {

	r.SetTimeout(o.timeout)
	var res []error

	// path param identifier
	if err := r.SetPathParam("identifier", o.Identifier); err != nil {
		return err
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}


text:
package io.datakernel.codegen;

import org.objectweb.asm.Type;

import java.util.List;

import static org.objectweb.asm.Type.getType;

/**
 * Defines methods for using constructors from other classes
 */
final class ExpressionConstructor implements Expression {
	private final Class<?> type;
	private final List<Expression> fields;

	ExpressionConstructor(Class<?> type, List<Expression> fields) {
		this.type = type;
		this.fields = fields;
	}

	@Override
	public Type load(Context ctx) {
		return ctx.invokeConstructor(getType(type), fields);
	}
}


text:
#include "sse.h"
#include "http.h"

#if defined(__APPLE__) && defined(__MACH__)

extern char **environ;
static int execvpe(const char *program, char **argv, char **envp)
{
    char **saved = environ;
    environ = envp;

    int rc = execvp(program, argv);

    environ = saved;
    return rc;
}

#endif

static char* sse_environment[MAX_HEADERS];

/*
 * copy headers into sse_environment and prefix those with SSE_.
 */
static void build_sse_environment(char** headers)
{
  char** destHeader = sse_environment;

  while(*headers) {
    *destHeader = malloc(strlen(*headers) + 4);
    strcpy(*destHeader, "SSE_");
    strcat(*destHeader, *headers);

    headers++, destHeader++;
  }

  *destHeader = 0;
}

/*
 * print sse environment.
 */

void fprint_list(FILE* out, char** h)
{
  while(*h) {
    fputs(*h++, out);
    fputs("\n", out);
  }
}

/*
 * free sse environment.
 */
static void free_sse_environment()
{
  char* const* h = sse_environment;

  while(*h) {
    free(*h);
    ++h;
  }

  sse_environment[0] = 0;
}

static char* run_command(const char* data, char** command, char** environment);

void log_sse_event(char** headers, const char* data)
{
  char* event_id = 0;
  char* event_type = 0;
  char** p;
  for(p = headers; (!event_id || !event_type) && *p; ++p) {
    if(strncmp(*p, "ID=", 3) == 0)
      event_id = *p + 3;
    else if(strncmp(*p, "TYPE=", 5) == 0)
      event_type = *p + 5;
  }

  fprintf(stderr, "EVENT %s:%s (%d byte)\n", event_type ? event_type : "event",
                      event_id ? event_id : "<none>", (int) strlen(data));
}

void on_sse_event(char** headers, const char* data, const char* reply_url)
{
  log_sse_event(headers, data);

  char* result = 0;

  if(options.command) {
    build_sse_environment(headers);

    result = run_command(data, options.command, sse_environment);
    free_sse_environment();
  }
  else {
    fprint_list(stdout, headers);
    fputs(data, stdout);
    fputs("\n\n", stdout);
  }

  if(reply_url) {
    char* body = result ? result : "";
    const char* reply_headers[] = {
      "Content-Type:",
      NULL
    };

    fprintf(stderr, "REPLY %s (%d byte)\n", reply_url, (int) strlen(body));
    http(HTTP_POST, reply_url, reply_headers, body, strlen(body), http_ignore_data, 0);
  }

  free(result);

  if(options.limit && 0 == --options.limit) {
    exit(0);
  }
}

/*
 * Run \a command, with the given \a environment, pass in \a data
 * into the subprocess' STDIN, and return the subprocess' STDOUT.
 *
 * Make sure to free the returned memory.
 */
static char* run_command(const char* data, char** command, char** environment)
{
  // Build pipes for subprocess
  int pipe_to_child[2];
  if (pipe(pipe_to_child) != 0) die("pipe");

  int pipe_from_child[2];
  if (pipe(pipe_from_child) != 0) die("pipe");

  // Start subprocess
  pid_t pid = fork();
  if (pid == -1) die("fork");

  char* read_data = 0;

  if (pid == 0) { /* the child */
    dup2(pipe_to_child[FD_STDIN], FD_STDIN);
    close(pipe_to_child[FD_STDOUT]);

    dup2(pipe_from_child[FD_STDOUT], FD_STDOUT);
    close(pipe_from_child[FD_STDIN]);

    char* ret;
    asprintf(&ret, "Running %s\n", command[0]);
    logger(1, ret, 0, 0);
    free(ret);

    execvpe(command[0], command, environment);
    _die(command[0]);  /* die via _exit: a failed child should not flush parent files */
  }
  else { /* code for parent */
    close(pipe_to_child[FD_STDIN]);
    write_all(pipe_to_child[FD_STDOUT], data, strlen(data));
    close(pipe_to_child[FD_STDOUT]);

    close(pipe_from_child[FD_STDOUT]);
    read_all(pipe_from_child[FD_STDIN], &read_data, RESPONSE_LIMIT);
    close(pipe_from_child[FD_STDIN]);

    int status = 0;
    waitpid(pid, &status, 0);

    // Show results if something broke.
    if(WIFEXITED(status) && WEXITSTATUS(status) != 0)
      fprintf(stderr, "child exited with stats %d\n", WEXITSTATUS(status));
    else if(WIFSIGNALED(status))
      fprintf(stderr, "child exited of signal %d\n", WTERMSIG(status));
  }

  return read_data;
}

/*
 * write dataLen bytes from data to the fd handle.
 */
int write_all(int fd, const char* data, unsigned dataLen) {
  const char *s = data, *e = data + dataLen;

  while(data < e) {
    int written = write(fd, data, e - data);
    if(written < 0)
      return -1;

    data += written;
  }

  return e - s;
}

/*
 * read data from fd handle, return a malloced area in the pResult
 * buffer - this must be freed by the caller - and returns the number
 * of bytes read.
 */
int read_all(int fd, char** pResult, size_t limit) {
  char buf[8192];
  int length = 0;

  *pResult = 0;

  while(1) {
    size_t bytes_to_read = limit ? limit - length : sizeof(buf);
    if(!bytes_to_read) break;

    int bytes_read = read(fd, buf, bytes_to_read);

    if(bytes_read < 0) {
      free(*pResult);
      *pResult = 0;
      return -1;
    }

    if(bytes_read > 0) {
      *pResult = realloc(*pResult, length + bytes_read + 1);

      memcpy(*pResult + length, buf, bytes_read);
      length += bytes_read;
    }

    if(bytes_read == 0)
      break;
  }

  if(*pResult) {
    (*pResult)[length] = 0;
  }
  return length;
}

void die(const char* msg) {
  perror(msg);
  exit(1);
}

void _die(const char* msg) {
  perror(msg);
  _exit(1);
}

/*
 * logging: when \a options.verbosity is greater than or equal \a verbosity
 * this function writes out \a data to stderr.
 *
 * Note: this is not an excessively well-performing logging method.
 */
void logger(int verbosity, const char* data, unsigned len, const char* sep)
{
  if(options.verbosity < verbosity) return;

  if(!len)
    len = strlen(data);

  if(sep)
    fputs(sep, stderr);

  for(; len--; ++data) {
    fputc(*data, stderr);

    if(sep && *data == '\n')
      fputs(sep, stderr);
  }
}

/*
 * string ends equal: returns pattern in string ends in pattern,
 * returns NULL otherwise.
 */
const char* streeq(const char* string, const char* pattern) {
  if(!*pattern || !*pattern) return string;
  if(!string || !*string) return NULL;

  size_t string_len = strlen(string);
  size_t pattern_len = strlen(pattern);
  if(string_len < pattern_len) return NULL;

  string += string_len - pattern_len;
  return strcmp(string, pattern) == 0 ? string : NULL;
}

/*
 * string starts equal: returns string after pattern if string starts
 * in pattern,
 * returns NULL otherwise.
 */
const char* strseq(const char* string, const char* pattern) {
  if(!*pattern || !*pattern) return string;
  if(!string || !*string) return NULL;

  size_t pattern_len = strlen(pattern);

  return strncmp(string, pattern, pattern_len) == 0 ? string + pattern_len : NULL;
}


text:
namespace Hg.Net
{
	public enum Channel
	{
		/// <summary>
		/// Input channel: the length field here tells the client how many bytes to send.
		/// </summary>
		I = 'I',

		/// <summary>
		/// Line based input channel: the client should send a single line of input (no more than length bytes).
		/// </summary>
		/// <remarks>This channel is used when Mercurial interacts with the user or when iterating over stdin. Data sent should include the line separator (\n or \r\n).</remarks>
		L = 'L',

		/// <summary>
		/// Output channel: most of the communication happens on this channel. When running commands, output Mercurial writes to stdout is written to this channel.
		/// </summary>
		O = 'o',

		/// <summary>
		/// Error channel: when running commands, this correlates to stderr.
		/// </summary>
		E = 'e',

		/// <summary>
		/// Result channel: the server uses this channel to tell the client that a command finished by writing its return value (command specific).
		/// </summary>
		R = 'r',

		/// <summary>
		/// Debug channel: used when the server is started with logging to '-'.
		/// </summary>
		D = 'd'
	}
}


text:
import asyncio
import aiohttp
import logging

from android.emulator import Emulator
from appium import AppiumNode

from utils import ping, get_free_port

log = logging.getLogger(__name__)

class Endpoint(object):
    ip = None
    port = None
    resources = None
    ready = False

    def __init__(self):
        self.resources = []

    def __repr__(self):
        return "<%s address=%s ready=%s>" % (
            self.__class__.__name__, self.address, self.ready
        )

    def to_json(self):
        return self.__dict__

    @asyncio.coroutine
    def start(self, desired_capabilities):
        raise NotImplementedError

    @asyncio.coroutine
    def delete(self):
        for resource in self.resources:
            yield from resource.delete()

    @property
    def address(self):
        return "%s:%s" % (self.ip, self.port)

    @asyncio.coroutine
    def _wait_open_port(self, port):
        log.info("wait for %s %s port is open" % (self, port))
        is_opened = ping(self.ip, port)
        while not is_opened:
            is_opened = ping(self.ip, port)
            yield from asyncio.sleep(0)
        loop = asyncio.get_event_loop()
        transport = None
        while not transport:
            try:
                transport, proto = yield from loop.create_connection(
                    lambda: asyncio.BaseProtocol(), host=self.ip, port=port)
            except OSError:
                pass
        transport.close()
        log.info("%s %s port is open" % (self, port))

    @asyncio.coroutine
    def _wait_selenium_status(self, reties=3):
        log.info("wait for %s selenium status" % self)
        status = None
        retry = 0
        while not status == 200 and retry < reties:
            response = yield from aiohttp.request(
                'GET', 'http://%s/wd/hub/status' % self.address)
            status = response.status
            yield from response.release()
            retry += 1
            yield from asyncio.sleep(0)
        log.info("got selenium status for %s" % self)

    @asyncio.coroutine
    def wait_ready(self):
        log.info("waiting for %s become ready" % self)
        yield from self._wait_open_port(self.port)
        yield from self._wait_selenium_status()
        self.ready = True
        log.info("%s ready" % self)

class AndroidEndpoint(Endpoint):
    @asyncio.coroutine
    def start(self, desired_capabilities):
        self.ip = "localhost"
        avd_name = desired_capabilities.get("avdName")
        emulator = Emulator(avd_name)
        self.resources.append(emulator)
        yield from emulator.start()
        self.port = get_free_port()
        appium_node = AppiumNode(self.port, emulator.device)
        self.resources.append(appium_node)
        yield from appium_node.start_coro()
        yield from self.wait_ready()
        return self


text:
#ifndef DESCARTES_CORE_PATH_PLANNER_BASE_H_
#define DESCARTES_CORE_PATH_PLANNER_BASE_H_

#include <descartes_core/trajectory_pt.h>
#include <descartes_core/robot_model.h>
#include <vector>

namespace descartes_core
{
namespace PlannerErrors
{
enum PlannerError
{
  OK = 1,
  IK_NOT_AVAILABLE = -1,
  FX_NOT_AVAILABLE = -2,
  SELF_COLLISION_FOUND = -3,
  ENVIRONMENT_COLLISION_FOUND = -4,
  PLANNING_TIMEOUT = -5,
  EMPTY_PATH = -6,
  SPEED_LIMIT_EXCEEDED = -7,
  ACCELERATION_LIMIT_EXCEEDED = -8,
  MAX_TRAJECTORY_SIZE_EXCEEDED = -9,
  UNINITIALIZED = -10,
  INVALID_ID = -11,
  INCOMPLETE_PATH = -12,
  INVALID_CONFIGURATION_PARAMETER = -13,
  UKNOWN = -99
};
}
typedef PlannerErrors::PlannerError PlannerError;

typedef std::map<std::string, std::string> PlannerConfig;

DESCARTES_CLASS_FORWARD(PathPlannerBase);
class PathPlannerBase
{
public:
  virtual ~PathPlannerBase()
  {
  }

  /**
   * @brief Plans a path for the given robot model and configuration parameters.
   * @param model robot model implementation for which to plan a path
   * @param config A map containing the parameter/value pairs.
   */
  virtual bool initialize(RobotModelConstPtr model) = 0;

  /**
   * @brief Configure the planner's parameters. Should return 'true' when all the entries were properly parsed.
   * @param config A map containing the parameter/value pairs.
   */
  virtual bool setConfig(const PlannerConfig& config) = 0;

  /**
   * @brief Get the current configuration parameters used by the planner
   * @param config A map containing the current parameter/value pairs.
   */
  virtual void getConfig(PlannerConfig& config) const = 0;

  /**
   * @brief Generates a robot path from the trajectory.
   * @param traj the points used to plan the robot path
   * @error_code Integer flag which indicates the type of error encountered during planning.
   */
  virtual bool planPath(const std::vector<TrajectoryPtPtr>& traj) = 0;

  /**
   * @brief Returns the last robot path generated from the input trajectory
   * @param path Array that contains the points in the robot path
   */
  virtual bool getPath(std::vector<TrajectoryPtPtr>& path) const = 0;

  /**
   * @brief Add a point to the current path after the point with 'ref_id'.
   * @param ref_id ID of the reference point
   */
  virtual bool addAfter(const TrajectoryPt::ID& ref_id, TrajectoryPtPtr tp) = 0;

  /**
   * @brief Add a point to the current path before the point with 'ref_id'.
   * @param ref_id ID of the reference point
   */
  virtual bool addBefore(const TrajectoryPt::ID& ref_id, TrajectoryPtPtr tp) = 0;

  /**
   * @brief Removes the point with 'ref_id' from the path.
   * @param ref_id ID of the reference point
   */
  virtual bool remove(const TrajectoryPt::ID& ref_id) = 0;

  /**
   * @brief Modifies the point with 'ref_id'.
   * @param ref_id ID of the reference point
   */
  virtual bool modify(const TrajectoryPt::ID& ref_id, TrajectoryPtPtr tp) = 0;

  /**
   * @brief Returns the last error code.
   */
  virtual int getErrorCode() const = 0;

  /**
   * @brief Gets the error message corresponding to the error code.
   * @param error_code Integer code from the PlannerError enumeration.
   */
  virtual bool getErrorMessage(int error_code, std::string& msg) const = 0;

protected:
  PathPlannerBase()
  {
  }
};
}

#endif /* DESCARTES_CORE_PATH_PLANNER_BASE_H_ */


text:
<?php

namespace Code\Bundle\CodeSelfBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class CodeCodeSelfBundle extends Bundle
{
}


text:
void Noise::setAmplitude(float amplitude)
{
    _amplitude = amplitude;
}

void Noise::process(float& output)
{
    output = (((float)rand() / (float)RAND_MAX) * 2.0 - 1.0) * _amplitude;
}


text:
package combobox

import "github.com/norisatir/go-gtk3/gobject"
import "github.com/norisatir/go-gtk3/gtk3"
import "github.com/norisatir/go-gtk3/gdk3"
import gp "github.com/norisatir/go-gtk3/gdkpixbuf"
import "strings"
import "regexp"

const (
	PixbufCol = iota
	TextCol
)

var window *gtk3.Window = nil

func createStockIconStore() gtk3.TreeModelLike {
	stockId := []string{gtk3.GtkStock.DIALOG_WARNING, gtk3.GtkStock.STOP,
		gtk3.GtkStock.NEW, gtk3.GtkStock.CLEAR, "", gtk3.GtkStock.OPEN}

	cellView := gtk3.NewCellView()
	store := gtk3.NewListStore([]gobject.GType{gp.G_TYPE_PIXBUF, gobject.G_TYPE_STRING})

	var iter gtk3.TreeIter

	for _, s := range stockId {
		if s != "" {
			pixbuf := cellView.RenderIconPixbuf(s, gtk3.GtkIconSize.BUTTON)
			_, stockItem := gtk3.StockLookup(s)

			label := strings.Map(func(in rune) rune {
				if in == rune('_') {
					return rune(-1)
				}
				return in
			}, stockItem.Label)

			store.Append(&iter)
			store.SetValues(&iter, gtk3.V{PixbufCol: pixbuf, TextCol: label})
		} else {
			store.Append(&iter)
			store.SetValues(&iter, gtk3.V{PixbufCol: nil, TextCol: "seperator"})
		}
	}
	return store
}

func setSensitive(data ...interface{}) {
	cell := data[1].(gtk3.CellRendererLike)
	treeModel := data[2].(gtk3.TreeModelLike)
	iter := data[3].(*gtk3.TreeIter)

	path := treeModel.ITreeModel().GetPath(iter)
	indices := path.GetIndices()
	sensitive := indices[0] != 1

	cell.CRenderer().Set(gtk3.P{"sensitive": sensitive})
}

func isSeparator(model gtk3.TreeModelLike, iter *gtk3.TreeIter, data ...interface{}) bool {
	path := model.ITreeModel().GetPath(iter)
	return path.GetIndices()[0] == 4
}

func createCapitalStore() gtk3.TreeModelLike {
	type Capital struct {
		Group   string
		Capital string
	}

	capitals := []Capital{
		{"A - B", ""},
		{"", "Albany"},
		{"", "Annapolis"},
		{"", "Atlanta"},
		{"", "Augusta"},
		{"", "Austin"},
		{"", "Baton Rouge"},
		{"", "Bismarck"},
		{"", "Boise"},
		{"", "Boston"},
		{"C - D", ""},
		{"", "Carson City"},
		{"", "Charleston"},
		{"", "Cheyenne"},
		{"", "Columbia"},
		{"", "Columbus"},
		{"", "Concord"},
		{"", "Denver"},
		{"", "Des Moines"},
		{"", "Dover"},
		{"E - J", ""},
		{"", "Frankfort"},
		{"", "Harrisburg"},
		{"", "Hartford"},
		{"", "Helena"},
		{"", "Honolulu"},
		{"", "Indianapolis"},
		{"", "Jackson"},
		{"", "Jefferson City"},
		{"", "Juneau"},
		{"K - O", ""},
		{"", "Lansing"},
		{"", "Lincoln"},
		{"", "Little Rock"},
		{"", "Ljubljana"},
		{"", "Madison"},
		{"", "Montgomery"},
		{"", "Montpelier"},
		{"", "Nashville"},
		{"", "Oklahoma City"},
		{"", "Olympia"},
		{"P - S", ""},
		{"", "Phoenix"},
		{"", "Pierre"},
		{"", "Providence"},
		{"", "Raleigh"},
		{"", "Richmond"},
		{"", "Sacramento"},
		{"", "Salem"},
		{"", "Salt Lake City"},
		{"", "Santa Fe"},
		{"", "Springfield"},
		{"", "St. Paul"},
		{"T - Z", ""},
		{"", "Tallahassee"},
		{"", "Topeka"},
		{"", "Trenton"},
		{"", ""}}

	var iter, iter2 gtk3.TreeIter
	store := gtk3.NewTreeStore([]gobject.GType{gobject.G_TYPE_STRING})

	for _, c := range capitals {
		switch {
		case c.Group != "":
			store.Append(&iter, nil)
			store.SetValues(&iter, gtk3.V{0: c.Group})
		case c.Capital != "":
			store.Append(&iter2, &iter)
			store.SetValues(&iter2, gtk3.V{0: c.Capital})
		}
	}
	return store
}

func isCapitalSensitive(data ...interface{}) {
	cell := data[1].(gtk3.CellRendererLike)
	model := data[2].(gtk3.TreeModelLike)
	iter := data[3].(*gtk3.TreeIter)
	sensitive := !model.ITreeModel().IterHasChild(iter)

	cell.CRenderer().Set(gtk3.P{"sensitive": sensitive})
}

func setBackground(entry *gtk3.Entry, mask string) {
	errorColor := gdk3.RGBA{1.0, 0.9, 0.9, 1.0}
	if mask != "" {
		m, _ := regexp.Compile(mask)
		if m.FindStringIndex(entry.GetText()) == nil {
			entry.OverrideColor(0, &errorColor)
			return
		}
	}
	entry.OverrideColor(0, nil)
}

func DoComboBox(w gtk3.WidgetLike) gtk3.WidgetLike {
	if window == nil {
		window = gtk3.NewWindow(gtk3.GtkWindowType.TOPLEVEL)
		window.SetScreen(w.W().GetScreen())
		window.SetTitle("Combo boxes")
		window.Connect("destroy", func() { window.Destroy(); window = nil })
		window.SetBorderWidth(10)

		vbox := gtk3.NewVBox(2)
		window.Add(vbox)

		// A combobox demonstrating cell renderers, separators and insensitive rows
		frame := gtk3.NewFrame("Some stock icons")
		vbox.PackStart(frame, false, false, 0)

		box := gtk3.NewVBox(0)
		box.SetBorderWidth(5)
		frame.Add(box)

		model := createStockIconStore()
		combo := gtk3.NewComboBoxWithModel(model)
		box.Add(combo)

		var renderer gtk3.CellRendererLike

		renderer = gtk3.NewCellRendererPixbuf()
		combo.PackStart(renderer, false)
		combo.SetAttributes(renderer, gtk3.A{{"pixbuf", PixbufCol}})
		combo.SetCellDataFunc(renderer, setSensitive)

		renderer = gtk3.NewCellRendererText()
		combo.PackStart(renderer, true)
		combo.SetAttributes(renderer, gtk3.A{{"text", TextCol}})
		combo.SetCellDataFunc(renderer, setSensitive)

		combo.SetRowSeparatorFunc(isSeparator)
		combo.SetActive(0)

		// A ComboBox demonstrating trees.
		frame = gtk3.NewFrame("Where are we ?")
		vbox.PackStart(frame, false, false, 0)

		box = gtk3.NewVBox(0)
		box.SetBorderWidth(5)
		frame.Add(box)

		model1 := createCapitalStore()
		combo3 := gtk3.NewComboBoxWithModel(model1)
		box.Add(combo3)

		renderer1 := gtk3.NewCellRendererText()
		combo3.PackStart(renderer1, true)
		combo3.SetAttributes(renderer1, gtk3.A{{"text", 0}})

		combo3.SetCellDataFunc(renderer1, isCapitalSensitive)

		var iter gtk3.TreeIter
		path := gtk3.NewTreePathFromString("3:3")
		model1.ITreeModel().GetIter(&iter, path)
		combo3.SetActiveIter(&iter)

		// a combobox with validation
		frame = gtk3.NewFrame("Editable")
		vbox.PackStart(frame, false, false, 0)

		box = gtk3.NewVBox(0)
		box.SetBorderWidth(5)
		frame.Add(box)

		combo1 := gtk3.NewComboBoxTextWithEntry()
		box.Add(combo1)
		combo1.AppendText("One")
		combo1.AppendText("Two")
		combo1.AppendText("2\302\275")
		combo1.AppendText("Three")

		mask := "^([0-9]*|One|Two|2\302\275|Three)$"
		entry := combo1.GetChild().(*gtk3.Entry)
		entry.Connect("changed", setBackground, entry, mask)

		// A ComboBox with string IDs
		frame = gtk3.NewFrame("String IDs")
		vbox.PackStart(frame, false, false, 0)

		box = gtk3.NewVBox(0)
		vbox.SetBorderWidth(5)
		frame.Add(box)

		combo2 := gtk3.NewComboBoxText()
		combo2.Append("never", "Not visible")
		combo2.Append("when-active", "Visible when active")
		combo2.Append("always", "Always visible")
		box.Add(combo2)

		entry = gtk3.NewEntry()
		box.Add(entry)

		gobject.BindProperty(combo2, "active-id", entry, "text", gobject.GBindingFlags.BIDIRECTIONAL)
	}

	if !window.GetVisible() {
		window.ShowAll()
	} else {
		window.Destroy()
		window = nil
		return nil
	}

	return window
}


text:
/*
 * 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.
 */
package io.prestosql.plugin.jdbc;

import io.airlift.testing.EquivalenceTester;
import io.prestosql.spi.connector.SchemaTableName;
import org.testng.annotations.Test;

import static io.prestosql.plugin.jdbc.MetadataUtil.TABLE_CODEC;
import static io.prestosql.plugin.jdbc.MetadataUtil.assertJsonRoundTrip;

public class TestJdbcTableHandle
{
    @Test
    public void testJsonRoundTrip()
    {
        assertJsonRoundTrip(TABLE_CODEC, new JdbcTableHandle(new SchemaTableName("schema", "table"), "jdbcCatalog", "jdbcSchema", "jdbcTable"));
    }

    @Test
    public void testEquivalence()
    {
        EquivalenceTester.equivalenceTester()
                .addEquivalentGroup(
                        new JdbcTableHandle(new SchemaTableName("schema", "table"), "jdbcCatalog", "jdbcSchema", "jdbcTable"),
                        new JdbcTableHandle(new SchemaTableName("schema", "table"), "jdbcCatalogX", "jdbcSchema", "jdbcTable"),
                        new JdbcTableHandle(new SchemaTableName("schema", "table"), "jdbcCatalog", "jdbcSchemaX", "jdbcTable"),
                        new JdbcTableHandle(new SchemaTableName("schema", "table"), "jdbcCatalog", "jdbcSchema", "jdbcTableX"))
                .addEquivalentGroup(
                        new JdbcTableHandle(new SchemaTableName("schemaX", "table"), "jdbcCatalog", "jdbcSchema", "jdbcTable"),
                        new JdbcTableHandle(new SchemaTableName("schemaX", "table"), "jdbcCatalogX", "jdbcSchema", "jdbcTable"),
                        new JdbcTableHandle(new SchemaTableName("schemaX", "table"), "jdbcCatalog", "jdbcSchemaX", "jdbcTable"),
                        new JdbcTableHandle(new SchemaTableName("schemaX", "table"), "jdbcCatalog", "jdbcSchema", "jdbcTableX"))
                .check();
    }
}


text:
import dac
import itertools
from ILDA import readFrames, readFirstFrame
import liblo
import argparse
import math

COORD_MAX = 32767
COORD_MIN = -32768
COORD_RANGE = COORD_MAX - COORD_MIN

def playshow(scale, pps, freq, amp, phase_v, step):
    a, bp = dac.find_first_dac()
    d = dac.DAC(a)

    target = liblo.Address(a, 60000)
    liblo.send(target, "/geom/tl", int(-1), int(1))
    liblo.send(target, "/geom/tr", int(1), int(1))
    liblo.send(target, "/geom/bl", int(-1), int(-1))
    liblo.send(target, "/geom/br", int(1), int(-1))
    liblo.send(target, "/geom/pps", pps)
    liblo.send(target, "/geom/size", scale)

    def fun(x, t):
        return round(amp*float(COORD_RANGE)/2*math.sin(freq*2*math.pi*float(x)/COORD_RANGE+2*math.pi*phase_v*t))

    def stream_points():
        last_dwell = 0
        t = 0
        while True:
            for x in xrange(COORD_MIN, COORD_MAX, step):
                p = (x, fun(x, t), 0, 0, COORD_MAX)

                dwell_count = 1
                last_dwell += 1
                if last_dwell > 100:
                    dwell_count = 100
                    last_dwell = 0

                for _ in xrange(dwell_count):
                    yield p

            t += 1

    itr = iter(stream_points())

    d.play_iter(pps, bp.buffer_capacity, itr)

def main():
    parser = argparse.ArgumentParser(description='Play an ILDA show')
    parser.add_argument('--pps', type=int, default=20000, help='PPS for show [default=%(default)s]')
    parser.add_argument('--scale', type=float, default=1.0, help='Scaling for show [default=%(default)s]')
    parser.add_argument('--freq', type=float, default=1.0, help='Frequency of wave for show [default=%(default)s]')
    parser.add_argument('--amp', type=float, default=1.0, help='Amplitude for show [default=%(default)s]')
    parser.add_argument('--phase_velocity', type=float, default=0.0, help='Phase velocity for show [default=%(default)s]')
    parser.add_argument('--steps', type=int, default=100, help='Number of steps per wave [default=%(default)s]')

    args = parser.parse_args()
    playshow(args.scale, args.pps, args.freq, args.amp, args.phase_velocity, args.steps)

if __name__ == '__main__':
    main()


text:
package com.davidflanagan.examples.gui;
import java.awt.*;

/**
 * This LayoutManager arranges the components into a column.
 * Components are always given their preferred size.
 *
 * When you create a ColumnLayout, you may specify four values:
 *   margin_height -- how much space to leave on top and bottom
 *   margin_width -- how much space to leave on left and right
 *   spacing -- how much vertical space to leave between items
 *   alignment -- the horizontal position of the components:
 *      ColumnLayout.LEFT -- left-justify the components
 *      ColumnLayout.CENTER -- horizontally center the components
 *      ColumnLayout.RIGHT -- right-justify the components
 *
 * You never call the methods of a ColumnLayout object.  Just create one
 * and make it the layout manager for your container by passing it to
 * the addLayout() method of the Container object.
 */
public class ColumnLayout implements LayoutManager2 {
    protected int margin_height;
    protected int margin_width;
    protected int spacing;
    protected int alignment;

    // Constants for the alignment argument to the constructor.
    public static final int LEFT = 0;
    public static final int CENTER = 1;
    public static final int RIGHT = 2;

    /** The constructor.  See comment above for meanings of these arguments */
    public ColumnLayout(int margin_height, int margin_width,
			int spacing, int alignment)  {
	this.margin_height = margin_height;
	this.margin_width = margin_width;
	this.spacing = spacing;
	this.alignment = alignment;
    }

    /**
     * A default constructor that creates a ColumnLayout using 5-pixel
     * margin width and height, 5-pixel spacing, and left alignment
     **/
    public ColumnLayout() { this(5, 5, 5, LEFT); }

    /**
     * The method that actually performs the layout.
     * Called by the Container
     **/
    public void layoutContainer(Container parent) {
	Insets insets = parent.getInsets();
	Dimension parent_size = parent.getSize();
	Component kid;
	int nkids = parent.getComponentCount();
	int x0 = insets.left + margin_width;  // The base X position
	int x;
	int y = insets.top + margin_height;   // Start at the top of the column

	for(int i = 0; i < nkids; i++) {      // Loop through the kids
	    kid = parent.getComponent(i);     // Get the kid
	    if (!kid.isVisible()) continue;   // Skip hidden ones
	    Dimension pref = kid.getPreferredSize();  // How big is it?
	    switch(alignment) {               // Compute X coordinate
	    default:
	    case LEFT:   x = x0; break;
	    case CENTER: x = (parent_size.width - pref.width)/2; break;
	    case RIGHT:
		x = parent_size.width-insets.right-margin_width-pref.width;
		break;
	    }
	    // Set the size and position of this kid
	    kid.setBounds(x, y, pref.width, pref.height);
	    y += pref.height + spacing;       // Get Y position of the next one
	}
    }

    /** The Container calls this to find out how big the layout should to be */
    public Dimension preferredLayoutSize(Container parent) {
	return layoutSize(parent, 1);
    }
    /** The Container calls this to find out how big the layout must be */
    public Dimension minimumLayoutSize(Container parent) {
	return layoutSize(parent, 2);
    }
    /** The Container calls this to find out how big the layout can be */
    public Dimension maximumLayoutSize(Container parent) {
	return layoutSize(parent, 3);
    }

    // Compute min, max, or preferred size of all the visible children
    protected Dimension layoutSize(Container parent, int sizetype) {
	int nkids = parent.getComponentCount();
	Dimension size = new Dimension(0,0);
	Insets insets = parent.getInsets();
	int num_visible_kids = 0;

	// Compute maximum width and total height of all visible kids
	for(int i = 0; i < nkids; i++) {
	    Component kid = parent.getComponent(i);
	    Dimension d;
	    if (!kid.isVisible()) continue;
	    num_visible_kids++;
	    if (sizetype == 1) d = kid.getPreferredSize();
	    else if (sizetype == 2) d = kid.getMinimumSize();
	    else d = kid.getMaximumSize();
	    if (d.width > size.width) size.width = d.width;
	    size.height += d.height;
	}

	// Now add in margins and stuff
	size.width += insets.left + insets.right + 2*margin_width;
	size.height += insets.top + insets.bottom + 2*margin_height;
	if (num_visible_kids > 1)
	    size.height += (num_visible_kids - 1) * spacing;
	return size;
    }

    // Other LayoutManager(2) methods that are unused by this class
    public void addLayoutComponent(String constraint, Component comp) {}
    public void addLayoutComponent(Component comp, Object constraint) {}
    public void removeLayoutComponent(Component comp) {}
    public void invalidateLayout(Container parent) {}
    public float getLayoutAlignmentX(Container parent) { return 0.5f; }
    public float getLayoutAlignmentY(Container parent) { return 0.5f; }
}


text:
module Andrake
  autoload :Generator, 'andrake/generator'
  autoload :Manifest,  'andrake/manifest'
  autoload :Tasks,     'andrake/tasks'
  autoload :Commands,  'andrake/commands'
end


text:
/**
 * @author v.lugovksy
 * created on 16.12.2015
 */
(function () {
  'use strict';

  angular.module('BrainPal.pages.dashboard')
      .service('dashboardPieChart', dashboardPieChart);

  /** @ngInject */
  function dashboardPieChart() {

  }
})();


text:
package mr.reviews.fsstruct.hbase;

import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.mapreduce.IdentityTableReducer;
import org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;

/**
yarn jar $PLAY_AREA/HadoopSamples.jar mr.reviews.fsstruct.hbase.FindReviewsByKeyword -Dreport.value="invaluable,affordable"
 */
public class FindReviewsByKeyword extends Configured implements Tool{
    public int run(String[] args) throws Exception {
        Job job = Job.getInstance(HBaseConfiguration.create(getConf()), this.getClass().getName());
        job.setJarByClass(getClass());

        Scan scan = new Scan();
        TableMapReduceUtil.initTableMapperJob(
                ReviewHBaseSchema.REVIEW_TABLE,
                scan,
                FindReviewsByKeywordMapper.class,
                NullWritable.class, Writable.class,
                job,
                true);

        TableMapReduceUtil.initTableReducerJob(
                ReviewHBaseSchema.REVIEW_REPORT_TABLE,
                IdentityTableReducer.class, job);
        job.setNumReduceTasks(0);
        return job.waitForCompletion(true) ? 0 : 1;
    }

    public static void main(String[] args) throws Exception {
        int exitCode = ToolRunner.run(new FindReviewsByKeyword(), args);
        System.exit(exitCode);
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Unlog.AdditionalTargets.WpfTest
{
	public partial class MainWindow : Window
	{
		public MainWindow ()
		{
			InitializeComponent ();

			var t = new WpfRtfLogTarget (rtfBox);
			Log.AddTarget (t);
			Log.AllowAsynchronousWriting = false;

			/*
			 * Test basic WriteLine
			 */
			Log.WriteLine ("First line");

			/*
			 * Test combination of Write and empty WriteLine
			 */
			Log.Write ("Second line");
			Log.WriteLine ();
			Log.WriteLine ("Third line");

			/*
			 * Test foreground colors
			 */
			Log.Write ("Foreground: Black,");
			Log.ForegroundColor = ConsoleColor.Red;
			Log.Write ("Red,");
			Log.ForegroundColor = ConsoleColor.Green;
			Log.Write ("Green,");
			Log.ResetColor ();
			Log.Write ("(Reset),");
			Log.ForegroundColor = ConsoleColor.Blue;
			Log.Write ("Blue,");
			Log.ResetColor ();
			Log.Write ("(Reset),");
			Log.WriteLine ();

			/*
			 * Test background colors
			 */
			Log.Write ("Background: White,");
			Log.BackgroundColor = ConsoleColor.Red;
			Log.Write ("Red,");
			Log.BackgroundColor = ConsoleColor.Green;
			Log.Write ("Green,");
			Log.ResetColor ();
			Log.Write ("(Reset),");
			Log.BackgroundColor = ConsoleColor.Blue;
			Log.Write ("Blue,");
			Log.ResetColor ();
			Log.Write ("(Reset),");
			Log.WriteLine ();

			/*
			 * Test fore- and background colors
			 */
			Log.ForegroundColor = ConsoleColor.White;
			Log.BackgroundColor = ConsoleColor.Black;
			Log.WriteLine ("White on black");
			Log.ForegroundColor = ConsoleColor.Cyan;
			Log.BackgroundColor = ConsoleColor.Magenta;
			Log.WriteLine ("Cyan on magenta");
			Log.ResetColor ();

			/*
			 * Done!
			 */
			Log.WriteLine ("Test complete");
		}
	}
}