text:
// This file is part of YamlDotNet - A .NET library for YAML.
// Copyright (c) Antoine Aubry and contributors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using Xunit;
using Xunit.Sdk;
using YamlDotNet.Core;
using YamlDotNet.RepresentationModel;

namespace YamlDotNet.Test.Spec
{
    public sealed class ParserSpecTests
    {
        private sealed class ParserSpecTestsData : SpecTestsData
        {
            protected override List<string> IgnoredSuites { get; } = ignoredSuites;
        }

        private static readonly List<string> ignoredSuites = new List<string>
        {
            "L383" // this is a multi document test, yamldotnet does not support it.
        };

        private static readonly List<string> knownFalsePositives = new List<string>
        {
            // no false-positives known as of https://github.com/yaml/yaml-test-suite/releases/tag/data-2020-02-11
        };

        private static readonly List<string> knownParserDesyncInErrorCases = new List<string>
        {
            "C2SP" // this is supposed to error out, which it does, just not in the same spot.
        };

        [Theory, ClassData(typeof(ParserSpecTestsData))]
#pragma warning disable xUnit1026 // Theory methods should use all of their parameters
        public void ConformsWithYamlSpec(string name, string description, string inputFile, string expectedEventFile, bool error, bool quoting)
#pragma warning restore xUnit1026 // Theory methods should use all of their parameters
        {
            // we don't care about quoting for this test.

            var expectedResult = File.ReadAllText(expectedEventFile)
                .Replace("+MAP {}", "+MAP")
                .Replace("+SEQ []", "+SEQ");

            using var writer = new StringWriter();
            try
            {
                using var reader = File.OpenText(inputFile);
                new LibYamlEventStream(new Parser(reader)).WriteTo(writer);
            }
            catch (Exception ex)
            {
                Assert.True(error, $"Unexpected spec failure ({name}).\n{description}\nExpected:\n{expectedResult}\nActual:\n[Writer Output]\n{writer}\n[Exception]\n{ex}");

                if (error)
                {
                    Debug.Assert(!knownFalsePositives.Contains(name), $"Spec test '{name}' passed but present in '{nameof(knownFalsePositives)}' list. Consider removing it from the list.");

                    try
                    {
                        Assert.Equal(expectedResult, writer.ToString(), ignoreLineEndingDifferences: true);
                        Debug.Assert(!knownParserDesyncInErrorCases.Contains(name), $"Spec test '{name}' passed but present in '{nameof(knownParserDesyncInErrorCases)}' list. Consider removing it from the list.");
                    }
                    catch (EqualException)
                    {
                        // In some error cases, YamlDotNet's parser output is in desync with what is expected by the spec.
                        // Throw, if it is not a known case.

                        if (!knownParserDesyncInErrorCases.Contains(name))
                        {
                            throw;
                        }
                    }
                }

                return;
            }

            try
            {
                Assert.Equal(expectedResult, writer.ToString(), ignoreLineEndingDifferences: true);
                Debug.Assert(!ignoredSuites.Contains(name), $"Spec test '{name}' passed but present in '{nameof(ignoredSuites)}' list. Consider removing it from the list.");
            }
            catch (EqualException)
            {
                // In some cases, YamlDotNet's parser/scanner is unexpectedly *not* erroring out.
                // Throw, if it is not a known case.

                if (!(error && knownFalsePositives.Contains(name)))
                {
                    throw;
                }
            }
        }
    }
}


text: Know what your team mates are doing

redpajama_set_name: RedPajamaGithub


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

<title>kariminf.langpi.basic.german (LangPi 1.1.1 API)</title>
<meta name="date" content="2017-03-28">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

kariminf.langpi.basic.german

Classes

DeInfo

DeNormalizer

DeSegmenter

DeStemmer

DeSWEliminator


text:
package com.facebook.buck.python.toolchain;

import com.facebook.buck.rules.BuildRuleResolver;
import com.facebook.buck.rules.Tool;
import com.facebook.buck.toolchain.Toolchain;

public interface PexToolProvider extends Toolchain {
  String DEFAULT_NAME = "pex-tool";

  Tool getPexTool(BuildRuleResolver resolver);
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Movember - Chiro Wichelen</title>

    <link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">

    <link href="vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">
    <link href='https://fonts.googleapis.com/css?family=Kaushan+Script' rel='stylesheet' type='text/css'>
    <link href='https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
    <link href='https://fonts.googleapis.com/css?family=Roboto+Slab:400,100,300,700' rel='stylesheet' type='text/css'>

    <link href="css/agency.min.css" rel="stylesheet">

    <link rel="apple-touch-icon" sizes="57x57" href="/img/favicon/apple-icon-57x57.png">
    <link rel="apple-touch-icon" sizes="60x60" href="/img/favicon/apple-icon-60x60.png">
    <link rel="apple-touch-icon" sizes="72x72" href="/img/favicon/apple-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="76x76" href="/img/favicon/apple-icon-76x76.png">
    <link rel="apple-touch-icon" sizes="114x114" href="/img/favicon/apple-icon-114x114.png">
    <link rel="apple-touch-icon" sizes="120x120" href="/img/favicon/apple-icon-120x120.png">
    <link rel="apple-touch-icon" sizes="144x144" href="/img/favicon/apple-icon-144x144.png">
    <link rel="apple-touch-icon" sizes="152x152" href="/img/favicon/apple-icon-152x152.png">
    <link rel="apple-touch-icon" sizes="180x180" href="/img/favicon/apple-icon-180x180.png">
    <link rel="icon" type="image/png" sizes="192x192"  href="/img/favicon/android-icon-192x192.png">
    <link rel="icon" type="image/png" sizes="32x32" href="/img/favicon/favicon-32x32.png">
    <link rel="icon" type="image/png" sizes="96x96" href="/img/favicon/favicon-96x96.png">
    <link rel="icon" type="image/png" sizes="16x16" href="/img/favicon/favicon-16x16.png">
    <link rel="manifest" href="/img/favicon/manifest.json">
    <meta name="msapplication-TileColor" content="#ffffff">
    <meta name="msapplication-TileImage" content="/img/favicon/ms-icon-144x144.png">
    <meta name="theme-color" content="#ffffff">

                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    Toggle navigation Menu
                </button>
                No Shave November

                        doel

                        status

                        planning

                        team

Chiro Juventud Wichelen

No shave november

Reeds €812,72 gedoneerd

                Help mee!

Doel

Waarom zijn we hieraan begonnnen?

Niet scheren

Intieel was het idee om een hele maand november onze snor niet scheren. Sommigen lieten ook hun baard staan, dit was vrij te kiezen. Omdat we deze actie doen via De Warmste Week, hebben we besloten de actie te verlengen tot en met deze week.

Sponsoren

Opdat wij dit een hele maand willen volhouden vragen wij een vrije bijdrage te storen op ons rekeningnummer: BE52 0689 0520 2209. Met in de mededeling 'Movember + uw naam'

Het goede doel

Al het verzamelde geld zullen wij tijdens De Warmste Week van Studio Brussel integraal storten naar Kom Op Tegen Kanker. Meer specifiek gericht op onderzoek naar prostaatkanker.

We doen verder

Status

Hoe zien die mannen er tegenwoordig uit?

Jef

15 december

Bert

14 december

Jens VDS

13 december

Bjorn

13 december

Siegfried

13 december

Gianni

13 december

Jannes

13 december

Lennert

13 december

Mattias

13 december

Laurens

13 december

Vincent

13 december

Wannes

13 december

Toon

13 december

Ruben

13 december

Arnaud

8 december

Björn

8 december

Jens VDS

8 december

Wout

8 december

Bert

7 december

Mattias

6 december

Jef

6 december

Vincent

6 december

Jannes

6 december

Siegfried

3 december

Lennert

3 december

Steffen

1 december

Jens VDS

30 november

Siegfried

30 november

Bert

29 november

Vincent

29 november

Gianni

28 november

Lennert

28 november

Arnaud

28 november

Jef

28 november

Jannes

28 november

Steffen

28 november

Arnaud

24 november

Vincent

23 november

Mattias

23 november

Laurens

23 november

Jef

23 november

Jens VDS

23 november

Jens

23 november

Bert

23 november

Wout

22 november

Wannes

22 november

Toon

21 november

Lennert

21 november

Björn

20 november

Steffen

20 november

Siegfried

20 november

Jens VDS

15 november

Wout

15 november

Ruben

15 november

Jannes

15 november

Bert

15 november

Vincent

15 november

Hond van Lennert

15 november

Wannes

15 november

Jens

15 november

Björn

15 november

Steffen

15 november

Laurens

14 november

Jef

14 november

Toon

14 november

Siegfried

14 november

Arnaud

14 november

Lennert Van Hond

14 november

Mattias

14 november

Björn

11 november

Steffen

11 november

Bert

8 november

Siegfried

8 november

Wannes

8 november

Vincent

8 november

Jannes

8 november

Jens VDS

8 november

Jef

8 november

Steffen

1 november

Bjorn

1 november

Ruben

1 november

Toon

1 november

Jens

1 november

Wannes

1 november

Mattias

1 november

Laurens

1 november

Wout

1 november

Gianni

1 november

Jannes

1 november

Vincent

1 november

Siegfried

1 november

Lennert Van Hond

1 november

Jens VDS

1 november

Jef

1 november

Bert

1 november

Arnaud

1 november

Planning

Hoe gaat dit allemaal verlopen?

31 oktober 2016

SCHEREN!

De leiding mag beginnen scheren. Om de evolutie goed op te kunnen volgen begint iedereen vanaf 0. Vanaf nu is het één maand gedaan met scheren.

November 2016

De actie

Gedurende de hele maand zullen hier update opkomen van de verschillende deelnemers. U kan ons intussen sponsoren door te storten zoals het hierboven beschreven staat.

30 november 2016

Het voorlopig resultaat

De eindfoto's komen online en de maand is achter de rug. Alsook zullen wij het finaal ingezamelde bedrag bekend maken.

18 - 24 december 2016

De Warmste Week

We doen nog even verder tot De Warmste Week. Tijdens deze week overhandigen wij ons geld aan Kom Op Tegen Kanker en loopt de actie finaal ten einde.

Word deel

van ons

verhaal!

Ons fantastisch Team

Wie is er zot genoeg om hieraan deel te nemen?

Wannes De Brouwer

Sloeber Leider

Bert Van Poecke

Sloeber Leider

Lennert De Pauw

Sloeber Leider

Arnaud Schockaert

Speelclub Leider

Ruben Van Bockstal

Speelclub Leider

Gianni Marckx

Rakker Leider

Wout Heynderickx

Rakker Leider

Vincent Van de Steen

Topper Leider

Jens Haegeman

Topper Leider

Toon Van Schuylenbergh

Kerel Leider

Björn Carré

Kerel Leider

Jannes De Kerpel

Aspi Leider

Jef Roosens

Aspi Leider

Steffen Roelandt

Oud Leider

Laurens Allart

Oud Leider

Mattias Van Bockstal

Oud Leider

Jens Van der Schueren

Oud Leider

Siegfried Mattys

Oud Leider

                    Copyright © Chiro Juventud Wichelen 2016

Kom Op Tegen Kanker

De Warmste Week

Project Name

Lorem ipsum dolor sit amet consectetur.

Use this area to describe your project. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Est blanditiis dolorem culpa incidunt minus dignissimos deserunt repellat aperiam quasi sunt officia expedita beatae cupiditate, maiores repudiandae, nostrum, reiciendis facere nemo!

                                    Want these icons in this portfolio item sample?You can download 60 of them for free, courtesy of RoundIcons.com, or you can purchase the 1500 icon set here.

Date: July 2014

Client: Round Icons

Category: Graphic Design

