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

<udhr iso639-3='pis' xml:lang='pis' key='pis' n='Pijin' xmlns="http://www.unhchr.ch/udhr">
  <title>Universol Declarason lo Hiuman Raits</title>
  <preamble>
    <title>Preamble</title>
    <para>Taem umi kam fo luk savve lo digniti en ikwol raits blo evri memba blo hiuman famili. Dis wan hemi givim fandasen fo friidom, jastis en pis insaed lo dis fala wol.</para>
    <para>Taem pipol no luk savve lo dis fala hiuman raits, risalt blo hem nao pipol i no luk savve lo gud wei en rabis wei. Lo dis fala wol, olketa pipol sapos fo garem friidom fo tallem tingting blo olketa en wanem olketa believim. Olketa pipol sapos fo stap frii fo no fraet en fo stap gud. Olketa tingting ya hemi dea wea evri wan savve olsem hemi samting gud fo evri wan.</para>
    <para>Hemi impoten tumas dat nomata wanem hemi hapen, loa hemi mas mek sua dat hemi kipim strong disfala hiuman raits.</para>
    <para>Hemi impoten tumas fo buildim up gud fala relensensip mele wan oketa kantre.</para>
    <para>Olketa pipol blo United Nations i bin talem raits aot agen anda disfala Charter dat olketa garem strong tingting lo saed blo olketa baraba importen samting olsem digniti en olketa gud samting insaed lo evri wan, en fo man en mere tufala semsem lo saed lo evriting olketa duim. Olketa samting ya nao mekem United Nations tingting strong fo buildim up en mek sua dat evri wan stap gud en frii.</para>
    <para>Olketa Stet wea memba blo United Nations tu i promis fo respectim en help supportim hiuman raits en olketa importen samting wea bae hemi givim friidom.</para>
    <para>Fo mekem dis fala promis hemi waka, evri wan mas meanim en keepim olketa raits ya en friidoms.</para>
    <para>So distaem,</para>
    <para>Olketa General Assembly,</para>
    <para>Talem aot dis fala Universal Declarason ya evri nasen en pipol olketa mas trae fo achievim en keepim. Evriwan mas help fo teachim en lanem olketa pipol fo luk savve en uppim olketa raits en friidom blo wanwan. Evri groups wea pat blo gavman or nomoa mas waka fo findim beta wei fo mekem pipol evriwea lo wol ya kam fo luk savve lo olketa hiuman raits ya.</para>
  </preamble>

    <title>Article 1</title>
    <para>Evri man en mere olketa born frii en ikwol lo digniti en raits blo olketa. Olketa evriwan olketa garem maeni fo tingting en olketa sapos fo treatim isada wittim spirit blo bradahood.</para>

    <title>Article 2</title>
    <para>Evri wan nomata olketa garem difren kala, langus, siosi, status, man or mere from difren kantre, evri wan stil garem rait en friidom wea hemi lo disfala Declarason, en nomata man hemi kam from kantre wea garem difren politiks or status lo nara kantre, or hemi indipenden or nomoa, hemi stil garem olketa raits en friidom ya.</para>
    <para/>

    <title>Article 3</title>
    <para>Evriwan i garem rait lo laef, friidom en sekuriti blo olketa.</para>

    <title>Article 4</title>
    <para>No eni wan sapos fo hemi slev blo nara man, dis wan hemi baraba tambu fo duim en babae no hapen lo eni kaen or eni wan.</para>

    <title>Article 5</title>
    <para>No eni wan babae panisim or tritim nara man no gud or mekem eni wan fo gare kil.</para>

    <title>Article 6</title>
    <para>Evri wan i garem rait lo eniwea fo loa luk savve lo olketa.</para>

    <title>Article 7</title>
    <para>Evri wan luk semsem en garem taetol lo loa fo loa luk aftam olketa. Dis fala loa hemi mek sua dat fo luk daonim or tritim no gud nara man bikos lo rabis tingting hemi brekim disfala Declarason.</para>

    <title>Article 8</title>
    <para>Olketa nasinol kaonsels olketa i stap fo helpim evriwan stretem kaen problems wea pipol luk daonim or tritim no gud nara fala. Olketa fo helpim evriwan fo stretem bak kaen problem wea man no luk savve lo raits wea loa i givim lo evri wan.</para>

    <title>Article 9</title>
    <para>No eni wan bae hemi sapos fo kasem kaen wea olketa i arrestim or tekem fo no eni gud rison, forcim fo lusim ples blo hem, hemi kaen samting wea sapos fo no kasem eniwan.</para>

    <title>Article 10</title>
    <para>Eni wan wea go lo kot lo eni kriminol samting, olketa sapos fo garem fea hiaring.</para>

    <title>Article 11</title>
    <orderedlist>
      <listitem>
	<para>Lo loa, evri wan wea olketa chargim wittim eni kriminol samting, kot mas lukim olketa olsem olketa inocen kasem taem olketa provim dat olketa guilti.</para>
      </listitem>
      <listitem>
	<para>No eni wan sapos fo guilti lo eni niu loa sapos kriminol samting or toktok olketa duim i lo taem wea olketa loa ya olketa no wakem yeti.</para>
      </listitem>
    </orderedlist>

    <title>Article 12</title>
    <para>Lo loa hemi tallem dat no eni wan sapos fo go disturbim olketa famili, haus or olketa privet samting blo nara man en no eni man sapos fo trae spoilem nara man.</para>

    <title>Article 13</title>
    <orderedlist>
      <listitem>
	<para>Evriwan olketa frii fo muv raon en stap eniwea lo insaed kantre blo olketa.</para>
      </listitem>
      <listitem>
	<para>Evriwan bae savve go aot lo eni kantre, nomata lo blo olketa seleva, en olketa savve go baek lo kantre blo olketa.</para>
      </listitem>
    </orderedlist>

    <title>Article 14</title>
    <orderedlist>
      <listitem>
	<para>Evriwan olketa garem rait fo go lo olketa nara kantre sapos olketa kasem trabol lo kantre blo olketa.</para>
      </listitem>
      <listitem>
	<para>Dis fala rait bae hemi hard fo waka sapos olketa kaen trabol wea hemi go againstim tingting blo United Nations or hemi kriminol samting.</para>
      </listitem>
    </orderedlist>

    <title>Article 15</title>
    <orderedlist>
      <listitem>
	<para>Everiwan olketa garem rait fo memba lo eni kantre.</para>
      </listitem>
      <listitem>
	<para>No eni man savve stopem nara wan fo memba lo eni kantre, lo sem taem olketa hard fo stopem tu sapos olketa laek memba lo eni niu kantre.</para>
      </listitem>
    </orderedlist>

    <title>Article 16</title>
    <orderedlist>
      <listitem>
	<para>Olketa man en mere wea kasem taem wea olketa savve maret, bae savve maretem eniwan blo difren ples, kantre or siosi en garem famili.</para>
      </listitem>
      <listitem>
	<para>Maret mas samting wea man en mere evriwan mas laek fo duim en no eniwan forcim.</para>
      </listitem>
      <listitem>
	<para>Olketa famili hemi impoten tumas en kantre mas luk aftam olketa.</para>
      </listitem>
    </orderedlist>

    <title>Article 17</title>
    <orderedlist>
      <listitem>
	<para>Evriwan olketa garem rait fo ownim propati, seleva or wittim olketa nara pipol.</para>
      </listitem>
      <listitem>
	<para>No eni wan hemi garem rait fo aotim propati blo nara man.</para>
      </listitem>
    </orderedlist>

    <title>Article 18</title>
    <para>Evriwan i garem rait en friidom lo tingting blo olketa seleva en lo siosi blo olketa. Dis wan hemi meanim dat if man laek changim siosi or belif blo hem, hemi frii fo duim dis wan. Evri wan mas savve teachim, practisim or preya lo siosi blo olketa en no frait fo som aot.</para>

    <title>Article 19</title>
    <para>Evri wan i frii fo som en talem wanem tingting blo olketa. Dis fala rait hemi coverim sapos man laek lukaotim or tekem or givim enikaen infomesin lo eni wei en eni wea hemi laek fo duim.</para>

    <title>Article 20</title>
    <orderedlist>
      <listitem>
	<para>Evriwan olketa garem rait wea olketa bae frii fo mekem eni asembli or asociasen.</para>
      </listitem>
      <listitem>
	<para>No eni wan bae hemi joinim eni asociasen bikos olketa forcim lo hem.</para>
      </listitem>
    </orderedlist>

    <title>Article 21</title>
    <orderedlist>
      <listitem>
	<para>Evriwan olketa garem rait fo tek pat or fo siusim eniwan fo representim olketa lo gavman blo kantre blo olketa.</para>
      </listitem>
      <listitem>
	<para>Everiwan olketa garem semsem rait go lo olketa public service lo kantre blo olketa.</para>
      </listitem>
      <listitem>
	<para>Olketa biki man blo gafman bae hemi stand up lo will blo olketa pipol. Olketa elekson wea ikwol en fea nao i showem dis fala will.</para>
      </listitem>
    </orderedlist>

    <title>Article 22</title>
    <para>Evri memba blo komuniti olketa garem rait fo garem sosol sekuriti en evri kantri mas waka wittim olketa organisation en olketa risoces blo olketa, en wittim olketa nara kantre mekem olketa pipol blo olketa luk savve wanem nao olketa ekonomik, sosol en kaltrol raits blo olketa.</para>

    <title>Article 23</title>
    <orderedlist>
      <listitem>
	<para>Evriwan i garem rait fo waka, fo siusim wanem kaen waka nao olketa i laek fo duim en wanem kaen samting nao lo waka ples blo olketa en fo mekem olketa garem protecsen againstim kaen no garem waka.</para>
      </listitem>
      <listitem>
	<para>Evriwan i garem rait fo tekem pei wea fittim waka olketa i duim.</para>
      </listitem>
      <listitem>
	<para>Evriwan wea waka olketa garem rait fo garem gud fala pei or eni sosol protecsen wea bae helpim olketa en famili blo olketa.</para>
      </listitem>
      <listitem>
	<para>Everiwan olketa garem rait fo formim en fo joinim tred unions fo luk aftam olketa intres blo olketa.</para>
      </listitem>
    </orderedlist>

    <title>Article 24</title>
    <para>Evriwan garem rait fo relax en rest en fo garem samfala holide wea olketa stil tek pei, en olketa taem blo waka hemi sapos fo hemi ovam tumas.</para>

    <title>Article 25</title>
    <orderedlist>
      <listitem>
	<para>Evriwan garem rait fo stap gud wea olketa garem kakai, kaliko, haus en babae hemi isi fo olketa nara help wea olketa bae needim. Evriwan garem rait fo garem sekuriti sapos olketa no garem waka, olketa siki, polio, olo tumas or fo olketa mere hasban blo olketa die finis en eni wan moa wea garem kaen problem wea bae mekem olketa hard fo luk aftam olketa seleva.</para>
      </listitem>
      <listitem>
	<para>Olketa mami en olketa pikinini olketa sapos fo garem rait fo garem care en help en nomata eni pikinini i born garem dadi or nomoa, olketa savve garem sem sosol protecsen.</para>
      </listitem>
    </orderedlist>

    <title>Article 26</title>
    <orderedlist>
      <listitem>
	<para>Evriwan olketa garem rait lo skul. Skul hemi sapos fo frii, fo everiwan lo olketa pramari en impoten levol. Hemi impoten dat evri pikinini mas go lo pramari skul. Kaen skul fo man savve garem waka hemi sapos fo isi fo eniwan savve tekem. Fo skool hae go moa, bae olketa pipol wea skul gud finis en garem gud risolt nao bae savve tekem.</para>
      </listitem>
      <listitem>
	<para>Skul hemi sapos fo help buildim up wei blo olketa pipol en fo mekem strong respect blo olketa fo human raits en hem sapos fo help fo buildim up frensip, fo buildim up frensip mele wan difren kantre, pipol en olketa difren preya group mekem olketa understandim isada en savve stap gud wittim isada. Evriting ya bae helpim United Nations fo keepim gud pis.</para>
      </listitem>
      <listitem>
	<para>Olketa mami en dadi i garem rait fo choosim wanem kaen edukason nao bae pikinini blo olketa i garem.</para>
      </listitem>
    </orderedlist>

    <title>Article 27</title>
    <orderedlist>
      <listitem>
	<para>Evriwan olketa frii fo tek pat lo kastom laef lo komuniti blo olketa en fo olketa sharim eni gud samting wea i kam aot lo olketa niu teknologi olsem lo saed lo olketa niu medsin, computa en olketa kaen samting olsem.</para>
      </listitem>
      <listitem>
	<para>Evriwan garem rait fo protectim eniting blo olketa, or eniting olketa wakem.</para>
      </listitem>
    </orderedlist>

    <title>Article 28</title>
    <para>Evriwan olketa garem rait fo garem eni sistem or oganaesesin wea bae hemi helpim olketa fo understandim en practisim olketa raits en friidoms lo disfala Declarason.</para>

    <title>Article 29</title>
    <orderedlist>
      <listitem>
	<para>Evriwan i garem waka go long olketa komuniti blo olketa biko bae hemi helpim olketa seleva fo buildim up olketa gud wei.</para>
      </listitem>
      <listitem>
	<para>Loa nao bae hemi luk savve hao mas raits en friidoms wea bae garem. Dis wan hemi fo mek sua dat pipol bae luk savve en respectim raits en friidom blo nara man. No onle dat wan bata insaed lo eni demokratic kantri loa hemi stap fo mek sua dat pablic oda i stap, pipol luk savve wanem nao gud en no gud en fo luk aftam intres blo kantre ya en olketa pipol lo hem, follom aedia blo demokraci.</para>
      </listitem>
      <listitem>
	<para>Olketa raits en friidoms ya pipol mas onle practisim follom olketa tingting lo wei en hao olketa United Nations i puttim.</para>
      </listitem>
    </orderedlist>

    <title>Article 30</title>
    <para>No eni kantri, group or man savve usim eni toktok insaed disfala deklaration fo duim eniting wea bae hemi spoilem eni wan lo olketa raits en friidoms wea i lo dis fala Declarason.</para>

