text:
package nats

import (
	"encoding/json"
	"io/ioutil"
	"net/http"
	"net/url"
	"path"
	"time"

	"github.com/influxdata/telegraf"
	"github.com/influxdata/telegraf/config"
	"github.com/influxdata/telegraf/plugins/inputs"
	gnatsd "github.com/nats-io/nats-server/v2/server"
)

type Nats struct {
	Server          string
	ResponseTimeout config.Duration

	client *http.Client
}

var sampleConfig = `
  ## The address of the monitoring endpoint of the NATS server
  server = "http://localhost:8222"

  ## Maximum time to receive response
  # response_timeout = "5s"
`

func (n *Nats) SampleConfig() string {
	return sampleConfig
}

func (n *Nats) Description() string {
	return "Provides metrics about the state of a NATS server"
}

func (n *Nats) Gather(acc telegraf.Accumulator) error {
	url, err := url.Parse(n.Server)
	if err != nil {
		return err
	}
	url.Path = path.Join(url.Path, "varz")

	if n.client == nil {
		n.client = n.createHTTPClient()
	}
	resp, err := n.client.Get(url.String())
	if err != nil {
		return err
	}
	defer resp.Body.Close()

	bytes, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return err
	}

	stats := new(gnatsd.Varz)
	err = json.Unmarshal(bytes, &stats)
	if err != nil {
		return err
	}

	acc.AddFields("nats",
		map[string]interface{}{
			"in_msgs":           stats.InMsgs,
			"out_msgs":          stats.OutMsgs,
			"in_bytes":          stats.InBytes,
			"out_bytes":         stats.OutBytes,
			"uptime":            stats.Now.Sub(stats.Start).Nanoseconds(),
			"cores":             stats.Cores,
			"cpu":               stats.CPU,
			"mem":               stats.Mem,
			"connections":       stats.Connections,
			"total_connections": stats.TotalConnections,
			"subscriptions":     stats.Subscriptions,
			"slow_consumers":    stats.SlowConsumers,
			"routes":            stats.Routes,
			"remotes":           stats.Remotes,
		},
		map[string]string{"server": n.Server},
		time.Now())

	return nil
}

func (n *Nats) createHTTPClient() *http.Client {
	transport := &http.Transport{
		Proxy: http.ProxyFromEnvironment,
	}
	timeout := time.Duration(n.ResponseTimeout)
	if timeout == time.Duration(0) {
		timeout = 5 * time.Second
	}
	return &http.Client{
		Transport: transport,
		Timeout:   timeout,
	}
}

func init() {
	inputs.Add("nats", func() telegraf.Input {
		return &Nats{
			Server: "http://localhost:8222",
		}
	})
}


text:
using System;
using System.Threading.Tasks;
using AESharp.Logon.Universal.Networking.Middleware;
using AESharp.Networking.Middleware;