                                <button type="button" class="btn btn-primary" data-dismiss="modal"> Close Project</button>

Project Heading

Lorem ipsum dolor sit amet consectetur.

Startup Framework is a website builder for professionals. Startup Framework contains components and complex blocks (PSD+HTML Bootstrap themes and templates) which can easily be integrated into almost any design. All of these components are made in the same style, and can easily be integrated into projects, allowing you to create hundreds of solutions for your future projects.

You can preview Startup Framework here.

                                <button type="button" class="btn btn-primary" data-dismiss="modal"> Close Project</button>

Project Name

Lorem ipsum dolor sit amet consectetur.

Treehouse is a free PSD web template built by Mathavan Jaya. This is bright and spacious design perfect for people or startup companies looking to showcase their apps or other projects.

You can download the PSD template in this portfolio sample item at FreebiesXpress.com.

                                <button type="button" class="btn btn-primary" data-dismiss="modal"> Close Project</button>

Project Name

Lorem ipsum dolor sit amet consectetur.

Start Bootstrap's Agency theme is based on Golden, a free PSD website template built by Mathavan Jaya. Golden is a modern and clean one page web template that was made exclusively for Best PSD Freebies. This template has a great portfolio, timeline, and meet your team sections that can be easily modified to fit your needs.

You can download the PSD template in this portfolio sample item at FreebiesXpress.com.

                                <button type="button" class="btn btn-primary" data-dismiss="modal"> Close Project</button>

Project Name

Lorem ipsum dolor sit amet consectetur.

Escape is a free PSD web template built by Mathavan Jaya. Escape is a one page web template that was designed with agencies in mind. This template is ideal for those looking for a simple one page solution to describe your business and offer your services.

You can download the PSD template in this portfolio sample item at FreebiesXpress.com.

                                <button type="button" class="btn btn-primary" data-dismiss="modal"> Close Project</button>

Project Name

Lorem ipsum dolor sit amet consectetur.

Dreams is a free PSD web template built by Mathavan Jaya. Dreams is a modern one page web template designed for almost any purpose. It's a beautiful template that's designed with the Bootstrap framework in mind.

You can download the PSD template in this portfolio sample item at FreebiesXpress.com.

                                <button type="button" class="btn btn-primary" data-dismiss="modal"> Close Project</button>


text:
#include "squid.h"
#include "acl/RequestMimeType.h"
#include "acl/Checklist.h"
#include "acl/RegexData.h"

/* explicit template instantiation required for some systems */

template class ACLRequestHeaderStrategy<HDR_CONTENT_TYPE>;


text:
testinfra_hosts = ['example-group1']

def test_etc_molecule_example_group1(File):
    f = File('/etc/molecule/example-group1')

    assert f.is_file
    assert f.user == 'root'
    assert f.group == 'root'
    assert f.mode == 0o644
    assert f.contains('molecule example-group1 file')

def test_etc_molecule_example_group2(File):
    f = File('/etc/molecule/example-group2')

    assert not f.exists


text:
package cx.ath.matthew.cgi;

public class TextArea extends Field {
	String defval;
	int cols;
	int rows;

	public TextArea(String name, String label, String defval) {
		this(name, label, defval, 30, 4);
	}

	public TextArea(String name, String label, String defval, int cols, int rows) {
		this.name = name;
		this.label = label;
		if (null == defval)
			this.defval = "";
		else
			this.defval = defval;
		this.cols = cols;
		this.rows = rows;
	}

	protected String print() {
		return "<textarea name='" + name + "' cols='" + cols + "' rows='"
				+ rows + "'>" + defval + "</textarea>";
	}
}


text:
package builtin

import (
	"fmt"

	"github.com/jvikstedt/watchful"
)

type Equal struct{}

func (e Equal) Identifier() string {
	return "equal"
}

func (e Equal) Instruction() watchful.Instruction {
	return watchful.Instruction{
		Input: []watchful.Param{
			watchful.Param{Type: watchful.ParamInt, Name: "value", Required: true},
			watchful.Param{Type: watchful.ParamInt, Name: "actual", Required: true},
		},
		Output: []watchful.Param{},
	}
}

func (e Equal) Execute(params map[string]interface{}) (map[string]watchful.InputValue, error) {
	result := map[string]watchful.InputValue{}

	actual, ok := params["actual"].(int64)
	if !ok {
		return result, fmt.Errorf("Checker %s received unknown datatype %T", e.Identifier(), params["actual"])
	}

	value, ok := params["value"].(int64)
	if !ok {
		return result, fmt.Errorf("Checker %s received unknown datatype %T", e.Identifier(), params["value"])
	}

	if actual != value {
		return result, fmt.Errorf("Checker %s expected: %d got: %d", e.Identifier(), value, actual)
	}

	return result, nil
}


text:
package uk.fstr.darwingateway;

import org.apache.commons.net.PrintCommandListener;
import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPFile;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import uk.fstr.darwingateway.bindings.Association;
import uk.fstr.darwingateway.bindings.Pport;
import uk.fstr.darwingateway.bindings.Schedule;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;
import java.io.*;
import java.util.HashSet;
import java.util.concurrent.BlockingQueue;
import java.util.zip.GZIPInputStream;

/** Class that handles fetching snapshot files from the Darwin FTP server and splitting them up
 * into SnapshotMessageComponents for processing and passing on.
 *
 * @author George Goldberg <george@fasteroute.com>
 */
public class SnapshotFetcher implements Runnable {
    private final Logger log = LoggerFactory.getLogger(SnapshotFetcher.class);

    private final String ftpHost;
    private final String ftpUser;
    private final String ftpPass;
    private final BlockingQueue<SnapshotMessageComponent> outputQueue;

    private HashSet<String> processedSnapshots = new HashSet<String>();
    private final JAXBContext jaxbContext;

    public SnapshotFetcher(String ftpHost, String ftpUser, String ftpPass, BlockingQueue outputQueue) {
        this.ftpHost = ftpHost;
        this.ftpUser = ftpUser;
        this.ftpPass = ftpPass;
        this.outputQueue = outputQueue;

        JAXBContext jbc = null;
        try {
            jbc = JAXBContext.newInstance("uk.fstr.darwingateway.bindings");
        } catch (Exception e) {
            log.error("Could not build JAXB context");
        }
        jaxbContext = jbc;
    }

