text:
package com.kenai.jbosh;

import java.io.IOException;
import java.io.StringReader;
import java.lang.ref.SoftReference;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.XMLConstants;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;

/**
 * Implementation of the BodyParser interface which uses the XmlPullParser
 * API.  When available, this API provides an order of magnitude performance
 * improvement over the default SAX parser implementation.
 */
final class BodyParserXmlPull implements BodyParser {

    /**
     * Logger.
     */
    private static final Logger LOG =
            Logger.getLogger(BodyParserXmlPull.class.getName());

    /**
     * Thread local to contain a XmlPullParser instance for each thread that
     * attempts to use one.  This allows us to gain an order of magnitude of
     * performance as a result of not constructing parsers for each
     * invocation while retaining thread safety.
     */
    private static final ThreadLocal<SoftReference<XmlPullParser>> XPP_PARSER =
        new ThreadLocal<SoftReference<XmlPullParser>>() {
            @Override protected SoftReference<XmlPullParser> initialValue() {
                return new SoftReference<XmlPullParser>(null);
            }
        };

    ///////////////////////////////////////////////////////////////////////////
    // BodyParser interface methods:

    /**
     * {@inheritDoc}
     */
    public BodyParserResults parse(final String xml) throws BOSHException {
        BodyParserResults result = new BodyParserResults();
        Exception thrown;
        try {
            XmlPullParser xpp = getXmlPullParser();

            xpp.setInput(new StringReader(xml));
            int eventType = xpp.getEventType();
            while (eventType != XmlPullParser.END_DOCUMENT) {
                if (eventType == XmlPullParser.START_TAG) {
                    if (LOG.isLoggable(Level.FINEST)) {
                        LOG.finest("Start tag: " + xpp.getName());
                    }
                } else {
                    eventType = xpp.next();
                    continue;
                }

                String prefix = xpp.getPrefix();
                if (prefix == null) {
                    prefix = XMLConstants.DEFAULT_NS_PREFIX;
                }
                String uri = xpp.getNamespace();
                String localName = xpp.getName();
                QName name = new QName(uri, localName, prefix);
                if (LOG.isLoggable(Level.FINEST)) {
                    LOG.finest("Start element: ");
                    LOG.finest("    prefix: " + prefix);
                    LOG.finest("    URI: " + uri);
                    LOG.finest("    local: " + localName);
                }

                BodyQName bodyName = AbstractBody.getBodyQName();
                if (!bodyName.equalsQName(name)) {
                    throw(new IllegalStateException(
                            "Root element was not '" + bodyName.getLocalPart()
                            + "' in the '" + bodyName.getNamespaceURI()
                            + "' namespace.  (Was '" + localName
                            + "' in '" + uri + "')"));
                }

                for (int idx=0; idx < xpp.getAttributeCount(); idx++) {
                    String attrURI = xpp.getAttributeNamespace(idx);
                    if (attrURI.length() == 0) {
                        attrURI = xpp.getNamespace(null);
                    }
                    String attrPrefix = xpp.getAttributePrefix(idx);
                    if (attrPrefix == null) {
                        attrPrefix = XMLConstants.DEFAULT_NS_PREFIX;
                    }
                    String attrLN = xpp.getAttributeName(idx);
                    String attrVal = xpp.getAttributeValue(idx);
                    BodyQName aqn = BodyQName.createWithPrefix(
                            attrURI, attrLN, attrPrefix);
                    if (LOG.isLoggable(Level.FINEST)) {
                        LOG.finest("        Attribute: {" + attrURI + "}"
                                + attrLN + " = '" + attrVal + "'");
                    }
                    result.addBodyAttributeValue(aqn, attrVal);
                }
                break;
            }
            return result;
        } catch (RuntimeException rtx) {
            thrown = rtx;
        } catch (XmlPullParserException xmlppx) {
            thrown = xmlppx;
        } catch (IOException iox) {
            thrown = iox;
        }
        throw(new BOSHException("Could not parse body:\n" + xml, thrown));
    }

    ///////////////////////////////////////////////////////////////////////////
    // Private methods:

    /**
     * Gets a XmlPullParser for use in parsing incoming messages.
     *
     * @return parser instance
     */
    private static XmlPullParser getXmlPullParser() {
        SoftReference<XmlPullParser> ref = XPP_PARSER.get();
        XmlPullParser result = ref.get();
        if (result == null) {
            Exception thrown;
            try {
                XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
                factory.setNamespaceAware(true);
                factory.setValidating(false);
                result = factory.newPullParser();
                ref = new SoftReference<XmlPullParser>(result);
                XPP_PARSER.set(ref);
                return result;
            } catch (Exception ex) {
                thrown = ex;
            }
            throw(new IllegalStateException(
                    "Could not create XmlPull parser", thrown));
        } else {
            return result;
        }
    }

}