namespace AESharp.Logon.Middleware
{
    public class TestMiddleware : IMiddleware<LogonMetaPacket, LogonRemoteClient>
    {
        public async Task<LogonMetaPacket> CallMiddlewareAsync(LogonMetaPacket metaPacket, LogonRemoteClient context)
        {
            Console.WriteLine($"[{context.ClientGuid}]: handling {metaPacket.Payload.Length} bytes");

            return metaPacket;
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
{-
Copyright 2012-2013 Google Inc. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-}

{-# LANGUAGE FlexibleContexts #-}

module Plush.Parser.Tokens (
    whitespace,

    tok_word, tok_name,
    tok_assignment_word,
    tok_io_number,
    tok_newline,

    hereDoc,

    operator,
    tok_and_if, tok_or_if, tok_dsemi,
    tok_dless, tok_dgreat, tok_lessand, tok_greatand, tok_lessgreat,
    tok_dlessdash, tok_clobber,
    tok_bang,
    tok_lparen, tok_rparen, tok_lbrace, tok_rbrace,
    tok_bar,

    -- * keywords
    tok_if, tok_then, tok_else, tok_elif, tok_fi, tok_do, tok_done, tok_case,
    tok_esac, tok_while, tok_until, tok_for, tok_in,
    reservedWords,

    content,
    name
    )
where

import Control.Applicative ((<*), (<*>), (*>))
import Control.Monad
import qualified Data.Char as Char
import Data.Functor
import Text.Parsec

import Plush.Parser.Aliases (originalSourceColumn)
import Plush.Parser.Base
import {-# SOURCE #-} Plush.Parser.Commands (complete_command)
import Plush.Types
import Plush.Utilities

-- This is a complete refactoring of §2.3 & §2.10.1. Those sections are written
-- operationally for a state machine lexer producing a token stream. However,
-- in places a full parse of the grammar is required in order to lex. Hence,
-- this code, like other implementations, implement the tokenization as part of
-- the grammar. This requires refactoring the tokenization rules into a grammar.

whitespace :: ShellParser ()
whitespace = do
    skipMany (void (satisfy isBlank) <|> try (void $ string "\\\n"))
    optional $ char '#' >> skipMany (satisfy (/= '\n'))
    -- Handling of backslash-newline here is not perfect. See notes in
    -- tests/quote.doctest.

tokenize :: ShellParser a -> ShellParser a
tokenize p = try p <* whitespace

operators :: [String]
operators = words "&& || ;; << >> <& >& <> <<- >|"

tok_word :: ShellParser Word
tok_word = tokenize . locatedWord $
    many1 (backslash <|> singlequote <|> doublequote <|> dollar <|> backquote <|> bare)

-- In the shell command language, a word consisting solely of underscores,
-- digits, and alphabetics from the portable character set. The first character
-- of a name is not a digit.
tok_name :: ShellParser Name
tok_name = tokenize $ do
    start <- originalSourceColumn
    n <- name
    end <- originalSourceColumn
    let loc = Span start end
    return $ Name loc n

backslash :: ShellParser WordPart
backslash = char '\\' *> (Backslashed <$> anyChar)

singlequote :: ShellParser WordPart
singlequote = q *> (Singlequoted <$> manyTill anyChar q)
  where q = char '\''

doublequote :: ShellParser WordPart
doublequote = q *> (Doublequoted <$> manyTill dqContent q)
  where
    q = char '"' -- '"' screws up my editor's hilighting

    dqContent = dollar <|> backquote <|> dqBackslash <|> dqBare
    dqBackslash = char '\\' *>
        ( ( Backslashed <$> oneOf "$`\"\\\n" ) <|> return (Bare "\\") )

    dqBare = Bare <$> many1 (noneOf "$`\"\\")
        -- TODO: might be safer as: Bare <$> anyChar, though less efficient

dollar :: ShellParser WordPart
dollar = char '$' *> ( parameter <|> arithmetic <|> subcommand <|> variable )
  where
    parameter = between (char '{') (char '}') $
        (char '#' >> (flip Parameter PModLength) <$> variableName)
        <|>
        (Parameter <$> variableName <*> option PModNone modification)

    arithmetic = (try $ string "((") >>
        Arithmetic . concat <$> manyTill arithmeticContent (string "))")

    subcommand = between (char '(') (char ')') $
        Commandsub <$> complete_command

    variable = variableName >>= \v -> return $ Parameter v PModNone

    variableName = positionalName <|> specialName <|> shellVariableName
    positionalName = many1 digit
        -- these overlap with 0 in special, but the parse is the same
        -- same as dash: $11 is treated as ${11} (bash inerprets it as ${1}1)
    specialName = oneOf "@*#?-$!0" >>= return . (:[])
    shellVariableName =
        liftM2 (:) (char '_' <|> letter) $ many (char '_' <|> alphaNum)

    modification = modifiers <*> wordContent (char '}')
    modifiers = choice $ map try
        [ string ":-" >> return (PModUseDefault True)
        , string "-"  >> return (PModUseDefault False)
        , string ":=" >> return (PModAssignDefault True)
        , string "="  >> return (PModAssignDefault False)
        , string ":?" >> return (PModIndicateError True)
        , string "?"  >> return (PModIndicateError False)
        , string ":+" >> return (PModUseAlternate True)
        , string "+"  >> return (PModUseAlternate False)
        , string "%%" >> return (PModRemoveSuffix True)
        , string "%"  >> return (PModRemoveSuffix False)
        , string "##" >> return (PModRemovePrefix True)
        , string "#"  >> return (PModRemovePrefix False)
        ]
        -- TODO rather inefficient way to do this!

backquote :: ShellParser WordPart
backquote = bq *> (Backquoted <$> manyTill (bqBackslash <|> bqChar) bq)
    -- TODO(mzero): parse the text right here as a complete_command
  where
    bq = char '`'
    bqBackslash = char '\\' *> (oneOf "$`\\" <|> return '\\')
    bqChar = anyChar

-- like tok_word, but a) spaces are allowed, and b) terminates on end
wordContent :: ShellParser a -> ShellParser Word
wordContent endP = locatedWord bits
  where
    bits = (lookAhead (try endP) >> return []) <|> liftM2 (:) bit bits
    bit = (backslash <|> singlequote <|> doublequote <|> dollar <|> bChar)
    bChar = (Bare . (:[])) <$> anyChar

-- | Like doublequote content, but slightly different! See §2.6.4
arithmeticContent :: ShellParser [WordPart]
arithmeticContent = a dollar <|> a backquote <|> aBackslash <|> aParen <|> aBare
  where
    a = ((:[]) <$>)
    aBackslash = char '\\' *>
        a ( ( Backslashed <$> oneOf "$`\\\n" ) <|> return (Bare "\\") )
    aParen = char '(' >> manyTill arithmeticContent (char ')') >>=
        return . (Bare "(" :) . (++ [Bare ")"]) . concat
        -- This is not expressly part of §2.6.4, but needed for $((3*(4+5)))
    aBare = a $ Bare <$> many1 (noneOf "()$`\\")

-- | Content that is processed for parameter, command, and arithmetic
-- expansions. Used to process @ENV@ and @PSn@ variables, and also some
-- here-documents. It is very much like the content of doublequoted text.
-- See §2.7.4
content :: ShellParser Parts
content = many (cDollar <|> backquote <|> cBackslash <|> cBare)
  where
    cBackslash = char '\\' *>
        ( ( Backslashed <$> oneOf "$`\\\n" ) <|> return (Bare "\\") )
    cDollar = try dollar <|> (Bare . (:[]) <$> char '$')
    cBare = Bare <$> many1 (noneOf "$`\\")

bare :: ShellParser WordPart
bare = Bare <$> many1 (noneOf nonWordChars)
  where
    nonWordChars = " \t\n\\\'\"$`()" ++ operatorStarts
    operatorStarts = concatMap (take 1) operators

locatedWord :: ShellParser Parts -> ShellParser Word
locatedWord partsParser = do
    start <- originalSourceColumn
    ps <- partsParser
    end <- originalSourceColumn
    return $ Word (Span start end) ps
        -- TODO: should handle case where start and end are on differnt lines

tok_assignment_word :: ShellParser Assignment
tok_assignment_word = tokenize $ do
    v <- char '_' <|> letter
    vs <- many (char '_' <|> alphaNum)
    _ <- char '='
    w <- tok_word <|> locatedWord (return [])
    return $ Assignment (v:vs) w

tok_io_number :: ShellParser Int
tok_io_number = tokenize $ do
    n <- many1 digit
    _ <- lookAhead (char '<' <|> char '>')
    return $ read n

tok_newline :: ShellParser ()
tok_newline = tokenize $ do
    _ <- char '\n'
    parseQueuedHereDocs

operator :: String -> a -> ShellParser a
operator [] _ = parserZero
operator op@(c0:_) r = tokenize $ do
    _ <- char c0
    maximalOp <- runNext operators c0
    if maximalOp == op
        then return r
        else unexpected maximalOp
  where
    runOne [] = return ""
    runOne ws = (satisfy (anyHead ws) >>= runNext ws) <|> return ""
    runNext ws c = runOne [ as | (a:as) <- ws, a == c ] >>= return . (c:)
    anyHead ws c = any (==c) [ a | (a:_) <- ws ]

hereDoc :: HereDocPreprocess -> ([String] -> HereDoc) -> String
    -> ShellParser HereDoc
hereDoc prep makeHereDoc marker = nextHereDoc parseHereDoc
  where
    parseHereDoc = makeHereDoc <$> linesUntilMarker

    linesUntilMarker = (eof >> return []) <|> do
        line <- removeTabs <$> manyTill anyChar (char '\n')
        if line == marker
            then return []
            else (line :) <$> linesUntilMarker
        -- Note: The spec is silent on what to do when the marker is absent.
        -- While an causing a parser error might seem reasonable, it is very
        -- difficult because this parser is called from others wrapped in try
        -- and it isn't possible to break out of a try in Parsec. On the other
        -- hand, other shells just do what we do here: sliently slew to the end.

    removeTabs (c:cs) | prep == HereDocStripTabs && c == '\t' = removeTabs cs
    removeTabs cs = cs

tok_and_if = operator "&&" AndThen
tok_or_if = operator "||" OrThen
tok_dsemi = operator ";;" ()

tok_dgreat = operator ">>" RedirAppend
tok_lessand = operator "<&" RedirDuplicateInput
tok_greatand = operator ">&" RedirDuplicateOutput
tok_lessgreat = operator "<>" RedirInputOutput
tok_clobber = operator ">|" RedirOutputClobber

data HereDocPreprocess = HereDocPlain | HereDocStripTabs
    deriving (Eq)

tok_dless = operator "<<" HereDocPlain
tok_dlessdash = operator "<<-" HereDocStripTabs

tok_bang :: ShellParser Sense
tok_bang = tokenize $ char '!' >> return Inverted

tok_lparen = tokenize $ char '('
tok_rparen = tokenize $ char ')'
tok_lbrace = tokenize $ char '{'
tok_rbrace = tokenize $ char '}'
tok_bar = tokenize $ char '|'

keyword :: String -> ShellParser String
keyword s = tokenize $ string s

tok_if = keyword "if"
tok_then = keyword "then"
tok_else = keyword "else"
tok_elif = keyword "elif"
tok_fi = keyword "fi"
tok_do = keyword "do"
tok_done = keyword "done"
tok_case = keyword "case"
tok_esac = keyword "esac"
tok_while = keyword "while"
tok_until = keyword "until"
tok_for = keyword "for"
tok_in = keyword "in"

reservedWords :: [String]
reservedWords =
    words "if then else elif fi do done case esac while until for { } ! in"

name :: (Stream s m Char) => ParsecT s u m String
name = (:) <$> nameStart <*> many nameContinue
  where
    nameStart = satisfy $ \c -> Char.isAscii c && (Char.isLetter c || c == '_')
    nameContinue = satisfy $ \c ->
        Char.isAscii c && (Char.isLetter c || Char.isDigit c || c == '_')


text:
 # Radiant-mediamaid-extension
 # @copyright (c) 2010 Blazing CLoud (http://www.blazingcloud.net)
 # @license MIT License
 #
class Admin::MediamaidController < ApplicationController

  def index
    @mediamaids = Mediamaid.all(:order=>"created_at DESC")
    @mediamaid = Mediamaid.new
  end

  def new
    @mediamaid = Mediamaid.new
  end

   def create
    @mediamaid = Mediamaid.create( params[:mediamaid] )
    respond_to do |format|
        if @mediamaid.save
         flash[:notice] = 'File was successfully loaded!'
         format.html { render :action => "show" }
        else
          format.html { render :action => "new" }
          format.xml { render :xml => @mediamaid.errors, :status => :unprocessable_entity }
        end
     end
  end

  def show
    @mediamaid = Mediamaid.find(params[:id])

    respond_to do |format|
      format.html
      format.xml { render :xml => @mediamaid }
    end
  end

  def remove
    @mediamaid = Mediamaid.find(params[:id])
    @mediamaid.destroy

    respond_to do |format|
      flash[:notice] = "Media was removed from Gallery."
      format.html { redirect_to(admin_mediamaid_index_url) }
    end
  end

end


text:
<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/ads/googleads/v12/enums/ad_group_ad_status.proto

namespace Google\Ads\GoogleAds\V12\Enums\AdGroupAdStatusEnum;

use UnexpectedValueException;

/**
 * The possible statuses of an AdGroupAd.
 *
 * Protobuf type google.ads.googleads.v12.enums.AdGroupAdStatusEnum.AdGroupAdStatus
 */
class AdGroupAdStatus
{
    /**
     * No value has been specified.
     *
     * Generated from protobuf enum UNSPECIFIED = 0;
     */
    const UNSPECIFIED = 0;
    /**
     * The received value is not known in this version.
     * This is a response-only value.
     *
     * Generated from protobuf enum UNKNOWN = 1;
     */
    const UNKNOWN = 1;
    /**
     * The ad group ad is enabled.
     *
     * Generated from protobuf enum ENABLED = 2;
     */
    const ENABLED = 2;
    /**
     * The ad group ad is paused.
     *
     * Generated from protobuf enum PAUSED = 3;
     */
    const PAUSED = 3;
    /**
     * The ad group ad is removed.
     *
     * Generated from protobuf enum REMOVED = 4;
     */
    const REMOVED = 4;

    private static $valueToName = [
        self::UNSPECIFIED => 'UNSPECIFIED',
        self::UNKNOWN => 'UNKNOWN',
        self::ENABLED => 'ENABLED',
        self::PAUSED => 'PAUSED',
        self::REMOVED => 'REMOVED',
    ];

    public static function name($value)
    {
        if (!isset(self::$valueToName[$value])) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no name defined for value %s', __CLASS__, $value));
        }
        return self::$valueToName[$value];
    }

    public static function value($name)
    {
        $const = __CLASS__ . '::' . strtoupper($name);
        if (!defined($const)) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no value defined for name %s', __CLASS__, $name));
        }
        return constant($const);
    }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(AdGroupAdStatus::class, \Google\Ads\GoogleAds\V12\Enums\AdGroupAdStatusEnum_AdGroupAdStatus::class);


text:
package org.lib4j.pipeline;

public interface PipelineEntity {
}


text:
define([
    'react',
    'lodash'
], function (React, _) {
    'use strict';
    return function () {
        return React.createElement('div', {}, React.createElement('div', {
            'style': {
                position: 'relative',
                textAlign: 'center',
                top: this.props.config.previewTop,
                height: this.props.config.previewHeight
            }
        }, React.createElement('div', {
            'style': {
                margin: 'auto',
                height: '100%',
                width: this.props.config.previewWidth || '100%'
            }
        }, React.createElement('iframe', {
            'id': 'preview',
            'src': 'http://localhost/sites/412?ds=true',
            'style': {
                width: '100%',
                height: '100%',
                border: '0'
            }
        }))), React.createElement('div', {}, 'editor\n        ', !this.props.editorState.previewMode ? React.createElement('div', { 'key': '440' }, 'left bar') : null));
    };
});


text:
<tool id="vsearch_search" name="VSearch search" version="@VERSION@.1">
    <description></description>
    <expand macro="bio_tools"/>
    <macros>
        <import>vsearch_macros.xml</import>
    </macros>
    <expand macro="requirements" />
    <expand macro="stdio" />
    <expand macro="version_command" />
    <command>
<![CDATA[
    vsearch

        @GENERAL@
        --db '$dbfile'
        #if $dbmask:
            --dbmask "$dbmask"
        #end if

        ##--fulldp                    full dynamic programming alignment (always on)
        ##--gapext STRING             penalties for gap extension (2I/1E)
        ##--gapopen STRING            penalties for gap opening (20I/2E)
        $hardmask
        --id "$id"
        --iddef "$iddef"

        #if str( $qmask ) != 'no':
            --qmask "$qmask"
        #end if

        ## --rowlen INT                width of alignment lines in alnout output (64)

        $self_param
        $selfid_param
        $sizeout
        --strand "$strand"
        --usearch_global '$queryfile'

        #if '--alnout' in str($outputs).split( "," ):
            --alnout '$alnout'
        #end if
        #if '--blast6out' in str($outputs).split( "," ):
            --blast6out '$blast6out'
        #end if
        #if '--dbmatched' in str($outputs).split( "," ):
            --dbmatched '$dbmatched'
        #end if
        #if '--dbnotmatched' in str($outputs).split( "," ):
            --dbnotmatched '$dbnotmatched'
        #end if
        #if '--fastapairs' in str($outputs).split( "," ):
            --fastapairs '$fastapairs'
        #end if
        #if '--notmatched' in str($outputs).split( "," ):
            --notmatched '$notmatched'
        #end if
        #if '--matched' in str($outputs).split( "," ):
            --matched '$matched'
        #end if

        #if $adv_opts.adv_opts_selector == "advanced":
            $adv_opts.top_hits_only
            $adv_opts.rightjust
            $adv_opts.leftjust
            --target_cov "$adv_opts.target_cov"
            --query_cov "$adv_opts.query_cov"

            #if str( $adv_opts.maxid ):
                --maxid "$adv_opts.maxid"
            #end if
            #if str( $adv_opts.maxqt ):
                --maxqt "$adv_opts.maxqsize"
            #end if
            #if str( $adv_opts.maxsizeratio ):
                --maxsizeratio "$adv_opts.maxsizeratio"
            #end if
            #if str( $adv_opts.maxsl ):
                --maxsl "$adv_opts.maxsl"
            #end if
            #if str( $adv_opts.mid ):
                --mid "$adv_opts.mid"
            #end if
            #if str( $adv_opts.minqt ):
                --minqt "$adv_opts.minqt"
            #end if
            #if str( $adv_opts.minsizeratio ):
                --minsizeratio "$adv_opts.minseqlength"
            #end if
            #if str( $adv_opts.minsl ):
                --minsl "$adv_opts.minsl"
            #end if

            #if str( $adv_opts.mintsize ):
                --mintsize "$adv_opts.mintsize"
            #end if
            #if str( $adv_opts.mismatch ):
                --mismatch "$adv_opts.mismatch"
            #end if
            #if str( $adv_opts.maxqsize ):
                --maxqsize "$adv_opts.maxqsize"
            #end if
            #if str( $adv_opts.mincols ):
                --mincols "$adv_opts.mincols"
            #end if
            #if str( $adv_opts.maxsubs ):
                --maxsubs "$adv_opts.maxsubs"
            #end if
            #if str( $adv_opts.maxrejects ):
                --maxrejects "$adv_opts.maxrejects"
            #end if
            #if str( $adv_opts.maxaccepts ):
                --maxaccepts "$adv_opts.maxaccepts"
            #end if
            #if str( $adv_opts.maxdiffs ):
                --maxdiffs "$adv_opts.maxdiffs"
            #end if
            #if str( $adv_opts.maxgaps ):
                --maxgaps "$adv_opts.maxgaps"
            #end if
            #if str( $adv_opts.maxhits ):
                --maxhits "$adv_opts.maxhits"
            #end if
            #if str( $adv_opts.match ):
                --match "$adv_opts.match"
            #end if
            #if str( $adv_opts.idprefix ):
                --idprefix "$adv_opts.idprefix"
            #end if
            #if str( $adv_opts.idsuffix ):
                --idsuffix str( $adv_opts.idsuffix )
            #end if

            #if $adv_opts.uclust_output.uclust_output_select == 'yes':
                --uc '$uc'
                $adv_opts.uclust_output.uc_allhits
            #end if

            #if $adv_opts.userfields_output.userfields_output_select == 'yes':
                --userfields '#echo '+'.join( str($adv_opts.userfields_output.userfields).split(',') )#'
                --userout '$userout'
            #end if

            ##--weak_id REAL              include aligned hits with >= id; continue search
            --wordlength "$adv_opts.wordlength"

            $adv_opts.output_no_hits

        #end if

]]>
    </command>
    <inputs>
        <param name="queryfile" type="data" format="fasta" label="Select your query FASTA file" help="(--usearch_global)" />
        <param name="dbfile" type="data" format="fasta" label="Select your database FASTA file" help="(--db)" />