    public void run() {
        while (true) {
            try {
                Thread.sleep(60000);

                FTPClient client = new FTPClient();

                try {
                    //client.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out), true));
                    client.connect(ftpHost);
                    client.login(ftpUser, ftpPass);
                    client.enterLocalPassiveMode();
                    client.setFileType(FTP.BINARY_FILE_TYPE);
                    client.changeWorkingDirectory("snapshot");

                    FTPFile[] files = client.listFiles();
                    for (FTPFile file : files) {
                        if (!processedSnapshots.contains(""+file.getTimestamp().getTimeInMillis())) {
                            log.info("New snapshot found: " + file.getName());
                            if (file.getType() == FTPFile.FILE_TYPE) {
                                InputStream fileStream = client.retrieveFileStream(file.getName());
                                GZIPInputStream gzInStream = new GZIPInputStream(fileStream);
                                Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
                                Reader reader = new InputStreamReader(gzInStream, "UTF-8");
                                try {
                                    Pport pport = (Pport) unmarshaller.unmarshal(reader);
                                    if (pport != null && pport.getSR() != null && pport.getSR().getSchedule() != null && pport.getSR().getAssociation() != null) {
                                        for (Schedule s : pport.getSR().getSchedule()) {
                                            outputQueue.add(new SnapshotMessageComponent(
                                                    pport.getTs().toString(),
                                                    pport.getVersion(),
                                                    s,
                                                    null));
                                        }
                                        for (Association a : pport.getSR().getAssociation()) {
                                            outputQueue.add(new SnapshotMessageComponent(
                                                    pport.getTs().toString(),
                                                    pport.getVersion(),
                                                    null,
                                                    a
                                            ));
                                        }
                                        processedSnapshots.add(""+file.getTimestamp().getTimeInMillis());
                                    } else {
                                        log.error("Something is null in the snapshot message");
                                    }
                                } finally {
                                    reader.close();
                                }
                            }
                        }

                    }
                    client.logout();
                } catch (IOException e) {
                    e.printStackTrace();
                } finally {
                    try {
                        client.disconnect();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
            } catch (Exception e) {
                log.error("An exception occurred.", e);
            }
        }
    }
}


text:
module Ebay # :nodoc:
  module Types # :nodoc:
    # == Attributes
    #  text_node :product_identifier_unavailable_text, 'ProductIdentifierUnavailableText', :optional => true
    class ProductDetails
      include XML::Mapping
      include Initializer
      root_element_name 'ProductDetails'
      text_node :product_identifier_unavailable_text, 'ProductIdentifierUnavailableText', :optional => true
    end
  end
end


text:
var keyMirror = require('keymirror');

export default keyMirror({
  PROJECTS_GET_SUCCESS: null,
  PROJECTS_GET_ERROR: null,
  PROJECTS_CREATE: null,
  PROJECTS_UPDATED: null,
  PROJECT_DELETE: null
});


text:
package com.zxytech.designpatterns.gof.structuralpatterns.decoratorpattern;

/**
 * Created by ryan on 2016/12/18.
 */
public class Circle implements Shape {
    public void draw() {
        System.out.println("Shape: Circle");
    }
}


text:
<!DOCTYPE HTML>

<title>KHRPriorityHints (LWJGL 3.1.0 - OpenCL)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2016-10-30">
<link rel="stylesheet" type="text/css" href="../../../javadoc.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../jquery/jquery-ui.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Package

Class

Deprecated

Index

Prev Class

Next Class

Frames

No Frames

All Classes

SEARCH:
<input type="text" id="search" value=" " disabled="disabled">
<input type="reset" id="reset" value=" " disabled="disabled">

JavaScript is disabled on your browser.

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Package org.lwjgl.opencl

Class KHRPriorityHints

java.lang.Object

org.lwjgl.opencl.KHRPriorityHints

public final class KHRPriorityHints
extends java.lang.Object

Native bindings to the khr_priority_hints extension.

This extension adds priority hints for OpenCL, but does not specify the scheduling behavior or minimum guarantees. It is expected that the the user
 guides associated with each implementation which supports this extension describe the scheduling behavior guaranteed.

Field Summary

Fields

Modifier and Type
Field and Description

static int
CL_QUEUE_PRIORITY_HIGH_KHR

cl_queue_priority_khr

static int
CL_QUEUE_PRIORITY_KHR

cl_command_queue_properties

static int
CL_QUEUE_PRIORITY_LOW_KHR

CL_QUEUE_PRIORITY_MED_KHR

cl_queue_priority_khr

Method Summary

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

CL_QUEUE_PRIORITY_KHR

cl_command_queue_properties

CL_QUEUE_PRIORITY_HIGH_KHR, CL_QUEUE_PRIORITY_MED_KHR, CL_QUEUE_PRIORITY_LOW_KHR

cl_queue_priority_khr

Skip navigation links

Package

Class

Deprecated

Index

Prev Class

Next Class

Frames

No Frames

All Classes

JavaScript is disabled on your browser.

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Copyright LWJGL. All Rights Reserved. License terms.


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectModuleManager">
    <modules>
      <module fileurl="file://$PROJECT_DIR$/CalculatorAA.iml" filepath="$PROJECT_DIR$/CalculatorAA.iml" />
    </modules>
  </component>
</project>


text:
package org.antlr.v4.tool;

/** the various kinds of labels. t=type, id=ID, types+=type ids+=ID */
public enum LabelType {
    RULE_LABEL,
    TOKEN_LABEL,
    RULE_LIST_LABEL,
    TOKEN_LIST_LABEL,
    LEXER_STRING_LABEL;         // used in lexer for x='a'
}


text:
import gql from '../gql';

export const USER_FIELDS = gql`
  fragment UserFields on User {
    _id
    avatar
    avatarFile {
      _id
    }
    createdOn
    lastLoggedIn
    meta
    username
    isActivated
  }
`;


text:
package com.planet_ink.coffee_mud.Locales;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.core.collections.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.GridZones.XYVector;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.Basic.GenCage;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;

import java.util.*;

import com.planet_ink.coffee_mud.Libraries.interfaces.*;

public class StdGrid extends StdRoom implements GridLocale
{
	@Override
	public String ID()
	{
		return "StdGrid";
	}

	protected Room[][] 		  subMap=null;
	protected String[] 		  descriptions=new String[0];
	protected String[] 		  displayTexts=new String[0];
	protected List<CrossExit> gridexits=new SVector<CrossExit>();
	protected int xsize=5;
	protected int ysize=5;

	public StdGrid()
	{
		super();
		_roomID=getClass().getName().substring(getClass().getName().lastIndexOf('.')+1);
	}

	@Override
	protected void cloneFix(final Room E)
	{
		super.cloneFix(E);
		if(E instanceof StdGrid)
		{
			descriptions=((StdGrid)E).descriptions.clone();
			displayTexts=((StdGrid)E).displayTexts.clone();
			gridexits=new SVector<CrossExit>(((StdGrid)E).gridexits);
		}
	}

	@Override
	public String getGridChildLocaleID()
	{
		return "StdRoom";
	}

	@Override
	public int getGridSize()
	{
		return xsize * ysize;
	}

	@Override
	public Room getGridChild(final XYVector xy)
	{
		if(xy==null)
			return null;
		return this.getGridChild(xy.x,xy.y);
	}

	@Override
	public CMObject newInstance()
	{
		if(CMSecurity.isDisabled(CMSecurity.DisFlag.FATGRIDS))
		{
			String name=ID();
			if(!name.endsWith("Grid"))
				return super.newInstance();
			name=name.substring(0,name.length()-4)+"ThinGrid";
			final Room R=CMClass.getLocale(name);
			if(R==null)
				return super.newInstance();
			if(R instanceof StdGrid)
				return super.newInstance();
			return R.newInstance();
		}
		return super.newInstance();
	}

	@Override
	public void destroy()
	{
		super.destroy();
		if(subMap!=null)
		{
			for (final Room[] element : subMap)
			{
				for(int y=0;y<element.length;y++)
				{
					if(element[y]!=null)
						element[y].destroy();
				}
			}
		}
		subMap=null;
		descriptions=null;
		displayTexts=null;
		gridexits=null;
	}

	@Override
	public int xGridSize()
	{
		return xsize;
	}

	@Override
	public int yGridSize()
	{
		return ysize;
	}

	@Override
	public void setXGridSize(final int x)
	{
		if (x > 0)
			xsize = x;
	}

	@Override
	public void setYGridSize(final int y)
	{
		if (y > 0)
			ysize = y;
	}

	@Override
	public XYVector getRoomXY(final String roomID)
	{
		final Room room=CMLib.map().getRoom(roomID);
		if(room==null)
			return null;
		return getRoomXY(room);
	}

	@Override
	public XYVector getRoomXY(final Room room)
	{
		final Room[][] subMap=getBuiltGrid();
		if(subMap!=null)
		{
			for(int x=0;x<subMap.length;x++)
			{
				for(int y=0;y<subMap[x].length;y++)
				{
					if(subMap[x][y]==room)
						return new XYVector(x,y);
				}
			}
		}
		return null;
	}

	@Override
	public Room prepareRoomInDir(final Room fromRoom, final int direction)
	{
		if(amDestroyed)
		{
			final Room R=CMLib.map().getRoom(roomID());
			if(R!=null)
				return R.prepareRoomInDir(fromRoom,direction);
			return super.prepareRoomInDir(fromRoom,direction);
		}
		return getAltRoomFrom(fromRoom,direction);
	}

	@Override
	public Room prepareGridLocale(final Room fromRoom, final Room toRoom, final int direction)
	{
		return toRoom;
	}

	@Override
	public void setDescription(String newDescription)
	{
		super.setDescription(newDescription);
		final Vector<String> descriptions=new Vector<String>();
		int x=newDescription.toUpperCase().indexOf("<P>");
		while(x>=0)
		{
			final String s=newDescription.substring(0,x).trim();
			if(s.length()>0)
				descriptions.addElement(s);
			newDescription=newDescription.substring(x+3).trim();
			x=newDescription.toUpperCase().indexOf("<P>");
		}
		if(newDescription.length()>0)
			descriptions.addElement(newDescription);
		this.descriptions=descriptions.toArray(new String[0]);
	}

	@Override
	public void setDisplayText(String newDisplayText)
	{
		super.setDisplayText(newDisplayText);
		final Vector<String> displayTexts=new Vector<String>();
		int x=newDisplayText.toUpperCase().indexOf("<P>");
		while(x>=0)
		{
			final String s=newDisplayText.substring(0,x).trim();
			if(s.length()>0)
				displayTexts.addElement(s);
			newDisplayText=newDisplayText.substring(x+3).trim();
			x=newDisplayText.toUpperCase().indexOf("<P>");
		}
		if(newDisplayText.length()>0)
			displayTexts.addElement(newDisplayText);
		this.displayTexts=displayTexts.toArray(new String[0]);
	}

	@SuppressWarnings("unchecked")
	@Override
	public Iterator<CrossExit> outerExits()
	{
		if(gridexits==null)
			return EmptyIterator.INSTANCE;
		return gridexits.iterator();
	}

	@Override
	public void addOuterExit(final CrossExit x)
	{
		if((x!=null)&&(gridexits!=null))
			gridexits.add(x);
	}

	@Override
	public void delOuterExit(final CrossExit x)
	{
		if(gridexits != null)
			gridexits.remove(x);
	}

	public Room getAltRoomFrom(Room loc, final int direction)
	{
		if((loc==null)||(direction<0))
			return null;
		final int opDirection=Directions.getOpDirectionCode(direction);

		getBuiltGrid();
		Room[][] grid=null;
		final List<CrossExit> gridexits=this.gridexits;
		if((gridexits!=null)&&(gridexits.size()>0))
		{
			grid=getBuiltGrid();
			final String roomID=CMLib.map().getExtendedRoomID(loc);
			if(grid!=null)
			{
				for(int d=0;d<gridexits.size();d++)
				{
					final CrossExit EX=gridexits.get(d);
					if((!EX.out)
					&&(EX.destRoomID.equalsIgnoreCase(roomID))
					&&(EX.dir==direction)
					&&(EX.x>=0)&&(EX.y>=0)&&(EX.x<xGridSize())&&(EX.y<yGridSize())
					&&(grid[EX.x][EX.y]!=null))
						return grid[EX.x][EX.y];
				}
			}
		}

		final Room oldLoc=loc;
		if(loc.getGridParent()!=null)
			loc=loc.getGridParent();
		if((oldLoc!=loc)&&(loc instanceof GridLocale))
		{
			if(grid==null)
				grid=getBuiltGrid();
			if(grid!=null)
			{
				final XYVector xy=((GridLocale)loc).getRoomXY(oldLoc);
				if((xy!=null)&&(xy.x>=0)&&(xy.y>=0))
				{
					switch(opDirection)
					{
					case Directions.EAST:
						if((((GridLocale)loc).yGridSize()==yGridSize()))
							return grid[grid.length-1][xy.y];
						break;
					case Directions.WEST:
						if((((GridLocale)loc).yGridSize()==yGridSize()))
							return grid[0][xy.y];
						break;
					case Directions.NORTHWEST:
						return grid[0][0];
					case Directions.NORTHEAST:
						return grid[grid.length-1][0];
					case Directions.NORTH:
						if((((GridLocale)loc).xGridSize()==xGridSize()))
							return grid[xy.x][0];
						break;
					case Directions.SOUTH:
						if((((GridLocale)loc).xGridSize()==xGridSize()))
							return grid[xy.x][grid[0].length-1];
						break;
					case Directions.SOUTHEAST:
						return grid[grid.length-1][grid[0].length-1];
					case Directions.SOUTHWEST:
						return grid[0][grid[0].length-1];
					}
				}
			}
		}
		return findCenterRoom(opDirection);
	}

	protected Room[][] getBuiltGrid()
	{
		if(subMap==null)
			buildGrid();
		if(subMap!=null)
			return subMap.clone();
		return null;
	}

	@Override
	public Room getRandomGridChild()
	{
		final List<Room> V=getAllRooms();
		if(V.size()==0)
			return null;
		return V.get(CMLib.dice().roll(1,V.size(),-1));
	}

	@Override
	public List<Room> getAllRooms()
	{
		final Room[][] subMap=getBuiltGrid();
		if(subMap!=null)
		{
			final Vector<Room> roomsV=new Vector<Room>(subMap.length * ((subMap.length>0)?subMap[0].length:0));
			for (final Room[] element : subMap)
			{
				for(int y=0;y<element.length;y++)
				{
					final Room R=element[y];
					if(R!=null)
						roomsV.addElement(R);
				}
			}
			return roomsV;
		}
		return new Vector<Room>(0);
	}

	@Override
	public List<Room> getAllRoomsFilled()
	{
		final Room[][] subMap=getBuiltGrid();
		if(subMap!=null)
		{
			final Vector<Room> roomsV=new Vector<Room>(subMap.length * ((subMap.length>0)?subMap[0].length:0));
			for (final Room[] element : subMap)
			{
				for(int y=0;y<element.length;y++)
				{
					final Room R=element[y];
					if(R==null)
					{
						roomsV.clear();
						if(!this.amDestroyed())
						{
							CMLib.s_sleep(10);
							for (final Room[] element2 : getBuiltGrid())
							{
								for(int y2=0;y2<element2.length;y2++)
								{
									final Room R2=element[y2];
									if(R2==null)
										return this.getAllRooms(); // give up.
								}
							}
							return getAllRoomsFilled();
						}
						return roomsV;
					}
					if(!roomsV.contains(R))
					{
						roomsV.addElement(R);
						final List<Room> sky = R.getSky();
						if(sky == null)
							Log.errOut("No Sky for "+R.roomID());
						else
						{
							for(final Room R2 : sky)
							{
								if(R2 instanceof GridLocale)
								{
									for(final Room R3 : ((GridLocale)R2).getAllRoomsFilled())
									{
										if(!roomsV.contains(R3))
											roomsV.add(R3);
									}
								}
								else
								if(!roomsV.contains(R2))
									roomsV.add(R2);
							}
						}
					}
				}
			}
			return roomsV;
		}
		return new Vector<Room>(0);
	}

	private static final Iterator<Room> emptyIterator = new Iterator<Room>()
	{
		@Override
		public boolean hasNext()
		{
			return false;
		}

		@Override
		public Room next()
		{
			throw new NoSuchElementException();
		}

		@Override
		public void remove()
		{
			throw new NoSuchElementException();
		}
	};

	@Override
	public final Iterator<Room> getExistingRooms()
	{
		final Room[][] map=this.subMap;
		if(subMap!=null)
		{
			return new Iterator<Room>()
			{
				int x=0;
				int y=0;
				Room R=null;
				private void setRoom()
				{
					while(R==null)
					{
						while((x<map.length)&&(y>=map[x].length))
						{
							y=0;
							x++;
						}
						if(x>=map.length)
							return;
						if((x<map.length)&&(y<map[x].length))
							R=map[x][y];
						if(R==null)
							y++;
					}
				}

				@Override
				public boolean hasNext()
				{
					setRoom();
					return R != null;
				}

				@Override
				public Room next()
				{
					setRoom();
					final Room r = R;
					y++;
					R=null;
					setRoom();
					return r;
				}

				@Override
				public void remove()
				{
					throw new java.lang.UnsupportedOperationException();
				}
			};
		}
		return emptyIterator;
	}

	protected void halfLink(final Room room, final Room loc, final int dirCode, Exit o)
	{
		if(room==null)
			return;
		if(loc==null)
			return;
		if(room.rawDoors()[dirCode]!=null)
		{
			if(room.rawDoors()[dirCode].getGridParent()==null)
				return;
			if(room.rawDoors()[dirCode].getGridParent().isMyGridChild(room.rawDoors()[dirCode]))
				return;
			room.rawDoors()[dirCode]=null;
		}
		if(o==null)
			o=CMClass.getExit("Open");
		room.rawDoors()[dirCode]=alternativeLink(room,loc,dirCode);
		room.setRawExit(dirCode,o);
	}

	protected Room alternativeLink(final Room room, final Room defaultRoom, final int dir)
	{
		if((subMap!=null)&&(room.getGridParent()==this)&&(gridexits!=null))
		for(int d=0;d<gridexits.size();d++)
		{
			final CrossExit EX=gridexits.get(d);
			try
			{
				if((EX.out)&&(EX.dir==dir)
				&&(EX.x>=0)&&(EX.y>=0)&&(EX.x<xGridSize())&&(EX.y<yGridSize())
				&&(subMap[EX.x][EX.y]==room))
				{
					final Room R=CMLib.map().getRoom(EX.destRoomID);
					if(R!=null)
					{
						if(R.getGridParent()!=null)
							return R.getGridParent();
						return R;
					}
				}
			}
			catch(final Exception e)
			{
			}
		}
		return defaultRoom;
	}

	protected void linkRoom(final Room room, final Room loc, final int dirCode, Exit o, Exit ao)
	{
		if(loc==null)
			return;
		if(room==null)
			return;
		final int opCode=Directions.getOpDirectionCode(dirCode);
		if(room.rawDoors()[dirCode]!=null)
		{
			if(room.rawDoors()[dirCode].getGridParent()==null)
				return;
			if(room.rawDoors()[dirCode].getGridParent().isMyGridChild(room.rawDoors()[dirCode]))
				return;
			room.rawDoors()[dirCode]=null;
		}
		if(o==null)
			o=CMClass.getExit("Open");
		room.rawDoors()[dirCode]=alternativeLink(room,loc,dirCode);
		room.setRawExit(dirCode,o);
		if(loc.rawDoors()[opCode]!=null)
		{
			if(loc.rawDoors()[opCode].getGridParent()==null)
				return;
			if(loc.rawDoors()[opCode].getGridParent().isMyGridChild(loc.rawDoors()[opCode]))
				return;
			loc.rawDoors()[opCode]=null;
		}
		if(ao==null)
			ao=CMClass.getExit("Open");
		loc.rawDoors()[opCode]=alternativeLink(loc,room,opCode);
		loc.setRawExit(opCode,ao);
	}

	protected int[] initCenterRoomXY(final int dirCode)
	{
		final int[] xy=new int[2];
		switch(dirCode)
		{
		case Directions.NORTHEAST:
			xy[0]=xGridSize()-1;
			break;
		case Directions.NORTHWEST:
			break;
		case Directions.NORTH:
			xy[0]=xGridSize()/2;
			break;
		case Directions.SOUTHEAST:
			xy[1]=yGridSize()-1;
			xy[0]=xGridSize()-1;
			break;
		case Directions.SOUTHWEST:
			xy[1]=yGridSize()-1;
			break;
		case Directions.SOUTH:
			xy[0]=xGridSize()/2;
			xy[1]=yGridSize()-1;
			break;
		case Directions.EAST:
			xy[0]=xGridSize()-1;
			xy[1]=yGridSize()/2;
			break;
		case Directions.WEST:
			xy[1]=yGridSize()/2;
			break;
		default:
			xy[0]=xGridSize()/2;
			xy[1]=yGridSize()/2;
			break;
		}
		return xy;
	}

	private static int[][] XY_ADJUSTMENT_CHART=null;
	private static int[] XY_ADJUSTMENT_DEFAULT={1,1};
	protected int[] initCenterRoomAdjustsXY(final int dirCode)
	{
		if((dirCode<0)||(dirCode>=Directions.NUM_DIRECTIONS()))
			return XY_ADJUSTMENT_DEFAULT;
		if((XY_ADJUSTMENT_CHART!=null)&&(dirCode<XY_ADJUSTMENT_CHART.length))
			return XY_ADJUSTMENT_CHART[dirCode];

		final int[][] xy=new int[Directions.NUM_DIRECTIONS()][2];
		for(int d=Directions.NUM_DIRECTIONS()-1;d>=0;d--)
		{
			switch(d)
			{
			case Directions.NORTHEAST:
			case Directions.NORTH:
			case Directions.SOUTHEAST:
			case Directions.SOUTH:
				xy[d][0]=1;
				xy[d][1]=0;
				break;
			case Directions.NORTHWEST:
			case Directions.EAST:
			case Directions.SOUTHWEST:
			case Directions.WEST:
				xy[d][0]=0;
				xy[d][1]=1;
				break;
			default:
				xy[d][0]=1;
				xy[d][1]=1;
				break;
			}
		}
		XY_ADJUSTMENT_CHART=xy;
		return xy[dirCode];
	}

	protected Room findCenterRoom(final int dirCode)
	{
		final int[] xy=initCenterRoomXY(dirCode);
		final int[] adjXY=initCenterRoomAdjustsXY(dirCode);

		final Room returnRoom=null;
		int xadjust=0;
		int yadjust=0;
		boolean moveAndCheckAgain=true;
		while((subMap!=null)&&(moveAndCheckAgain))
		{
			moveAndCheckAgain=false;

			if(((xy[0]-xadjust)>=0)&&((xy[1]-yadjust)>=0))
			{
				moveAndCheckAgain=true;
				try
				{
					if(subMap[xy[0]-xadjust][xy[1]-yadjust]!=null)
						return subMap[xy[0]-xadjust][xy[1]-yadjust];
				}
				catch(final Exception e)
				{
				}
			}

			if(((xy[0]+xadjust)<xGridSize())&&((xy[1]+yadjust)<yGridSize()))
			{
				moveAndCheckAgain=true;
				try
				{
					if(subMap[xy[0]+xadjust][xy[1]+yadjust]!=null)
						return subMap[xy[0]+xadjust][xy[1]+yadjust];
				}
				catch(final Exception e)
				{
				}
			}
			if(moveAndCheckAgain)
			{
				xadjust+=adjXY[0];
				yadjust+=adjXY[1];
			}
		}
		return returnRoom;
	}

	protected void buildFinalLinks()
	{
		final Exit ox=CMClass.getExit("Open");
		for(int d=Directions.NUM_DIRECTIONS()-1;d>=0;d--)
		{
			if(d==Directions.GATE)
				continue;
			final Room dirRoom=rawDoors()[d];
			Exit dirExit=getRawExit(d);
			if((dirExit==null)||(dirExit.hasADoor()))
				dirExit=ox;
			if(dirRoom!=null)
			{
				Exit altExit=dirRoom.getRawExit(Directions.getOpDirectionCode(d));
				if(altExit==null)
					altExit=ox;
				switch(d)
				{
				case Directions.NORTH:
					for (final Room[] element : subMap)
						linkRoom(element[0],dirRoom,d,dirExit,altExit);
					break;
				case Directions.SOUTH:
					for (final Room[] element : subMap)
						linkRoom(element[element.length-1],dirRoom,d,dirExit,altExit);
					break;
				case Directions.NORTHEAST:
					linkRoom(subMap[subMap.length-1][0],dirRoom,d,dirExit,altExit);
					break;
				case Directions.NORTHWEST:
					linkRoom(subMap[0][0],dirRoom,d,dirExit,altExit);
					break;
				case Directions.SOUTHEAST:
					linkRoom(subMap[subMap.length-1][subMap[0].length-1],dirRoom,d,dirExit,altExit);
					break;
				case Directions.SOUTHWEST:
					linkRoom(subMap[0][subMap[0].length-1],dirRoom,d,dirExit,altExit);
					break;
				case Directions.EAST:
					for(int y=0;y<subMap[0].length;y++)
						linkRoom(subMap[subMap.length-1][y],dirRoom,d,dirExit,altExit);
					break;
				case Directions.WEST:
					for(int y=0;y<subMap[0].length;y++)
						linkRoom(subMap[0][y],dirRoom,d,dirExit,altExit);
					break;
				case Directions.UP:
					for (final Room[] element : subMap)
					{
						for(int y=0;y<element.length;y++)
							linkRoom(element[y],dirRoom,d,dirExit,altExit);
					}
					break;
				case Directions.DOWN:
					for (final Room[] element : subMap)
					{
						for(int y=0;y<element.length;y++)
							linkRoom(element[y],dirRoom,d,dirExit,altExit);
					}
					break;
				}
			}
		}
	}

	public void tryFillInExtraneousExternal(final CrossExit EX, Exit ox)
	{
		if(EX==null)
			return;
		Room linkFrom=null;
		if(subMap!=null)
			linkFrom=subMap[EX.x][EX.y];
		if(linkFrom!=null)
		{
			Room linkTo=CMLib.map().getRoom(EX.destRoomID);
			if((linkTo!=null)&&(linkTo.getGridParent()!=null))
				linkTo=linkTo.getGridParent();
			if((linkTo!=null)&&(linkFrom.rawDoors()[EX.dir]!=linkTo))
			{
				if(ox==null)
					ox=CMClass.getExit("Open");
				linkFrom.rawDoors()[EX.dir]=linkTo;
				linkFrom.setRawExit(EX.dir,ox);
			}
		}
	}

	public void fillInTheExtraneousExternals(final Room[][] subMap, final Exit ox)
	{
		if(subMap!=null)
		{
			for(int d=0;d<gridexits.size();d++)
			{
				final CrossExit EX=gridexits.get(d);
				try
				{
					if(!EX.out)
						continue;
					switch(EX.dir)
					{
					case Directions.NORTH:
						if(EX.y==0)
							tryFillInExtraneousExternal(EX,ox);
						break;
					case Directions.SOUTH:
						if(EX.y==yGridSize()-1)
							tryFillInExtraneousExternal(EX,ox);
						break;
					case Directions.EAST:
						if(EX.x==xGridSize()-1)
							tryFillInExtraneousExternal(EX,ox);
						break;
					case Directions.WEST:
						if(EX.x==0)
							tryFillInExtraneousExternal(EX,ox);
						break;
					case Directions.NORTHEAST:
						if((EX.y==0)&&(EX.x==xGridSize()-1))
							tryFillInExtraneousExternal(EX,ox);
						break;
					case Directions.SOUTHWEST:
						if((EX.y==yGridSize()-1)&&(EX.x==0))
							tryFillInExtraneousExternal(EX,ox);
						break;
					case Directions.NORTHWEST:
						if((EX.y==0)&&(EX.x==0))
							tryFillInExtraneousExternal(EX,ox);
						break;
					case Directions.SOUTHEAST:
						if((EX.y==yGridSize()-1)&&(EX.x==xGridSize()-1))
							tryFillInExtraneousExternal(EX,ox);
						break;
					}
				}
				catch (final Exception e)
				{
				}
			}
		}
	}

	@Override
	public void buildGrid()
	{
		clearGrid(null);
		try
		{
			subMap=new Room[xsize][ysize];
			final Exit ox=CMClass.getExit("Open");
			for(int x=0;x<subMap.length;x++)
			{
				for(int y=0;y<subMap[x].length;y++)
				{
					final Room newRoom=getGridRoom(x,y);
					if(newRoom!=null)
					{
						if((y>0)&&(subMap[x][y-1]!=null))
							linkRoom(newRoom,subMap[x][y-1],Directions.NORTH,ox,ox);
						if((x>0)&&(subMap[x-1][y]!=null))
							linkRoom(newRoom,subMap[x-1][y],Directions.WEST,ox,ox);
						if(Directions.NORTHEAST<Directions.NUM_DIRECTIONS())
						{
							if((y>0)&&(x>0)&&(subMap[x-1][y-1]!=null))
								linkRoom(newRoom,subMap[x-1][y-1],Directions.NORTHWEST,ox,ox);
							if(((y+1)<subMap[x].length)&&(x>0)&&(subMap[x-1][y+1]!=null))
								linkRoom(newRoom,subMap[x-1][y+1],Directions.SOUTHWEST,ox,ox);
						}
					}
				}
			}
			buildFinalLinks();
			fillInTheExtraneousExternals(subMap,ox);
		}
		catch(final Exception e)
		{
			Log.errOut("StdGrid",e);
			clearGrid(null);
		}
	}

	@Override
	public boolean isMyGridChild(final Room loc)
	{
		final Room[][] subMap=getBuiltGrid();
		if(subMap!=null)
		{
			for (final Room[] element : subMap)
			{
				for(int y=0;y<element.length;y++)
				{
					final Room room=element[y];
					if(room==loc)
						return true;
				}
			}
		}
		return false;
	}

	@Override
	public void clearGrid(final Room backHere)
	{
		try
		{
			if(subMap!=null)
			{
				for (final Room[] element : subMap)
				{
					for(int y=0;y<element.length;y++)
					{
						final Room room=element[y];
						if(room!=null)
						{
							while(room.numInhabitants()>0)
							{
								final MOB M=room.fetchInhabitant(0);
								if(M!=null)
								{
									if(backHere!=null)
										backHere.bringMobHere(M,true);
									else
									if((M.getStartRoom()==null)
									||(M.getStartRoom()==room))
										M.destroy();
									else
									if((M.getStartRoom().ID().length()==0)
									&&(M.isMonster())
									&&((M.amFollowing()==null)||(M.amUltimatelyFollowing().isMonster())))
										M.destroy();
									else
										M.getStartRoom().bringMobHere(M,true);
									if(room.isInhabitant(M))
									{
										if(M.isMonster())
											M.destroy();
										M.setLocation(null);
										if(room.isInhabitant(M))
											room.delInhabitant(M);
									}
								}
							}
							while(room.numItems()>0)
							{
								final Item I=room.getItem(0);
								if(I!=null)
								{
									if(backHere!=null)
										backHere.moveItemTo(I,ItemPossessor.Expire.Player_Drop,ItemPossessor.Move.Followers);
									else
									if((I instanceof PrivateProperty)&&(((PrivateProperty)I).getOwnerName().length()>0))
									{
										final Room R=CMLib.map().getSafeRoomToMovePropertyTo(room, (PrivateProperty)I);
										if((R!=null)&&(R!=room))
											R.moveItemTo(I);
									}
									else
										I.destroy();
									if(room.isContent(I))
									{
										if((I instanceof PrivateProperty)&&(((PrivateProperty)I).getOwnerName().length()>0))
											room.delItem(I);
										else
											I.destroy();
										I.destroy();
										if(room.isContent(I))
										{
											I.setOwner(null);
											room.delItem(I);
										}
									}
								}
							}
							room.clearSky();
							room.destroy();
							room.setGridParent(null);
						}
					}
				}
			}
			subMap=null;
		}
		catch (final Exception e)
		{
		}
	}

	@Override
	public String getGridChildCode(final Room loc)
	{
		final Room[][] subMap=getBuiltGrid();
		if(subMap!=null)
		{
			for(int x=0;x<subMap.length;x++)
			{
				for(int y=0;y<subMap[x].length;y++)
				{
					if(subMap[x][y]==loc)
						return roomID()+"#("+x+","+y+")";
				}
			}
		}
		return "";

	}

	@Override
	public int getGridChildX(final Room loc)
	{
		if(roomID().length()==0)
			return -1;
		final Room[][] subMap=getBuiltGrid();
		if(subMap!=null)
		{
			for(int x=0;x<subMap.length;x++)
			{
				for(int y=0;y<subMap[x].length;y++)
				{
					if(subMap[x][y]==loc)
						return x;
				}
			}
		}
		return -1;
	}

	@Override
	public int getGridChildY(final Room loc)
	{
		if(roomID().length()==0)
			return -1;
		final Room[][] subMap=getBuiltGrid();
		if(subMap!=null)
		{
			for (final Room[] element : subMap)
			{
				for(int y=0;y<element.length;y++)
				{
					if(element[y]==loc)
						return y;
				}
			}
		}
		return -1;
	}

	@Override
	public Room getGridChild(final String childCode)
	{
		if(childCode.equalsIgnoreCase(roomID()))
			return this;
		if(!childCode.toUpperCase().startsWith(roomID().toUpperCase()+"#("))
			return null;
		final int len=roomID().length()+2;
		final int comma=childCode.indexOf(',',len);
		if(comma<0)
			return null;
		final Room[][] subMap=getBuiltGrid();
		final int x=CMath.s_int(childCode.substring(len,comma));
		final int y=CMath.s_int(childCode.substring(comma+1,childCode.length()-1));
		if(subMap!=null)
		if((x<subMap.length)&&(y<subMap[x].length))
			return subMap[x][y];
		return null;
	}

	@Override
	public Room getGridChild(final int x, final int y)
	{
		if((subMap==null)
		||(x<0)
		||(y<0)
		||(x>=subMap.length)
		||(y>=subMap[x].length))
			return null;
		return subMap[x][y];
	}

	protected Room getGridRoom(final int x, final int y)
	{
		if(subMap==null)
			subMap=new Room[xsize][ysize];
		if((x<0)||(y<0)||(y>=subMap[0].length)||(x>=subMap.length))
			return null;
		final Room gc=CMClass.getLocale(getGridChildLocaleID());
		gc.setRoomID("");
		gc.setGridParent(this);
		subMap[x][y]=gc;
		gc.setArea(getArea());
		gc.setDisplayText(displayText());
		gc.setDescription(description());
		int c=-1;
		if(displayTexts!=null)
		if(displayTexts.length>0)
		{
			c=CMLib.dice().roll(1,displayTexts.length,-1);
			gc.setDisplayText(displayTexts[c]);
		}
		if(descriptions!=null)
		if(descriptions.length>0)
		{
			if((c<0)||(c>descriptions.length)||(descriptions.length!=displayTexts.length))
				c=CMLib.dice().roll(1,descriptions.length,-1);
			gc.setDescription(descriptions[c]);
		}

		for(final Enumeration<Ability> a=effects();a.hasMoreElements();)
			gc.addEffect((Ability)a.nextElement().copyOf());
		if(behaviors != null)
		{
			for(final Behavior B : behaviors)
				gc.addBehavior((Behavior)B.copyOf());
		}
		return gc;
	}

	@Override
	public boolean okMessage(final Environmental myHost, final CMMsg msg)
	{
		if(!super.okMessage(myHost,msg))
			return false;

		if((msg.targetMinor()==CMMsg.TYP_ENTER)
		&&(msg.target()==this))
		{
			final MOB mob=msg.source();
			if((mob.location()!=null)&&(mob.location().roomID().length()>0))
			{
				int direction=-1;
				for(int d=Directions.NUM_DIRECTIONS()-1;d>=0;d--)
				{
					if(mob.location().getRoomInDir(d)==this)
						direction=d;
				}
				if(direction<0)
				{
					mob.tell(L("Some great evil is preventing your movement that way."));
					return false;
				}
				msg.modify(msg.source(),
						   getAltRoomFrom(mob.location(),direction),
						   msg.tool(),
						   msg.sourceCode(),
						   msg.sourceMessage(),
						   msg.targetCode(),
						   msg.targetMessage(),
						   msg.othersCode(),
						   msg.othersMessage());
			}
		}
		return true;
	}

	private final static String[] MYCODES={"XSIZE","YSIZE"};

	@Override
	public String getStat(final String code)
	{
		switch(getStdGridCodeNum(code))
		{
		case 0:
			return Integer.toString(xGridSize());
		case 1:
			return Integer.toString(yGridSize());
		default:
			return super.getStat(code);
		}
	}

	@Override
	public void setStat(final String code, final String val)
	{
		switch(getStdGridCodeNum(code))
		{
		case 0:
			setXGridSize(CMath.s_parseIntExpression(val));
			break;
		case 1:
			setYGridSize(CMath.s_parseIntExpression(val));
			break;
		default:
			super.setStat(code, val);
			break;
		}
	}

	protected int getStdGridCodeNum(final String code)
	{
		for(int i=0;i<MYCODES.length;i++)
		{
			if(code.equalsIgnoreCase(MYCODES[i]))
				return i;
		}
		return -1;
	}

	private static String[] codes=null;

	@Override
	public String[] getStatCodes()
	{
		return (codes != null) ? codes : (codes =  CMProps.getStatCodesList(CMParms.appendToArray(STDCODES, MYCODES),this));
	}
}


text:
class ApplicationController < ActionController::Base
  # Prevent CSRF attacks by raising an exception.
  # For APIs, you may want to use :null_session instead.
  # protect_from_forgery with: :null_session

  # Add this before action to force CAS Authentication on all controllers + actions
  before_action CASClient::Frameworks::Rails::Filter, unless: :skip_login?

  # Add this before action to set a local variable for the current user from CAS session
  before_action :getMe

  after_filter :set_access_control_headers

  def set_access_control_headers
    headers['Access-Control-Allow-Origin'] = '*'
    headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS'
    headers['Access-Control-Request-Method'] = '*'
    headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'
  end

  protected

  def getMe
    current_user = User.find_or_create_by(netid: session[:cas_user])
    if !current_user
      redirect_to :root
      return false
    end
  end

  # hack for skip_before_action with CAS
  # overwrite this method (with 'true') in any controller to skip CAS auth
  def skip_login?
    false
  end
end


text:
(function() {
  var APIBlueprintGenerator;

  require("mustache.js");

  APIBlueprintGenerator = function() {
    this.response = function(exchange) {
      var body, body_indentation, has_body, has_headers, headers, key, value, _ref;
      if (!exchange) {
        return null;
      }
      headers = [];
      _ref = exchange.responseHeaders;
      for (key in _ref) {
        value = _ref[key];
        if (key === 'Content-Type' || key === 'Connection' || key === 'Date' || key === 'Via' || key === 'Server' || key === 'Content-Length') {
          continue;
        }
        headers.push({
          key: key,
          value: value
        });
      }
      has_headers = headers.length > 0;
      body = exchange.responseBody;
      has_body = body.length > 0;
      if (has_body) {
        body_indentation = '        ';
        if (has_headers) {
          body_indentation += '    ';
        }
        body = body.replace(/^/gm, body_indentation);
      }
      return {
        statusCode: exchange.responseStatusCode,
        contentType: exchange.responseHeaders['Content-Type'],
        "headers?": has_headers,
        headers: headers,
        "body?": has_headers && has_body,
        body: body
      };
    };
    this.request = function(paw_request) {
      var body, body_indentation, has_body, has_headers, headers, key, value, _ref;
      headers = [];
      _ref = paw_request.headers;
      for (key in _ref) {
        value = _ref[key];
        if (key === 'Content-Type') {
          continue;
        }
        headers.push({
          key: key,
          value: value
        });
      }
      has_headers = headers.length > 0;
      body = paw_request.body;
      has_body = body.length > 0;
      if (has_body) {
        body_indentation = '        ';
        if (has_headers) {
          body_indentation += '    ';
        }
        body = body.replace(/^/gm, body_indentation);
      }
      if (has_headers || has_body || paw_request.headers['Content-Type']) {
        return {
          "headers?": has_headers,
          headers: headers,
          contentType: paw_request.headers['Content-Type'],
          "body?": has_headers && has_body,
          body: body
        };
      }
    };
    this.path = function(url) {
      var path;
      path = url.replace(/^https?:\/\/[^\/]+/i, '');
      if (!path) {
        path = '/';
      }
      return path;
    };
    this.generate = function(context) {
      var paw_request, template, url;
      paw_request = context.getCurrentRequest();
      url = paw_request.url;
      template = readFile("apiblueprint.mustache");
      return Mustache.render(template, {
        method: paw_request.method,
        path: this.path(url),
        request: this.request(paw_request),
        response: this.response(paw_request.getLastExchange())
      });
    };
  };

  APIBlueprintGenerator.identifier = "io.apiary.PawExtensions.APIBlueprintGenerator";

  APIBlueprintGenerator.title = "API Blueprint Generator";

  registerCodeGenerator(APIBlueprintGenerator);

}).call(this);


text:
//
//  TSCTableInputSliderRowDataSource.h
//  ThunderTable
//
//  Created by Matt Cheetham on 03/04/2014.
//  Copyright (c) 2014 3 SIDED CUBE. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "TSCTableInputRowDataSource.h"

/**
 The `TSCTableInputSliderRowDataSource` inhertis the `TSCTableInputRowDataSource` protocol and is specific to slider input types.
 */
@protocol TSCTableInputSliderRowDataSource <TSCTableInputRowDataSource>

///---------------------------------------------------------------------------------------
/// @name General setup
///---------------------------------------------------------------------------------------

/**
 @abstract The maximum value the slider can reach
 */
- (NSNumber *)maximumValue;

/**
 @abstract The minimum value the slider can reach
 */
- (NSNumber *)minimumValue;

@end


text:
require 'constants'

require 'json'
require 'paint'
require 'rexml/document'
require 'rexml/formatters/pretty'

module Thoom
  class OutputBuilder
    attr_accessor :colors, :title_output, :response_time

    def initialize(colors)
      @colors = colors
      @output = ''
    end

    def title(centered = true)
      return if title_output

      client_copy = "Thoom::RestUp v#{Thoom::Constants::VERSION}"
      author_copy = '@author Z.d. Peacock <zdp@thoomtech.com>'
      link_copy   = '@link http://github.com/thoom/restup'

      if centered
        max         = [client_copy.length, author_copy.length, link_copy.length].max + 2
        client_copy = client_copy.center(max, ' ')
        author_copy = author_copy.center(max, ' ')
        link_copy   = link_copy.center(max, ' ')
      end

      @title_output = true
      puts "\n",
           Paint[client_copy, colors[:title_color], colors[:title_bgcolor]],
           Paint[author_copy, colors[:subtitle_color], colors[:subtitle_bgcolor]],
           Paint[link_copy, colors[:subtitle_color], colors[:subtitle_bgcolor]]
    end

    def header(h)
      len = Paint.unpaint(h).length
      l   = '-' * len
      puts "\n#{h}\n#{l}\n"
    end

    def help(config_file, opts)
      title
      section 'How to use RestUp'

      puts <<TEXT
RestUp works out of the box with APIs that use Basic Authentication (though this is not required).
To use other forms of authentication, custom headers can either be passed with each request
or stored in the config file as described below.

If a #{Paint[config_file, colors[:help_filename]]} file exists, the client will pull in defaults and provide several shortcut methods
that can simplify using a REST-based API.

If the API uses form encoded input, you can define your post in JSON format. The client
will encode it automatically.
TEXT

      section 'Console'
      puts opts

      section 'YAML config'
      puts <<TEXT
If a file is not passed in with the `-c, --config` flag, then it will use the default #{Paint[config_file, colors[:help_filename]]}.
The client uses two different methods to find the YAML configuration file. It will
first look in the current directory. If it is not present, it will then look in the current user's
home directory.

This makes it possible to use restup to connect to different APIs simply by changing folders.

KEY          DESC
----         -----
user:       The username. Default: blank, so disable Basic Authentication
pass:       The password. Default: blank, so disable Basic Authentication

url:        The base REST url
json:       The default JSON MIME type. Default: "application/json"
xml:        The default XML MIME type.  Default: "application/xml"

colors:     Hash of default color values
  success:  Color to highlight successful messages.  Default: :green
  warning:  Color to highlight warning messages.     Default: :yellow
  info:     Color to highlight info messages.        Default: :yellow
  error:    Color to highlight error messages.       Default :red

flags:      Default command line options
  display:  What to display by default.
            Values: concise, response_only, response_code_only, succcess_only, verbose
            Default: response_only

headers:    Hash of default headers. Useful for custom headers or headers used in every request.
timeout:    The number of seconds to wait for a response before timing out. Default: 300
tls_verify: Whether or not to verify TLS (SSL) certificates.  Values: true, false.  Default: true

xmethods:   Array of nonstandard methods that are accepted by the API. To use these methods the
            API must support X-HTTP-Method-Override.
TEXT

      section 'Examples'

      header 'GET Request'

      puts <<TEXT
The YAML config:
url: http://example.com/api
user: myname
pass: P@ssWord

#{Paint['restup -j /hello/world', colors[:help_sample_request]]}

To use without the config:
#{Paint['restup -u myname -p P@ssWord -j http://example.com/api/hello/world', colors[:help_sample_request]]}

Submits a GET request to #{Paint['http://example/api/hello/world', colors[:help_sample_url]]} with Basic Auth header using the
user and pass values in the config.

It would return JSON values. If successful, the JSON would be parsed and highlighted in #{Paint[colors[:success].to_s.upcase, colors[:success]]}. If
the an error was returned (an HTTP response code >= 400), the body would be in #{Paint[colors[:error].to_s.upcase, colors[:error]]}.
TEXT

      header 'POST Request'

      puts <<TEXT
The YAML config:
url: http://example.com/api
user: myname
pass: P@ssWord
headers:
  X-Custom-Id: abc12345

#{Paint['restup -m post -j /hello/world < salutation.json', colors[:help_sample_request]]}

Submits a POST request to #{Paint['http://example/api/hello/world', colors[:help_sample_url]]} with Basic Auth header
using the user and pass values in the config. It imports the salutation.json and passes it to the API as application/json
content type. It would also set the X-Custom-Id header with every request.

It would return JSON values. If successful, the JSON would be parsed and highlighted in #{Paint[colors[:success].to_s.upcase, colors[:success]]}. If
the an error was returned (an HTTP response code >= 400), the body would be in #{Paint[colors[:error].to_s.upcase, colors[:error]]}.
TEXT
      exit
    end

    def section(h)
      len = Paint.unpaint(h).length
      l   = '-' * (len + 4)
      puts "\n#{l}\n| #{h} |\n#{l}\n"
    end

    def xp(xml_text)
      out = ''

      formatter = REXML::Formatters::Pretty.new
      formatter.compact = true
      formatter.write(REXML::Document.new(xml_text), out)
      out
    end

    def request(client, request, verbose)
      path  = client.uri.path
      query = ''
      query += '?' + client.uri.query if client.uri.query

      port_color      = client.uri.port == 80 ? :request_port_http : :request_port_tls
      request_section = "REQUEST: #{Paint[client.method.upcase, colors[:request_method]]} "
      request_section += Paint["#{client.uri.host}:", colors[:request_path]]
      request_section += Paint[client.uri.port.to_s, colors[port_color]]
      request_section += Paint[path, colors[:request_path]]
      request_section += Paint[query, colors[:request_endpoint]]

      unless request.respond_to? 'each_header'
        header 'MALFORMED REQUEST'
        quit Paint[request, colors[:error]]
      end

      if verbose
        section request_section if verbose

        header 'HEADERS'
        request.each_header { |k, v| puts "#{k}: #{v}\n" }

        if client.data
          header 'BODY'

          begin
            puts %w(UTF-8 ASCII-8BIT).include?(client.data.encoding.to_s) ? client.data : client.data.encode('ASCII-8BIT')
          rescue EncodingError
            puts "Data posted, but contains non-UTF-8 data, so it's not echoed here."
          end
        end
      else
        puts "\n#{request_section}"
      end
    end

    def response(response, verbose)
      response_color   = response.code.to_i < 400 ? colors[:success] : colors[:error]
      response_section = "RESPONSE: #{Paint[response.code, response_color]} (#{response_time} sec)"

      if verbose || response_color == colors[:error]
        section response_section
        header 'HEADERS'
        response.each_header { |k, v| puts "#{k}: #{v}\n" }
      else
        puts response_section
      end

      header 'BODY' if verbose
      puts 'BODY:' unless verbose

      if !response.body || response.body.empty?
        puts Paint['NONE', colors[:info]]
      else
        body = response.body
        begin
          body.encode!('ASCII-8BIT') if body.encoding.to_s != 'ASCII-8BIT'

          body = if response['content-type'].nil?
                   body
                 elsif response['content-type'].include? 'json'
                   JSON.pretty_unparse(JSON.parse(body))
                 elsif response['content-type'].include? 'xml'
                   xp(body)
                 else
                   body
             end
          puts Paint[body, response_color]
        rescue EncodingError
          puts Paint["RESPONSE contains non-UTF-8 data, so it's not echoed here.", colors[:info]]
        end
      end
    end

    def save_response(response, content_disposition, output)
      if content_disposition && output.nil? && response.to_hash.key?('content-disposition')
        cd = response['content-disposition']
        output = cd[cd.index('filename=') + 9..-1]
      end

      unless output.nil?
        file = File.expand_path(output)
        if File.exist?(File.dirname(file))
          File.open(file, 'w') { |f| f.write response.body }
          puts Paint["Response written to file: #{file}", colors[:info]]
        else
          puts Paint["Could not write to file #{file}", colors[:error]]
        end
      end
    end

    def quit(content, centered = true)
      title(centered)
      puts "\n#{content}"
      exit
    end
  end

  # Sets up the default color set
  class DefaultOutputBuilder < OutputBuilder
    def initialize
      colors = {
        title_color: '4D7326',
        title_bgcolor: :white,

        subtitle_color: :white,
        subtitle_bgcolor: '4D7326',

        help_filename: :yellow,
        help_sample_request: :magenta,
        help_sample_url: :blue,

        request_method: :cyan,
        request_path: '813b5e',
        request_port_http: '813b5e',
        request_port_tls: '264d73',
        request_endpoint: :yellow,

        success: '277326',
        warning: :yellow,
        info: :yellow,
        error: 'c20f12'
      }
      super(colors)
    end
  end

  # Outputs just the basic default colors
  class SimpleOutputBuilder < OutputBuilder
    def initialize
      colors = {
        subtitle_color: :default,
        subtitle_bgcolor: :default,
        title_color: :default,
        title_bgcolor: :default
      }
      super(colors)
    end
  end
end


text:
using System;
using System.Collections.Generic;

namespace LightBDD.Results
{
    /// <summary>
    /// Interface describing scenario test result.
    /// </summary>
    public interface IScenarioResult
    {
        /// <summary>
        /// [Label] attribute associated to scenario.
        /// </summary>
        string Label { get; }

        /// <summary>
        /// Scenario name.
        /// </summary>
        string Name { get; }

        /// <summary>
        /// Scenario status.
        /// </summary>
        ResultStatus Status { get; }

        /// <summary>
        /// Status details.
        /// It is useful for ignored or failed tests.
        /// It may be null if no additional details are provided.
        /// </summary>
        string StatusDetails { get; }

        /// <summary>
        /// Scenario steps.
        /// </summary>
        IEnumerable<IStepResult> Steps { get; }

        /// <summary>
        /// Scenario execution time.
        /// Null if scenario was not run.
        /// </summary>
        TimeSpan? ExecutionTime { get; }

        /// <summary>
        /// Time when scenario execution started.
        /// Null if scenario was not run.
        /// </summary>
        DateTimeOffset? ExecutionStart { get; }

        /// <summary>
        /// Returns categories associated with scenario.
        /// </summary>
        IEnumerable<string> Categories { get; }
    }
}


text:
layout: post
title: SANS Christmas Challenge 2014 Write-Up
category: PDF
tags: SANS
comments: true
---

This is a post to my Write-Up for the SANS Christmas Challenge 2014. The challenge is of 4 levels, including basics of exploitation, web application security and forensics.
The challenge is still up and running for enthusiasts wanting to give it a try.

[Link to SANS Challenge Website](http://pen-testing.sans.org/holiday-challenge/2014)
[Link to my Write-Up]({{ site.url }}/assets/tschoranov 2014 writeup.pdf)

Unfortunately I didn't win, however I did made it to the "Really Honorable Mentions" ;).
[Link to Winners](http://pen-testing.sans.org/blog/pen-testing/2015/02/04/2014-sans-holiday-hack-winners-and-official-answers)


text:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:state_pressed="true"
        android:color="@color/common_signin_btn_dark_text_pressed" />
    <item
        android:state_enabled="false"
        android:state_focused="true"
        android:color="@color/common_signin_btn_dark_text_disabled" />
    <item
        android:state_focused="true"
        android:color="@color/common_signin_btn_dark_text_focused" />
    <item
        android:state_enabled="false"
        android:color="@color/common_signin_btn_dark_text_disabled" />
    <item
        android:color="@color/common_signin_btn_dark_text_default" />
</selector>
<!-- From: file:/C:/Users/Alex/Google%20Drive/CS/GitHub/PersonalProjects/HastingsCollegeProject/GooglePlayServices/src/main/res/color/common_signin_btn_text_dark.xml -->


text:
"use strict";
var $ = require("jquery"),
    Class = require("../../core/class"),
    errors = require("../widget/ui.errors"),
    dateUtils = require("../../core/utils/date");
var abstract = Class.abstract;
var APPOINTMENT_MIN_SIZE = 2,
    COMPACT_APPOINTMENT_DEFAULT_SIZE = 15,
    COMPACT_APPOINTMENT_DEFAULT_OFFSET = 3;
var BaseRenderingStrategy = Class.inherit({
    ctor: function(instance) {
        this.instance = instance
    },
    getAppointmentMinSize: function() {
        return APPOINTMENT_MIN_SIZE
    },
    getDeltaTime: abstract,
    getAppointmentGeometry: function(coordinates) {
        return coordinates
    },
    createTaskPositionMap: function(items) {
        var length = items.length;
        if (!length) {
            return
        }
        this._defaultWidth = this.instance._cellWidth;
        this._defaultHeight = this.instance._cellHeight;
        this._allDayHeight = this.instance._allDayCellHeight;
        var map = [];
        for (var i = 0; i < length; i++) {
            var coordinates = this._getItemPosition(items[i]);
            if (this._isRtl()) {
                coordinates = this._correctRtlCoordinates(coordinates)
            }
            map.push(coordinates)
        }
        var positionArray = this._getSortedPositions(map),
            resultPositions = this._getResultPositions(positionArray);
        return this._getExtendedPositionMap(map, resultPositions)
    },
    _getDeltaWidth: function(args, initialSize) {
        var cellWidth = this._defaultWidth || this.getAppointmentMinSize(),
            initialWidth = initialSize.width;
        return Math.round((args.width - initialWidth) / cellWidth)
    },
    _correctRtlCoordinates: function(coordinates) {
        var width = coordinates[0].width || this._getAppointmentMaxWidth();
        if (!coordinates[0].appointmentReduced) {
            coordinates[0].left -= width
        }
        this._correctRtlCoordinatesParts(coordinates, width);
        return coordinates
    },
    _correctRtlCoordinatesParts: $.noop,
    _getAppointmentMaxWidth: function() {
        return this._defaultWidth
    },
    _getItemPosition: function(item) {
        var position = this._getAppointmentCoordinates(item),
            allDay = this.isAllDay(item),
            result = [],
            startDate = this.instance.invoke("getField", "startDate", item);
        for (var j = 0; j < position.length; j++) {
            var height = this.calculateAppointmentHeight(item, position[j]),
                width = this.calculateAppointmentWidth(item, position[j]),
                resultWidth = width,
                appointmentReduced = null,
                multiWeekAppointmentParts = [];
            if (this._needVerifyItemSize() || allDay) {
                var currentMaxAllowedPosition = position[j].hMax;
                if (this.isAppointmentGreaterThan(currentMaxAllowedPosition, {
                        left: position[j].left,
                        width: width
                    })) {
                    appointmentReduced = "head";
                    resultWidth = this._reduceMultiWeekAppointment(width, {
                        left: position[j].left,
                        right: currentMaxAllowedPosition
                    });
                    multiWeekAppointmentParts = this._getAppointmentParts({
                        sourceAppointmentWidth: width,
                        reducedWidth: resultWidth,
                        height: height
                    }, position[j], startDate, j);
                    if (this._isRtl()) {
                        position[j].left = currentMaxAllowedPosition
                    }
                }
            }
            $.extend(position[j], {
                height: height,
                width: resultWidth,
                allDay: allDay,
                appointmentReduced: appointmentReduced
            });
            result = this._getAppointmentPartsPosition(multiWeekAppointmentParts, position[j], result)
        }
        return result
    },
    _getAppointmentPartsPosition: function(appointmentParts, position, result) {
        if (appointmentParts.length) {
            appointmentParts.unshift(position);
            result = result.concat(appointmentParts)
        } else {
            result.push(position)
        }
        return result
    },
    _getAppointmentCoordinates: function(itemData) {
        var coordinates = [{
            top: 0,
            left: 0
        }];
        this.instance.notifyObserver("needCoordinates", {
            startDate: this._startDate(itemData),
            originalStartDate: this._startDate(itemData, true),
            appointmentData: itemData,
            callback: function(value) {
                coordinates = value
            }
        });
        return coordinates
    },
    _needVerifyItemSize: function() {
        return false
    },
    _isRtl: function() {
        return this.instance.option("rtlEnabled")
    },
    _getAppointmentParts: function() {
        return []
    },
    _getCompactAppointmentParts: function(appointmentWidth) {
        var cellWidth = this._defaultWidth || this.getAppointmentMinSize();
        return Math.round(appointmentWidth / cellWidth)
    },
    _reduceMultiWeekAppointment: function(sourceAppointmentWidth, bound) {
        if (this._isRtl()) {
            sourceAppointmentWidth = Math.floor(bound.left - bound.right)
        } else {
            sourceAppointmentWidth = bound.right - Math.floor(bound.left)
        }
        return sourceAppointmentWidth
    },
    calculateAppointmentHeight: function() {
        return 0
    },
    calculateAppointmentWidth: function() {
        return 0
    },
    isAppointmentGreaterThan: function(etalon, comparisonParameters) {
        var result = comparisonParameters.left + comparisonParameters.width - etalon;
        if (this._isRtl()) {
            result = etalon + comparisonParameters.width - comparisonParameters.left
        }
        return result > this._defaultWidth / 2
    },
    isAllDay: function() {
        return false
    },
    _getSortedPositions: function(arr) {
        var result = [],
            __tmpIndex = 0;
        for (var i = 0, arrLength = arr.length; i < arrLength; i++) {
            for (var j = 0, itemLength = arr[i].length; j < itemLength; j++) {
                var item = arr[i][j];
                var start = {
                    i: i,
                    j: j,
                    top: item.top,
                    left: item.left,
                    isStart: true,
                    allDay: item.allDay,
                    __tmpIndex: __tmpIndex
                };
                __tmpIndex++;
                var end = {
                    i: i,
                    j: j,
                    top: item.top + item.height,
                    left: item.left + item.width,
                    isStart: false,
                    allDay: item.allDay,
                    __tmpIndex: __tmpIndex
                };
                result.push(start, end);
                __tmpIndex++
            }
        }
        result.sort($.proxy(function(a, b) {
            return this._sortCondition(a, b)
        }, this));
        return result
    },
    _fixUnstableSorting: function(comparisonResult, a, b) {
        if (0 === comparisonResult) {
            if (a.__tmpIndex < b.__tmpIndex) {
                return -1
            }
            if (a.__tmpIndex > b.__tmpIndex) {
                return 1
            }
        }
        return comparisonResult
    },
    _sortCondition: abstract,
    _rowCondition: function(a, b) {
        var columnCondition = this._normalizeCondition(a.left, b.left),
            rowCondition = this._normalizeCondition(a.top, b.top);
        return columnCondition ? columnCondition : rowCondition ? rowCondition : a.isStart - b.isStart
    },
    _columnCondition: function(a, b) {
        var columnCondition = this._normalizeCondition(a.left, b.left),
            rowCondition = this._normalizeCondition(a.top, b.top);
        return rowCondition ? rowCondition : columnCondition ? columnCondition : a.isStart - b.isStart
    },
    _normalizeCondition: function(first, second) {
        var result = first - second;
        return Math.abs(result) > 1.001 ? result : 0
    },
    _getResultPositions: function(sortedArray) {
        var position, stack = [],
            indexes = [],
            result = [],
            intersectPositions = [],
            intersectPositionCount = 0,
            sortedIndex = 0;
        for (var i = 0; i < sortedArray.length; i++) {
            var j, current = sortedArray[i];
            if (current.isStart) {
                position = void 0;
                for (j = 0; j < indexes.length; j++) {
                    if (!indexes[j]) {
                        position = j;
                        indexes[j] = true;
                        break
                    }
                }
                if (void 0 === position) {
                    position = indexes.length;
                    indexes.push(true);
                    for (j = 0; j < stack.length; j++) {
                        stack[j].count++
                    }
                }
                stack.push({
                    index: position,
                    count: indexes.length,
                    i: current.i,
                    j: current.j,
                    sortedIndex: sortedIndex++
                });
                if (intersectPositionCount < indexes.length) {
                    intersectPositionCount = indexes.length
                }
            } else {
                var removeIndex = this._findIndexByKey(stack, "i", "j", current.i, current.j),
                    resultItem = stack[removeIndex];
                stack.splice(removeIndex, 1);
                indexes[resultItem.index] = false;
                intersectPositions.push(resultItem);
                if (!stack.length) {
                    indexes = [];
                    for (var k = 0; k < intersectPositions.length; k++) {
                        intersectPositions[k].count = intersectPositionCount
                    }
                    intersectPositions = [];
                    intersectPositionCount = 0
                }
                result.push(resultItem)
            }
        }
        return result.sort(function(a, b) {
            var columnCondition = a.j - b.j,
                rowCondition = a.i - b.i;
            return rowCondition ? rowCondition : columnCondition
        })
    },
    _findIndexByKey: function(arr, iKey, jKey, iValue, jValue) {
        var result = 0;
        for (var i = 0, len = arr.length; i < len; i++) {
            if (arr[i][iKey] === iValue && arr[i][jKey] === jValue) {
                result = i;
                break
            }
        }
        return result
    },
    _getExtendedPositionMap: function(map, positions) {
        var positionCounter = 0,
            result = [];
        for (var i = 0, mapLength = map.length; i < mapLength; i++) {
            var resultString = [];
            for (var j = 0, itemLength = map[i].length; j < itemLength; j++) {
                map[i][j].index = positions[positionCounter].index;
                map[i][j].sortedIndex = positions[positionCounter].sortedIndex;
                map[i][j].count = positions[positionCounter++].count;
                resultString.push(map[i][j]);
                this._checkLongCompactAppointment(map[i][j], resultString)
            }
            result.push(resultString)
        }
        return result
    },
    _checkLongCompactAppointment: $.noop,
    _splitLongCompactAppointment: function(item, result) {
        var compactCount = 0;
        if (item.index > 1) {
            item.isCompact = true;
            compactCount = this._getCompactAppointmentParts(item.width);
            for (var k = 1; k < compactCount; k++) {
                var compactPart = $.extend(true, {}, item);
                compactPart.left = this._getCompactLeftCoordinate(item.left, k);
                compactPart.cellIndex = compactPart.cellIndex + k;
                compactPart.sortedIndex = null;
                result.push(compactPart)
            }
        }
        return result
    },
    _startDate: function(appointment, skipNormalize, position) {
        var startDate = position && position.startDate,
            viewStartDate = this.instance._getStartDate(appointment, skipNormalize),
            text = this.instance.invoke("getField", "text", appointment);
        if (startDate && viewStartDate > startDate || !startDate) {
            startDate = viewStartDate
        }
        if (isNaN(startDate.getTime())) {
            throw errors.Error("E1032", text)
        }
        return startDate
    },
    _endDate: function(appointment, position) {
        var endDate = this.instance._getEndDate(appointment),
            realStartDate = this._startDate(appointment, true),
            viewStartDate = this._startDate(appointment, false, position);
        if (!endDate || realStartDate.getTime() >= endDate.getTime()) {
            endDate = new Date(realStartDate.getTime() + 6e4 * this.instance.option("appointmentDurationInMinutes"));
            this.instance.invoke("setField", "endDate", appointment, endDate)
        }
        if (viewStartDate >= endDate) {
            var recurrencePartStartDate = position ? position.startDate : realStartDate,
                fullDuration = endDate.getTime() - realStartDate.getTime();
            endDate = new Date(viewStartDate.getTime() + fullDuration);
            if (!dateUtils.sameDate(realStartDate, endDate) && recurrencePartStartDate < viewStartDate) {
                var headDuration = dateUtils.trimTime(endDate).getTime() - recurrencePartStartDate.getTime(),
                    tailDuration = fullDuration - headDuration;
                endDate = new Date(dateUtils.trimTime(viewStartDate).getTime() + tailDuration)
            }
        }
        return endDate
    },
    _getAppointmentDurationInMs: function(startDate, endDate, allDay) {
        var result;
        this.instance.notifyObserver("getAppointmentDurationInMs", {
            startDate: startDate,
            endDate: endDate,
            allDay: allDay,
            callback: function(duration) {
                result = duration
            }
        });
        return result
    },
    _getMaxNeighborAppointmentCount: function() {
        var outerAppointmentWidth = this.getCompactAppointmentDefaultSize() + this.getCompactAppointmentDefaultOffset();
        return Math.floor(this.getCompactAppointmentGroupMaxWidth() / outerAppointmentWidth)
    },
    _markAppointmentAsVirtual: function(coordinates, isAllDay) {
        var countFullWidthAppointmentInCell = 2;
        if (coordinates.count - countFullWidthAppointmentInCell > this._getMaxNeighborAppointmentCount()) {
            coordinates.virtual = {
                top: coordinates.top,
                left: coordinates.left,
                index: coordinates.rowIndex + "-" + coordinates.cellIndex,
                isAllDay: isAllDay
            }
        }
    },
    getCompactAppointmentGroupMaxWidth: function() {
        var widthInPercents = 75;
        return widthInPercents * this.getDefaultCellWidth() / 100
    },
    getDefaultCellWidth: function() {
        return this._defaultWidth
    },
    getCompactAppointmentDefaultSize: function() {
        return COMPACT_APPOINTMENT_DEFAULT_SIZE
    },
    getCompactAppointmentDefaultOffset: function() {
        return COMPACT_APPOINTMENT_DEFAULT_OFFSET
    },
    getAppointmentDataCalculator: $.noop
});
module.exports = BaseRenderingStrategy;


text:
var fs = require("fs");
var path = require("path");
var webpackDevMiddleware = require("webpack-dev-middleware");
var express = require("express");
var socketio = require("socket.io");
var StreamCache = require("stream-cache");
var http = require("http");
var https = require("https");
var httpProxy = require("http-proxy");
var proxy = new httpProxy.createProxyServer();
var serveIndex = require("serve-index");
var historyApiFallback = require("connect-history-api-fallback");

function Server(compiler, options) {
	// Default options
	if(!options) options = {};

	if (options.lazy && !options.filename) {
		throw new Error("'filename' option must be set in lazy mode.");
	}

	this.hot = options.hot;
	this.headers = options.headers;

	// Listening for events
	var invalidPlugin = function() {
		if(this.io) this.io.sockets.emit("invalid");
	}.bind(this);
	compiler.plugin("compile", invalidPlugin);
	compiler.plugin("invalid", invalidPlugin);
	compiler.plugin("done", function(stats) {
		if(!this.io) return;
		this._sendStats(this.io.sockets, stats.toJson());
		this._stats = stats;
	}.bind(this));

	// Prepare live html page
	var livePage = this.livePage = new StreamCache();
	fs.createReadStream(path.join(__dirname, "..", "client", "live.html")).pipe(livePage);

	// Prepare the live js file
	var liveJs = new StreamCache();
	fs.createReadStream(path.join(__dirname, "..", "client", "live.bundle.js")).pipe(liveJs);

	// Prepare the inlined js file
	var inlinedJs = new StreamCache();
	fs.createReadStream(path.join(__dirname, "..", "client", "index.bundle.js")).pipe(inlinedJs);

	// Init express server
	var app = this.app = new express();

	// serve webpack bundle
	app.use(this.middleware = webpackDevMiddleware(compiler, options));

	app.get("/__webpack_dev_server__/live.bundle.js", function(req, res) {
		res.setHeader("Content-Type", "application/javascript");
		liveJs.pipe(res);
	});

	app.get("/webpack-dev-server.js", function(req, res) {
		res.setHeader("Content-Type", "application/javascript");
		inlinedJs.pipe(res);
	});

	app.get("/webpack-dev-server/*", function(req, res) {
		res.setHeader("Content-Type", "text/html");
		this.livePage.pipe(res);
	}.bind(this));

	app.get("/webpack-dev-server", function(req, res) {
		res.setHeader("Content-Type", "text/html");
		res.write('<!DOCTYPE html><meta charset="utf-8"/>');
		var path = this.middleware.getFilenameFromUrl(options.publicPath || "/");
		var fs = this.middleware.fileSystem;
		function writeDirectory(baseUrl, basePath) {
			var content = fs.readdirSync(basePath);
			res.write("
");
			content.forEach(function(item) {
				var p = basePath + "/" + item;
				if(fs.statSync(p).isFile()) {
					res.write('
');
					res.write(item);
					res.write('
');
					if(/\.js$/.test(item)) {
						var htmlItem = item.substr(0, item.length - 3);
						res.write('
');
						res.write(htmlItem);
						res.write(' (magic html for ');
						res.write(item);
						res.write(') (webpack-dev-server)
');
					}
				} else {
					res.write('
');
					res.write(item);
					res.write('
');
					writeDirectory(baseUrl + item + "/", p);
					res.write('
');
				}
			});
			res.write("
");
		}
		writeDirectory(options.publicPath || "/", path);
		res.end('');
	}.bind(this));

	if (options.proxy) {
		var paths = Object.keys(options.proxy);
		paths.forEach(function (path) {
			var proxyOptions;
			if (typeof options.proxy[path] === 'string') {
				proxyOptions = {target: options.proxy[path], ws: true};
			} else {
				proxyOptions = options.proxy[path];
			}
			app.all(path, function (req, res) {
				if (proxyOptions.host) {
					req.headers.host = proxyOptions.host;
				}
				proxy.web(req, res, proxyOptions, function(err){
					var msg = "cannot proxy to " + proxyOptions.target + " (" + err.message + ")";
					this.io.sockets.emit("proxy-error", [msg]);
					res.statusCode = 502;
					res.end();
				}.bind(this));
				if (proxyOptions.configure) {
					proxyOptions.configure(proxy);
				}
			}.bind(this));
		}.bind(this));
	}

	if (options.historyApiFallback) {
		// Fall back to /index.html if nothing else matches.
		app.use(historyApiFallback(typeof options.historyApiFallback === 'object' ? options.historyApiFallback : null));
		// include our middleware to ensure it is able to handle '/index.html' requrst after redirect
		app.use(this.middleware);
	}

	if(options.contentBase !== false) {
		var contentBase = options.contentBase || process.cwd();

		if(typeof contentBase === "object") {
			console.log('Using contentBase as a proxy is deprecated and will be removed in the next major version. Please use the proxy option instead.\n\nTo update remove the contentBase option from webpack.config.js and add this:');
			console.log('proxy: {\n\t"*": <your current contentBase configuration>\n}');
			// Proxy every request to contentBase.target
			app.all("*", function(req, res) {
				proxy.web(req, res, contentBase, function(err) {
					var msg = "cannot proxy to " + contentBase.target + " (" + err.message + ")";
					this.io.sockets.emit("proxy-error", [msg]);
					res.statusCode = 502;
					res.end();
				}.bind(this));
			}.bind(this));
		} else if(/^(https?:)?\/\//.test(contentBase)) {
			// Redirect every request to contentBase
			app.get("*", function(req, res) {
				res.writeHead(302, {
					'Location': contentBase + req.path + (req._parsedUrl.search || "")
				});
				res.end();
			}.bind(this));
		} else if(typeof contentBase === "number") {
			// Redirect every request to the port contentBase
			app.get("*", function(req, res) {
				res.writeHead(302, {
					'Location': "//localhost:" + contentBase + req.path + (req._parsedUrl.search || "")
				});
				res.end();
			}.bind(this));
		} else {
			// route content request
			app.get("*", this.setContentHeaders.bind(this), this.serveMagicHtml.bind(this), express.static(contentBase), serveIndex(contentBase));
		}
	}

	this.listeningApp = options.https
		? https.createServer({
				// using built-in self-signed certificate
				key: options.key || fs.readFileSync(path.join(__dirname, "../ssl/server.key")),
				cert: options.cert || fs.readFileSync(path.join(__dirname, "../ssl/server.crt")),
				ca: options.ca || fs.readFileSync(path.join(__dirname, "../ssl/ca.crt")),
				requestCert: true,
				rejectUnauthorized: false
			}, app)
		: http.createServer(app);
}

Server.prototype.use = function() {
	this.app.use.apply(this.app, arguments);
}

Server.prototype.setContentHeaders = function(req, res, next) {
	if(this.headers) {
		for(var name in this.headers) {
			res.setHeader(name, this.headers[name]);
		}
	}

	next();
}

// delegate listen call and init socket.io
Server.prototype.listen = function() {
	this.listeningApp.listen.apply(this.listeningApp, arguments);
	this.io = socketio.listen(this.listeningApp, {
		"log level": 1
	});
	this.io.sockets.on("connection", function(socket) {
		if(this.hot) socket.emit("hot");
		if(!this._stats) return;
		this._sendStats(socket, this._stats.toJson(), true);
	}.bind(this));
}

Server.prototype.serveMagicHtml = function(req, res, next) {
	var _path = req.path;
	try {
		if(!this.middleware.fileSystem.statSync(this.middleware.getFilenameFromUrl(_path + ".js")).isFile())
			return next();
		// Serve a page that executes the javascript
		res.write('<!DOCTYPE html><meta charset="utf-8"/>');
	} catch(e) { return next(); }
}

// send stats to a socket or multiple sockets
Server.prototype._sendStats = function(socket, stats, force) {
	if(!force && stats && stats.assets && stats.assets.every(function(asset) {
		return !asset.emitted;
	})) return socket.emit("still-ok");;
	socket.emit("hash", stats.hash);
	if(stats.errors.length > 0)
		socket.emit("errors", stats.errors);
	else if(stats.warnings.length > 0)
		socket.emit("warnings", stats.warnings);
	else
		socket.emit("ok");
}

Server.prototype.invalidate = function() {
	if(this.middleware) this.middleware.invalidate();
}

module.exports = Server;