text:
동영상 관리

            <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addVideo">등록하기</button>

          카테고리
          썸네일
          제목
          글쓴이
          작성일시
          재생
          삭제

        <?php foreach ($video_list as $k => $row): ?>
          <?php
            $youtubeVideoId = $row['media_content'];

            $thumbURL = 'http://img.youtube.com/vi/'.$youtubeVideoId.'/0.jpg';
            $videoURL = 'https://www.youtube.com/embed/'.$youtubeVideoId;
          ?>

            <?=$row['media_category']?>

              <img src="<?=$thumbURL?>" alt="" width="150px">

            <?=$row['media_title']?>
            <?=$row['user_name'].'('.$row['media_writer'].')'?>
            <?=$row['media_dttm']?>

              <a href="#" data-toggle="modal" data-target="#vdoModal"
                data-vdo="<?=$videoURL?>"
                data-title="<?=$row['media_title']?>">
                <button type="button" class="btn btn-block btn-success">재생</button>

              <form class="" action="<?=base_url('admin/Board/remove_video')?>" method="post" onsubmit="return confirm('삭제하시겠습니까?');">
                <input type="hidden" name="media_id" value="<?=$row['media_id']?>">
                <button type="submit" class="btn btn-block btn-danger">삭제</button>
              </form>

        <?php endforeach; ?>

        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

동영상 추가(Youtube)

      <form action="<?=base_url('admin/Board/add_video')?>" method="post" enctype="multipart/form-data">
        <input type="hidden" name="media_writer" value="<?=$this->session->userdata('user_id')?>">

            제목
            <input class="form-control" type="text" name="media_title" required>

            카테고리
            <input class="form-control" type="text" name="media_category" required>

            링크
            <input class="form-control" type="text" name="media_content"
              placeholder="유투브 링크를 복붙해주세요.(https://youtube.com/xxxxxx)" required>

          <button type="button" class="btn btn-default" data-dismiss="modal">닫기</button>
          <button type="submit" class="btn btn-primary">추가하기</button>

      </form>

redpajama_set_name: RedPajamaGithub


text:
name "base"
description "Base role applied to all nodes."
run_list(
  "recipe[apt]",
  "recipe[build-essential]",
  "recipe[git]",
  "recipe[users::sysadmins]",
  "recipe[sudo]"
)


text:
class UsersController < ApplicationController
  before_action :authenticate_user!
  before_action :requires_admin

  def index
    @users = User.list user_index_params
  end

  def edit
    @user = User.find params[:id]
  end

  def update
    @user = User.find params[:id]
    @user.update_attributes user_update_params
    if @user.save
      flash[:notice] = "User updated successfully."
      redirect_to users_path
    else
      render :edit
    end
  end

  def destroy
    user = User.find params[:id]
    redirect_to root_path if user.destroy
  end

  private

  def user_update_params
    params.require(:user).permit(:first_name, :last_name, :email, :agency_id, :approved)
  end

  def user_index_params
    params.permit(:agency_id, :search, :page)
  end
end


text:
package com.perchlive.broadcast.sdk.av;

/**
 * @hide
 */
public class VideoEncoderConfig {
    protected final int mWidth;
    protected final int mHeight;
    protected final int mBitRate;

    public VideoEncoderConfig(int width, int height, int bitRate) {
        mWidth = width;
        mHeight = height;
        mBitRate = bitRate;
    }

    public int getWidth() {
        return mWidth;
    }

    public int getHeight() {
        return mHeight;
    }

    public int getBitRate() {
        return mBitRate;
    }

    @Override
    public String toString() {
        return "VideoEncoderConfig: " + mWidth + "x" + mHeight + " @" + mBitRate + " bps";
    }
}


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
  <meta name="description" content="Outils de consultation des contrats de la ville de Montréal">
  <meta name="keywords" content="Contrats,ville de montreal" />

  <title>Ville de Montréal - Vue sur les contrats</title>
  <link rel="shortcut icon" sizes="16x16 24x24 32x32 48x48 64x64" href="favicon.ico">
  <link href="css/style.css" rel="stylesheet">

VUE SUR LES CONTRATS

              À propos

              

              

              

         Retour