        <expand macro="qmask" />
        <expand macro="sizeout" />
        <expand macro="strand" />
        <expand macro="self_and_selfid" />
        <expand macro="id_and_iddef" />
        <expand macro="hardmask" />

        <param name="dbmask" type="select" optional="True" label="Mask database sequences" help="(--dbmask)">
            <option value="none" selected="True">No masking</option>
            <option value="dust" selected="True">dust</option>
            <option value="soft">soft</option>
        </param>

        <expand macro="general_output">
            <option value="--dbmatched">FASTA file for matching database sequences</option>
            <option value="--dbnotmatched">FASTA file for non-matching database sequences</option>
            <option value="--notmatched">Write non-matching query sequences to separate file</option>
            <option value="--matched">Write matching query sequences to separate file</option>
        </expand>

        <conditional name="adv_opts">
            <param name="adv_opts_selector" type="select" label="Advanced Options">
              <option value="basic" selected="True">Hide Advanced Options</option>
              <option value="advanced">Show Advanced Options</option>
            </param>
            <when value="basic" />
            <when value="advanced">

                <param name="top_hits_only" type="boolean" truevalue="--top_hits_only" falsevalue="" checked="False"
                    label="Output only hits with identity equal to the best" help="(--top_hits_only)"/>
                <param name="rightjust" type="boolean" truevalue="--rightjust" falsevalue="" checked="False"
                    label="Reject if terminal gaps at alignment right end" help="(--rightjust)"/>
                <param name="leftjust" type="boolean" truevalue="--leftjust" falsevalue="" checked="False"
                    label="Reject if terminal gaps at alignment left end" help="(--leftjust)"/>

                <param name="query_cov" type="float" value="" optional="True" label="Reject if fraction of query seq. aligned lower than this value"
                    help="(--query_cov)"/>
                <param name="target_cov" type="float" value="" optional="True" label="Reject if fraction of target seq. aligned lower than this value"
                    help="(--target_cov)"/>
                <param name="maxid" type="float" value="" optional="True" label="Reject if identity higher than this value"
                    help="(--maxid)"/>
                <param name="maxqt" type="float" value="" optional="True" label="Reject if query/target length ratio higher than this value"
                    help="(--maxqt)"/>
                <param name="maxsizeratio" type="float" value="" optional="True" label="Reject if query/target abundance ratio higher than this value"
                    help="(--maxsizeratio)"/>
                <param name="maxsl" type="float" value="" optional="True" label="Reject if shorter/longer length ratio higher than this value"
                    help="(--maxsl)"/>
                <param name="mid" type="float" value="" optional="True" label="Reject if percent identity lower than this value, ignoring gaps"
                    help="(--mid)"/>
                <param name="minqt" type="float" value="" optional="True" label="Reject if query/target length ratio lower than this value"
                    help="(--minqt)"/>
                <param name="minsl" type="float" value="" optional="True" label="Reject if shorter/longer length ratio lower than this value"
                    help="(--minsl)"/>
                <param name="minsizeratio" type="float" value="" optional="True" label="Reject if query/target abundance ratio lower than this value"
                    help="(--minsizeratio)"/>

                <param name="maxqsize" type="integer" value="" optional="True" label="Reject if query abundance larger than this value"
                    help="(--maxqsize)"/>
                <param name="mincols" type="integer" value="" optional="True" label="Reject if alignment length shorter than this value"
                    help="(--mincols)"/>
                <param name="maxsubs" type="integer" value="" optional="True" label="Reject if more substitutions than this value"
                    help="(--maxsubs)"/>
                <expand macro="maxrejects" />
                <expand macro="maxaccepts" />
                <param name="maxdiffs" type="integer" value="" optional="True" label="Reject if more substitutions or indels than this value"
                    help="(--maxdiffs)"/>
                <param name="maxgaps" type="integer" value="" optional="True" label="Reject if more indels than this value"
                    help="(--maxgaps)"/>
                <param name="maxhits" type="integer" value="" optional="True" label="Maximum number of hits to show"
                    help="(--maxhits)"/>
                <param name="match" type="integer" value="2" label="Score for match"
                    help="(--match)"/>
                <param name="idprefix" type="integer" value="" optional="True" label="Reject if first n nucleotides do not match"
                    help="(--idprefix)"/>
                <param name="idsuffix" type="integer" value="" optional="True" label="Reject if last n nucleotides do not match"
                    help="(--idsuffix)"/>
                <param name="mintsize" type="integer" value="" optional="True" label="Reject if target abundance lower"
                    help="(--mintsize)"/>
                <param name="mismatch" type="integer" value="-4" label="Score for mismatch"
                    help="(--mismatch)"/>

                <conditional name="uclust_output">
                    <param name="uclust_output_select" type="select" label="UCLUST-like output" help="(--uc)">
                        <option value="yes">Yes</option>
                        <option value="no" selected="True">No</option>
                    </param>
                    <when value="yes">
                        <param name="uc_allhits" type="boolean" truevalue="--uc_allhits" falsevalue="" checked="False"
                            label="Show all, not just top hits" help="(--uc_allhits)"/>
                    </when>
                    <when value="no" />
                </conditional>

                <param name="wordlength" type="integer" value="8" min="3" max="15" label="Length of words for database index 3-15"
                    help="Allowed values: 3-15 (--wordlength)"/>
                <param name="output_no_hits" type="boolean" truevalue="--output_no_hits" falsevalue="" checked="False"
                    label="Write non-matching queries to the output file" help="(--output_no_hits)"/>

                <expand macro="userfields" />
            </when>
        </conditional>