</udhr>


text:
class Fish < Formula
  desc "User-friendly command-line shell for UNIX-like operating systems"
  homepage "https://fishshell.com"

  stable do
    url "https://github.com/fish-shell/fish-shell/releases/download/2.5.0/fish-2.5.0.tar.gz"
    mirror "https://fishshell.com/files/2.5.0/fish-2.5.0.tar.gz"
    sha256 "f8c0edadca2de379ccf305aeace660a9255fa2180c72e85e97705a24c256b2a5"
  end

  bottle do
    sha256 "d012c7b4d1dce5e766fe9990f19ec7ac0ae5c4a69fc15e01cf123e8f88c1910f" => :sierra
    sha256 "2b28972cc66472fa11782b344c64b51569a43d0fd8b098ad4b787a1c79aca2b1" => :el_capitan
    sha256 "385def41fe9c29237b7319218ae0184f64b6b750e525f92ee6913cf20c478a69" => :yosemite
  end

  head do
    url "https://github.com/fish-shell/fish-shell.git", :shallow => false

    depends_on "autoconf" => :build
    depends_on "automake" => :build
    depends_on "doxygen" => :build
  end

  depends_on "pcre2"

  def install
    system "autoreconf", "--no-recursive" if build.head?

    # In Homebrew's 'superenv' sed's path will be incompatible, so
    # the correct path is passed into configure here.
    args = %W[
      --prefix=#{prefix}
      --with-extra-functionsdir=#{HOMEBREW_PREFIX}/share/fish/vendor_functions.d
      --with-extra-completionsdir=#{HOMEBREW_PREFIX}/share/fish/vendor_completions.d
      --with-extra-confdir=#{HOMEBREW_PREFIX}/share/fish/vendor_conf.d
      SED=/usr/bin/sed
    ]
    system "./configure", *args
    system "make", "install"
  end

  def caveats; <<-EOS.undent
    You will need to add:
      #{HOMEBREW_PREFIX}/bin/fish
    to /etc/shells.

    Then run:
      chsh -s #{HOMEBREW_PREFIX}/bin/fish
    to make fish your default shell.
    EOS
  end

  def post_install
    (pkgshare/"vendor_functions.d").mkpath
    (pkgshare/"vendor_completions.d").mkpath
    (pkgshare/"vendor_conf.d").mkpath
  end

  test do
    system "#{bin}/fish", "-c", "echo"
  end
end

redpajama_set_name: RedPajamaGithub


text:
module Euler15 where
--
-- Use a dynamic programming solution to find the number of ways
-- to travel through a grid from top corner to bottom corner

import Control.Monad.State
import qualified Data.Map as M (empty, Map, insert, lookup)

runWays :: (Int, Int) -> Int
runWays t = evalState (ways t) $ M.empty

ways :: (Int, Int) -> State (M.Map (Int, Int) Int) Int
ways (0, _) = return 1
ways (_, 0) = return 1
ways (x, y) | (x < 0 || y < 0) = return 0
            | otherwise = do
                v1 <- lookupOrCompute (x-1,y)
                v2 <- lookupOrCompute (x, y-1)
                let v = v1 + v2
                modify $ M.insert (x,y) v
                return v

lookupOrCompute :: (Int, Int) -> State (M.Map (Int, Int) Int) Int
lookupOrCompute (x,y) = do
  m <- get
  case (M.lookup (x,y) m) of
    Just v  -> return v
    Nothing -> ways (x,y)


text:
module Language.CADT.Parse where

import Text.ParserCombinators.Parsec as X hiding (many, (<|>), optional)
import Text.ParserCombinators.Parsec.Expr as X
import Text.ParserCombinators.Parsec.Language as X
import qualified Text.ParserCombinators.Parsec.Token as T

import Control.Applicative as X

languageDef = haskellDef

lexer = T.makeTokenParser languageDef
identifier = T.identifier lexer
reservedOp = T.reservedOp lexer
reserved = T.reserved lexer
symbol = T.symbol lexer
braces = T.braces lexer
commaSep = T.commaSep lexer

data DataDecl = DataDecl { dataName :: String
                         , dataCtors :: [Constructor]
                         } deriving Show
data Constructor = Constructor { ctorName :: String
                               , ctorFields :: [Field]
                               } deriving Show
data Field = Field { fieldName :: String
                   , fieldType :: String
                   } deriving Show

parseField :: Parser Field
parseField = Field <$> identifier <*> typename
  where typename = reservedOp ":" *> identifier

parseConstructor :: Parser Constructor
parseConstructor = Constructor <$> identifier <*> fields
  where fields = braces $ commaSep parseField

parseDataDecl :: Parser DataDecl
parseDataDecl = DataDecl <$> name <*> ctors
  where name = reserved "data" *> identifier <* reservedOp "="
        ctors = parseConstructor `sepBy1` (symbol "|")


text:
#import "FBGraphObjectDataSourceDataNeededDelegate.h"
#import <XXUnknownSuperclass.h> // Unknown library

@class FBSession, FBGraphObjectTableDataSource, NSString, FBRequestConnection, UITableView;
@protocol FBGraphObjectPagingLoaderDelegate;

@interface FBGraphObjectPagingLoader : XXUnknownSuperclass <FBGraphObjectDataSourceDataNeededDelegate> {
	BOOL _isResultFromCache;
	BOOL _skipRoundtripIfCached;
	UITableView* _tableView;
	FBGraphObjectTableDataSource* _dataSource;
	FBSession* _session;
	id<FBGraphObjectPagingLoaderDelegate> _delegate;
	int _pagingMode;
	NSString* _nextLink;
	FBRequestConnection* _connection;
	NSString* _cacheIdentity;
}
@property(copy, nonatomic) NSString* cacheIdentity;
@property(retain, nonatomic) FBRequestConnection* connection;
@property(retain, nonatomic) FBGraphObjectTableDataSource* dataSource;
@property(readonly, copy) NSString* debugDescription;
@property(assign, nonatomic) id<FBGraphObjectPagingLoaderDelegate> delegate;
@property(readonly, copy) NSString* description;
@property(readonly, assign) unsigned hash;
@property(readonly, assign, nonatomic) BOOL isResultFromCache;
@property(retain, nonatomic) NSString* nextLink;
@property(assign, nonatomic) int pagingMode;
@property(retain, nonatomic) FBSession* session;
@property(assign, nonatomic) BOOL skipRoundtripIfCached;
@property(readonly, assign) Class superclass;
@property(retain, nonatomic) UITableView* tableView;
- (id)initWithDataSource:(id)dataSource pagingMode:(int)mode;
- (void)addResultsAndUpdateView:(id)view;
- (void)cancel;
- (void)dealloc;
- (void)followNextLink;
- (void)graphObjectTableDataSourceNeedsData:(id)data triggeredByIndexPath:(id)path;
- (void)requestCompleted:(id)completed result:(id)result error:(id)error;
- (void)reset;
- (void)startLoadingWithRequest:(id)request cacheIdentity:(id)identity skipRoundtripIfCached:(BOOL)cached;
- (void)updateView;
@end


text:
Beanstalk\\Command\\Peek Class Ref
==================================

.. php:namespace:: Beanstalk\Command

.. php:class:: Peek

    :Extends: :php:class:`Beanstalk\\Command`
    :Description: The peek commands let the client inspect a job in the system
    :Author: Joshua Dechant <jdechant@shapeup.com>

    There are four variations. All but the first operate only on the currently used tube.
         - peek $id - return job $id
         - ready - return the next ready job
         - delayed - return the delayed job with the shortest delay left
         - buried - return the next job in the list of buried jobs

.. topic:: Class Methods

    * :php:meth:`Peek::__construct` -- Constructor
    * :php:meth:`Peek::getCommand` -- Get the command to send to the beanstalkd server
    * :php:meth:`Peek::parseResponse` -- Parse the response for success or failure.
    * :php:meth:`Peek::returnsData` -- Does the command return data?

.. php:method:: __construct( $what )

    :Description: Constructor
    :param mixed $what: What to peek. One of job id, "ready", "delayed", or "buried"

.. php:method:: getCommand(  )

    :Description: Get the command to send to the beanstalkd server
    :returns: *string*

.. php:method:: parseResponse( $response [ , $data = null , $conn = null ] )

    :Description: Parse the response for success or failure.
    :param string $response: Response line, i.e, first line in response
    :param string $data: Data recieved with reponse, if any, else null
    :param Beanstalk\Connection $conn: BeanstalkConnection use to send the command
    :returns: *\Beanstalk\Job*
    :throws: *\Beanstalk\Exception* When the job doesn't exist or there are no jobs in the requested state
    :throws: *\Beanstalk\Exception* When any other error occurs