À propos

              Le site « Vue sur les contrats » est un outil de visualisation qui permet de consulter les contrats et les subventions octroyés par la Ville de Montréal de façon simple et conviviale. Il donne accès à tous les contrats autorisés par le comité exécutif et par le conseil municipal depuis janvier 2012.

                Vue sur les contrats utilise les fichiers disponibles sur le portail des données ouvertes de la Ville de Montréal (http://donnees.ville.montreal.qc.ca/). Ces fichiers proviennent de diverses sources, notamment :

l'outil de gestion des dossiers décisionnels utilisé par les élus

les systèmes financiers de la Ville.

                Ces systèmes sont utilisés pour des besoins internes et certaines informations souhaitables du point de vue de la transparence, comme le numéro d'entreprise, ne sont pas disponibles pour le moment. De plus, la saisie des informations peut varier d'un contrat à l'autre.

                Les citoyens qui veulent pousser leurs recherches plus loin ont accès à une interface de programmation (« API ») qui permet d'automatiser les requêtes (http://ville.montreal.qc.ca/vuesurlescontrats/api/).
                La documentation de l'API est également disponible dans le portail des données ouvertes (http://donnees.ville.montreal.qc.ca/dataset/contrats-et-subventions-api/).

                Ce projet s'inscrit dans le plan d'action de Montréal, ville intelligente et numérique (http://villeintelligente.montreal.ca/).

      © Ville de Montréal

          Politique de confidentialité et conditions d'utilisations |
          À propos |
          Twitter |
          Facebook |
          Linkedin


text:
package lexer

import (
	"strings"
	"unicode"

	"github.com/sysr-q/lua/token"
)

const (
	eof        = -1
	alphabet   = "abcdefghijklymnopqrstuvwxyzABCDEFGHIJKLYMNOPQRSTUVWXYZ"
	digits     = "01234567890"
	underscore = "_"
)

// lexText is the starting point for a new Lua lexer.
func lexText(l *lexer) stateFn {
	l.skipSpace()

	if r := l.peek(); unicode.IsDigit(r) {
		return lexNumberLiteral
	} else if r == '.' {
		l.next() // must advance because we only peeked before
		r2 := l.peek()
		l.backup()
		if unicode.IsDigit(r2) {
			return lexNumberLiteral
		}
	}

	if strings.HasPrefix(l.input[l.pos:], "--[") {
		return lexBlockComment
	}

	if strings.HasPrefix(l.input[l.pos:], "--") {
		return lexLineComment
	}

	if l.peek() == eof {
		l.emit(token.EOF)
		return nil
	}

	if l.peek() == '\'' {
		return lexSingleQuotedStringLiteral
	}

	if l.peek() == '"' {
		return lexDoubleQuotedStringLiteral
	}

	if l.peek() == '[' {
		return lexDoubleBracketStringLiteral
	}

	for _, tokenString := range token.TokenList {
		t := token.TokenMap[tokenString]
		potentialToken := l.input[l.pos:]
		if len(potentialToken) > len(tokenString) {
			potentialToken = potentialToken[:len(tokenString)]
		}
		if strings.HasPrefix(strings.ToLower(potentialToken), tokenString) {
			l.pos += token.Pos(len(tokenString))
			if IsKeyword(t, tokenString) && l.accept(alphabet+underscore+digits) {
				l.backup() // to account for the character consumed by accept
				l.pos -= token.Pos(len(tokenString))
				break
			}
			l.emit(t)
			return lexText
		}
	}

	l.acceptRun(alphabet + underscore + digits)
	l.emit(token.Identifier)
	return lexText
}

func lexNumberLiteral(l *lexer) stateFn {
	if l.accept("0") && l.accept("xX") {
		// hexadecimal?
		l.acceptRun(digits + "abcdefABCDEF")
		l.emit(token.NumberLiteral)
		return lexText
	}

	// is decimal?
	l.acceptRun(digits)
	if l.accept(".") {
		l.acceptRun(digits)
	}

	// TODO: 3.1e-1 etc
	if l.accept("eE") {
		l.acceptRun(digits)
	}

	l.emit(token.NumberLiteral)
	return lexText
}

func lexBlockComment(l *lexer) stateFn {
	// Eat the --[
	l.acceptRun("-")
	l.next()

	equalsRun := l.acceptRun("=")
	if !l.accept("[") {
		return l.errorf("didn't find another opening bracket")
	}

	for {
		switch l.next() {
		case '\\':
			l.next()
			continue
		case ']':
			if l.acceptRun("=") != equalsRun {
				// Not the same amount as when we opened this string.
				continue
			}
			if !l.accept("]") {
				return l.errorf("didn't find closing bracket")
			}
			l.ignore()
			return lexText
		}
	}
}

func lexLineComment(l *lexer) stateFn {
	lineLength := strings.Index(l.input[l.pos:], "\n")
	if lineLength == 0 {
		// this is the last line, so lex until the end
		lineLength = len(l.input[l.pos:])
	}

	l.pos += token.Pos(lineLength)
	l.ignore()
	return lexText
}

func lexSingleQuotedStringLiteral(l *lexer) stateFn {
	l.next()
	for {
		switch l.next() {
		case '\\':
			l.next()
			continue
		case '\'':
			l.emit(token.StringLiteral)
			return lexText
		}
	}
}

func lexDoubleQuotedStringLiteral(l *lexer) stateFn {
	l.next()
	for {
		switch l.next() {
		case '\\':
			l.next()
			continue
		case '"':
			l.emit(token.StringLiteral)
			return lexText
		}
	}
}

func lexDoubleBracketStringLiteral(l *lexer) stateFn {
	// Eat the opening '['
	l.next()
	equalsRun := l.acceptRun("=")
	if !l.accept("[") {
		return l.errorf("didn't find another opening bracket")
	}

	// Potentially eat up a newline.
	l.accept("\n")

	for {
		switch l.next() {
		case '\\':
			l.next()
			continue
		case ']':
			if l.acceptRun("=") != equalsRun {
				// Not the same amount as when we opened this string.
				continue
			}
			if !l.accept("]") {
				return l.errorf("didn't find closing bracket")
			}
			l.emit(token.StringLiteral)
			return lexText
		}
	}
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using TrafficMonitor.Models;

namespace TrafficMonitor.Data
{
    public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
    {
        public DbSet<Station> Stations { get; set; }
        public DbSet<StationMeasurement> Measurements { get; set; }
        public DbSet<StationStatus> StationStatuses { get; set; }
        public DbSet<Tip> Tips { get; set; }
        public DbSet<Notification> Notifications { get; set; }
        public DbSet<UserNotification> UserNotifications { get; set; }
        public DbSet<Subscribtion> Subscribtions { get; set; }
        public DbSet<Consent> Consents { get; set; }

        public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
            : base(options)
        {
        }

        protected override void OnModelCreating(ModelBuilder builder)
        {
            builder.Entity<UserNotification>().HasKey(un => new { un.UserId, un.NotificationId });

            builder.Entity<UserNotification>()
                .HasOne(un => un.User)
                .WithMany(un => un.UserNotifications)
                .HasForeignKey(un => un.UserId)
                .OnDelete(Microsoft.EntityFrameworkCore.Metadata.DeleteBehavior.Cascade); //Deleting all their notifications

            builder.Entity<Subscribtion>().HasKey(s => new { s.StationId, s.SubscriberId });

            builder.Entity<Subscribtion>().HasOne(s => s.Station).WithMany(s => s.Subscribtions).HasForeignKey(s => s.StationId)
                .OnDelete(Microsoft.EntityFrameworkCore.Metadata.DeleteBehavior.Cascade);

            //builder.Entity<ApplicationUser>()
            //    .HasMany(au => au.UserNotifications)
            //    .WithOne(un => un.User)
            //    .HasForeignKey(au => au.)
            //    .OnDelete(Microsoft.EntityFrameworkCore.Metadata.DeleteBehavior.Cascade);

            base.OnModelCreating(builder);
            // Customize the ASP.NET Identity model and override the defaults if needed.
            // For example, you can rename the ASP.NET Identity table names and more.
            // Add your customizations after calling base.OnModelCreating(builder);
        }
    }
}


text:
package runner

import (
	"bytes"
	"errors"
	"fmt"
	"io"
	"math/rand"
	"net"
)

func versionToWire(vers uint16, isDTLS bool) uint16 {
	if isDTLS {
		return ^(vers - 0x0201)
	}
	return vers
}

func wireToVersion(vers uint16, isDTLS bool) uint16 {
	if isDTLS {
		return ^vers + 0x0201
	}
	return vers
}

func (c *Conn) dtlsDoReadRecord(want recordType) (recordType, *block, error) {
	recordHeaderLen := dtlsRecordHeaderLen

	if c.rawInput == nil {
		c.rawInput = c.in.newBlock()
	}
	b := c.rawInput

	// Read a new packet only if the current one is empty.
	if len(b.data) == 0 {
		// Pick some absurdly large buffer size.
		b.resize(maxCiphertext + recordHeaderLen)
		n, err := c.conn.Read(c.rawInput.data)
		if err != nil {
			return 0, nil, err
		}
		if c.config.Bugs.MaxPacketLength != 0 && n > c.config.Bugs.MaxPacketLength {
			return 0, nil, fmt.Errorf("dtls: exceeded maximum packet length")
		}
		c.rawInput.resize(n)
	}

	// Read out one record.
	//
	// A real DTLS implementation should be tolerant of errors,
	// but this is test code. We should not be tolerant of our
	// peer sending garbage.
	if len(b.data) < recordHeaderLen {
		return 0, nil, errors.New("dtls: failed to read record header")
	}
	typ := recordType(b.data[0])
	vers := wireToVersion(uint16(b.data[1])<<8|uint16(b.data[2]), c.isDTLS)
	if c.haveVers {
		if vers != c.vers {
			c.sendAlert(alertProtocolVersion)
			return 0, nil, c.in.setErrorLocked(fmt.Errorf("dtls: received record with version %x when expecting version %x", vers, c.vers))
		}
	} else {
		if expect := c.config.Bugs.ExpectInitialRecordVersion; expect != 0 && vers != expect {
			c.sendAlert(alertProtocolVersion)
			return 0, nil, c.in.setErrorLocked(fmt.Errorf("dtls: received record with version %x when expecting version %x", vers, expect))
		}
	}
	seq := b.data[3:11]
	// For test purposes, we assume a reliable channel. Require
	// that the explicit sequence number matches the incrementing
	// one we maintain. A real implementation would maintain a
	// replay window and such.
	if !bytes.Equal(seq, c.in.seq[:]) {
		c.sendAlert(alertIllegalParameter)
		return 0, nil, c.in.setErrorLocked(fmt.Errorf("dtls: bad sequence number"))
	}
	n := int(b.data[11])<<8 | int(b.data[12])
	if n > maxCiphertext || len(b.data) < recordHeaderLen+n {
		c.sendAlert(alertRecordOverflow)
		return 0, nil, c.in.setErrorLocked(fmt.Errorf("dtls: oversized record received with length %d", n))
	}

	// Process message.
	b, c.rawInput = c.in.splitBlock(b, recordHeaderLen+n)
	ok, off, err := c.in.decrypt(b)
	if !ok {
		c.in.setErrorLocked(c.sendAlert(err))
	}
	b.off = off
	return typ, b, nil
}

func (c *Conn) makeFragment(header, data []byte, fragOffset, fragLen int) []byte {
	fragment := make([]byte, 0, 12+fragLen)
	fragment = append(fragment, header...)
	fragment = append(fragment, byte(c.sendHandshakeSeq>>8), byte(c.sendHandshakeSeq))
	fragment = append(fragment, byte(fragOffset>>16), byte(fragOffset>>8), byte(fragOffset))
	fragment = append(fragment, byte(fragLen>>16), byte(fragLen>>8), byte(fragLen))
	fragment = append(fragment, data[fragOffset:fragOffset+fragLen]...)
	return fragment
}

func (c *Conn) dtlsWriteRecord(typ recordType, data []byte) (n int, err error) {
	if typ != recordTypeHandshake {
		// Only handshake messages are fragmented.
		return c.dtlsWriteRawRecord(typ, data)
	}

	maxLen := c.config.Bugs.MaxHandshakeRecordLength
	if maxLen <= 0 {
		maxLen = 1024
	}

	// Handshake messages have to be modified to include fragment
	// offset and length and with the header replicated. Save the
	// TLS header here.
	//
	// TODO(davidben): This assumes that data contains exactly one
	// handshake message. This is incompatible with
	// FragmentAcrossChangeCipherSpec. (Which is unfortunate
	// because OpenSSL's DTLS implementation will probably accept
	// such fragmentation and could do with a fix + tests.)
	header := data[:4]
	data = data[4:]

	isFinished := header[0] == typeFinished

	if c.config.Bugs.SendEmptyFragments {
		fragment := c.makeFragment(header, data, 0, 0)
		c.pendingFragments = append(c.pendingFragments, fragment)
	}

	firstRun := true
	fragOffset := 0
	for firstRun || fragOffset < len(data) {
		firstRun = false
		fragLen := len(data) - fragOffset
		if fragLen > maxLen {
			fragLen = maxLen
		}

		fragment := c.makeFragment(header, data, fragOffset, fragLen)
		if c.config.Bugs.FragmentMessageTypeMismatch && fragOffset > 0 {
			fragment[0]++
		}
		if c.config.Bugs.FragmentMessageLengthMismatch && fragOffset > 0 {
			fragment[3]++
		}

		// Buffer the fragment for later. They will be sent (and
		// reordered) on flush.
		c.pendingFragments = append(c.pendingFragments, fragment)
		if c.config.Bugs.ReorderHandshakeFragments {
			// Don't duplicate Finished to avoid the peer
			// interpreting it as a retransmit request.
			if !isFinished {
				c.pendingFragments = append(c.pendingFragments, fragment)
			}

			if fragLen > (maxLen+1)/2 {
				// Overlap each fragment by half.
				fragLen = (maxLen + 1) / 2
			}
		}
		fragOffset += fragLen
		n += fragLen
	}
	if !isFinished && c.config.Bugs.MixCompleteMessageWithFragments {
		fragment := c.makeFragment(header, data, 0, len(data))
		c.pendingFragments = append(c.pendingFragments, fragment)
	}

	// Increment the handshake sequence number for the next
	// handshake message.
	c.sendHandshakeSeq++
	return
}

func (c *Conn) dtlsFlushHandshake() error {
	if !c.isDTLS {
		return nil
	}

	// This is a test-only DTLS implementation, so there is no need to
	// retain |c.pendingFragments| for a future retransmit.
	var fragments [][]byte
	fragments, c.pendingFragments = c.pendingFragments, fragments

	if c.config.Bugs.ReorderHandshakeFragments {
		perm := rand.New(rand.NewSource(0)).Perm(len(fragments))
		tmp := make([][]byte, len(fragments))
		for i := range tmp {
			tmp[i] = fragments[perm[i]]
		}
		fragments = tmp
	}

	maxRecordLen := c.config.Bugs.PackHandshakeFragments
	maxPacketLen := c.config.Bugs.PackHandshakeRecords

	// Pack handshake fragments into records.
	var records [][]byte
	for _, fragment := range fragments {
		if n := c.config.Bugs.SplitFragments; n > 0 {
			if len(fragment) > n {
				records = append(records, fragment[:n])
				records = append(records, fragment[n:])
			} else {
				records = append(records, fragment)
			}
		} else if i := len(records) - 1; len(records) > 0 && len(records[i])+len(fragment) <= maxRecordLen {
			records[i] = append(records[i], fragment...)
		} else {
			// The fragment will be appended to, so copy it.
			records = append(records, append([]byte{}, fragment...))
		}
	}

	// Format them into packets.
	var packets [][]byte
	for _, record := range records {
		b, err := c.dtlsSealRecord(recordTypeHandshake, record)
		if err != nil {
			return err
		}

		if i := len(packets) - 1; len(packets) > 0 && len(packets[i])+len(b.data) <= maxPacketLen {
			packets[i] = append(packets[i], b.data...)
		} else {
			// The sealed record will be appended to and reused by
			// |c.out|, so copy it.
			packets = append(packets, append([]byte{}, b.data...))
		}
		c.out.freeBlock(b)
	}

	// Send all the packets.
	for _, packet := range packets {
		if _, err := c.conn.Write(packet); err != nil {
			return err
		}
	}
	return nil
}

// dtlsSealRecord seals a record into a block from |c.out|'s pool.
func (c *Conn) dtlsSealRecord(typ recordType, data []byte) (b *block, err error) {
	recordHeaderLen := dtlsRecordHeaderLen
	maxLen := c.config.Bugs.MaxHandshakeRecordLength
	if maxLen <= 0 {
		maxLen = 1024
	}

	b = c.out.newBlock()

	explicitIVLen := 0
	explicitIVIsSeq := false

	if cbc, ok := c.out.cipher.(cbcMode); ok {
		// Block cipher modes have an explicit IV.
		explicitIVLen = cbc.BlockSize()
	} else if aead, ok := c.out.cipher.(*tlsAead); ok {
		if aead.explicitNonce {
			explicitIVLen = 8
			// The AES-GCM construction in TLS has an explicit nonce so that
			// the nonce can be random. However, the nonce is only 8 bytes
			// which is too small for a secure, random nonce. Therefore we
			// use the sequence number as the nonce.
			explicitIVIsSeq = true
		}
	} else if c.out.cipher != nil {
		panic("Unknown cipher")
	}
	b.resize(recordHeaderLen + explicitIVLen + len(data))
	b.data[0] = byte(typ)
	vers := c.vers
	if vers == 0 {
		// Some TLS servers fail if the record version is greater than
		// TLS 1.0 for the initial ClientHello.
		vers = VersionTLS10
	}
	vers = versionToWire(vers, c.isDTLS)
	b.data[1] = byte(vers >> 8)
	b.data[2] = byte(vers)
	// DTLS records include an explicit sequence number.
	copy(b.data[3:11], c.out.outSeq[0:])
	b.data[11] = byte(len(data) >> 8)
	b.data[12] = byte(len(data))
	if explicitIVLen > 0 {
		explicitIV := b.data[recordHeaderLen : recordHeaderLen+explicitIVLen]
		if explicitIVIsSeq {
			copy(explicitIV, c.out.outSeq[:])
		} else {
			if _, err = io.ReadFull(c.config.rand(), explicitIV); err != nil {
				return
			}
		}
	}
	copy(b.data[recordHeaderLen+explicitIVLen:], data)
	c.out.encrypt(b, explicitIVLen)
	return
}

func (c *Conn) dtlsWriteRawRecord(typ recordType, data []byte) (n int, err error) {
	b, err := c.dtlsSealRecord(typ, data)
	if err != nil {
		return
	}

	_, err = c.conn.Write(b.data)
	if err != nil {
		return
	}
	n = len(data)

	c.out.freeBlock(b)

	if typ == recordTypeChangeCipherSpec {
		err = c.out.changeCipherSpec(c.config)
		if err != nil {
			// Cannot call sendAlert directly,
			// because we already hold c.out.Mutex.
			c.tmp[0] = alertLevelError
			c.tmp[1] = byte(err.(alert))
			c.writeRecord(recordTypeAlert, c.tmp[0:2])
			return n, c.out.setErrorLocked(&net.OpError{Op: "local error", Err: err})
		}
	}
	return
}

func (c *Conn) dtlsDoReadHandshake() ([]byte, error) {
	// Assemble a full handshake message.  For test purposes, this
	// implementation assumes fragments arrive in order. It may
	// need to be cleverer if we ever test BoringSSL's retransmit
	// behavior.
	for len(c.handMsg) < 4+c.handMsgLen {
		// Get a new handshake record if the previous has been
		// exhausted.
		if c.hand.Len() == 0 {
			if err := c.in.err; err != nil {
				return nil, err
			}
			if err := c.readRecord(recordTypeHandshake); err != nil {
				return nil, err
			}
		}

		// Read the next fragment. It must fit entirely within
		// the record.
		if c.hand.Len() < 12 {
			return nil, errors.New("dtls: bad handshake record")
		}
		header := c.hand.Next(12)
		fragN := int(header[1])<<16 | int(header[2])<<8 | int(header[3])
		fragSeq := uint16(header[4])<<8 | uint16(header[5])
		fragOff := int(header[6])<<16 | int(header[7])<<8 | int(header[8])
		fragLen := int(header[9])<<16 | int(header[10])<<8 | int(header[11])

		if c.hand.Len() < fragLen {
			return nil, errors.New("dtls: fragment length too long")
		}
		fragment := c.hand.Next(fragLen)

		// Check it's a fragment for the right message.
		if fragSeq != c.recvHandshakeSeq {
			return nil, errors.New("dtls: bad handshake sequence number")
		}

		// Check that the length is consistent.
		if c.handMsg == nil {
			c.handMsgLen = fragN
			if c.handMsgLen > maxHandshake {
				return nil, c.in.setErrorLocked(c.sendAlert(alertInternalError))
			}
			// Start with the TLS handshake header,
			// without the DTLS bits.
			c.handMsg = append([]byte{}, header[:4]...)
		} else if fragN != c.handMsgLen {
			return nil, errors.New("dtls: bad handshake length")
		}

		// Add the fragment to the pending message.
		if 4+fragOff != len(c.handMsg) {
			return nil, errors.New("dtls: bad fragment offset")
		}
		if fragOff+fragLen > c.handMsgLen {
			return nil, errors.New("dtls: bad fragment length")
		}
		c.handMsg = append(c.handMsg, fragment...)
	}
	c.recvHandshakeSeq++
	ret := c.handMsg
	c.handMsg, c.handMsgLen = nil, 0
	return ret, nil
}

// DTLSServer returns a new DTLS server side connection
// using conn as the underlying transport.
// The configuration config must be non-nil and must have
// at least one certificate.
func DTLSServer(conn net.Conn, config *Config) *Conn {
	c := &Conn{config: config, isDTLS: true, conn: conn}
	c.init()
	return c
}

// DTLSClient returns a new DTLS client side connection
// using conn as the underlying transport.
// The config cannot be nil: users must set either ServerHostname or
// InsecureSkipVerify in the config.
func DTLSClient(conn net.Conn, config *Config) *Conn {
	c := &Conn{config: config, isClient: true, isDTLS: true, conn: conn}
	c.init()
	return c
}


text:
import os
from importlib import import_module
import builtins

import flask
from rdflib.namespace import Namespace

import helpers
from escape_helpers import sparql_escape

# WSGI variable name used by the server
app = flask.Flask(__name__)

##################
## Vocabularies ##
##################
mu = Namespace('http://mu.semte.ch/vocabularies/')
mu_core = Namespace('http://mu.semte.ch/vocabularies/core/')
mu_ext = Namespace('http://mu.semte.ch/vocabularies/ext/')

SERVICE_RESOURCE_BASE = 'http://mu.semte.ch/services/'

builtins.app = app
builtins.helpers = helpers
builtins.sparql_escape = sparql_escape

# Import the app from the service consuming the template
app_file = os.environ.get('APP_ENTRYPOINT')
try:
    module_path = 'ext.app.{}'.format(app_file)
    import_module(module_path)
except Exception as e:
    helpers.log(str(e))

#######################
## Start Application ##
#######################
if __name__ == '__main__':
    debug = os.environ.get('MODE') == "development"
    app.run(debug=debug, host='0.0.0.0', port=80)


text:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<meta name="Robots" content="index,follow" />
<meta name="Date" content="2003-05-20" />
<meta name="Keywords" content="jHTTPp2,Benjamin Kohl,Jhttp2,proxy,java,HTTP,opensource,free,HTTP/1.1" />
<meta name="Description" content="jHTTPp2 is an opensource HTTP/1.1 proxy server written in Java" />
<meta name="Author" content="Benjamin Kohl" />
<meta http-equiv="Content-Language" content="en-us" />
<meta name="GENERATOR" content="Microsoft FrontPage 5.0" />
<meta name="ProgId" content="FrontPage.Editor.Document" />
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<title>jHTTPp2</title>
<link rel="stylesheet" type="text/css" href="lb.css" />

<link rel="home" href="/index.html" title="jHTTPp2" />
<link rev="start" href="/index.html" title="jHTTPp2" />

jHTTPp2 0.4.62

Local files

jHTTPp2 User Manual (PDF,
      requires Acrobat Reader)

Configuration with the Web interface

jHTTPp2 on the web

jHTTPp2 Project Home on SourceForge.net

Contact

Use the web interface
      to report Bugs, Wishes

Developer Information

Note that jHTTPp2 is not a finished product. There are known and unknown
      bugs.

If you want to help, you can subscribe to the
      Developers
      Mailing List (with release info) and contact me via email:
      bkohl@users.sf.net

http://jhttp2.sourceforge.net
      Copyright © 2001-2003 Benjamin
      Kohl

      jHTTPp2 Copyright © 2001-2003
      Benjamin Kohl

      This program is free software; you can redistribute it and/or modify it under
      the terms of the GNU General Public License as published
      by the Free Software Foundation; either version 2 of the License, or (at your
      option) any later version. This program is distributed in the hope that it
      will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
      of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
      GNU General Public License for more details.

        Page modified 2003-05-20


text:
namespace wave {

const auto TEST_IMAGE_0 = "tests/data/tracker_test_sequence/frame0059.jpg";
const auto TEST_IMAGE_1 = "tests/data/tracker_test_sequence/frame0060.jpg";
const auto TEST_IMAGE_2 = "tests/data/tracker_test_sequence/frame0061.jpg";

TEST(TrackerTests, ConstructorTest) {
    FASTDetector detector1;
    BRISKDescriptor descriptor1;
    ORBDetector detector2;
    ORBDescriptor descriptor2;
    BruteForceMatcher matcher;

    // Cannot define ASSERTS here, as gtest is very sensitive to commas.
    Tracker<FASTDetector, BRISKDescriptor, BruteForceMatcher> tracker1(
      detector1, descriptor1, matcher);

    Tracker<ORBDetector, ORBDescriptor, BruteForceMatcher> tracker2(
      detector2, descriptor2, matcher);

    SUCCEED();
}

TEST(TrackerTests, AddImageGetTracks) {
    // Define detectors, descriptors, and matcher.
    FASTDetector detector;
    BRISKDescriptor descriptor;
    BruteForceMatcher matcher;

    std::chrono::steady_clock clock;

    // Create 2 trackers, one online and one offline
    Tracker<FASTDetector, BRISKDescriptor, BruteForceMatcher> tracker(
      detector, descriptor, matcher);

    int window_size = 2;
    Tracker<FASTDetector, BRISKDescriptor, BruteForceMatcher> tracker2(
      detector, descriptor, matcher, window_size);

    cv::Mat image_1 = cv::imread(TEST_IMAGE_0);
    cv::Mat image_2 = cv::imread(TEST_IMAGE_1);
    cv::Mat image_3 = cv::imread(TEST_IMAGE_2);

    // Add image 1
    auto time1 = clock.now();
    tracker.addImage(image_1, time1);
    tracker2.addImage(image_1, time1);

    // Extracting tracks for images that don't exist should throw exceptions.
    ASSERT_THROW(tracker.getTracks(-1), std::out_of_range);
    ASSERT_THROW(tracker2.getTracks(-1), std::out_of_range);
    ASSERT_THROW(tracker.getTracks(5), std::out_of_range);
    ASSERT_THROW(tracker2.getTracks(5), std::out_of_range);

    // The tracks from the first image should be empty (no sequence for tracks)
    std::vector<FeatureTrack> ft0_t1 = tracker.getTracks(0);
    std::vector<FeatureTrack> ft0_t2 = tracker2.getTracks(0);
    ASSERT_TRUE(ft0_t1.empty());
    ASSERT_TRUE(ft0_t2.empty());

    // Add image 2
    auto time2 = clock.now();
    tracker.addImage(image_2, time2);
    tracker2.addImage(image_2, time2);

    // Add image 3
    auto time3 = clock.now();
    tracker.addImage(image_3, time3);
    tracker2.addImage(image_3, time3);

    // After adding image3 to tracker2, getting tracks for image 0 should throw
    ASSERT_THROW(tracker2.getTracks(0), std::out_of_range);

    // Get tracks from both images, make sure in both cases they are not empty.
    std::vector<FeatureTrack> ft1_t1 = tracker.getTracks(1);
    std::vector<FeatureTrack> ft2_t1 = tracker.getTracks(1);
    std::vector<FeatureTrack> ft1_t2 = tracker2.getTracks(2);
    std::vector<FeatureTrack> ft2_t2 = tracker2.getTracks(2);

    ASSERT_FALSE(ft1_t1.empty());
    ASSERT_FALSE(ft2_t1.empty());
    ASSERT_FALSE(ft1_t2.empty());
    ASSERT_FALSE(ft2_t2.empty());

    // Compare size of landmark measurement containers after 3rd image.
    // In online mode, landmarks should be cleaned out.
    ASSERT_TRUE(tracker.lmc_size > tracker2.lmc_size);
}

TEST(TrackerTests, OfflineTrackerNoImages) {
    std::vector<cv::Mat> image_sequence;
    FASTDetector detector;
    BRISKDescriptor descriptor;
    BruteForceMatcher matcher;

    Tracker<FASTDetector, BRISKDescriptor, BruteForceMatcher> tracker(
      detector, descriptor, matcher);

    ASSERT_THROW(tracker.offlineTracker(image_sequence), std::invalid_argument);
}
}  // namespace wave


text:
import { initialize } from "../../index";

test("street view panorama is mocked", () => {
  initialize();
  expect(new google.maps.StreetViewPanorama(null)).toBeTruthy();
});


text:
package seedu.jobs.commons.events.model;

import seedu.jobs.commons.events.BaseEvent;
import seedu.jobs.model.task.Task;

public class AddCommandEvent extends BaseEvent {

    private Task task;

    public AddCommandEvent(Task task) {
        this.task = task;
    }

    public Task getTask() {
        return this.task;
    }

    @Override
    public String toString() {
        return "Adding task : " + task;
    }

}


text:
C Copyright (C) 2009-2017 National Technology & Engineering Solutions
C of Sandia, LLC (NTESS).  Under the terms of Contract DE-NA0003525 with
C NTESS, the U.S. Government retains certain rights in this software.
C
C Redistribution and use in source and binary forms, with or without
C modification, are permitted provided that the following conditions are
C met:
C
C     * Redistributions of source code must retain the above copyright
C       notice, this list of conditions and the following disclaimer.
C
C     * Redistributions in binary form must reproduce the above
C       copyright notice, this list of conditions and the following
C       disclaimer in the documentation and/or other materials provided
C       with the distribution.
C
C     * Neither the name of NTESS nor the names of its
C       contributors may be used to endorse or promote products derived
C       from this software without specific prior written permission.
C
C THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
C "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
C LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
C A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
C OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
C SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
C LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
C DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
C THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
C (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
C OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
C

C $Id: lxrnl.f,v 1.3 1993/07/16 18:28:52 gdsjaar Exp $
C $Log: lxrnl.f,v $
C Revision 1.3  1993/07/16 18:28:52  gdsjaar
C Changed real*8 to double precision
C
c Revision 1.2  1993/07/16  18:07:49  gdsjaar
c Added external pltblk statements so that linkers would pull in block
c data subprogram to initialize constants.
c
c Revision 1.1  1993/07/16  16:46:47  gdsjaar
c Changed plt to library rather than single source file.
c
C=======================================================================
      LOGICAL FUNCTION LXRNL(VAL,N,CH)
      DOUBLE PRECISION VAL(*)
      CHARACTER CH
      LOGICAL LDUM,LXGTCH,LXGTWH,LXREAL
      DOUBLE PRECISION XX,XY

      I = 1
 2320 IF (.NOT. (I.LE.N)) GO TO 2340
      VAL(I) = 0.
      I = I + 1
      GO TO 2320

 2340 CONTINUE
      N = 0
      LXRNL = .TRUE.
 2350 CONTINUE
      LDUM = LXGTWH(CH)
      IF (LXREAL(VAL(N+1),CH)) THEN
         N = N + 1
         LDUM = LXGTWH(CH)
         IF (LXGTCH('#',CH)) THEN
            RETURN

         END IF

         IF (LXGTCH(',',CH)) THEN
            GO TO 2360

         END IF

         IF (CH.EQ.CHAR(0)) THEN
            RETURN

         END IF

         IF (LXGTCH('*',CH)) THEN
            LDUM = LXGTWH(CH)
            XX = VAL(N)
            IF (.NOT.LXREAL(XY,CH)) THEN
               LXRNL = .FALSE.
               RETURN

            END IF

            M = INT(XX + .1)
            N0 = N
 2380       IF (.NOT. (N.LT.M+N0)) GO TO 2400
            VAL(N) = XY
            N = N + 1
            GO TO 2380

 2400       CONTINUE
            LDUM = LXGTWH(CH)
            N = N0 + MAX(M-1,0)
            IF (LXGTCH(',',CH)) THEN
               GO TO 2360

            END IF

            IF (LXGTCH('#',CH)) THEN
               RETURN

            END IF

            IF (CH.EQ.CHAR(0)) THEN
               RETURN

            END IF

         END IF

      ELSE IF (LXGTCH(',',CH)) THEN
         VAL(N+1) = 0.
         N = N + 1

      ELSE IF (LXGTCH('#',CH)) THEN
         RETURN

      ELSE IF (CH.EQ.CHAR(0)) THEN
         IF (N.EQ.0) THEN
            RETURN

         END IF

         N = N + 1
         VAL(N) = 0.
         RETURN

      ELSE
         LXRNL = .FALSE.
         RETURN

      END IF

 2360 GO TO 2350

      END