    </inputs>
    <outputs>
        <data name="uc" format="tabular" label="${tool.name} on ${on_string}: UCLUST like output">
            <filter>adv_opts['adv_opts_selector'] == "advanced" and adv_opts['uclust_output']['uclust_output_select'] == 'yes'</filter>
        </data>
        <data name="dbnotmatched" format="fasta" label="${tool.name} on ${on_string}: Non-matched database sequences">
            <filter>'--dbnotmatchedt' in outputs</filter>
        </data>
        <data name="dbmatched" format="fasta" label="${tool.name} on ${on_string}: Matched database sequences">
            <filter>'--dbmatched' in outputs</filter>
        </data>
        <data name="alnout" format="fasta" label="${tool.name} on ${on_string}: Alignment">
            <filter>'--alnout' in outputs</filter>
        </data>
        <data name="blast6out" format="tabular" label="${tool.name} on ${on_string}: BLAST like tabular">
            <filter>'--blast6out' in outputs</filter>
        </data>
        <data name="notmatched" format="fasta" label="${tool.name} on ${on_string}: Non-matched queries">
            <filter>'--notmatched' in outputs</filter>
        </data>
        <data name="matched" format="fasta" label="${tool.name} on ${on_string}: Matching query sequences">
            <filter>'--matched' in outputs</filter>
        </data>
        <data name="fastapairs" format="fasta" label="${tool.name} on ${on_string}: Query/Target sequences">
            <filter>'--fastapairs' in outputs</filter>
        </data>
        <data name="userout" format="tabular" label="${tool.name} on ${on_string}: tabular output">
            <filter>adv_opts['adv_opts_selector'] == "advanced" and adv_opts['userfields_output']['userfields_output_select'] == 'yes'</filter>
        </data>
    </outputs>
    <tests>
        <test expect_num_outputs="2">
            <param name="dbfile" value="three_human_mRNA.fasta" ftype="fasta" />
            <param name="queryfile" value="query.fasta" ftype="fasta" />
            <param name="outputs" value="--blast6out,--dbmatched" />
            <param name="dbmask" value="none" />
            <param name="adv_opts_selector" value="advanced" />
            <param name="top_hits_only" value="True" />
            <output name="dbmatched" file="search_dbmatched_result1.fasta" ftype="fasta" />
            <output name="blast6out" file="search_blast6out_result1.tabular" ftype="tabular" />
        </test>
        <test expect_num_outputs="4">
            <param name="dbfile" value="three_human_mRNA.fasta" ftype="fasta" />
            <param name="queryfile" value="query.fasta" ftype="fasta" />
            <param name="outputs" value="--fastapairs,--matched" />
            <param name="dbmask" value="none" />
            <param name="adv_opts_selector" value="advanced" />
            <param name="userfields_output_select" value="yes" />
            <param name="userfields" value="query,target,evalue" />
            <param name="top_hits_only" value="True" />
            <param name="output_no_hits" value="True" />
            <param name="uclust_output_select" value="yes" />
            <output name="uc" file="search_dbmatched_uc.tsv" ftype="tabular" />
            <output name="matched" file="search_matched_result2.fasta" ftype="fasta" />
            <output name="fastapairs" file="search_fastapairs_result2.fasta" ftype="fasta" />
            <output name="userout" file="search_userfields_result2.tabular" ftype="tabular" />
        </test>
    </tests>
    <help>
<![CDATA[
**What it does**

Sequence search based on vsearch.

@USERFIELDS_HELP@

Searching options
  --alnout FILENAME           filename for human-readable alignment output
  --blast6out FILENAME        filename for blast-like tab-separated output
  --db FILENAME               filename for FASTA formatted database for search
  --dbmask                    mask db with "dust", "soft" or "none" method (dust)
  --dbmatched FILENAME        FASTA file for matching database sequences
  --dbnotmatched FILENAME     FASTA file for non-matching database sequences
  --fastapairs FILENAME       FASTA file with pairs of query and target
  --fulldp                    full dynamic programming alignment (always on)
  --gapext STRING             penalties for gap extension (2I/1E)
  --gapopen STRING            penalties for gap opening (20I/2E)
  --hardmask                  mask by replacing with N instead of lower case
  --id REAL                   reject if identity lower
  --iddef INT                 id definition, 0-4=CD-HIT,all,int,MBL,BLAST (2)
  --idprefix INT              reject if first n nucleotides do not match
  --idsuffix INT              reject if last n nucleotides do not match
  --leftjust                  reject if terminal gaps at alignment left end
  --match INT                 score for match (2)
  --matched FILENAME          FASTA file for matching query sequences
  --maxaccepts INT            number of hits to accept and show per strand (1)
  --maxdiffs INT              reject if more substitutions or indels
  --maxgaps INT               reject if more indels
  --maxhits INT               maximum number of hits to show (unlimited)
  --maxid REAL                reject if identity higher
  --maxqsize INT              reject if query abundance larger
  --maxqt REAL                reject if query/target length ratio higher
  --maxrejects INT            number of non-matching hits to consider (32)
  --maxsizeratio REAL         reject if query/target abundance ratio higher
  --maxsl REAL                reject if shorter/longer length ratio higher
  --maxsubs INT               reject if more substitutions
  --mid REAL                  reject if percent identity lower, ignoring gaps
  --mincols INT               reject if alignment length shorter
  --minqt REAL                reject if query/target length ratio lower
  --minsizeratio REAL         reject if query/target abundance ratio lower
  --minsl REAL                reject if shorter/longer length ratio lower
  --mintsize INT              reject if target abundance lower
  --mismatch INT              score for mismatch (-4)
  --notmatched FILENAME       FASTA file for non-matching query sequences
  --output_no_hits            output non-matching queries to output files
  --qmask                     mask query with "dust", "soft" or "none" method (dust)
  --query_cov REAL            reject if fraction of query seq. aligned lower
  --rightjust                 reject if terminal gaps at alignment right end
  --rowlen INT                width of alignment lines in alnout output (64)
  --self                      reject if labels identical
  --selfid                    reject if sequences identical
  --sizeout                   write abundance annotation to output
  --strand                    search "plus" or "both" strands (plus)
  --target_cov REAL           reject if fraction of target seq. aligned lower
  --top_hits_only             output only hits with identity equal to the best
  --uc FILENAME               filename for UCLUST-like output
  --uc_allhits                show all, not just top hit with uc output
  --usearch_global FILENAME   filename of queries for global alignment search
  --userfields STRING         fields to output in userout file
  --userout FILENAME          filename for user-defined tab-separated output
  --weak_id REAL              include aligned hits with >= id; continue search
  --wordlength INT            length of words for database index 3-15 (8)

@EXTERNAL_DOCUMENTATION@

]]>
    </help>
    <expand macro="citations" />
</tool>


text:
<!-- START doctoc -->
<!-- END doctoc -->

## What belongs in the views folder?
The `views` folder is for holding code specific to a
particular page of the application. For example, you
might have a view for the homepage, a view for the
login page, and a separate view for an admin page.

UI components and widgets that could be common to
several pages should _not_ be placed in the `views`
folder - they belong in the `components` folder.

## How is the views folder structured?
Each separate view for the application should have its
own subdirectory in the `views` folder. This should
contain _all_ code specific to that view, with the
exception of Sass code. This includes the tests for
that view.

For example, the file structure for a view might look
like this:

    - views
        |- hero-panel
            |- hero-panel.controller.ts
            |- hero-panel.controller.test.ts
            |- hero-panel.service.ts
            |- hero-panel.service.test.ts
            |- hero-panel.html


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