.. php:method:: returnsData(  )

    :Description: Does the command return data?
    :returns: *boolean*


text:
// Copyright 2015 pyros2097. All rights reserved.
// Use of this source code is governed by the MIT
// license that can be found in the LICENSE file.

package vector

import (
	. "github.com/pyros2097/spike/interpolation"
)

/** Encapsulates a general vector. Allows chaining operations by returning a reference to itself in all modification methods. See
 * {@link Vector2} and {@link Vector3} for specific implementations.
 * @author Xoppa */
type IVector interface {
	/** @return a copy of this vector */
	Copy() interface{}

	/** @return The euclidean length */
	Len() float32

	/** This method is faster than {@link Vector#len()} because it avoids calculating a square root. It is useful for comparisons,
	 * but not for getting exact lengths, as the return value is the square of the actual length.
	 * @return The squared euclidean length */
	Len2() float32

	/** Limits the length of this vector, based on the desired maximum length.
	 * @param limit desired maximum length for this vector
	 * @return this vector for chaining */
	Limit(limit float32) interface{}

	/** Limits the length of this vector, based on the desired maximum length squared.
	 *

	 * This method is slightly faster than limit().
	 * @param limit2 squared desired maximum length for this vector
	 * @return this vector for chaining
	 * @see #len2() */
	Limit2(limit2 float32) interface{}

	/** Sets the length of this vector. Does nothing is this vector is zero.
	 * @param len desired length for this vector
	 * @return this vector for chaining */
	SetLength(length float32) interface{}

	/** Sets the length of this vector, based on the square of the desired length. Does nothing is this vector is zero.
	 *

	 * This method is slightly faster than setLength().
	 * @param len2 desired square of the length for this vector
	 * @return this vector for chaining
	 * @see #len2() */
	SetLength2(length2 float32) interface{}

	/** Clamps this vector's length to given min and max values
	 * @param min Min length
	 * @param max Max length
	 * @return This vector for chaining */
	Clamp(min, max float32) interface{}

	/** Sets this vector from the given vector
	 * @param v The vector
	 * @return This vector for chaining */
	SetV(v interface{}) interface{}

	/** Subtracts the given vector from this vector.
	 * @param v The vector
	 * @return This vector for chaining */
	SubV(v interface{}) interface{}

	/** Normalizes this vector. Does nothing if it is zero.
	 * @return This vector for chaining */
	Nor() interface{}

	/** Adds the given vector to this vector
	 * @param v The vector
	 * @return This vector for chaining */
	AddV(v interface{}) interface{}

	/** @param v The other vector
	 * @return The dot product between this and the other vector */
	DotV(v interface{}) float32

	/** Scales this vector by a scalar
	 * @param scalar The scalar
	 * @return This vector for chaining */
	SclScalar(scalar float32) interface{}

	/** Scales this vector by another vector
	 * @return This vector for chaining */
	SclV(v interface{}) interface{}

	/** @param v The other vector
	 * @return the distance between this and the other vector */
	DstV(v interface{}) float32

	/** This method is faster than {@link Vector#dst(Vector)} because it avoids calculating a square root. It is useful for
	 * comparisons, but not for getting accurate distances, as the return value is the square of the actual distance.
	 * @param v The other vector
	 * @return the squared distance between this and the other vector */
	Dst2V(v interface{}) float32

	/** Linearly interpolates between this vector and the target vector by alpha which is in the range [0,1]. The result is stored
	 * in this vector.
	 * @param target The target vector
	 * @param alpha The interpolation coefficient
	 * @return This vector for chaining. */
	Lerp(target interface{}, alpha float32) interface{}

	/** Interpolates between this vector and the given target vector by alpha (within range [0,1]) using the given Interpolation
	 * method. the result is stored in this vector.
	 * @param target The target vector
	 * @param alpha The interpolation coefficient
	 * @param interpolator An Interpolation object describing the used interpolation method
	 * @return This vector for chaining. */
	Interpolate(target interface{}, alpha float32, interpolation Interpolation) interface{}

	/** @return Whether this vector is a unit length vector */
	IsUnit() bool

	/** @return Whether this vector is a unit length vector within the given margin. */
	IsUnitMargin(margin float32) bool

	/** @return Whether this vector is a zero vector */
	IsZero() bool

	/** @return Whether the length of this vector is smaller than the given margin */
	IsZeroMargin(margin float32) bool

	/** @return true if this vector is in line with the other vector (either in the same or the opposite direction) */
	IsOnLine(other interface{}) bool

	/** @return true if this vector is in line with the other vector (either in the same or the opposite direction) */
	IsOnLineEpsilon(other interface{}, epsilon float32)

	/** @return true if this vector is collinear with the other vector ({@link #isOnLine(Vector, float)} &&
	 *         {@link #hasSameDirection(Vector)}). */
	IsCollinearEpsilon(other interface{}, epsilon float32) bool

	/** @return true if this vector is collinear with the other vector ({@link #isOnLine(Vector)} &&
	 *         {@link #hasSameDirection(Vector)}). */
	IsCollinear(other interface{}) bool

	/** @return true if this vector is opposite collinear with the other vector ({@link #isOnLine(Vector, float)} &&
	 *         {@link #hasOppositeDirection(Vector)}). */
	IsCollinearOppositeEpsilon(other interface{}, epsilon float32) bool

	/** @return true if this vector is opposite collinear with the other vector ({@link #isOnLine(Vector)} &&
	 *         {@link #hasOppositeDirection(Vector)}). */
	IsCollinearOpposite(other interface{}) bool

	/** @return Whether this vector is perpendicular with the other vector. True if the dot product is 0. */
	IsPerpendicular(v interface{}) bool

	/** @return Whether this vector is perpendicular with the other vector. True if the dot product is 0.
	 * @param epsilon a positive small number close to zero */
	IsPerpendicularEpsilon(vector interface{}, epsilon float32) bool

	/** @return Whether this vector has similar direction compared to the other vector. True if the normalized dot product is > 0. */
	HasSameDirection(v interface{}) bool

	/** @return Whether this vector has opposite direction compared to the other vector. True if the normalized dot product is < 0. */
	HasOppositeDirection(v interface{}) bool

	/** Compares this vector with the other vector, using the supplied epsilon for fuzzy equality testing.
	 * @param other
	 * @param epsilon
	 * @return whether the vectors have fuzzy equality. */
	EpsilonEqualsV(other interface{}, epsilon float32) bool

	/** First scale a supplied vector, then add it to this vector.
	 * @param v addition vector
	 * @param scalar for scaling the addition vector */
	MulAddScalar(v interface{}, scalar float32) interface{}

	/** First scale a supplied vector, then add it to this vector.
	 * @param v addition vector
	 * @param mulVec vector by whose values the addition vector will be scaled */
	MulAdd(v interface{}, mulVec interface{}) interface{}

	/** Sets the components of this vector to 0
	 * @return This vector for chaining */
	SetZero() interface{}
}


text:
import fs from "fs";
import test from "tape";
import path from "path";
import load from "load-json-file";
import write from "write-json-file";
import { point } from "@turf/helpers";
import flip from "./index";

const directories = {
  in: path.join(__dirname, "test", "in") + path.sep,
  out: path.join(__dirname, "test", "out") + path.sep,
};

const fixtures = fs.readdirSync(directories.in).map((filename) => {
  return {
    filename,
    name: path.parse(filename).name,
    geojson: load.sync(directories.in + filename),
  };
});

test("turf-flip", (t) => {
  fixtures.forEach((fixture) => {
    const name = fixture.name;
    const filename = fixture.filename;
    const geojson = fixture.geojson;
    const results = flip(geojson);

    if (process.env.REGEN) write.sync(directories.out + filename, results);
    t.deepEqual(load.sync(directories.out + filename), results, name);
  });
  t.end();
});

test("turf-flip - handle input mutation", (t) => {
  const geojson = point([120, 40]);
  flip(geojson);
  t.deepEqual(geojson, point([120, 40]), "does not mutate input");
  flip(geojson, { mutate: true });
  t.deepEqual(geojson, point([40, 120]), "does mutate input");
  t.end();
});


text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2017.11.30 at 08:24:17 PM JST
//

package eu.datex2.schema._2_0rc1._2_0;

import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for TpegLoc04HeightTypeEnum.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *

 *

 * <simpleType name="TpegLoc04HeightTypeEnum">
 *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
 *     <enumeration value="above"/>
 *     <enumeration value="aboveSeaLevel"/>
 *     <enumeration value="aboveStreetLevel"/>
 *     <enumeration value="at"/>
 *     <enumeration value="atSeaLevel"/>
 *     <enumeration value="atStreetLevel"/>
 *     <enumeration value="below"/>
 *     <enumeration value="belowSeaLevel"/>
 *     <enumeration value="belowStreetLevel"/>
 *     <enumeration value="undefined"/>
 *     <enumeration value="unknown"/>
 *     <enumeration value="other"/>
 *   </restriction>
 * </simpleType>
 *

 *
 */
@XmlType(name = "TpegLoc04HeightTypeEnum")
@XmlEnum
public enum TpegLoc04HeightTypeEnum {

    @XmlEnumValue("above")
    ABOVE("above"),
    @XmlEnumValue("aboveSeaLevel")
    ABOVE_SEA_LEVEL("aboveSeaLevel"),
    @XmlEnumValue("aboveStreetLevel")
    ABOVE_STREET_LEVEL("aboveStreetLevel"),
    @XmlEnumValue("at")
    AT("at"),
    @XmlEnumValue("atSeaLevel")
    AT_SEA_LEVEL("atSeaLevel"),
    @XmlEnumValue("atStreetLevel")
    AT_STREET_LEVEL("atStreetLevel"),
    @XmlEnumValue("below")
    BELOW("below"),
    @XmlEnumValue("belowSeaLevel")
    BELOW_SEA_LEVEL("belowSeaLevel"),
    @XmlEnumValue("belowStreetLevel")
    BELOW_STREET_LEVEL("belowStreetLevel"),
    @XmlEnumValue("undefined")
    UNDEFINED("undefined"),
    @XmlEnumValue("unknown")
    UNKNOWN("unknown"),
    @XmlEnumValue("other")
    OTHER("other");
    private final String value;

    TpegLoc04HeightTypeEnum(String v) {
        value = v;
    }

    public String value() {
        return value;
    }

    public static TpegLoc04HeightTypeEnum fromValue(String v) {
        for (TpegLoc04HeightTypeEnum c: TpegLoc04HeightTypeEnum.values()) {
            if (c.value.equals(v)) {
                return c;
            }
        }
        throw new IllegalArgumentException(v);
    }

}


text:
layout: post

title: Wow, much reliable, so better
cover_image: blog-cover.jpg

excerpt: "This week was about improving the robustness and reliability of the Spark Cloud and our firmware."

author:
  name: Zach Supalla
  twitter: zsupalla
  bio: Founder, CEO
  image: zach.jpg
---

We just completed our fourth sprint on the Spark platform, where our main focus was increasing the reliability and performance of the Cloud/Core combo. This involved improvements to a variety of areas, including the web IDE, the firmware, and our cross-compile service that builds binaries to be flashed onto the Core.

### Example apps in the IDE

The most visible enhancement we put in place during this sprint was adding example Core apps to the IDE that can you can fork and edit. Check it out:

When you open an example app, you can fork it into your own apps in order to edit it and flash it onto a Core.