	<title>Body Systems</title>
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />

Body Systems LSM400 Linear Smith Machine

Overview

Linear Smith Machines are the ultimate in weight machines and the LSM400
leads the field. Designed for both serious fitness users and beginners, the
LSM400's vertical design provides all of the safety and control associated
with Smith Machines, while still allowing for the effective use of gravity
for effective resistance. You don't even need a workout partner. Lock points
can be set to prevent the bar from movement outside of your body's natural
range of motion.

You can tailor the LSM400 to meet you specific workout needs. Start with the
basic package of the Smith Machine rack and, as your needs grow, add a
lat/row, pec dec, plate tree, dip, and accessory organizer. Accessories are easy
to insert and remove, allowing you to continue your workout without delay.
The LSM400 works with all standard Olympic weight plates

The LSM400 is compact with all components place one side of the unit for easy
access. This makes the LSM400 perfect for people who want a quality home gym, but
do not have a lot of space. Place the LSM400 against a wall and you're ready
to go!

Features

Smooth Smith Action: The bar (rated at 800 lb. capacity) slides on Teflon bushings alongside solid steel guide rods. Smooth motion is key to successful workouts, as the target muscles are utilized to their full potential with each repetition.

Proper Angle: The bar travels along a 7 degree path from vertical. Studies have shown that this is the proper lifting angle to increase your comfort and prevent injury.

Safety: The LSM400 has 20 lock-out points for a safe, solid stop at any point in your workout routine.

Rugged: Constructed with heavy 12 gauge steel and 7 gauge reinforcing plate. This is a unit built to last.

Warranty: Every part of the LSM400 has a lifetime guarantee. We will replace or repair anything that goes wrong.

Dimensions:Width: 85" Height: 82" Depth: 72"

Optional Attachements

Selectorized Lat/Row station (Part: MA831-4)

Pec Dec station (Part: MA218-6)

Dip station (Part: MA105-3)

Plate tree (Part: MA488-0)

Accessory organizer (MA212-1)

Workout DVD (MA051-1)

Workout poster (MA055-3)

<address style="text-align: center">Body Systems 401 Commercial Drive Eaton, TX  87015 (800) 555-2811</address>

© 2012


text:
default_unit='admin_tools dashboard theming menu'
default_all="$default_unit test_app"
if [ $# -eq 0 ]
then
    test_proj/manage.py test $default_all
else
    if [ $1 = 'unit' ]
    then
        test_proj/manage.py test $default_unit
    else
        test_proj/manage.py test $*
    fi
fi


text:
require 'spec_helper'

describe AgentsController do

  before do
    controller.stub(:set_locale)
    controller.stub(:populate_config_validity)
  end

  describe "GET 'index'" do

    before(:all) do
      config = ConfigMigrator.migrate(ConfigFileFixture::WITH_VARIETY_OF_AGENTS)
      cachedGoConfig = Spring.bean("cachedGoConfig")
      cachedGoConfig.save(config, false)
    end

    it "should answer for /agents" do
      expect(:get => "/agents").to route_to({:controller => "agents", :action => 'index',:format => "html"})
      expect(:get => "/agents.html").to route_to({:controller => "agents", :action => 'index', :format => "html"})
      expect(:get => "/agents.json").to route_to({:controller => "agents", :action => 'index', :format => "json"})
      expect(controller.send(:agents_path)).to eq("/agents")
    end

    it "should filter agents based on parameters" do
      get :index, {:filter => 'resource:filtering_resource'}
      expect(assigns(:agents).size).to eq(1)
    end

    it "should set current tab" do
     get :index
     expect(assigns(:current_tab_name)).to eq("agents")
    end

    it "should show all agents" do
      get 'index'

      response.should be_success
      expect(assigns(:agents).size).to eq(6)
      assert_template layout: :application
    end

    it "should sortBy DESC on fields" do
      get "index", :column => 'hostname', :order => 'DESC'
      assigns(:agents).inject(nil) do |previous, agent|
        expect(previous.getHostname()).to be > agent.getHostname() if previous
        agent
      end
    end

    it "should sortBy ASC on fields" do
      get "index", :column => "ip_address", :order => "ASC"
      assigns(:agents).inject(nil) do |previous, agent|
        expect(previous.getIpAddress()).to be < agent.getIpAddress() if previous
        agent
      end
    end

    it "should sort on status if no sort requested" do
      controller.stub(:agent_service).and_return(agent_service = Object.new)
      agent_service.stub(:agents).and_return(agents = [])
      agents.should_receive(:sortBy).with(AgentsController::AgentViewModel.STATUS_COMPARATOR, com.thoughtworks.go.server.ui.SortOrder::ASC).and_return([])
      agents.should_receive(:filter).with(nil).and_return([])
      agents.stub(:disabledCount).and_return(0)
      agents.stub(:enabledCount).and_return(10)
      agents.stub(:pendingCount).and_return(0)
      get "index"
      expect(assigns(:agents)).to eq []
    end

    describe :apply_default_sort_unless_sorted do
      before do
        controller.stub(:params).and_return(@params = { })
      end
      it "should apply default sort if not sorted" do
        controller.send(:apply_default_sort_unless_sorted)
        expect(@params[:column]).to eq "status"
        expect(@params[:order]).to eq("ASC")
      end

      it "should not override applied sort" do
        @params[:column] = "foo"
        @params[:order] = "DESC"
        controller.send(:apply_default_sort_unless_sorted)
        expect(@params[:column]).to eq("foo")
        expect(@params[:order]).to eq("DESC")
      end

      it "should be applied on GET index" do
        controller.should_receive(:apply_default_sort_unless_sorted)
        get :index
      end
    end

    it "should use agent_instances.agent_count to find agent count by status(for building, idle, lost_contact and missing agents)" do
      controller.stub(:agent_service).and_return(agent_service = Object.new)
      agent_service.stub(:agents).and_return(agents = [])
      agents.stub(:disabledCount).and_return(9)
      agents.stub(:enabledCount).and_return(10)
      agents.stub(:pendingCount).and_return(8)
      agents.stub(:sortBy).and_return([])
      agents.should_receive(:filter).with(nil).and_return([])
      get :index
      expect(assigns(:agents_disabled)).to eq 9
      expect(assigns(:agents_pending)).to eq 8
      expect(assigns(:agents_enabled)).to eq 10
    end

  end

  describe :edit_agents do

    it "should resolve routes" do
      expect(:post => "agents/edit_agents").to route_to({:controller => "agents", :action => 'edit_agents'})
      expect(controller.send(:edit_agents_path)).to eq("/agents/edit_agents")
    end

    it "should redirect to :index maintaining sort" do
      setup_base_urls
      bulk_edit_result = double('bulk_edit_result')
      controller.should_receive(:bulk_edit).and_return(bulk_edit_result)
      bulk_edit_result.stub(:message).and_return("successfuly managed to edit")
      bulk_edit_result.stub(:canContinue).and_return(false)
      get :edit_agents, :column => "foo", :order => "bar", :filter => "criteria"
      expect(response).to redirect_to("/agents?column=foo&filter=criteria&order=bar")
    end
  end

  describe :resource_selector do
    before(:each) do
      controller.stub(:agent_service).and_return(@agent_service = Object.new)
      @resources = [ TriStateSelection.new('resource-1', 'remove') ]
      @agent_service.stub(:getResourceSelections)
    end

    it "should resolve routes" do
      expect(controller.send(:agent_grouping_data_path, {:action => "resource_selector"})).to eq("/agents/resource_selector")
      expect(:post => "/agents/resource_selector").to route_to({:controller => "agents", :action => 'resource_selector'})
    end

    it "should load all resources" do
      @agent_service.should_receive(:getResourceSelections).with(["UUID1", "UUID2"]).and_return(@resources)
      post :resource_selector, :selected => ["UUID1", "UUID2"]
      expect(assigns(:selections)).to eq(@resources)
    end

    it "should default selected UUIDS to empty list" do
      @agent_service.should_receive(:getResourceSelections).with([]).and_return(@resources)
      post :resource_selector
      expect(assigns(:selections)).to eq(@resources)
    end

    it "should render partial resource_selector" do
      post :resource_selector, :selected => ["UUID1", "UUID2"]
      expect(response).to render_template("resource_selector")
      assert_template :layout => false
    end
  end

  describe :environments_selector do
    before(:each) do
      controller.stub(:agent_service).and_return(@agent_service = Object.new)
      @environments = [ TriStateSelection.new('resource-1', 'remove') ]
      @agent_service.stub(:getEnvironmentSelections)
    end

    it "should resolve routes" do
      expect(controller.send(:agent_grouping_data_path, {:action => "environment_selector"})).to eq("/agents/environment_selector")
      expect(:post => "/agents/environment_selector").to route_to({:controller => "agents", :action => 'environment_selector'})
    end

    it "should load all environments" do
      @agent_service.should_receive(:getEnvironmentSelections).with(["UUID1", "UUID2"]).and_return(@environments)
      post :environment_selector, :selected => ["UUID1", "UUID2"]
      expect(assigns(:selections)).to eq @environments
    end

    it "should default selected UUIDS to empty list" do
      @agent_service.should_receive(:getEnvironmentSelections).with([]).and_return(@resources)
      post :environment_selector
      expect(assigns(:selections)).to eq @resources
    end

    it "should render partial selectors" do
      post :environment_selector, :selected => ["UUID1", "UUID2"]
      expect(response).to render_template("environment_selector")
      assert_template :layout => false
    end
  end
end


text:
/* Copyright (C) 2012 Renesas Electronics Corporation. All rights reserved.   */
/*******************************************************************************
* File Name     : usbdescriptors.h
* Version       : 1.00
* Device        : Renesas Generic MCU.
* Tool-Chain    : HEW
* H/W Platform  : RSK Generic
* Description   : Descriptors required to enumerate a device as a
*                    Communication Device Class - Abstract Class Model(CDC ACM).
*
* NOTE          : This will need to be modified for a particular
*                 product as it includes company/product specific data including
*                 string descriptors specifying
*                 Manufacturer, Product and Serial Number.
***********************************************************************************/
/***********************************************************************************
* History       : 23.01.2012 Ver. 1.00 First Release
***********************************************************************************/

#ifndef FILENAME_USBDESCRIPTORS_H
#define FILENAME_USBDESCRIPTORS_H

/***********************************************************************************
System Includes
***********************************************************************************/
#include <stdint.h>

/***********************************************************************************
Type Definitions
***********************************************************************************/
/*    Descriptor    */
typedef    struct DESCRIPTOR
{
    const uint16_t length;
    const uint8_t* pucData;
}DESCRIPTOR;

/* Device Descriptor */
extern const DESCRIPTOR gDeviceDescriptor;

/* Configuration, Interface, CDC and Endpoint Descriptor */
extern const DESCRIPTOR gConfigurationDescriptor;

/* String descriptors */
extern const DESCRIPTOR gStringDescriptorLanguageIDs;
extern const DESCRIPTOR gStringDescriptorManufacturer;
extern const DESCRIPTOR gStringDescriptorProduct;
extern const DESCRIPTOR gStringDescriptorSerialNum;

/* FILENAME_USBDESCRIPTORS_H */
#endif


text:
@implementation STKBloggerComment (CoreDataProperties)

@end


text:
require 'spec_helper'

describe PoorManSearch do
  it 'should have a version number' do
    PoorManSearch::VERSION.should_not be_nil
  end
end


text:
/*
	Daytime Server
*/

package main

import (
	"net"
	"time"
)

func main() {

	service := ":1200"
	tcpAddr, err := net.ResolveTCPAddr("tcp4", service)
	checkError(err)

	listener, err := net.ListenTCP("tcp", tcpAddr)
	checkError(err)

	for {
		conn, err := listener.Accept()
		if err != nil {
			continue
		}

		daytime := time.Now().String()
		conn.Write([]byte(daytime)) // don't care about return value
		conn.Close()                // we're finished with this client
	}

}


text:
package DDS;

public interface TopicOperations  extends DDS.EntityOperations, DDS.TopicDescriptionOperations
{

  // Access the status
  int get_inconsistent_topic_status (DDS.InconsistentTopicStatusHolder status);
  int get_all_data_disposed_topic_status (DDS.AllDataDisposedTopicStatusHolder status);
  int get_qos (DDS.TopicQosHolder qos);
  int set_qos (DDS.TopicQos qos);
  DDS.TopicListener get_listener ();
  int set_listener (DDS.TopicListener a_listener, int mask);
  int dispose_all_data();
} // interface TopicOperations


text:
package cn.edu.ncut.test;

import cn.edu.ncut.model.User;
import cn.edu.ncut.service.UserService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author NikoBelic
 * @create 21:46
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath*:spring/applicationContext*.xml"})
public class SSMTest
{
    @Resource
    private UserService userService;
    @Test
    public void test()
    {
        List<User> userList = userService.findAll();
        for (User user : userList)
        {
            System.out.println(user.toString());
        }
    }
}


text:
echo
echo "Inititalizing Derby Databases for JSR352 RI/TCK"

USAGE="Usage: initDerbyDatabases.sh <DATABASE_ROOT_DIR>"

cd `dirname $0`
SCRIPT_HOME=`pwd`
cd -
WORKSPACE_HOME=$SCRIPT_HOME/../..
DERBY_HOME=$WORKSPACE_HOME/JSR352.BinaryDependencies/shipped/derby

if [ -z "$DERBY_HOME" ]; then
	echo "Missing DERBY_HOME directory!!! This is the directory where derby is installed. "
	echo $USAGE
	exit 1
fi

DATABASE_ROOT_DIR=$1
if [ -z "$DATABASE_ROOT_DIR" ]; then
	echo "Missing database root directory!!! This can be any directory where you want to create your derby databases. "
	echo $USAGE
	exit 1
fi
echo "Building databases in $DATABASE_ROOT_DIR if they don't already exist"
export DERBY_OPTS="-Dderby.system.home=$DATABASE_ROOT_DIR"

# Run the DDL files to create the database (if it doesn't already exist) and drop and recreate the tables
echo $DERBY_HOME/bin/ij $WORKSPACE_HOME/JSR352.Runtime/resources/jsr352-derby.ddl
`$DERBY_HOME/bin/ij $WORKSPACE_HOME/JSR352.Runtime/resources/jsr352-derby.ddl`

echo
echo $DERBY_HOME/bin/ij $WORKSPACE_HOME/JSR352.Tests.TCK/resources/jsr352-order-database.ddl
`$DERBY_HOME/bin/ij $WORKSPACE_HOME/JSR352.Tests.TCK/resources/jsr352-order-database.ddl`

echo
echo $DERBY_HOME/bin/ij $WORKSPACE_HOME/JSR352.Tests.TCK/resources/jsr352-numbers-database.ddl
`$DERBY_HOME/bin/ij $WORKSPACE_HOME/JSR352.Tests.TCK/resources/jsr352-numbers-database.ddl`

echo "Derby database initialization complete"


text:
module Puppet::Parser::Functions
  newfunction(:join, :type => :rvalue, :doc => <<-EOS
Returns a new string which is the concatenation of each element of the array
into a string using separator given.

Prototype:

    join(a)
    join(a, s)

Where a is an array and s is the separator to join array elements with.

For example:

  Given the following statements:

    $a = ['a', 'b', 'c']
    $b = ','

    notice join($a)
    notice join($a, $b)

  The result will be as follows:

    notice: Scope(Class[main]): abc
    notice: Scope(Class[main]): a,b,c
    EOS
  ) do |*arguments|
    #
    # This is to ensure that whenever we call this function from within
    # the Puppet manifest or alternatively form a template it will always
    # do the right thing ...
    #
    arguments = arguments.shift if arguments.first.is_a?(Array)

    # Technically we support two arguments but only first is mandatory ...
    raise Puppet::ParseError, "join(): Wrong number of arguments " +
      "given (#{arguments.size} for 1)" if arguments.size < 1

    array = arguments.shift

    raise Puppet::ParseError, 'join(): Requires an array type ' +
      'to work with' unless array.is_a?(Array)

    separator = arguments.shift unless arguments.empty?

    if separator and not separator.is_a?(String)
      raise Puppet::ParseError, 'join(): Requires separator to be of a string type'
    end

    # We join with separator or just join ...
    separator ? array.join(separator) : array.join
  end
end

# vim: set ts=2 sw=2 et :
# encoding: utf-8


text:
class DelayedMailer < ActionMailer::Base
  include ActionMailer::DeliverLater::Mixin

  def test_message(*)
    mail(from: "test-sender@test.com", to: "test-receiver@test.com", subject: "Test Subject", body: "Test Body")
  end
end


text:
![alt text](https://cdn0.iconfinder.com/data/icons/poker-1/154/casino-poker-gamble-label-128.png "Black Jack Bot Logo")

A Discord Bot that will play Black Jack with you (In Progress)

A link so you can add this bot to your Discord Server (Will come when bot can be hosted)

Command List

.play

starts a new game for the user, the user will be given 500 chips to play with

.min

bet the minimum amount of chips for a hand (5 chips)

.max

bet the maximum amount of chips for a hand (100 chips)

.draw

draw a card for your hand

.split

split your hand into two hands

.double down

double your bet for this hand

.hold

decide to keep the hand you have and see how you fare against the dealer

.deal

deal another hand to continue playing

.quit

end the game and lose your progress


text:
window.init_dashboard = function(id, columns, preferences, url) {
    jQuery('#'+id).dashboard({
        'columns': columns,
        'load_preferences_function': function(options) {
            return preferences;
        },
        'save_preferences_function': function(options, preferences) {
            jQuery.post(url, { data: JSON.stringify(preferences) });
        }
    });
    jQuery(".group-tabs").tabs();
    jQuery(".group-accordion").accordion({header: '.group-accordion-header'});
};


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

<title>InstanceNetworkInterfaceSpecification (AWS SDK for Android - 2.2.1)</title>
<meta name="date" content="2015-04-21">
<link rel="stylesheet" type="text/css" href="../../../../../JavaDoc.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

com.amazonaws.services.ec2.model

Class InstanceNetworkInterfaceSpecification

java.lang.Object

com.amazonaws.services.ec2.model.InstanceNetworkInterfaceSpecification

All Implemented Interfaces:

Serializable

public class InstanceNetworkInterfaceSpecification
extends Object
implements Serializable

 Describes a network interface.

See Also:

Serialized Form

Constructor Summary

Constructors

Constructor and Description

InstanceNetworkInterfaceSpecification()

Method Summary

Methods

Modifier and Type
Method and Description

boolean
equals(Object obj)

Boolean
getAssociatePublicIpAddress()

Indicates whether to auto-assign a public IP address to an instance in
 a VPC.

Boolean
getDeleteOnTermination()

If set to true, the interface is deleted when the
 instance is terminated.

String
getDescription()

The description of the network interface.

Integer
getDeviceIndex()

The index of the device on the instance for the network interface
 attachment.

List<String>
getGroups()

The IDs of the security groups for the network interface.

String
getNetworkInterfaceId()

The ID of the network interface.

String
getPrivateIpAddress()

The private IP address of the network interface.

List<PrivateIpAddressSpecification>
getPrivateIpAddresses()

One or more private IP addresses to assign to the network interface.

Integer
getSecondaryPrivateIpAddressCount()

The number of secondary private IP addresses.

String
getSubnetId()

The ID of the subnet associated with the network string.

int
hashCode()

Boolean
isAssociatePublicIpAddress()

Indicates whether to auto-assign a public IP address to an instance in
 a VPC.

Boolean
isDeleteOnTermination()

If set to true, the interface is deleted when the
 instance is terminated.

void
setAssociatePublicIpAddress(Boolean associatePublicIpAddress)

Indicates whether to auto-assign a public IP address to an instance in
 a VPC.

void
setDeleteOnTermination(Boolean deleteOnTermination)

If set to true, the interface is deleted when the
 instance is terminated.

void
setDescription(String description)

The description of the network interface.

void
setDeviceIndex(Integer deviceIndex)

The index of the device on the instance for the network interface
 attachment.

void
setGroups(Collection<String> groups)

The IDs of the security groups for the network interface.

void
setNetworkInterfaceId(String networkInterfaceId)

The ID of the network interface.

void
setPrivateIpAddress(String privateIpAddress)

The private IP address of the network interface.

void
setPrivateIpAddresses(Collection<PrivateIpAddressSpecification> privateIpAddresses)

One or more private IP addresses to assign to the network interface.

void
setSecondaryPrivateIpAddressCount(Integer secondaryPrivateIpAddressCount)

The number of secondary private IP addresses.

void
setSubnetId(String subnetId)

The ID of the subnet associated with the network string.

String
toString()

Returns a string representation of this object; useful for testing and
 debugging.

InstanceNetworkInterfaceSpecification
withAssociatePublicIpAddress(Boolean associatePublicIpAddress)

Indicates whether to auto-assign a public IP address to an instance in
 a VPC.

InstanceNetworkInterfaceSpecification
withDeleteOnTermination(Boolean deleteOnTermination)

If set to true, the interface is deleted when the
 instance is terminated.

InstanceNetworkInterfaceSpecification
withDescription(String description)

The description of the network interface.

InstanceNetworkInterfaceSpecification
withDeviceIndex(Integer deviceIndex)

The index of the device on the instance for the network interface
 attachment.

InstanceNetworkInterfaceSpecification
withGroups(Collection<String> groups)

The IDs of the security groups for the network interface.

InstanceNetworkInterfaceSpecification
withGroups(String... groups)

The IDs of the security groups for the network interface.

InstanceNetworkInterfaceSpecification
withNetworkInterfaceId(String networkInterfaceId)

The ID of the network interface.

InstanceNetworkInterfaceSpecification
withPrivateIpAddress(String privateIpAddress)

The private IP address of the network interface.

InstanceNetworkInterfaceSpecification
withPrivateIpAddresses(Collection<PrivateIpAddressSpecification> privateIpAddresses)

One or more private IP addresses to assign to the network interface.

InstanceNetworkInterfaceSpecification
withPrivateIpAddresses(PrivateIpAddressSpecification... privateIpAddresses)

One or more private IP addresses to assign to the network interface.

InstanceNetworkInterfaceSpecification
withSecondaryPrivateIpAddressCount(Integer secondaryPrivateIpAddressCount)

The number of secondary private IP addresses.

InstanceNetworkInterfaceSpecification
withSubnetId(String subnetId)

The ID of the subnet associated with the network string.

Methods inherited from class java.lang.Object

getClass, notify, notifyAll, wait, wait, wait

Constructor Detail

InstanceNetworkInterfaceSpecification

public InstanceNetworkInterfaceSpecification()

Method Detail

getNetworkInterfaceId

public String getNetworkInterfaceId()

The ID of the network interface.

Returns:

The ID of the network interface.

setNetworkInterfaceId

public void setNetworkInterfaceId(String networkInterfaceId)

The ID of the network interface.

Parameters:

networkInterfaceId - The ID of the network interface.

withNetworkInterfaceId

public InstanceNetworkInterfaceSpecification withNetworkInterfaceId(String networkInterfaceId)

The ID of the network interface.

 Returns a reference to this object so that method calls can be chained together.

Parameters:

networkInterfaceId - The ID of the network interface.

Returns:

A reference to this updated object so that method calls can be chained
         together.

getDeviceIndex

public Integer getDeviceIndex()

The index of the device on the instance for the network interface
 attachment.

Returns:

The index of the device on the instance for the network interface
         attachment.

setDeviceIndex

public void setDeviceIndex(Integer deviceIndex)

The index of the device on the instance for the network interface
 attachment.

Parameters:

deviceIndex - The index of the device on the instance for the network interface
         attachment.

withDeviceIndex

public InstanceNetworkInterfaceSpecification withDeviceIndex(Integer deviceIndex)

The index of the device on the instance for the network interface
 attachment.

 Returns a reference to this object so that method calls can be chained together.

Parameters:

deviceIndex - The index of the device on the instance for the network interface
         attachment.

Returns:

A reference to this updated object so that method calls can be chained
         together.

getSubnetId

public String getSubnetId()

The ID of the subnet associated with the network string.

Returns:

The ID of the subnet associated with the network string.

setSubnetId

public void setSubnetId(String subnetId)

The ID of the subnet associated with the network string.

Parameters:

subnetId - The ID of the subnet associated with the network string.

withSubnetId

public InstanceNetworkInterfaceSpecification withSubnetId(String subnetId)

The ID of the subnet associated with the network string.

 Returns a reference to this object so that method calls can be chained together.

Parameters:

subnetId - The ID of the subnet associated with the network string.

Returns:

A reference to this updated object so that method calls can be chained
         together.

getDescription

public String getDescription()

The description of the network interface.

Returns:

The description of the network interface.

setDescription

public void setDescription(String description)

The description of the network interface.

Parameters:

description - The description of the network interface.

withDescription

public InstanceNetworkInterfaceSpecification withDescription(String description)

The description of the network interface.

 Returns a reference to this object so that method calls can be chained together.

Parameters:

description - The description of the network interface.

Returns:

A reference to this updated object so that method calls can be chained
         together.

getPrivateIpAddress

public String getPrivateIpAddress()

The private IP address of the network interface.

Returns:

The private IP address of the network interface.

setPrivateIpAddress

public void setPrivateIpAddress(String privateIpAddress)

The private IP address of the network interface.

Parameters:

privateIpAddress - The private IP address of the network interface.

withPrivateIpAddress

public InstanceNetworkInterfaceSpecification withPrivateIpAddress(String privateIpAddress)

The private IP address of the network interface.

 Returns a reference to this object so that method calls can be chained together.

Parameters:

privateIpAddress - The private IP address of the network interface.

Returns:

A reference to this updated object so that method calls can be chained
         together.

getGroups

public List<String> getGroups()

The IDs of the security groups for the network interface.

Returns:

The IDs of the security groups for the network interface.

setGroups

public void setGroups(Collection<String> groups)

The IDs of the security groups for the network interface.

Parameters:

groups - The IDs of the security groups for the network interface.

withGroups

public InstanceNetworkInterfaceSpecification withGroups(String... groups)

The IDs of the security groups for the network interface.

 Returns a reference to this object so that method calls can be chained together.

Parameters:

groups - The IDs of the security groups for the network interface.

Returns:

A reference to this updated object so that method calls can be chained
         together.

withGroups

public InstanceNetworkInterfaceSpecification withGroups(Collection<String> groups)

The IDs of the security groups for the network interface.

 Returns a reference to this object so that method calls can be chained together.

Parameters:

groups - The IDs of the security groups for the network interface.

Returns:

A reference to this updated object so that method calls can be chained
         together.

isDeleteOnTermination

public Boolean isDeleteOnTermination()

If set to true, the interface is deleted when the
 instance is terminated.

Returns:

If set to true, the interface is deleted when the
         instance is terminated.

setDeleteOnTermination

public void setDeleteOnTermination(Boolean deleteOnTermination)

If set to true, the interface is deleted when the
 instance is terminated.

Parameters:

deleteOnTermination - If set to true, the interface is deleted when the
         instance is terminated.

withDeleteOnTermination

public InstanceNetworkInterfaceSpecification withDeleteOnTermination(Boolean deleteOnTermination)

If set to true, the interface is deleted when the
 instance is terminated.

 Returns a reference to this object so that method calls can be chained together.

Parameters:

deleteOnTermination - If set to true, the interface is deleted when the
         instance is terminated.

Returns:

A reference to this updated object so that method calls can be chained
         together.

getDeleteOnTermination

public Boolean getDeleteOnTermination()

If set to true, the interface is deleted when the
 instance is terminated.

Returns:

If set to true, the interface is deleted when the
         instance is terminated.

getPrivateIpAddresses

public List<PrivateIpAddressSpecification> getPrivateIpAddresses()

One or more private IP addresses to assign to the network interface.

Returns:

One or more private IP addresses to assign to the network interface.

setPrivateIpAddresses

public void setPrivateIpAddresses(Collection<PrivateIpAddressSpecification> privateIpAddresses)

One or more private IP addresses to assign to the network interface.

Parameters:

privateIpAddresses - One or more private IP addresses to assign to the network interface.

withPrivateIpAddresses

public InstanceNetworkInterfaceSpecification withPrivateIpAddresses(PrivateIpAddressSpecification... privateIpAddresses)

One or more private IP addresses to assign to the network interface.

 Returns a reference to this object so that method calls can be chained together.

Parameters:

privateIpAddresses - One or more private IP addresses to assign to the network interface.

Returns:

A reference to this updated object so that method calls can be chained
         together.

withPrivateIpAddresses

public InstanceNetworkInterfaceSpecification withPrivateIpAddresses(Collection<PrivateIpAddressSpecification> privateIpAddresses)

One or more private IP addresses to assign to the network interface.

 Returns a reference to this object so that method calls can be chained together.

Parameters:

privateIpAddresses - One or more private IP addresses to assign to the network interface.

Returns:

A reference to this updated object so that method calls can be chained
         together.

getSecondaryPrivateIpAddressCount

public Integer getSecondaryPrivateIpAddressCount()

The number of secondary private IP addresses.

Returns:

The number of secondary private IP addresses.

setSecondaryPrivateIpAddressCount

public void setSecondaryPrivateIpAddressCount(Integer secondaryPrivateIpAddressCount)

The number of secondary private IP addresses.

Parameters:

secondaryPrivateIpAddressCount - The number of secondary private IP addresses.

withSecondaryPrivateIpAddressCount

public InstanceNetworkInterfaceSpecification withSecondaryPrivateIpAddressCount(Integer secondaryPrivateIpAddressCount)

The number of secondary private IP addresses.

 Returns a reference to this object so that method calls can be chained together.

Parameters:

secondaryPrivateIpAddressCount - The number of secondary private IP addresses.

Returns:

A reference to this updated object so that method calls can be chained
         together.

isAssociatePublicIpAddress

public Boolean isAssociatePublicIpAddress()

Indicates whether to auto-assign a public IP address to an instance in
 a VPC. This public IP address can be assigned to the network interface
 for eth0 only when you launch the instance. You must create the
 network interface instead of using an existing network interface for
 eth0, and you must not specify more than one network interface.

Returns:

Indicates whether to auto-assign a public IP address to an instance in
         a VPC. This public IP address can be assigned to the network interface
         for eth0 only when you launch the instance. You must create the
         network interface instead of using an existing network interface for
         eth0, and you must not specify more than one network interface.

setAssociatePublicIpAddress

public void setAssociatePublicIpAddress(Boolean associatePublicIpAddress)

Indicates whether to auto-assign a public IP address to an instance in
 a VPC. This public IP address can be assigned to the network interface
 for eth0 only when you launch the instance. You must create the
 network interface instead of using an existing network interface for
 eth0, and you must not specify more than one network interface.

Parameters:

associatePublicIpAddress - Indicates whether to auto-assign a public IP address to an instance in
         a VPC. This public IP address can be assigned to the network interface
         for eth0 only when you launch the instance. You must create the
         network interface instead of using an existing network interface for
         eth0, and you must not specify more than one network interface.

withAssociatePublicIpAddress

public InstanceNetworkInterfaceSpecification withAssociatePublicIpAddress(Boolean associatePublicIpAddress)

Indicates whether to auto-assign a public IP address to an instance in
 a VPC. This public IP address can be assigned to the network interface
 for eth0 only when you launch the instance. You must create the
 network interface instead of using an existing network interface for
 eth0, and you must not specify more than one network interface.

 Returns a reference to this object so that method calls can be chained together.

Parameters:

associatePublicIpAddress - Indicates whether to auto-assign a public IP address to an instance in
         a VPC. This public IP address can be assigned to the network interface
         for eth0 only when you launch the instance. You must create the
         network interface instead of using an existing network interface for
         eth0, and you must not specify more than one network interface.

Returns:

A reference to this updated object so that method calls can be chained
         together.

getAssociatePublicIpAddress

public Boolean getAssociatePublicIpAddress()

Indicates whether to auto-assign a public IP address to an instance in
 a VPC. This public IP address can be assigned to the network interface
 for eth0 only when you launch the instance. You must create the
 network interface instead of using an existing network interface for
 eth0, and you must not specify more than one network interface.

Returns:

Indicates whether to auto-assign a public IP address to an instance in
         a VPC. This public IP address can be assigned to the network interface
         for eth0 only when you launch the instance. You must create the
         network interface instead of using an existing network interface for
         eth0, and you must not specify more than one network interface.

toString

public String toString()

Returns a string representation of this object; useful for testing and
 debugging.

Overrides:

toString in class Object

Returns:

A string representation of this object.

See Also:

Object.toString()

hashCode

public int hashCode()

Overrides:

hashCode in class Object

equals

public boolean equals(Object obj)

Overrides:

equals in class Object

Overview

Package

Class

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

                Copyright © 2010 Amazon Web Services, Inc. All Rights Reserved.


text:
<?php

namespace NicMart\Rulez\Core;

/**
 * Class ArrayAccessTrait
 * @package NicMart\Rulez\Core
 */
trait ArrayAccessTrait
{
    /**
     * @var array
     */
    private $arrayAccessAry = [];

    /**
     * @param $offset
     * @param $value
     * @throws \DomainException
     */
    public function offsetSet($offset, $value)
    {
        if (!$this->offsetValid($value))
            throw new \DomainException("Offset value is not valid");

        if (is_null($offset)) {
            $this->arrayAccessAry[] = $value;
        } else {
            $this->arrayAccessAry[$offset] = $value;
        }
    }

    /**
     * @param $offset
     * @return bool
     */
    public function offsetExists($offset)
    {
        return isset($this->arrayAccessAry[$offset]);
    }

    /**
     * @param $offset
     */
    public function offsetUnset($offset)
    {
        unset($this->arrayAccessAry[$offset]);
    }

    /**
     * @param $offset
     * @return mixed
     */
    public function offsetGet($offset)
    {
        return $this->arrayAccessAry[$offset];
    }

    /**
     * @return \ArrayIterator
     */
    public function getIterator()
    {
        return new \ArrayIterator($this->arrayAccessAry);
    }

    /**
     * @param $value
     * @return bool
     */
    private function offsetValid($value)
    {
        return true;
    }
}


text:
<?php

namespace JuniorEsiee\FinancesBundle\Form\EventListener;

use JuniorEsiee\FinancesBundle\Entity\CustomerInvoice;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class AddPaidAtSubscriber implements EventSubscriberInterface
{
    public static function getSubscribedEvents()
    {
        return array(FormEvents::PRE_SET_DATA => 'preSetData');
    }

    public function preSetData(FormEvent $event)
    {
        /** @var CustomerInvoice $invoice */
        $invoice = $event->getData();
        $form = $event->getForm();

        if ($invoice->getPaid()) {
            $form->add('paidAt', 'datepicker', array(
                'label' => 'Date de paiment'
            ));
        }
    }
}


text:
package com.ericsson.eiffel.remrem.publish.cli;

import java.util.ArrayList;
import java.util.Map;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.MissingOptionException;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.OptionGroup;
import org.apache.commons.cli.Options;
import org.apache.commons.lang3.ArrayUtils;

import com.ericsson.eiffel.remrem.publish.config.PropertiesConfig;
import com.ericsson.eiffel.remrem.shared.VersionService;

public class CliOptions {

    static private Options options=null;
    static private CommandLine commandLine;

    //Used for testing purposes
    private static ArrayList<Integer> testErrorCodes = new ArrayList<>();

    public static ArrayList getErrorCodes() {
    return testErrorCodes;
    }

    public static void addErrorCode(int errorCode) {
        testErrorCodes.add(errorCode);
    }

    public static void cleanErrorCodes() {
        testErrorCodes.clear();
    }

    private static OptionGroup contentGroup = null;

    public static CommandLine getCommandLine() {
        return commandLine;
    }

    public static Options createHelpOptions() {
        Options hOptions = new Options();
        hOptions.addOption(createHelpOption());
        return hOptions;
    }

    /**
     * Creates the options needed by command line interface
     * @return the options this CLI can handle
     */
    public static void createCLIOptions() {
        options = new Options();
        options.addOption(createHelpOption());
        options.addOption("d", "debug", false, "enable debug traces");
        options.addOption("mb", "message_bus", true, "host of message bus to use");
        options.addOption("en", "exchange_name", true, "exchange name");
        options.addOption("ce", "create_exchange", true, "option to denote if we need to create an exchange eg: -ce true or --create_exchange true");
        options.addOption("np", "non_persistent", false, "remove persistence from message sending");
        options.addOption("port", "port", true, "port to connect to message bus, default is 5672");
        options.addOption("tls", "tls", true, "tls version, specify a valid tls version: '1', '1.1, '1.2' or 'default'. It is required for RabbitMq secured port.");
        options.addOption("mp", "messaging_protocol", true, "name of messaging protocol to be used, e.g. eiffel3, eiffelsemantics, default is eiffelsemantics");
        options.addOption("domain", "domainId", true, "identifies the domain that produces the event");
        options.addOption("ud", "user_domain_suffix", true, "user domain suffix");
        options.addOption("v", "lists the versions of publish and all loaded protocols");
        options.addOption("tag", "tag", true, "tag to be used in routing key");
        options.addOption("rk", "routing_key", true, "routing key of the eiffel message. When provided routing key is not generated and the value provided is used.");

        contentGroup = createContentGroup();
        options.addOptionGroup(contentGroup);
    }

    private static Option createJsonOption() {
        return new Option("json", "json_content", true, "event content in json string. The value can also be a dash(-) and the json will be read from the output of other programs if piped.");
    }

    private static Option createFileOption() {
        return new Option("f", "content_file", true, "event content file");
    }

    private static Option createHelpOption() {
        return new Option("h", "help", false, "show help");
    }

    private static OptionGroup createContentGroup() {
        OptionGroup group = new OptionGroup();
        group.addOption(createFileOption());
        group.addOption(createJsonOption());
        return group;
    }

    /**
     * Parse the given arguments and act on them
     * @param args command line arguments
     * @return if the service should start or not
     */
    public static void parse(String[] args) {
            createCLIOptions();
            CommandLineParser parser = new DefaultParser();
            try {
                commandLine = parser.parse(options, args);
                afterParseChecks();
                handleMessageBusOptions();
                handleDebugOptions();
            } catch (Exception e) {
                System.out.println(e.getMessage());
                help(CLIExitCodes.CLI_MISSING_OPTION_EXCEPTION);
            }
    }

    public static void afterParseChecks() throws MissingOptionException {
        if (commandLine.hasOption("h")) {
            System.out.println("You passed help flag.");
            help(0);
        } else if (commandLine.hasOption("v")) {
            printVersions();
        }else {
            checkRequiredOptions();
        }
    }

    public static void checkRequiredOptions() throws MissingOptionException {
        OptionGroup[] groups = {contentGroup};
        for(OptionGroup group : groups) {
            ArrayList<Option> groupOptions = new ArrayList<Option>(group.getOptions());
            boolean groupIsGiven = false;
            for (Option option : groupOptions){
                if (commandLine.hasOption(option.getOpt())) {
                    groupIsGiven = true;
                    break;
                }
            }
            if (!groupIsGiven){
                throw new MissingOptionException(groupOptions);
            }
        }
    }

    /**
     * Checks if any options that CLI can handle have been passed
     * @return true if any valid options have been
     *             passed as arguments otherwise false
     */
    public static boolean hasParsedOptions() {
        if (commandLine == null)
            return false;

        Option[] existingOptions = commandLine.getOptions();
        return existingOptions.length > 0;
    }

    /**
     * Prints the help for this application and exits.
     * @param options the options to print usage help for
     */
    public static void help(int errorCode) {
        CliOptions.clearSystemProperties();
        // This prints out some help
        HelpFormatter formater = new HelpFormatter();
        formater.printHelp("java -jar", options);
        exit(errorCode);
    }

    /**
     * Sets the system properties with values passed for
     * message bus host and exchange name
     * @param commandLine command line arguments
     */
    public static void handleMessageBusOptions() throws HandleMessageBusException {
        if (commandLine.hasOption("mb")) {
            String messageBusHost = commandLine.getOptionValue("mb");
            String key = PropertiesConfig.MESSAGE_BUS_HOST;
            System.setProperty(key, messageBusHost);
        }

        if (commandLine.hasOption("en")) {
            String exchangeName = commandLine.getOptionValue("en");
            String key = PropertiesConfig.EXCHANGE_NAME;
            System.setProperty(key, exchangeName);
        }

        if (commandLine.hasOption("port")) {
            String port = commandLine.getOptionValue("port");
            String key = PropertiesConfig.MESSAGE_BUS_PORT;
            System.setProperty(key, port);
        }

        if (commandLine.hasOption("ce")) {
            String createExchange = commandLine.getOptionValue("ce");
            String key = PropertiesConfig.CREATE_EXCHANGE_IF_NOT_EXISTING;
            System.setProperty(key, createExchange);
        }

        if (commandLine.hasOption("domain")) {
            String domain = commandLine.getOptionValue("domain");
            String key = PropertiesConfig.DOMAIN_ID;
            System.setProperty(key, domain);
        }

        if (commandLine.hasOption("tls")) {
            String tls_ver = commandLine.getOptionValue("tls");
            if (tls_ver == null) {
                tls_ver = "NULL";
            }
            String[] validTlsVersions = new String[]{"1", "1.1", "1.2", "default"};
            if (!ArrayUtils.contains(validTlsVersions, tls_ver)) {
                throw new HandleMessageBusException("Specified TLS version is not valid! Specify a valid TLS version!");
            }
            String key = PropertiesConfig.TLS;
            System.setProperty(key, tls_ver);
        }

        String usePersistance = "true";
        if (commandLine.hasOption("np")) {
            usePersistance = "false";
        }
        String key = PropertiesConfig.USE_PERSISTENCE;
        System.setProperty(key, usePersistance);
        key = PropertiesConfig.CLI_MODE;
        System.setProperty(key, "true");
    }

    /**
     * Sets the system property with "false" value if debug option is not present"
     * @param commandLine command line arguments
     */
    public static void handleDebugOptions()
    {
        String key = PropertiesConfig.DEBUG;
        if (!commandLine.hasOption("d"))
            System.setProperty(key, "false");
    }

    /**
     * Remove the system properties added by this application
     */
    public static void clearSystemProperties() {
        String key = PropertiesConfig.MESSAGE_BUS_HOST;
        System.clearProperty(key);
        key = PropertiesConfig.EXCHANGE_NAME;
        System.clearProperty(key);
        key = PropertiesConfig.USE_PERSISTENCE;
        System.clearProperty(key);
        key = PropertiesConfig.CLI_MODE;
        System.clearProperty(key);
        key = PropertiesConfig.MESSAGE_BUS_PORT;
        System.clearProperty(key);
        key = PropertiesConfig.TLS;
        System.clearProperty(key);
        key = PropertiesConfig.DOMAIN_ID;
        System.clearProperty(key);
    }

    /**
     * Wrapper to call system exit making class easier to test.
     * @param errorCode
     */
    public static void exit(int errorCode) {
      boolean testMode = Boolean.getBoolean(PropertiesConfig.TEST_MODE);
      if (testMode)
        addErrorCode(errorCode);
      else
        System.exit(errorCode);
    }

    /**
     * Lists the versions of publish and all loaded protocols
     */
    @SuppressWarnings({ "rawtypes", "unchecked" })
    private static void printVersions() {
        Map versions = new VersionService().getMessagingVersions();
        Map<String, String> endpointVersions = (Map<String, String>) versions.get("endpointVersions");
        Map<String, String> serviceVersion = (Map<String, String>) versions.get("serviceVersion");

        if(serviceVersion != null) {
            System.out.print("REMReM Publish version ");
            for (String version: serviceVersion.values()) {
                System.out.println(version);
            }
        }
        if(endpointVersions != null) {
            System.out.println("Available endpoints");
            for (Map.Entry<String, String> entry : endpointVersions.entrySet()) {
                System.out.println(entry);
            }
        }
        exit(0);
    }
}


text:
module.exports = function(path) {
  return require((process.env.APP_DIR_FOR_CODE_COVERAGE || '../../src/') + path);
};


text:
package mltk.core;

/**
 * Abstract class for attributes.
 *
 * @author Yin Lou
 *
 */
public abstract class Attribute implements Comparable<Attribute>, Copyable<Attribute> {

	public enum Type {
		/**
		 * Nominal type.
		 */
		NOMINAL,
		/**
		 * Numeric type.
		 */
		NUMERIC,
		/**
		 * Binned type.
		 */
		BINNED;
	}

	protected Type type;

	protected int index;

	protected String name;

	/**
	 * Returns the type of this attribute.
	 *
	 * @return the type of this attribute.
	 */
	public final Type getType() {
		return type;
	}

	/**
	 * Returns the index of this attribute.
	 *
	 * @return the index of this attribute.
	 */
	public final int getIndex() {
		return index;
	}

	/**
	 * Sets the index of this attribute.
	 *
	 * @param index the new index.
	 */
	public final void setIndex(int index) {
		this.index = index;
	}

	/**
	 * Returns the name of this attribute.
	 *
	 * @return the name of this attribute.
	 */
	public final String getName() {
		return name;
	}

	@Override
	public int compareTo(Attribute att) {
		return (this.index - att.index);
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + index;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result + ((type == null) ? 0 : type.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Attribute other = (Attribute) obj;
		if (index != other.index)
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (type != other.type)
			return false;
		return true;
	}

	@Override
	public String toString() {
		return name;
	}

}


text:
package user;

import com.qatang.admin.entity.user.User;
import com.qatang.admin.query.user.UserSearchable;
import com.qatang.admin.service.user.UserService;
import com.qatang.admin.web.config.InitConfig;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
 * @author qatang
 * @since 2014-12-30 17:26
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {InitConfig.class})
public class RoleServiceTest {

    @Autowired
    private UserService userService;

    @Test
    public void findAllTest() {
        UserSearchable userSearchable = new UserSearchable();

        Page<User> page = userService.find(userSearchable);
        System.out.println(page.getContent().size());
        System.out.println(page.getSize());
    }
}


text:
require "numberofdaysuntil/version"
require 'date'

module Numberofdaysuntil
  def self.valid?(date)
    if date < Date.today
      false
    else
      true
    end
  end

  def self.days_until(date)
    (date - Date.today).numerator
  end

  def self.date_string_to_date(date_string)
    Date.parse(date_string)
  end
end


text:
from base64 import urlsafe_b64encode

def headers_raw_to_dict(headers_raw):
    r"""
    Convert raw headers (single multi-line bytestring)
    to a dictionary.

    For example:

    >>> import w3lib.http
    >>> w3lib.http.headers_raw_to_dict(b"Content-type: text/html\n\rAccept: gzip\n\n")   # doctest: +SKIP
    {'Content-type': ['text/html'], 'Accept': ['gzip']}

    Incorrect input:

    >>> w3lib.http.headers_raw_to_dict(b"Content-typt gzip\n\n")
    {}
    >>>

    Argument is ``None`` (return ``None``):

    >>> w3lib.http.headers_raw_to_dict(None)
    >>>

    """

    if headers_raw is None:
        return None
    headers = headers_raw.splitlines()
    headers_tuples = [header.split(b':', 1) for header in headers]
    return dict([
        (header_item[0].strip(), [header_item[1].strip()])
        for header_item in headers_tuples
        if len(header_item) == 2
    ])

def headers_dict_to_raw(headers_dict):
    r"""
    Returns a raw HTTP headers representation of headers

    For example:

    >>> import w3lib.http
    >>> w3lib.http.headers_dict_to_raw({b'Content-type': b'text/html', b'Accept': b'gzip'}) # doctest: +SKIP
    'Content-type: text/html\\r\\nAccept: gzip'
    >>>

    Note that keys and values must be bytes.

    Argument is ``None`` (returns ``None``):

    >>> w3lib.http.headers_dict_to_raw(None)
    >>>

    """

    if headers_dict is None:
        return None
    raw_lines = []
    for key, value in headers_dict.items():
        if isinstance(value, bytes):
            raw_lines.append(b": ".join([key, value]))
        elif isinstance(value, (list, tuple)):
            for v in value:
                raw_lines.append(b": ".join([key, v]))
    return b'\r\n'.join(raw_lines)

def basic_auth_header(username, password):
    """
    Return an `Authorization` header field value for `HTTP Basic Access Authentication (RFC 2617)`_

    >>> import w3lib.http
    >>> w3lib.http.basic_auth_header('someuser', 'somepass')
    'Basic c29tZXVzZXI6c29tZXBhc3M='

    .. _HTTP Basic Access Authentication (RFC 2617): http://www.ietf.org/rfc/rfc2617.txt

    """

    auth = "%s:%s" % (username, password)
    if not isinstance(auth, bytes):
        # XXX: RFC 2617 doesn't define encoding, but ISO-8859-1
        # seems to be the most widely used encoding here. See also:
        # http://greenbytes.de/tech/webdav/draft-ietf-httpauth-basicauth-enc-latest.html
        auth = auth.encode('ISO-8859-1')
    return b'Basic ' + urlsafe_b64encode(auth)


text:
PRAGMA temp_store = 3;
PRAGMA temp_store;


text:
using namespace std;

BytecodeStream DefaultClassFileReader::read(string classPath) {
    long length = 0;
    ifstream classFileStream(classPath, ios::binary | ios::in);
    if (!classFileStream) {
        throw "找不到文件:" + classPath;
    } else {
        classFileStream.seekg(0, ios::end);
        length = classFileStream.tellg();
        classFileStream.seekg(0, ios::beg);
        char *bytes = new char[length];
        classFileStream.read(bytes, length);
        vector<byte> bytecodes(&bytes[0], &bytes[length]);
        return BytecodeStream(bytecodes);
    }
}


text:
var $ = require('jquery')
window.$ = window.jQuery = $;

require('backbone')

require('./common.js')
var router = require('./components/router.jsx')
router.initialize()