These apps are populated from a Github repository at [github.com/spark/examples](http://www.github.com/spark/examples).

We are working on providing a mechanism to enable community contributions of example apps. In addition, this feature provides the first step toward libraries, a frequently requested feature; now that we have a linkage between the Spark IDE and Github, it opens up a lot of opportunities for collaborative coding through Spark.

### Proper authentication for multiple clients

Previously the Spark API put in place basic authentication where each user has one API token, which can be used to securely access and control that user's Spark Core.

This feature, however, was limited to only one access token. This means that if multiple clients were to use the access token (for instance, the Spark iOS app and the user's own webapp), either one could request a new access token, revoking the previous token, and causing a failure in the other app.

This week, we implemented a feature allowing multiple clients. This means that two or more apps can request their own access token without revoking each others' access. Access tokens can be managed through the Spark API.

##### Generate a new access token

    POST /oauth/token

    # Using curl in your terminal
    curl https://api.spark.io/oauth/token -u spark:spark \
         -d grant_type=password -d username=joe@example.com \
         -d password=SuperSecret

    # A typical JSON response will look like this
    {
        "access_token": "254406f79c1999af65a7df4388971354f85cfee9",
        "token_type": "bearer",
        "expires_in": 7776000
    }

When creating a new access token, you need to specify several additional pieces of info.

You must give a valid client ID and password in HTTP Basic Auth.
Any client ID will work right now, so we suggest `spark:spark`.
In the POST body, you need three parameters:

* grant_type=password
* username=YOUR_EMAIL@ADDRE.SS
* password=YOUR_PASSWORD

For now, Spark Build will list the single most recently created token.

##### List all your tokens

    GET /v1/access_tokens

    # Using curl in your terminal
    curl https://api.spark.io/v1/access_tokens \
        -u joe@example.com:SuperSecret

    # Example JSON response
    [
        {
            "token": "b5b901e8760164e134199bc2c3dd1d228acf2d98",
            "expires_at": "2014-04-27T02:20:36.177Z",
            "client": "spark"
        },
        {
            "token": "ba54b6bb71a43b7612bdc7c972914604a078892b",
            "expires_at": "2014-04-27T06:31:08.991Z",
            "client": "spark"
        }
    ]

You can list all your access tokens by passing your email address and password
in an HTTP Basic Auth header to `/v1/access_tokens`.

##### Delete an access token

    DELETE /v1/access_tokens/:token

    # Using curl in your terminal
    curl https://api.spark.io/v1/access_tokens/b5b901e8760164e134199bc2c3dd1d228acf2d98 \
         -u joe@example.com:SuperSecret -X DELETE

    # Example JSON response
    {
        "ok": true
    }

If you have a bunch of unused tokens and want to clean up, you can delete tokens.

Just as for listing them, send your username and password in an HTTP Basic Auth header.

Complete documentation for authentication on the Spark API can be found on [our docs site](http://docs.spark.io/#/api/spark-cloud-api-authentication).

### More reliable firmware

Until this week, some users have been reporting an issue that has been referred to as the "Cyan Flash of Death". Due to an internal failure in the CC3000, on some networks after anytime from a few minutes to a few hours, the Core would go mute, and would be unresponsive until manually reset.

Because the underlying issue here is within the CC3000 where we do not have complete visibility, we are working with Texas Instruments to understand the root cause of the failure. In the meantime, we have issued a workaround; when the Core disconnects, it will now reset the Wi-Fi module so that it will recover. So while some users will still encounter occasional disconnects, they should now be temporary, and the Core will re-connect automatically within a minute or two.

We will be continuing to debug this issue during our next Sprint.

### Spark.disconnect() and Spark.connect()

In the Spark community, many users were requesting a mechanism to take control over the connection to the Spark Cloud. We have now implemented two functions, `Spark.disconnect()` and `Spark.connect()`, which will let users temporarily deactivate and re-activate the connection to the Spark Cloud.

### Better code parsing

Like the Arduino IDE, the Spark IDE has a pre-processor that adds a little magic to your code. The pre-processor automatically includes the Spark libraries and generates function prototypes that declare functions at the beginning of your code so that they can be used anywhere.

The pre-processor uses a bunch of regular expressions (regex), and previously had a few bugs, such as parsing functions within multi-line comments.

This week, the pre-processor went through an overhaul, so more of your code will compile successfully.

### Miscellaneous tweaks and improvements

In addition to the larger features and bugfixes above, we made a number of minor improvements, such as:

- The Spark Build IDE should now show a 'log in' screen rather than a 'sign up' screen if you've already been to the site and created an account/logged in before.
- We purchased a wildcard certificate so that we can register more domains. Now, [community.sparkdevices.com](http://community.sparkdevices.com) is [community.spark.io](http://community.spark.io)!
- We improved our staging environment for the Cloud, Core, and IDE. This won't have any direct effect on Spark users, since it is for internal development, but it does mean that we can better test changes internally before pushing them out.
- We merged a number of pull requests from the community, including [a fix to I2C addressing](https://community.spark.io/t/important-7-bit-i2c-addresses-are-now-working-01-24-2014/2376?u=zach). Some of our best features and bug fixes are generated by the community; we happily accept pull requests to our firmware and other open source software!

### Next up: Multiple files and further robustness improvements

As mentioned above, one of our most frequent feature requests is adding a capability for creating and sharing libraries for the Spark Core. While our example apps feature above was the first step, the next major step forward will be creating the capability for apps that include multiple files. This feature will be one of our top priorities during Sprint 5. Once this is complete, we will be able to link in community-generated libraries, most likely during Sprint 6.

In addition, while we have made a number of changes improving the robustness of the Spark Core, there's still work to do. During Sprint 5, we hope to squash the "Cyan Flash of Death" for good, and make other changes to ensure that the Spark Core stays connected and running your code consistently.


text:
import random
import itertools
from srtools import sam

class NullSequenceError(ValueError):
    """The exception raised when attempting to illegally manipulate a null
    sequence (i.e., an empty sequence or one composed entirely of N's).
    The GC content of a null sequence is undefined, for example.

    """
    pass

COMPLEMENT = {'A': 'T', 'C': 'G', 'G': 'C', 'T': 'A', 'N': 'N'}

def read_fasta(fasta_file):
    """Returns a dictionary a sequence names and values from a fasta-format
    file.

    """
    seq_dict = {}
    with open(fasta_file) as f:
        for line in f:
            if line.startswith(">"):
                name = line[1:].strip()
            elif line.strip():
                seq_dict.setdefault(name, "")
                seq_dict[name] += line.strip()
    return seq_dict

def reverse_complement(sequence):
    rc = []
    seq = list(sequence)
    while seq:
        rc.append(COMPLEMENT[seq.pop()])
    return "".join(rc)

def gc_content(sequence):
    """Returns the fraction of the sequence which consists of GC base pairs.

    """
    base_counts = {x: sequence.count(x) for x in sequence if x in "ACGT"}
    base_counts.setdefault("G", 0)
    base_counts.setdefault("C", 0)
    total = sum(base_counts.values())

    if total == 0:
        raise NullSequenceError

    gc_count = base_counts["G"] + base_counts["C"]
    return gc_count / total

def block_sequence(seq, start, n):
    """Splits a sequence into blocks of size n, prepended by the first 'start'
    items. Helper function for reading_frames.

    """
    blocks = []
    if start != 0:
        blocks.append(seq[:start])
    blocks.extend([seq[i:i + n] for i in range(start, len(seq), n)])
    return  blocks

def reading_frames(sequence):
    """Returns the six possible reading frames of the sequence."""

    frames = []

    for i in range(3):
        frames.append(block_sequence(sequence, i, 3))
        frames.append(block_sequence(reverse_complement(sequence), i, 3))

    return frames

def open_reading_frames(sequence):
    """Returns a list of the ORFs of the sequence in all six translation
    frames.

    """
    stop_codons = ["TAG", "TAA", "TGA"]
    orfs = []
    for frame in reading_frames(sequence):
        starts = [i for i, x in enumerate(frame) if x == "ATG"]
        stops = [i for i, x in enumerate(frame) if x in stop_codons]
        product = itertools.product(starts, stops)
        fr_list = ["".join(frame[a:b]) for a, b in product if a < b]
        orfs.extend(fr_list)
    return orfs

def random_sequence(length):
    """Returns a random nucleotide sequence of the specified length."""
    return "".join([random.choice("ACGT") for i in range(length)])

def randomize_sequence(seq):
    """Randomizes a sequence of nucleotides, preserving N's"""
    nucs = []
    for nucleotide in seq:
        if nucleotide == "N":
            nucs.append("N")
        else:
            nucs.append(random.choice("ACGT"))
    return "".join(nucs)


text:
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <locale>
#include <sstream>

using namespace std;

/* implement your stack here */

main( int argc, char** argv ){//get arguments from command line, i.e., yourexec filename
	int result, op1,op2,number,i;
	char oper;
	string expression;
	ifstream input_file;
	if(argc==2) input_file.open(argv[1]);
	else { cout<< "cannot read file " << argv[1] << endl; exit(0);}
	while(!input_file.eof()){
		getline(input_file,expression);
		if(isdigit(expression[0])){
		  stringstream line(expression);
		  line >> number;
		  cout << "reading number " << number << endl;
		  //modify here to deal with the Stack
		  //PUSH number
		}
		else {
		  if(expression[0]=='+' || expression[0]=='-'|| expression[0]=='/'||expression[0]=='*') {
		    stringstream line(expression);
		    line >> oper;
		    cout << "reading operator " << oper << endl;
		    //op2 = TOP
		    //POP
		    //op1 = TOP
		    //POP
		    //compute result
		    //PUSH result
		  }
		}
	}
	//finalanswer = TOP
	//the last element of the stack should be the final answer...
}


text:
from __future__ import division, print_function, absolute_import

import os.path
import tempfile
import shutil
import numpy as np
import warnings

from numpy.testing import (assert_, assert_equal, dec, decorate_methods,
                           TestCase, run_module_suite, assert_allclose)

from scipy import misc

try:
    import PIL.Image
except ImportError:
    _have_PIL = False
else:
    _have_PIL = True

# Function / method decorator for skipping PIL tests on import failure
_pilskip = dec.skipif(not _have_PIL, 'Need to import PIL for this test')

datapath = os.path.dirname(__file__)

class TestPILUtil(TestCase):
    def test_imresize(self):
        im = np.random.random((10,20))
        for T in np.sctypes['float'] + [float]:
            # 1.1 rounds to below 1.1 for float16, 1.101 works
            im1 = misc.imresize(im,T(1.101))
            assert_equal(im1.shape,(11,22))

    def test_imresize2(self):
        im = np.random.random((20,30))
        im2 = misc.imresize(im, (30,40), interp='bicubic')
        assert_equal(im2.shape, (30,40))

    def test_imresize3(self):
        im = np.random.random((15,30))
        im2 = misc.imresize(im, (30,60), interp='nearest')
        assert_equal(im2.shape, (30,60))

    def test_imresize4(self):
        im = np.array([[1, 2],
                       [3, 4]])
        # Check that resizing by target size, float and int are the same
        im2 = misc.imresize(im, (4,4), mode='F')  # output size
        im3 = misc.imresize(im, 2., mode='F')  # fraction
        im4 = misc.imresize(im, 200, mode='F')  # percentage
        assert_equal(im2, im3)
        assert_equal(im2, im4)

    def test_bytescale(self):
        x = np.array([0,1,2], np.uint8)
        y = np.array([0,1,2])
        assert_equal(misc.bytescale(x), x)
        assert_equal(misc.bytescale(y), [0,127,255])

    def test_bytescale_keywords(self):
        x = np.array([40, 60, 120, 200, 300, 500])
        res_lowhigh = misc.bytescale(x, low=10, high=143)
        assert_equal(res_lowhigh, [10, 16, 33, 56, 85, 143])
        res_cmincmax = misc.bytescale(x, cmin=60, cmax=300)
        assert_equal(res_cmincmax, [0, 0, 64, 149, 255, 255])

        assert_equal(misc.bytescale(np.array([3, 3, 3]), low=4), [4, 4, 4])

    def test_imsave(self):
        with warnings.catch_warnings(record=True):  # PIL ResourceWarning
            img = misc.imread(os.path.join(datapath, 'data', 'icon.png'))
        tmpdir = tempfile.mkdtemp()
        try:
            fn1 = os.path.join(tmpdir, 'test.png')
            fn2 = os.path.join(tmpdir, 'testimg')
            with warnings.catch_warnings(record=True):  # PIL ResourceWarning
                misc.imsave(fn1, img)
                misc.imsave(fn2, img, 'PNG')

            with warnings.catch_warnings(record=True):  # PIL ResourceWarning
                data1 = misc.imread(fn1)
                data2 = misc.imread(fn2)

            assert_allclose(data1, img)
            assert_allclose(data2, img)
        finally:
            shutil.rmtree(tmpdir)

def tst_fromimage(filename, irange):
    fp = open(filename, "rb")
    img = misc.fromimage(PIL.Image.open(fp))
    fp.close()
    imin,imax = irange
    assert_(img.min() >= imin)
    assert_(img.max() <= imax)

@_pilskip
def test_fromimage():
    # Test generator for parametric tests
    data = {'icon.png':(0,255),
            'icon_mono.png':(0,2),
            'icon_mono_flat.png':(0,1)}
    for fn, irange in data.items():
        yield tst_fromimage, os.path.join(datapath,'data',fn), irange

decorate_methods(TestPILUtil, _pilskip)

if __name__ == "__main__":
    run_module_suite()


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

public class Car : MonoBehaviour {

    public float speed;
    private Vector3 movement; //движение
    public Rigidbody rb;
    public Vector3 napravlenie;
    public float tempspeed;

    void Start()
    {
        rb = GetComponent<Rigidbody>();
    }

    void FixedUpdate()
    {
        movement = new Vector3(speed * napravlenie.x, speed * napravlenie.y, speed * napravlenie.z);
        rb.velocity = movement;
    }

    private void OnTriggerStay(Collider collider)
    {
        StopLine stop = collider.GetComponent<StopLine>();
        Svetofor svetofor = collider.GetComponent<Svetofor>();
        Car nextCar = collider.GetComponent<Car>();

        if (nextCar != null)
        {
            speed = 0;
            this.tempspeed = nextCar.tempspeed;
        }
        else if ((stop && (stop._signalCar == Svetofor.signalcar.red || stop._signalCar == Svetofor.signalcar.yellow))) //при красном или желтом сигнале скорость=0
        {
            speed = 0;
        }
        else if ((stop && stop._signalCar == Svetofor.signalcar.green))//при зеленом сигнале восстанавливается начальная скорость
        {
            speed = tempspeed;
        }
        else if (collider.GetComponent<Deleter>())
        {
            speed = tempspeed;
        }
    }

    private void OnTriggerExit(Collider collider)
    {
        speed = tempspeed;
      //  Debug.Log("едет " + speed);
    }

}


text:
//-----------------------------------------------------------------------
// <copyright file="mainwindow.xaml.cs" company="ELTE">
//     Copyright (c) ELTE All rights reserved.
// </copyright>
// <author>kornel.katai</author>
// <date>3/2/2016 4:55 PM</date>
//-----------------------------------------------------------------------

namespace MovieCatalog
{
    using MovieCatalog.ViewModel;
    using System.Windows;

    /// <summary>
    /// Interaction logic for <see cref="MainWindow" />.
    /// </summary>
    public partial class MainWindow : Window
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="MainWindow"/> class.
        /// </summary>
        /// <param name="context">The context.</param>
        public MainWindow(MovieCatalogViewModel context)
        {
            this.DataContext = context;
            this.InitializeComponent();
        }
    }
}


text:
#include <skiboot.h>
#include <lpc.h>
#include <console.h>
#include <opal.h>
#include <device.h>
#include <interrupts.h>
#include <processor.h>
#include <errorlog.h>
#include <trace.h>
#include <timebase.h>
#include <cpu.h>
#include <chip.h>

DEFINE_LOG_ENTRY(OPAL_RC_UART_INIT, OPAL_PLATFORM_ERR_EVT, OPAL_UART,
		 OPAL_CEC_HARDWARE, OPAL_PREDICTIVE_ERR_GENERAL,
		 OPAL_NA, NULL);

/* UART reg defs */
#define REG_RBR		0
#define REG_THR		0
#define REG_DLL		0
#define REG_IER		1
#define REG_DLM		1
#define REG_FCR		2
#define REG_IIR		2
#define REG_LCR		3
#define REG_MCR		4
#define REG_LSR		5
#define REG_MSR		6
#define REG_SCR		7

#define LSR_DR		0x01  /* Data ready */
#define LSR_OE		0x02  /* Overrun */
#define LSR_PE		0x04  /* Parity error */
#define LSR_FE		0x08  /* Framing error */
#define LSR_BI		0x10  /* Break */
#define LSR_THRE	0x20  /* Xmit holding register empty */
#define LSR_TEMT	0x40  /* Xmitter empty */
#define LSR_ERR		0x80  /* Error */

#define LCR_DLAB 	0x80  /* DLL access */

#define IER_RX		0x01
#define IER_THRE	0x02
#define IER_ALL		0x0f

static struct lock uart_lock = LOCK_UNLOCKED;
static struct dt_node *uart_node;
static uint32_t uart_base;
static bool has_irq, irq_ok, rx_full, tx_full;
static uint8_t tx_room;
static uint8_t cached_ier;

static void uart_trace(u8 ctx, u8 cnt, u8 irq_state, u8 in_count)
{
	union trace t;

	t.uart.ctx = ctx;
	t.uart.cnt = cnt;
	t.uart.irq_state = irq_state;
	t.uart.in_count = in_count;
	trace_add(&t, TRACE_UART, sizeof(struct trace_uart));
}

static inline uint8_t uart_read(unsigned int reg)
{
	return lpc_inb(uart_base + reg);
}

static inline void uart_write(unsigned int reg, uint8_t val)
{
	lpc_outb(val, uart_base + reg);
}

static void uart_check_tx_room(void)
{
	if (uart_read(REG_LSR) & LSR_THRE) {
		/* FIFO is 16 entries */
		tx_room = 16;
		tx_full = false;
	}
}

static void uart_wait_tx_room(void)
{
	while(!tx_room) {
		uart_check_tx_room();
		if (!tx_room)
			cpu_relax();
	}
}

static void uart_update_ier(void)
{
	uint8_t ier = 0;

	if (!has_irq)
		return;
	/* If we have never got an interrupt, enable them all,
	 * the first interrupt received will tell us if interrupts
	 * are functional (some boards are missing an EC or FPGA
	 * programming causing LPC interrupts not to work).
	 */
	if (!irq_ok)
		ier = IER_ALL;
	if (!rx_full)
		ier |= IER_RX;
	if (tx_full)
		ier |= IER_THRE;
	if (ier != cached_ier) {
		uart_write(REG_IER, ier);
		cached_ier = ier;
	}
}

/*
 * Internal console driver (output only)
 */
static size_t uart_con_write(const char *buf, size_t len)
{
	size_t written = 0;

	/* If LPC bus is bad, we just swallow data */
	if (!lpc_ok())
		return written;

	lock(&uart_lock);
	while(written < len) {
		if (tx_room == 0) {
			uart_wait_tx_room();
			if (tx_room == 0)
				goto bail;
		} else {
			uart_write(REG_THR, buf[written++]);
			tx_room--;
		}
	}
 bail:
	unlock(&uart_lock);
	return written;
}

static struct con_ops uart_con_driver = {
	.write = uart_con_write
};

/*
 * OPAL console driver
 */

/*
 * We implement a simple buffer to buffer input data as some bugs in
 * Linux make it fail to read fast enough after we get an interrupt.
 *
 * We use it on non-interrupt operations as well while at it because
 * it doesn't cost us much and might help in a few cases where Linux
 * is calling opal_poll_events() but not actually reading.
 *
 * Most of the time I expect we'll flush it completely to Linux into
 * it's tty flip buffers so I don't bother with a ring buffer.
 */
#define IN_BUF_SIZE	0x1000
static uint8_t	*in_buf;
static uint32_t	in_count;

/*
 * We implement a ring buffer for output data as well to speed things
 * up a bit. This allows us to have interrupt driven sends. This is only
 * for the output data coming from the OPAL API, not the internal one
 * which is already bufferred.
 */
#define OUT_BUF_SIZE	0x1000
static uint8_t *out_buf;
static uint32_t out_buf_prod;
static uint32_t out_buf_cons;

static void uart_flush_out(void)
{
	bool tx_was_full = tx_full;

	while(out_buf_prod != out_buf_cons) {
		if (tx_room == 0) {
			/*
			 * If the interrupt is not functional,
			 * we force a full synchronous flush,
			 * otherwise the Linux console isn't
			 * usable (too slow).
			 */
			if (irq_ok)
				uart_check_tx_room();
			else
				uart_wait_tx_room();
		}
		if (tx_room == 0) {
			tx_full = true;
			break;
		}
		uart_write(REG_THR, out_buf[out_buf_cons++]);
		out_buf_cons %= OUT_BUF_SIZE;
		tx_room--;
	}
	if (tx_full != tx_was_full)
		uart_update_ier();
}

static uint32_t uart_tx_buf_space(void)
{
	return OUT_BUF_SIZE - 1 -
		(out_buf_prod + OUT_BUF_SIZE - out_buf_cons) % OUT_BUF_SIZE;
}

static int64_t uart_opal_write(int64_t term_number, int64_t *length,
			       const uint8_t *buffer)
{
	size_t written = 0, len = *length;

	if (term_number != 0)
		return OPAL_PARAMETER;

	lock(&uart_lock);

	/* Copy data to out buffer */
	while (uart_tx_buf_space() && len--) {
		out_buf[out_buf_prod++] = *(buffer++);
		out_buf_prod %= OUT_BUF_SIZE;
		written++;
	}

	/* Flush out buffer again */
	uart_flush_out();

	unlock(&uart_lock);

	*length = written;

	return OPAL_SUCCESS;
}

static int64_t uart_opal_write_buffer_space(int64_t term_number,
					    int64_t *length)
{
	if (term_number != 0)
		return OPAL_PARAMETER;

	lock(&uart_lock);
	*length = uart_tx_buf_space();
	unlock(&uart_lock);

	return OPAL_SUCCESS;
}

/* Must be called with UART lock held */
static void uart_read_to_buffer(void)
{
	/* As long as there is room in the buffer */
	while(in_count < IN_BUF_SIZE) {
		/* Read status register */
		uint8_t lsr = uart_read(REG_LSR);

		/* Nothing to read ... */
		if ((lsr & LSR_DR) == 0)
			break;

		/* Read and add to buffer */
		in_buf[in_count++] = uart_read(REG_RBR);
	}

	/* If the buffer is full disable the interrupt */
	rx_full = (in_count == IN_BUF_SIZE);
	uart_update_ier();
}

static void uart_adjust_opal_event(void)
{
	if (in_count)
		opal_update_pending_evt(OPAL_EVENT_CONSOLE_INPUT,
					OPAL_EVENT_CONSOLE_INPUT);
	else
		opal_update_pending_evt(OPAL_EVENT_CONSOLE_INPUT, 0);
}

/* This is called with the console lock held */
static int64_t uart_opal_read(int64_t term_number, int64_t *length,
			      uint8_t *buffer)
{
	size_t req_count = *length, read_cnt = 0;
	uint8_t lsr = 0;

	if (term_number != 0)
		return OPAL_PARAMETER;
	if (!in_buf)
		return OPAL_INTERNAL_ERROR;

	lock(&uart_lock);

	/* Read from buffer first */
	if (in_count) {
		read_cnt = in_count;
		if (req_count < read_cnt)
			read_cnt = req_count;
		memcpy(buffer, in_buf, read_cnt);
		req_count -= read_cnt;
		if (in_count != read_cnt)
			memmove(in_buf, in_buf + read_cnt, in_count - read_cnt);
		in_count -= read_cnt;
	}

	/*
	 * If there's still room in the user buffer, read from the UART
	 * directly
	 */
	while(req_count) {
		lsr = uart_read(REG_LSR);
		if ((lsr & LSR_DR) == 0)
			break;
		buffer[read_cnt++] = uart_read(REG_RBR);
		req_count--;
	}

	/* Finally, flush whatever's left in the UART into our buffer */
	uart_read_to_buffer();

	uart_trace(TRACE_UART_CTX_READ, read_cnt, tx_full, in_count);

	unlock(&uart_lock);

	/* Adjust the OPAL event */
	uart_adjust_opal_event();

	*length = read_cnt;
	return OPAL_SUCCESS;
}

static void __uart_do_poll(u8 trace_ctx)
{
	if (!in_buf)
		return;

	lock(&uart_lock);
	uart_read_to_buffer();
	uart_flush_out();
	uart_trace(trace_ctx, 0, tx_full, in_count);
	unlock(&uart_lock);

	uart_adjust_opal_event();
}

static void uart_console_poll(void *data __unused)
{
	__uart_do_poll(TRACE_UART_CTX_POLL);
}

static void uart_irq(uint32_t chip_id __unused, uint32_t irq_mask __unused)
{
	if (!irq_ok) {
		prlog(PR_DEBUG, "UART: IRQ functional !\n");
		irq_ok = true;
	}
	__uart_do_poll(TRACE_UART_CTX_IRQ);
}

/*
 * Common setup/inits
 */

void uart_setup_linux_passthrough(void)
{
	char *path;

	dt_add_property_strings(uart_node, "status", "ok");
	path = dt_get_path(uart_node);
	dt_add_property_string(dt_chosen, "linux,stdout-path", path);
	free(path);
	prlog(PR_DEBUG, "UART: Enabled as OS pass-through\n");
}

void uart_setup_opal_console(void)
{
	struct dt_node *con, *consoles;

	/* Create OPAL console node */
	consoles = dt_new(opal_node, "consoles");
	assert(consoles);
	dt_add_property_cells(consoles, "#address-cells", 1);
	dt_add_property_cells(consoles, "#size-cells", 0);

	con = dt_new_addr(consoles, "serial", 0);
	assert(con);
	dt_add_property_string(con, "compatible", "ibm,opal-console-raw");
	dt_add_property_cells(con, "#write-buffer-size", INMEM_CON_OUT_LEN);
	dt_add_property_cells(con, "reg", 0);
	dt_add_property_string(con, "device_type", "serial");

	dt_add_property_string(dt_chosen, "linux,stdout-path",
			       "/ibm,opal/consoles/serial@0");

	/*
	 * We mark the UART as reserved since we don't want the
	 * kernel to start using it with its own 8250 driver
	 */
	dt_add_property_strings(uart_node, "status", "reserved");

	/*
	 * If the interrupt is enabled, turn on RX interrupts (and
	 * only these for now
	 */
	tx_full = rx_full = false;
	uart_update_ier();

	/* Allocate an input buffer */
	in_buf = zalloc(IN_BUF_SIZE);
	out_buf = zalloc(OUT_BUF_SIZE);
	prlog(PR_DEBUG, "UART: Enabled as OS console\n");

	/* Register OPAL APIs */
	opal_register(OPAL_CONSOLE_READ, uart_opal_read, 3);
	opal_register(OPAL_CONSOLE_WRITE_BUFFER_SPACE,
		      uart_opal_write_buffer_space, 2);
	opal_register(OPAL_CONSOLE_WRITE, uart_opal_write, 3);

	opal_add_poller(uart_console_poll, NULL);
}

static bool uart_init_hw(unsigned int speed, unsigned int clock)
{
	unsigned int dll = (clock / 16) / speed;

	/* Clear line control */
	uart_write(REG_LCR, 0x00);

	/* Check if the UART responds */
	uart_write(REG_IER, 0x01);
	if (uart_read(REG_IER) != 0x01)
		goto detect_fail;
	uart_write(REG_IER, 0x00);
	if (uart_read(REG_IER) != 0x00)
		goto detect_fail;

	uart_write(REG_LCR, LCR_DLAB);
	uart_write(REG_DLL, dll & 0xff);
	uart_write(REG_DLM, dll >> 8);
	uart_write(REG_LCR, 0x03); /* 8N1 */
	uart_write(REG_MCR, 0x03); /* RTS/DTR */
	uart_write(REG_FCR, 0x07); /* clear & en. fifos */
	return true;

 detect_fail:
	prerror("UART: Presence detect failed !\n");
	return false;
}

static struct lpc_client uart_lpc_client = {
	.interrupt = uart_irq,
};

void uart_init(bool use_interrupt)
{
	const struct dt_property *prop;
	struct dt_node *n;
	char *path __unused;
	uint32_t chip_id, irq;

	if (!lpc_present())
		return;

	/* UART lock is in the console path and thus must block
	 * printf re-entrancy
	 */
	uart_lock.in_con_path = true;

	/* We support only one */
	uart_node = n = dt_find_compatible_node(dt_root, NULL, "ns16550");
	if (!n)
		return;

	/* Get IO base */
	prop = dt_find_property(n, "reg");
	if (!prop) {
		log_simple_error(&e_info(OPAL_RC_UART_INIT),
				"UART: Can't find reg property\n");
		return;
	}
	if (dt_property_get_cell(prop, 0) != OPAL_LPC_IO) {
		log_simple_error(&e_info(OPAL_RC_UART_INIT),
				"UART: Only supports IO addresses\n");
		return;
	}
	uart_base = dt_property_get_cell(prop, 1);

	if (!uart_init_hw(dt_prop_get_u32(n, "current-speed"),
			  dt_prop_get_u32(n, "clock-frequency"))) {
		prerror("UART: Initialization failed\n");
		dt_add_property_strings(n, "status", "bad");
		return;
	}
	chip_id = dt_get_chip_id(uart_node);

	/*
	 * Mark LPC used by the console (will mark the relevant
	 * locks to avoid deadlocks when flushing the console)
	 */
	lpc_used_by_console();

	/* Install console backend for printf() */
	set_console(&uart_con_driver);

	/* On Naples, use the SerIRQ, which Linux will have to share with
	 * OPAL as we don't really play the cascaded interrupt game at this
	 * point...
	 */
	if (use_interrupt) {
		irq = dt_prop_get_u32(n, "interrupts");
		uart_lpc_client.interrupts = LPC_IRQ(irq);
		lpc_register_client(chip_id, &uart_lpc_client);
		has_irq = true;
		prlog(PR_DEBUG, "UART: Using LPC IRQ %d\n", irq);
	} else
		has_irq = false;
}


text:
* Latest code: please clone the latest code from [Github](https://github.com/apache/incubator-singa)

* v0.3.0 (20 April 2016):
    * [Apache SINGA 0.3.0](http://www.apache.org/dyn/closer.cgi/incubator/singa/0.3.0/apache-singa-incubating-0.3.0.tar.gz)
      [\[MD5\]](https://dist.apache.org/repos/dist/release/incubator/singa/0.3.0/apache-singa-incubating-0.3.0.tar.gz.md5)
      [\[KEYS\]](https://dist.apache.org/repos/dist/release/incubator/singa/0.3.0/KEYS)
    * [Release Notes 0.3.0](releases/RELEASE_NOTES_0.3.0.html)
    * New features and major updates,
        * [Training on GPU cluster](v0.3.0/gpu.html) enables training of deep learning models over a GPU cluster.
        * [Python wrapper improvement](v0.3.0/python.html) makes it easy to configure the job, including neural net and SGD algorithm.
        * [New SGD updaters](v0.3.0/updater.html) are added, including Adam, AdaDelta and AdaMax.
        * [Installation](v0.3.0/installation.html) has fewer dependent libraries for single node training.
        * Heterogeneous training with CPU and GPU.
        * Support cuDNN V4.
        * Data prefetching.
        * Fix some bugs.

* v0.2.0 (14 January 2016):
    * [Apache SINGA 0.2.0](http://www.apache.org/dyn/closer.cgi/incubator/singa/0.2.0/apache-singa-incubating-0.2.0.tar.gz)
      [\[MD5\]](https://archive.apache.org/dist/incubator/singa/0.2.0/apache-singa-incubating-0.2.0.tar.gz.md5)
      [\[KEYS\]](https://archive.apache.org/dist/incubator/singa/0.2.0/KEYS)
    * [Release Notes 0.2.0](releases/RELEASE_NOTES_0.2.0.html)
    * New features and major updates,
        * [Training on GPU](v0.2.0/gpu.html) enables training of complex models on a single node with multiple GPU cards.
        * [Hybrid neural net partitioning](v0.2.0/hybrid.html) supports data and model parallelism at the same time.
        * [Python wrapper](v0.2.0/python.html) makes it easy to configure the job, including neural net and SGD algorithm.
        * [RNN model and BPTT algorithm](v0.2.0/general-rnn.html) are implemented to support applications based on RNN models, e.g., GRU.
        * [Cloud software integration](v0.2.0/distributed-training.html) includes Mesos, Docker and HDFS.
        * Visualization of neural net structure and layer information, which is helpful for debugging.
        * Linear algebra functions and random functions against Blobs and raw data pointers.
        * New layers, including SoftmaxLayer, ArgSortLayer, DummyLayer, RNN layers and cuDNN layers.
        * Update Layer class to carry multiple data/grad Blobs.
        * Extract features and test performance for new data by loading previously trained model parameters.
        * Add Store class for IO operations.

* v0.1.0 (8 October 2015):
    * [Apache SINGA 0.1.0](http://www.apache.org/dyn/closer.cgi/incubator/singa/apache-singa-incubating-0.1.0.tar.gz)
      [\[MD5\]](https://archive.apache.org/dist/incubator/singa/apache-singa-incubating-0.1.0.tar.gz.md5)
      [\[KEYS\]](https://archive.apache.org/dist/incubator/singa/KEYS)
    * [Amazon EC2 image](https://console.aws.amazon.com/ec2/v2/home?region=ap-southeast-1#LaunchInstanceWizard:ami=ami-b41001e6)
    * [Release Notes 0.1.0](releases/RELEASE_NOTES_0.1.0.html)
    * Major features include,
        * Installation using GNU build utility
        * Scripts for job management with zookeeper
        * Programming model based on NeuralNet and Layer abstractions.
        * System architecture based on Worker, Server and Stub.
        * Training models from three different model categories, namely, feed-forward models, energy models and RNN models.
        * Synchronous and asynchronous distributed training frameworks using CPU
        * Checkpoint and restore
        * Unit test using glog

**Disclaimer**

Apache SINGA is an effort undergoing incubation at The Apache Software
Foundation (ASF), sponsored by the name of Apache Incubator PMC. Incubation is
required of all newly accepted projects until a further review indicates that
the infrastructure, communications, and decision making process have stabilized
in a manner consistent with other successful ASF projects. While incubation
status is not necessarily a reflection of the completeness or stability of the
code, it does indicate that the project has yet to be fully endorsed by the
ASF.


text:
using Sordid.Core.Model;

namespace Sordid.Core.Interfaces
{
    public interface ISkillRepository : IBaseRepository<Skill>
    {
    }
}


text:
package org.apache.camel.component.atmosphere.websocket;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.io.StringReader;
import java.util.List;

import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class WebsocketRouteTest extends WebsocketCamelRouterTestSupport {
    private static final String RESPONSE_GREETING = "Hola ";
    private static final byte[] RESPONSE_GREETING_BYTES = { 0x48, 0x6f, 0x6c, 0x61, 0x20 };

    @Test
    void testWebsocketSingleClient() throws Exception {
        TestClient wsclient = new TestClient("ws://localhost:" + PORT + "/hola");
        wsclient.connect();

        wsclient.sendTextMessage("Cerveza");

        assertTrue(wsclient.await(10));
        List<String> received = wsclient.getReceived(String.class);
        assertEquals(1, received.size());
        assertEquals("Hola Cerveza", received.get(0));
        wsclient.close();
    }

    @Test
    void testWebsocketSingleClientForBytes() throws Exception {
        TestClient wsclient = new TestClient("ws://localhost:" + PORT + "/hola");
        wsclient.connect();

        wsclient.sendBytesMessage("Cerveza".getBytes("UTF-8"));

        assertTrue(wsclient.await(10));
        List<String> received = wsclient.getReceived(String.class);
        assertEquals(1, received.size());
        assertEquals("Hola Cerveza", received.get(0));
        wsclient.close();
    }

    @Test
    void testWebsocketSingleClientForReader() throws Exception {
        TestClient wsclient = new TestClient("ws://localhost:" + PORT + "/hola3");
        wsclient.connect();

        wsclient.sendTextMessage("Cerveza");

        assertTrue(wsclient.await(10));
        List<String> received = wsclient.getReceived(String.class);
        assertEquals(1, received.size());
        assertEquals("Hola Cerveza", received.get(0));
        wsclient.close();
    }

    @Test
    void testWebsocketSingleClientForInputStream() throws Exception {
        TestClient wsclient = new TestClient("ws://localhost:" + PORT + "/hola3");
        wsclient.connect();

        wsclient.sendBytesMessage("Cerveza".getBytes("UTF-8"));

        assertTrue(wsclient.await(10));
        List<String> received = wsclient.getReceived(String.class);
        assertEquals(1, received.size());
        assertEquals("Hola Cerveza", received.get(0));
        wsclient.close();
    }

    @Test
    void testWebsocketBroadcastClient() throws Exception {
        TestClient wsclient1 = new TestClient("ws://localhost:" + PORT + "/hola2", 2);
        TestClient wsclient2 = new TestClient("ws://localhost:" + PORT + "/hola2", 2);
        wsclient1.connect();
        wsclient2.connect();

        wsclient1.sendTextMessage("Gambas");
        wsclient2.sendTextMessage("Calamares");

        assertTrue(wsclient1.await(10));
        assertTrue(wsclient2.await(10));

        List<String> received1 = wsclient1.getReceived(String.class);
        assertEquals(2, received1.size());

        assertTrue(received1.contains("Hola Gambas"));
        assertTrue(received1.contains("Hola Calamares"));

        List<String> received2 = wsclient2.getReceived(String.class);
        assertEquals(2, received2.size());
        assertTrue(received2.contains("Hola Gambas"));
        assertTrue(received2.contains("Hola Calamares"));

        wsclient1.close();
        wsclient2.close();
    }

    @Test
    void testWebsocketEventsResendingDisabled() throws Exception {
        TestClient wsclient = new TestClient("ws://localhost:" + PORT + "/hola4");
        wsclient.connect();
        assertFalse(wsclient.await(10));
        wsclient.close();
    }

    // START SNIPPET: payload
    @Override
    protected RouteBuilder createRouteBuilder() {
        return new RouteBuilder() {
            public void configure() {
                // route for a single line
                from("atmosphere-websocket:///hola").to("log:info").process(new Processor() {
                    public void process(final Exchange exchange) {
                        createResponse(exchange, false);
                    }
                }).to("atmosphere-websocket:///hola");

                // route for a broadcast line
                from("atmosphere-websocket:///hola2").to("log:info").process(new Processor() {
                    public void process(final Exchange exchange) {
                        createResponse(exchange, false);
                    }
                }).to("atmosphere-websocket:///hola2?sendToAll=true");

                // route for a single stream line
                from("atmosphere-websocket:///hola3?useStreaming=true").to("log:info").process(new Processor() {
                    public void process(final Exchange exchange) {
                        createResponse(exchange, true);
                    }
                }).to("atmosphere-websocket:///hola3");

                // route for events resending disabled
                from("atmosphere-websocket:///hola4").to("log:info").process(new Processor() {
                    public void process(final Exchange exchange) {
                        checkEventsResendingDisabled(exchange);
                    }
                }).to("atmosphere-websocket:///hola4");
            }
        };
    }

    private static void createResponse(Exchange exchange, boolean streaming) {
        Object msg = exchange.getIn().getBody();
        if (streaming) {
            assertTrue(msg instanceof Reader || msg instanceof InputStream, "Expects Reader or InputStream");
        } else {
            assertTrue(msg instanceof String || msg instanceof byte[], "Expects String or byte[]");
        }

        if (msg instanceof String) {
            exchange.getIn().setBody(RESPONSE_GREETING + msg);
        } else if (msg instanceof byte[]) {
            exchange.getIn().setBody(createByteResponse((byte[]) msg));
        } else if (msg instanceof Reader) {
            exchange.getIn().setBody(new StringReader(RESPONSE_GREETING + readAll((Reader) msg)));
        } else if (msg instanceof InputStream) {
            exchange.getIn().setBody(createByteResponse(readAll((InputStream) msg)));
        }
    }

    private static void checkEventsResendingDisabled(Exchange exchange) {
        Object eventType = exchange.getIn().getHeader(WebsocketConstants.EVENT_TYPE);

        if (eventType instanceof Integer) {
            if (eventType.equals(WebsocketConstants.ONOPEN_EVENT_TYPE)
                    || eventType.equals(WebsocketConstants.ONCLOSE_EVENT_TYPE)
                    || eventType.equals(WebsocketConstants.ONERROR_EVENT_TYPE)) {
                exchange.getIn().setBody("Error. This place should never be reached.");
            }
        }
    }

    private static byte[] createByteResponse(byte[] req) {
        byte[] resp = new byte[req.length + RESPONSE_GREETING_BYTES.length];
        System.arraycopy(RESPONSE_GREETING_BYTES, 0, resp, 0, RESPONSE_GREETING_BYTES.length);
        System.arraycopy(req, 0, resp, RESPONSE_GREETING_BYTES.length, req.length);
        return resp;
    }

    private static String readAll(Reader reader) {
        StringBuilder builder = new StringBuilder();
        try {
            char[] buf = new char[4024];
            int n;
            while ((n = reader.read(buf, 0, buf.length)) > 0) {
                builder.append(buf, 0, n);
            }
        } catch (IOException e) {
            // ignore
        } finally {
            try {
                reader.close();
            } catch (IOException e) {
                // ignore
            }
        }

        return builder.toString();
    }

    private static byte[] readAll(InputStream is) {
        ByteArrayOutputStream bytebuf = new ByteArrayOutputStream();
        try {
            byte[] buf = new byte[4024];
            int n;
            while ((n = is.read(buf, 0, buf.length)) > 0) {
                bytebuf.write(buf, 0, n);
            }
        } catch (IOException e) {
            // ignore
        } finally {
            try {
                is.close();
            } catch (IOException e) {
                // ignore
            }
        }

        return bytebuf.toByteArray();
    }
    // END SNIPPET: payload
}


text:
<?php

namespace League\CLImate\Argument;

class Argument
{
    /**
     * An argument's name.
     *
     * Use this name when internally referring to the argument.
     *
     * @var string
     */
    protected $name;

    /**
     * An argument's short representation.
     *
     * @var string
     */
    protected $prefix;

    /**
     * An argument's long representation.
     *
     * @var string
     */
    protected $longPrefix;

    /**
     * An argument's description.
     *
     * @var string
     */
    protected $description;

    /**
     * Whether or not an argument is required.
     *
     * @var bool
     */
    protected $required = false;

    /**
     * Whether or not an argument only needs to be defined to have a value.
     *
     * These arguments have the value true when they are defined on the command
     * line.
     *
     * @var bool
     */
    protected $noValue = false;

    /**
     * Which data type to cast an argument's value to.
     *
     * Valid data types are "string", "int", "float", and "bool".
     *
     * @var string
     */
    protected $castTo = 'string';

    /**
     * An argument's default value.
     *
     * @var string
     */
    protected $defaultValue;

    /**
     * An argument's value, after type casting.
     *
     * @var string|int|float|bool
     */
    protected $value;

    /**
     * Build a new command argument.
     *
     * @param string $name
     */
    public function __construct($name)
    {
        $this->setName($name);
    }

    /**
     * Build a new command argument from an array.
     *
     * @param string $name
     * @param array $params
     *
     * @return Argument
     */
    public static function createFromArray($name, array $params)
    {
        $argument = new Argument($name);
        $params   = self::getSettableArgumentParams($params);

        foreach ($params as $key => $value) {
            $method = 'set' . ucwords($key);
            $argument->{$method}($value);
        }

        if ($argument->defaultValue()) {
            $argument->setValue($argument->defaultValue());
        }

        return $argument;
    }

    /**
     * Get argument params based on settable properties
     *
     * @param array $params
     *
     * @return array
     */
    protected static function getSettableArgumentParams(array $params)
    {
        $allowed = [
                    'prefix',
                    'longPrefix',
                    'description',
                    'required',
                    'noValue',
                    'castTo',
                    'defaultValue',
                ];

        return array_intersect_key($params, array_flip($allowed));
    }

    /**
     * Retrieve an argument's name.
     *
     * Use this name when internally referring to the argument.
     *
     * @return string
     */
    public function name()
    {
        return $this->name;
    }

    /**
     * Set an argument's name.
     *
     * Use this name when internally referring to the argument.
     *
     * @param string $name
     */
    protected function setName($name)
    {
        $this->name = trim($name);
    }

    /**
     * Retrieve an argument's short form.
     *
     * @return string
     */
    public function prefix()
    {
        return $this->prefix;
    }

    /**
     * Set an argument's short form.
     *
     * @param string $prefix
     */
    protected function setPrefix($prefix)
    {
        $this->prefix = trim($prefix);
    }

    /**
     * Retrieve an argument's long form.
     *
     * @return string
     */
    public function longPrefix()
    {
        return $this->longPrefix;
    }

    /**
     * Set an argument's short form.
     *
     * @param string $longPrefix
     */
    protected function setLongPrefix($longPrefix)
    {
        $this->longPrefix = trim($longPrefix);
    }

    /**
     * Determine if an argument has a prefix.
     *
     * @return bool
     */
    public function hasPrefix()
    {
        return $this->prefix() || $this->longPrefix();
    }

    /**
     * Retrieve an argument's description.
     *
     * @return string
     */
    public function description()
    {
        return $this->description;
    }

    /**
     * Set an argument's description.
     *
     * @param string $description
     */
    protected function setDescription($description)
    {
        $this->description = trim($description);
    }

    /**
     * Determine whether or not an argument is required.
     *
     * @return bool
     */
    public function isRequired()
    {
        return $this->required;
    }

    /**
     * Set whether an argument is required or not.
     *
     * @param bool $required
     */
    protected function setRequired($required)
    {
        $this->required = (bool) $required;
    }

    /**
     * Determine whether or not an argument only needs to be defined to have a
     * value.
     *
     * @return bool
     */
    public function noValue()
    {
        return $this->noValue;
    }

    /**
     * Set whether or not an argument only needs to be defined to have a value.
     *
     * @param bool $noValue
     */
    protected function setNoValue($noValue)
    {
        $this->setCastTo('bool');
        $this->noValue = (bool) $noValue;
    }

    /**
     * Retrieve the data type to cast an argument's value to.
     *
     * @return string
     */
    public function castTo()
    {
        return $this->castTo;
    }

    /**
     * Set the data type to cast an argument's value to.
     *
     * Valid data types are "string", "int", "float", and "bool".
     *
     * @throws \Exception if $castTo is not a valid data type.
     * @param string $castTo
     */
    protected function setCastTo($castTo)
    {
        if (!in_array($castTo, ['string', 'int', 'float', 'bool'])) {
            throw new \Exception(
                "An argument may only be cast to the data type "
                . "'string', 'int', 'float', or 'bool'."
            );
        }

        $this->castTo = $this->noValue() ? 'bool' : $castTo;
    }

    /**
     * Retrieve an argument's default value.
     *
     * @return string
     */
    public function defaultValue()
    {
        return $this->defaultValue;
    }

    /**
     * Set an argument's default value.
     *
     * @param string $defaultValue
     */
    public function setDefaultValue($defaultValue)
    {
        $this->defaultValue = $defaultValue;
    }

    /**
     * Retrieve an argument's value.
     *
     * Argument values are type cast based on the value of $castTo.
     *
     * @return string|int|float|bool
     */
    public function value()
    {
        return $this->value;
    }

    /**
     * Set an argument's value based on its command line entry.
     *
     * Argument values are type cast based on the value of $castTo.
     *
     * @param string|bool $value
     */
    public function setValue($value)
    {
        $cast_method = 'castTo' . ucwords($this->castTo);
        $this->value = $this->{$cast_method}($value);
    }

    /**
     * @param string $value
     *
     * @return string
     */
    protected function castToString($value)
    {
        return (string) $value;
    }

    /**
     * @param string $value
     *
     * @return int
     */
    protected function castToInt($value)
    {
        return (int) $value;
    }

    /**
     * @param string $value
     *
     * @return float
     */
    protected function castToFloat($value)
    {
        return (float) $value;
    }

    /**
     * @param string $value
     *
     * @return bool
     */
    protected function castToBool($value)
    {
        return (bool) $value;
    }
}


text:
@class SVWebViewController;
@class SVModalWebViewController;

typedef NS_ENUM(NSUInteger, SVWebViewControllerDismissButtonStyle) {
    SVWebViewControllerDismissButtonStyleDone = 0,
    SVWebViewControllerDismissButtonStyleCancel
};

@protocol SVModalWebViewControllerDelegate <UIWebViewDelegate>

@optional
- (void)controllerDidPressDoneButton:(SVModalWebViewController *)controller;

@end

@interface SVModalWebViewController : UINavigationController

- (instancetype)initWithAddress:(NSString*)urlString;
- (instancetype)initWithURL:(NSURL *)URL;
- (instancetype)initWithURLRequest:(NSURLRequest *)request;

@property (nonatomic, readonly) SVWebViewController *webViewController;

@property (nonatomic, strong) UIColor *barsTintColor;
@property (nonatomic, weak) id<SVModalWebViewControllerDelegate> webViewDelegate;
@property (nonatomic, assign) SVWebViewControllerDismissButtonStyle dismissButtonStyle;

@end


text:
/*
 * This file is part of Bitsquare.
 *
 * Bitsquare is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or (at
 * your option) any later version.
 *
 * Bitsquare is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
 * License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
 */

package net.tomp2p.examples;

import net.tomp2p.dht.PeerBuilderDHT;
import net.tomp2p.nat.PeerBuilderNAT;
import net.tomp2p.p2p.Peer;
import net.tomp2p.p2p.PeerBuilder;
import net.tomp2p.peers.Number160;
import net.tomp2p.peers.PeerAddress;
import net.tomp2p.rpc.ObjectDataReply;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Used for testing with {@link TomP2PTests}
 */
public class SeedNodeForTesting {
    private static Peer peer = null;
    private static boolean running = true;
    private static final Logger log = LoggerFactory.getLogger(SeedNodeForTesting.class);

    public static void main(String[] args) throws Exception {
        try {
            Number160 peerId = Number160.createHash(TomP2PTests.BOOTSTRAP_NODE_ID);
           /* PeerMapConfiguration pmc = new PeerMapConfiguration(peerId).peerNoVerification();
            PeerMap pm = new PeerMap(pmc);*/
            peer = new PeerBuilder(peerId).ports(TomP2PTests.BOOTSTRAP_NODE_PORT)/*.peerMap(pm)*/.start();
            peer.objectDataReply(new ObjectDataReply() {
                @Override
                public Object reply(PeerAddress sender, Object request) throws Exception {
                    log.trace("received request: ", request.toString());
                    return "pong";
                }
            });

            new PeerBuilderDHT(peer).start();
            new PeerBuilderNAT(peer).start();

            log.debug("SeedNode started.");
            new Thread(new Runnable() {

                @Override
                public void run() {
                    while (running) {
                        for (PeerAddress pa : peer.peerBean().peerMap().all()) {
                            log.debug("peer online:" + pa);
                        }
                        try {
                            Thread.sleep(2000);
                        } catch (InterruptedException e) {
                            return;
                        }
                    }

                }
            }).start();

        } catch (Exception e) {
            if (peer != null)
                peer.shutdown().awaitUninterruptibly();
        }
    }

    public static void stop() {
        running = false;
        if(peer!=null ) {
            peer.shutdown().awaitUninterruptibly();
        }
        peer = null;
    }
}


text:
package org.apache.any23.writer;

import java.io.OutputStream;

import org.openrdf.rio.RDFFormat;

/**
 * @author Peter Ansell p_ansell@yahoo.com
 *
 */
public class URIListWriterFactory implements WriterFactory {

    public static final String MIME_TYPE = "text/plain";
    public static final String IDENTIFIER = "uri";

    /**
     *
     */
    public URIListWriterFactory() {
    }

    @Override
    public RDFFormat getRdfFormat() {
        throw new RuntimeException("This writer does not print RDF triples");
    }

    @Override
    public String getIdentifier() {
        return URIListWriterFactory.IDENTIFIER;
    }

    @Override
    public String getMimeType() {
        return URIListWriterFactory.MIME_TYPE;
    }

    @Override
    public FormatWriter getRdfWriter(OutputStream os) {
        return new URIListWriter(os);
    }

}


text:
Some tests targeted at how we deduce the types of closure arguments.
This process is a result of some heuristics aimed at combining the
*expected type* we have with the *actual types* that we get from
inputs. This investigation was kicked off by #38714, which revealed
some pretty deep flaws in the ad-hoc way that we were doing things
before.

See also `src/test/ui/closure-expected-type`.


text:
package com.chullas.dev.authetication.core.services.authenticationservice;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;

@SpringBootApplication
@EnableDiscoveryClient
public class AuthenticationServiceApplication {

	public static void main(String[] args) {
		SpringApplication.run(AuthenticationServiceApplication.class, args);
	}
}


text:
import sys
import os
from Maltego import *
import stawk_db
import logging
import datetime
from common import *

logging.basicConfig(level=logging.DEBUG,filename='/tmp/maltego_logs.txt',format='%(asctime)s %(levelname)s: %(message)s',datefmt='%Y-%m-%d %H:%M:%S')

sys.stderr = sys.stdout

def main():
    print "Content-type: xml\n\n";
    MaltegoXML_in = sys.stdin.read()
    if MaltegoXML_in <> '':
    	#logging.debug(MaltegoXML_in)
        m = MaltegoMsg(MaltegoXML_in)

	cursor=stawk_db.dbconnect()
        TRX = MaltegoTransform()

	drone='%'
	now=datetime.datetime.now()
        if 'start_time' in m.AdditionalFields and 'end_time' in m.AdditionalFields :
                start_time=m.AdditionalFields['start_time']
                end_time=m.AdditionalFields['end_time']
        else:
                start_time=now+datetime.timedelta(seconds=-lookback)
                end_time=now+datetime.timedelta(seconds=lookback)

                # Maltego requires format e.g 2012-10-23 22:37:12.0
                now=now.strftime("%Y-%m-%d %H:%M:%S.0")
                start_time=start_time.strftime("%Y-%m-%d %H:%M:%S.0")
                end_time=end_time.strftime("%Y-%m-%d %H:%M:%S.0")

        if 'location' in m.AdditionalFields:
		location=m.AdditionalFields['location']
	else:
                location="%"

	if 'properties.drone' in m.AdditionalFields:
		drone=m.AdditionalFields['properties.drone']

#	logging.debug("SELECT DISTINCT location FROM probes WHERE timestamp > '%s' AND timestamp < '%s' AND monitor_id LIKE '%s'" %(start_time,end_time,drone))
#	cursor.execute("SELECT DISTINCT location FROM probes WHERE timestamp > %s AND timestamp < %s AND monitor_id LIKE %s", (start_time,end_time,drone))

	logging.debug("SELECT location,MIN(timestamp),MAX(timestamp),run_id FROM probes WHERE timestamp > '%s' AND timestamp < '%s' AND monitor_id LIKE '%s' GROUP BY location"% (start_time,end_time,drone))
	cursor.execute("SELECT location,MIN(timestamp),MAX(timestamp),run_id FROM probes WHERE timestamp > %s AND timestamp < %s AND monitor_id LIKE %s GROUP BY location", (start_time,end_time,drone))

	results=cursor.fetchall()

	for row in results:
		location,start,end,run_id=row[0],row[1].strftime("%Y-%m-%d %H:%M:%S.0"),row[2].strftime("%Y-%m-%d %H:%M:%S.0"),row[3]
		logging.debug("SE / ET - %s / %s" %(start,end))
        	NewEnt=TRX.addEntity("snoopy.DroneLocation", location);

		NewEnt.addAdditionalFields("drone","drone","strict",drone)
                NewEnt.addAdditionalFields("start_time", "start_time", "nostrict",start)
                NewEnt.addAdditionalFields("end_time","end_time", "nostrict",end)
                NewEnt.addAdditionalFields("location","location","strict",location)
		NewEnt.addAdditionalFields("run_id","run_id","strict",run_id)

        TRX.returnOutput()
try:
	main()
except Exception, e:
	logging.debug(e)