text:
<?xml version="1.0"?>

<?dlps id="NurDep3"?>
<?dlps page-images="none" figure-images="no"?>
<?dlps transcription="other"?>

<!DOCTYPE TEI.2 SYSTEM "http://text.lib.virginia.edu/dtd/tei/tei-p4/tei2.dtd" [
<!ENTITY % POSTKB "INCLUDE">
<!ENTITY % TEI.extensions.ent SYSTEM "http://text.lib.virginia.edu/dtd/tei/uva-dl-tei/uva-dl-tei.ent">
<!ENTITY % TEI.extensions.dtd SYSTEM "http://text.lib.virginia.edu/dtd/tei/uva-dl-tei/uva-dl-tei.dtd">

]>
<TEI.2 id="NurDep3">
<teiHeader type="migrated" creator="Etext">
<fileDesc>
<titleStmt>
<title type="main">Rebecca Nurse Collection:
Ann Putnam, Sr.Vs. Rebecca Nurse</title>
<title type="sort">rebecca nurse collection ann putnam, sr vs rebecca nurse</title>
<author>Nurse, Rebecca</author>
<respStmt>
<resp>Creation of machine-readable version:</resp>
<name>Carolyn Fay, Electronic Text Center</name>
<resp>Creation of digital images:</resp>
<name/>
<resp>Conversion to TEI.2-conformant markup:</resp>
<name>University of Virginia Library Electronic Text Center.</name>
</respStmt>
</titleStmt>
<extent>ca. <num type="kilobytes">5</num> kilobytes</extent>
<publicationStmt>
<publisher>University of Virginia Library</publisher>
<pubPlace>Charlottesville, Virginia</pubPlace>
<idno type="ETC">NurDep3</idno>
<date value="1998">1998</date>
<availability status="public">

Copyright © 1998 by the Rector and Visitors of the University of Virginia

Publicly accessible

</availability>
<idno type="uva-pid">uva-lib:476592</idno>
</publicationStmt>
<seriesStmt>
<title>University of Virginia Library, Text collection</title>
<idno type="uva-set">UVA-LIB-Text</idno>
</seriesStmt>
<notesStmt>
<note>

This document is part of a collection of documents pertaining to the Rebecca Nurse witchcraft trial of 1692 in Salem Village, Massachusetts, collected and edited by Richard B. Trask in "The Devil hath been raised." This electronic collection is a pilot project that is part of a larger digital enterprise which will collect together all of the documents pertaining to the Salem witchcraft trials. This enterprise is a project undertaken by the Electronic Text Center. Benjamin C. Ray, professor of Religious Studies, is the project supervisor.

</note>
</notesStmt>
<sourceDesc>
<biblFull>
<titleStmt>
<title type="main">Rebecca Nurse Collection: Ann Putnam, Sr. Vs. Rebecca Nurse</title>
<title level="m">"The Devil hath been raised:" A Documentary History of the Salem Village Witchcraft Outbreak of March 1692</title>
<title type="sort">rebecca nurse collection ann putnam, sr vs rebecca nurse</title>
<author>Rebecca Nurse</author>
<respStmt>
<resp>Editor</resp>
<name>Richard B. Trask</name>
</respStmt>
</titleStmt>
<editionStmt>

Revised Edition

</editionStmt>
<extent>p. 59</extent>
<publicationStmt>
<publisher>Yeoman Press</publisher>
<pubPlace>Danvers, Mass.</pubPlace>
<date value="1997">1997</date>
<idno type="callNo">Print copy consulted: personal copy</idno>
</publicationStmt>
</biblFull>
</sourceDesc>
</fileDesc>
<encodingDesc>
<projectDesc>

Prepared for the University of Virginia Library Electronic Text Center.

</projectDesc>
<editorialDecl>

The images exist as archived TIFF images, one or more JPEG versions for general use, and thumbnail GIFs.

Some keywords in the header are a local Electronic Text Center scheme to aid in establishing analytical groupings.

</editorialDecl>
</encodingDesc>
<profileDesc>
<creation>
<date value="1692-03-24">1692-03-24</date>
</creation>
<langUsage>
<language id="eng" usage="main">English</language>
</langUsage>
<textClass>
<keywords>
<term>nonfiction</term>
<term>prose</term>
<term>feminine</term>
</keywords>
</textClass>
</profileDesc>
<revisionDesc>
<change>
<date value="1998-07">July 1998</date>
<respStmt>
<resp>corrector</resp>
<name>Carolyn Fay, Electronic Text Center</name>
</respStmt>
<item>Added TEI header and tags.</item>
</change>
<change>
<date value="2005-07">July 2005</date>
<respStmt>
<resp>Corrector</resp>
<name>John Ivor Carlson</name>
</respStmt>
<item>Converted to XML and/or checked tags.</item>
</change>
<change>
<date value="2007-09">September 2007</date>
<respStmt>
<resp>Migration</resp>
<name>Ethan Gruber, University of Virginia Library</name>
</respStmt>
<item>Converted XML markup from TEI Lite to uva-dl-tei (TEI P4 with local customizations).</item>
</change>
<change>
<date value="2008-01">January 2008</date>
<respStmt>
<resp>Migration</resp>
<name>Greg Murray, University of Virginia Library</name>
</respStmt>
<item>Programmatically updated TEI header markup (but not header content) for minimal compliance with current QA requirements.</item>
</change>
</revisionDesc>
</teiHeader>
<text id="d1">

<div1 type="statement" n="1692-05-31" id="d3">

<hi rend="bold">Ann Putnam, Sr.Vs. Rebecca Nurse</hi>

The final portion of an Ann Putnam, Sr., deposition relating to her
suffering during the examination of Rebecca Nurse. On May 31, 1692, this
deposition was sworn to by Putnam.

24: march being the days of the examination of Rebekah Nurs: I was
severall times afflected in the morning by the Apperishtion of Rebekah
Nurs: but most dreadfully tortored by hir in the dime of her
examination: in so much that The Honoured Majestraits gave my Husband
leave to cary me out of the meeting house: and as soon as I was caryed
out of the meeting house dores it pleased Allmighty God for his free
grace and mircy sake to deliver me out of the paws of thos Roaring
lions: and jaws of those tareing bears that ever sence that time they
have not had power so to afflect me

[Reverse of document contains statements relating to incidents in May
and June, 1692.They are not included here.]

</div1>

</text>
</TEI.2>


text:
package io.cattle.host.api.proxy.launch;

import io.cattle.platform.lock.definition.AbstractLockDefinition;
import io.cattle.platform.lock.definition.LockDefinition;

public class ProxyLauncherLock extends AbstractLockDefinition implements LockDefinition {

    public ProxyLauncherLock() {
        super("PROXY.LAUNCH");
    }
}

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using NinthChevron.Data.Entity;
using NinthChevron.Helpers;

namespace NinthChevron.Data.AutoMap
{
    internal class ModelMapper<TEntity>
    {
        private TEntity _entity;
        private bool _isPreLoading;

        private ModelMapper(TEntity entity, bool isPreloading)
        {
            this._entity = entity;
            this._isPreLoading = isPreloading;
        }

        private void EnterModel(PropertyDescriptor property, IModelVisitorContext context, IModelVisitorContext parentContext)
        {
            context.Data = true;

            if (parentContext != null)
                context.Model = property.GetValue(parentContext.Model);
        }

        private void ExitModel(PropertyDescriptor property, IModelVisitorContext context, IModelVisitorContext parentContext) { }

        private void VisitProperty(PropertyDescriptor property, IModelVisitorContext context)
        {
            if (!(bool)context.Data)
                return;

            PropertyDescriptor entityProp = null;
            object entityObject = this._entity;

            EntityMapAttribute entityMapAttr = property.Attributes.OfType<EntityMapAttribute>().FirstOrDefault();
            EntityUpdateAttribute entityUpdateAttr = property.Attributes.OfType<EntityUpdateAttribute>().FirstOrDefault();

            if (entityMapAttr == null && entityUpdateAttr == null)
                return;

            List<string> properties;
            if (entityMapAttr != null && (!entityMapAttr.IsReadOnly || this._isPreLoading))
                properties = entityMapAttr.Properties.ToList();
            else
                properties = new List<string>();

            if (entityMapAttr != null && entityMapAttr.Properties.Count() == 0 && (!entityMapAttr.IsReadOnly || this._isPreLoading))
                properties.Add(property.Name);
            if (entityUpdateAttr != null)
                properties.AddRange(entityUpdateAttr.Properties);

            // If the property is entity mapped with multiple we cannot map it back to an entity!!
            if (properties.Count > 1)
                return;

            foreach (IEnumerable<PropertyDescriptor> propertyList in properties.Select(e => TypeDescriptorHelper.GetProperty<TEntity>(e)))
            {
                foreach (PropertyDescriptor propDescriptor in propertyList)
                {
                    object tempEntity = propDescriptor.GetValue(entityObject);
                    if (tempEntity == null && !TypeHelper.IsBaseType(propDescriptor.PropertyType))
                    {
                        tempEntity = TypeDescriptor.CreateInstance(null, propDescriptor.PropertyType, null, null);
                        propDescriptor.SetValue(entityObject, tempEntity);
                    }

                    if (!TypeHelper.IsBaseType(propDescriptor.PropertyType))
                        entityObject = tempEntity;

                    entityProp = propDescriptor;
                }

                ColumnAttribute columnAttr = entityProp.Attributes.OfType<ColumnAttribute>().FirstOrDefault();
                if (columnAttr == null || (columnAttr.IsIdentity || columnAttr.IsPrimaryKey) && !this._isPreLoading) return;

                object value = entityProp.GetValue(entityObject);
                object newValue = property.GetValue(context.Model);
                if (value != null && value.Equals(newValue) && !this._isPreLoading) return;

                if (property.PropertyType == entityProp.PropertyType)
                    entityProp.SetValue(entityObject, property.GetValue(context.Model));
                else
                {
                    if (TypeHelper.NonNullableType(property.PropertyType) == typeof(bool) && TypeHelper.NonNullableType(entityProp.PropertyType) == typeof(int))
                        entityProp.SetValue(entityObject, (bool)(newValue ?? false) ? 1 : 0);
                    else if (property.PropertyType.IsSubclassOf(typeof(Enum)) && TypeHelper.IsBaseType(entityProp.PropertyType))
                        entityProp.SetValue(entityObject, Convert.ChangeType(newValue, entityProp.PropertyType));
                    else
                    {
                        if (newValue != null)
                            entityProp.SetValue(entityObject, Convert.ChangeType(newValue, entityProp.PropertyType));
                    }
                }
            }
        }

        public static void Visit<TModel>(TEntity entity, object model, bool isPreloading = false)
        {
            ModelMapper<TEntity> merger = new ModelMapper<TEntity>(entity, isPreloading);
            IModelVisitor visitor = ModelVisitorProvider.Default;

            visitor.OnEnterModel += merger.EnterModel;
            visitor.OnExitModel += merger.ExitModel;
            visitor.OnVisitProperty += merger.VisitProperty;

            visitor.Visit<TModel>(model);
        }
    }
}


text:
package com.family.service.impl;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.family.db.dao.EventDao;
import com.family.db.domain.EventDomain;
import com.family.enums.SectionEnum;
import com.family.service.AccountService;
import com.family.service.EventService;
import com.family.service.WallService;
import com.family.service.bean.EventBean;
import com.family.service.bean.FamilyBean;
import com.family.service.bean.UserBean;

@Service
public class EventServiceImpl implements EventService {

	@Autowired
	private EventDao eventDao;

	@Autowired
	private WallService wallService;

	@Autowired
	private AccountService accountService;

	@Transactional
	public void addNewEvent(UserBean user, Date startTime, Date endTime, String title, String description, Boolean allDay) {
		eventDao.addNewEvent(String.valueOf(user.getFamilyId()), startTime, endTime, title, description, allDay);
		String message = user.getFirstName() + " has added new event : " + title ;
		wallService.addWallMessage(user, SectionEnum.Calendar, message);
	}

	@Transactional
	public void updateEvent(UserBean user, long id, Date startTime, Date endTime, String title, String description, Boolean allDay) {
		eventDao.updateEvent(String.valueOf(id), startTime, endTime, title, description, allDay);
		String message = user.getFirstName() + " has updated the event : " + title ;
		wallService.addWallMessage(user, SectionEnum.Calendar, message);

	}

	@Transactional
	public void deleteEvent(UserBean user, long id) {
		EventDomain event = eventDao.findEvent(String.valueOf(id));

		if (event != null) {
			String message = user.getFirstName() + " has deleted the event : " + event.getTitle() ;
			wallService.addWallMessage(user, SectionEnum.Calendar, message);

			eventDao.deleteEvent(String.valueOf(id));
		}

	}

	@Transactional
	public EventBean getEvent(long id) {
		EventDomain eventDomain = eventDao.findEvent(String.valueOf(id));
		EventBean eventBean = new EventBean(eventDomain);
		FamilyBean familyBean = accountService.findFamily(Long.valueOf(eventDomain.getFamilyId()));
		eventBean.setFamily(familyBean);
		return eventBean;
	}

}


text:
#import <iWorkImport/TSPReader.h>

#import "TSPComponentParserDelegate-Protocol.h"

@class TSPObjectContext;

// Not exported
@interface TSPComponentReader : TSPReader <TSPComponentParserDelegate>
{
    id <TSUStreamReadChannel> _readChannel;
    TSPObjectContext *_context;
    struct {
        unsigned int isReadingFromDocument:1;
        unsigned int ignoreUnknownContent:1;
        unsigned int ignoreVersionChecking:1;
    } _flags;
}

- (id).cxx_construct;
- (void).cxx_destruct;
- (id)unknownObjectUnarchiverArchiveInfo:(const struct ArchiveInfo *)arg1 stream:(struct DispatchDataInputStream *)arg2;
- (id)unknownMessageFromMessageInfo:(const struct MessageInfo *)arg1 stream:(struct DispatchDataInputStream *)arg2;
- (const struct MessageInfo *)unknownObjectMessageInfo;
- (void)didUnarchiveObject:(id)arg1 withUnarchiver:(id)arg2;
- (id)newUnarchiverWithArchiveInfo:(const struct ArchiveInfo *)arg1 stream:(struct DispatchDataInputStream *)arg2 isUnknownObject:(_Bool *)arg3;
- (_Bool)componentParser:(id)arg1 didReadArchiveInfo:(const struct ArchiveInfo *)arg2 stream:(struct DispatchDataInputStream *)arg3 error:(id *)arg4;
- (void)beginReadingWithCompletionQueue:(id)arg1 completion:(id)arg2;
- (void)dealloc;
- (id)initWithComponent:(id)arg1 finalizeHandlerQueue:(id)arg2 delegate:(id)arg3 readChannel:(id)arg4;
- (id)initWithComponent:(id)arg1 delegate:(id)arg2;
- (id)init;

@end


text:
<?php

namespace ZF\OAuth2\Factory;

use OAuth2\Server as OAuth2Server;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use ZF\OAuth2\Controller\AuthController;

class AuthControllerFactory implements FactoryInterface
{
    /**
     * @param ServiceLocatorInterface $controllers
     * @return AuthController
     */
    public function createService(ServiceLocatorInterface $controllers)
    {
        $services = $controllers->getServiceLocator()->get('ServiceManager');

        // For BC, if the ZF\OAuth2\Service\OAuth2Server service returns an
        // OAuth2\Server instance, wrap it in a closure.
        $oauth2ServerFactory = $services->get('ZF\OAuth2\Service\OAuth2Server');
        if ($oauth2ServerFactory instanceof OAuth2Server) {
            $oauth2Server = $oauth2ServerFactory;
            $oauth2ServerFactory = function () use ($oauth2Server) {
                return $oauth2Server;
            };
        }

        $authController = new AuthController(
            $oauth2ServerFactory,
            $services->get('ZF\OAuth2\Provider\UserId')
        );

        $config = $services->get('Config');
        $authController->setApiProblemErrorResponse((isset($config['zf-oauth2']['api_problem_error_response'])
            && $config['zf-oauth2']['api_problem_error_response'] === true));

        return $authController;
    }
}


text:
<?php
/**
 * CommentFormWidget.php
 * @author Revin Roman
 * @link https://rmrevin.ru
 */

namespace rmrevin\yii\module\Comments\widgets;

use rmrevin\yii\module\Comments;

/**
 * Class CommentFormWidget
 * @package rmrevin\yii\module\Comments\widgets
 */
class CommentFormWidget extends \yii\base\Widget
{

    /** @var string|null */
    public $theme;

    /** @var string */
    public $entity;

    /** @var Comments\models\Comment */
    public $Comment;

    /** @var string */
    public $anchor = '#comment-%d';

    /** @var string */
    public $viewFile = 'comment-form';

    /**
     * Register asset bundle
     */
    protected function registerAssets()
    {
        CommentFormAsset::register($this->getView());
    }

    /**
     * @inheritdoc
     */
    public function run()
    {
        $this->registerAssets();

        /** @var Comments\forms\CommentCreateForm $CommentCreateForm */
        $CommentCreateFormClassData = Comments\Module::instance()->model(
            'commentCreateForm', [
                'Comment' => $this->Comment,
                'entity' => $this->entity,
            ]
        );

        $CommentCreateForm = \Yii::createObject($CommentCreateFormClassData);

        if ($CommentCreateForm->load(\Yii::$app->getRequest()->post())) {
            if ($CommentCreateForm->validate()) {
                if ($CommentCreateForm->save()) {
                    \Yii::$app->getResponse()
                        ->refresh(sprintf($this->anchor, $CommentCreateForm->Comment->id))
                        ->send();

                    exit;
                }
            }
        }

        return $this->render($this->viewFile, [
            'CommentCreateForm' => $CommentCreateForm,
        ]);
    }

    /**
     * @inheritdoc
     */
    public function getViewPath()
    {
        return empty($this->theme)
            ? parent::getViewPath()
            : (\Yii::$app->getViewPath() . DIRECTORY_SEPARATOR . $this->theme);
    }
}


text:
<!DOCTYPE html>

    <meta http-equiv="content-type" content="text/html; charset=utf-8" />

    <meta name="viewport" content="width=device-width,user-scalable=no" />

    <meta name="apple-mobile-web-app-capable" content="yes" />

    <meta http-equiv="X-UA-Compatible" content="IE=edge" />

    <title>KeymanWeb #160</title>

KeymanWeb #266

      Type "b" for Keyman beep

      (flashes screen or vibrates device)

Type in your language in this text area:

    <textarea id='ta1' class='test' placeholder='Type here'></textarea>

or in this input field:

    <input class='test' value='' placeholder='or here'/>

Return to testing home page


text:
package io.sipstack.transaction.impl;

import io.pkts.packet.sip.SipMessage;
import io.pkts.packet.sip.SipRequest;
import io.pkts.packet.sip.SipResponse;
import io.pkts.packet.sip.Transport;
import io.pkts.packet.sip.address.SipURI;
import io.pkts.packet.sip.header.CSeqHeader;
import io.pkts.packet.sip.header.SipHeader;
import io.pkts.packet.sip.header.ViaHeader;
import io.sipstack.transaction.Transaction;
import io.sipstack.transaction.TransactionId;
import io.sipstack.transaction.TransactionLayer;
import io.sipstack.transaction.TransactionUser;
import io.sipstack.transaction.event.TransactionEvent;

import java.util.Optional;

import static org.hamcrest.CoreMatchers.not;
import static org.junit.Assert.*;

/**
 * @author jonas@jonasborjesson.com
 */
public class MockTransactionUser implements TransactionUser {

    /**
     * The {@link TransactionLayer} API is our way into the transaction layer
     * and is how we will be writing messages back.
     */
    private TransactionLayer transactionLayer;

    private SipAndTransactionStorage<TransactionEvent> storage = new SipAndTransactionStorage<>(transactionEvent -> {
        if (transactionEvent.isSipTransactionEvent()) {
            return transactionEvent.toSipTransactionEvent().message();
        }
        return null;
    });

    public void ensureTransactionTerminated(final TransactionId id) {
        fail("not to use this one anymore...");
    }

    public Transaction assertAndConsumeRequest(final String method) {
        return storage.assertAndConsumeRequest(method).transaction();
    }

    public Transaction assertAndConsumeResponse(final String method, final int responseStatus) {
        return storage.assertAndConsumeResponse(method, responseStatus).transaction();
    }

    /**
     * Poke this client to send out a new request through the transaction layer.
     *
     * @param request the request to send.
     * @return the transaction that got created for this request.
     */
    public void sendRequest(final SipRequest request) {
        transactionLayer.createFlow("127.0.0.1")
                .withTransport(Transport.udp)
                .withPort(5060)
                .onSuccess(f -> {
                    transactionLayer.newClientTransaction(f, request).start();
                    // storage.store(request);
                })
                .onFailure(f -> fail("Not sure why this failed"))
                .onCancelled(f -> fail("Who cancelled the flow future!"))
                .connect();
    }

    /**
     * Lookup a specific transaction based on the message
     *
     * @param msg
     * @return
     */
    public Transaction assertTransaction(final SipMessage msg) {
        final TransactionId id = TransactionId.create(msg);
        return storage.assertTransaction(id);
    }

    public Transaction assertTransaction(final TransactionId id) {
        return storage.assertTransaction(id);
    }

    public void reset() {
        storage.reset();
    }

    @Override
    public void start(final TransactionLayer transactionLayer) {
        this.transactionLayer = transactionLayer;
    }

    @Override
    public void onRequest(final Transaction transaction, final SipRequest request) {
        // storage.store(transaction, request);

        if (request.isAck()) {
            return;
        }

        final Optional<SipHeader> header = request.getHeader("X-Transaction-Test-Response");
        int responseCode = 200;
        if (header.isPresent()) {
            responseCode = Integer.valueOf(header.get().getValue().toString());
        }

        // transactionLayer.send(transaction.flow(), request.createResponse(responseCode));
        throw new RuntimeException("In the middle of fixing all of this stuff again");

        /*
        FlowFuture flowFuture = Flow.withHost().withPort()...connect();

        transactionLayer.newFlow().withHost("127.0.0.1").withPort(5060).withTransport(Transport.tcp).onComplete(to something).onFailure(hello).connect();

        final Transaction anotherTransaction = transactionLayer.send(anotherFlow, request);
        */
    }

    @Override
    public void onResponse(final Transaction transaction, final SipResponse response) {
        // storage.store(transaction, response);

        if (response.isSuccess() && response.isInvite()) {
            final ViaHeader via = ViaHeader
                    .withHost("127.0.0.1")
                    .withPort(5099)
                    .withTransportUDP()
                    .withBranch(ViaHeader.generateBranch())
                    .build();

            // of course, the request-uri of the ack should be the contact etc but
            // we keep it simple here
            final CSeqHeader cSeq = CSeqHeader.withMethod("ACK").withCSeq(response.getCSeqHeader().getSeqNumber()).build();
            final SipRequest ack = SipRequest.ack(SipURI.withHost("127.0.0.1").withPort(5090).build())
                    .withCallIdHeader(response.getCallIDHeader())
                    .withFromHeader(response.getFromHeader())
                    .withToHeader(response.getToHeader())
                    .withCSeqHeader(cSeq)
                    .withTopMostViaHeader(via).build();

            // final Transaction ackTransaction = transactionLayer.send(transaction.flow(), ack);
            // assertThat(ackTransaction, not((Transaction) null));
            // storage.store(ackTransaction, ack);
            throw new RuntimeException("In the middle of fixing all of this stuff again");
        }
    }

    @Override
    public void onTransactionTerminated(final Transaction transaction) {
        fail("not using this anymore...");
        // storage.onTransactionTerminated(transaction);
    }

    @Override
    public void onIOException(Transaction transaction, SipMessage msg) {
        assertThat(transaction, not((Transaction)null));
    }

}


text:
using System.Threading.Tasks;
using Orleans;
using Orleans.Messaging;
using Orleans.Runtime;
using Orleans.TestingHost;
using Xunit;

namespace UnitTests.MembershipTests
{
    /// <summary>
    /// Tests for operation of Orleans SiloInstanceManager using ZookeeperStore - Requires access to external Zookeeper storage
    /// </summary>
    public class ZookeeperMembershipTableTests : MembershipTableTestsBase
    {
        public ZookeeperMembershipTableTests(ConnectionStringFixture fixture) : base(fixture)
        {
            LogManager.AddTraceLevelOverride(typeof (ZookeeperMembershipTableTests).Name, Severity.Verbose3);
        }

        protected override IMembershipTable CreateMembershipTable(Logger logger)
        {
            return AssemblyLoader.LoadAndCreateInstance<IMembershipTable>(Constants.ORLEANS_ZOOKEEPER_UTILS_DLL, logger);
        }

        protected override IGatewayListProvider CreateGatewayListProvider(Logger logger)
        {
            return AssemblyLoader.LoadAndCreateInstance<IGatewayListProvider>(Constants.ORLEANS_ZOOKEEPER_UTILS_DLL, logger);
        }

        protected override string GetConnectionString()
        {
            return StorageTestConstants.GetZooKeeperConnectionString();
        }

        [Fact, TestCategory("Membership"), TestCategory("ZooKeeper")]
        public void MembershipTable_ZooKeeper_Init()
        {
        }

        [Fact, TestCategory("Membership"), TestCategory("ZooKeeper")]
        public async Task MembershipTable_ZooKeeper_GetGateways()
        {
            await MembershipTable_GetGateways();
        }

        [Fact, TestCategory("Membership"), TestCategory("ZooKeeper")]
        public async Task MembershipTable_ZooKeeper_ReadAll_EmptyTable()
        {
            await MembershipTable_ReadAll_EmptyTable();
        }

        [Fact, TestCategory("Membership"), TestCategory("ZooKeeper")]
        public async Task MembershipTable_ZooKeeper_InsertRow()
        {
            await MembershipTable_InsertRow();
        }

        [Fact, TestCategory("Membership"), TestCategory("ZooKeeper")]
        public async Task MembershipTable_ZooKeeper_ReadRow_Insert_Read()
        {
            await MembershipTable_ReadRow_Insert_Read();
        }

        [Fact, TestCategory("Membership"), TestCategory("ZooKeeper")]
        public async Task MembershipTable_ZooKeeper_ReadAll_Insert_ReadAll()
        {
            await MembershipTable_ReadAll_Insert_ReadAll();
        }

        [Fact, TestCategory("Membership"), TestCategory("ZooKeeper")]
        public async Task MembershipTable_ZooKeeper_UpdateRow()
        {
            await MembershipTable_UpdateRow();
        }

        [Fact, TestCategory("Membership"), TestCategory("ZooKeeper")]
        public async Task MembershipTable_ZooKeeper_UpdateRowInParallel()
        {
            await MembershipTable_UpdateRowInParallel();
        }
    }
}


text:
package rbs

import (
	"context"
	"errors"
	"fmt"
	"io"
	"strconv"
	"sync"
	"time"

	"github.com/garyburd/redigo/redis"
)

// ErrStarveEOF marks when we are returning a zero size buffer,
// in the cases where either we do not yet know the full size of the
// stream, or we do, and have not received that data yet.
var ErrStarveEOF = errors.New("data not yet available")

// // RedReader is the implementation that retrieves a variable-length stream
// // of bytes from a Redis hash, as written by its RedWriter counterpart
// type RedReader struct {
// 	quit bool
// 	conn redis.Conn
// 	name string
// 	next uint16
// 	last uint16
// 	ends bool
// 	peek uint8
// }

// NewReader creates an io.ReadCloser that assembles a byte stream as
// stored in complete chunks on a Redis hash.
//
// The name parameter is used as the key for the Redis hash.
//
// Configuration is by functional options, as inspired by this blog post:
// http://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis
//
// See: ReadLookahead
func NewReader(conn redis.Conn, name string, options ...func(*reader)) io.Reader {
	// r := &RedReader{conn: conn, name: name}
	r := &reader{doer: conn, name: name}
	for _, option := range options {
		option(r)
	}
	return r
}

// ReadLookahead sets the number of chunks to optimistically look for when
// hitting the network doing a single fetch from Redis
func ReadLookahead(peek uint8) func(*reader) {
	return func(r *reader) {
		r.peek = peek
	}
}

type reader struct {
	doer Doer
	name string
	next uint16
	last uint16
	ends bool
	peek uint8
}

// Read conforms to the io.Reader interface
//
// This read entire chunks from Redis, so if the buffer p is shorter than
// the first chunk, this returns an io.ErrShortBuffer error. If ReadLookahead
// has been set, this attempts to deliver those lookahead chunks as well, but
// will always stop short of overflowing p.
//
// (Receiving a io.ErrShortBuffer is not necessarily a fatal condition:
// the Read will try to "keep its place" in the stream and delivery
// what bytes it can per invocation.)
//
// This implementation has one very specific behavior: if the end-of-stream
// marker has not yet been written, but there are currently no bytes to
// deliver, the error ErrStarveEOF is returned.
//
// If the byte stream is already fully written, or would be by the Read's
// get to the end-of-stream marker, this acts just like any other io.Reader
func (r *reader) Read(p []byte) (int, error) {
	if r.ends && r.next > r.last {
		return 0, io.EOF
	}

	fields := []string{}

	// If we don't already know the max chunk, ask for it
	if !r.ends {
		fields = append(fields, chunkLast)
	}

	// Build all the chunk requests
	for ix := uint16(0); ix < uint16(r.peek+1); ix++ {
		num := r.next + ix
		fields = append(fields, fmt.Sprintf(chunkNumber, num))
	}

	// Send the requests to redis
	vals, err := redis.ByteSlices(r.doer.Do("HMGET", redis.Args{}.Add(r.name).AddFlat(fields)...))
	if err != nil {
		return 0, err
	}

	// We can pull the last chunk number early
	if !r.ends {
		temp := string(vals[0])

		// This might be nil, if it hadn't been written yet
		if len(temp) != 0 {
			last, err := strconv.Atoi(temp)
			if err != nil {
				return 0, err
			}
			r.last = uint16(last)
			r.ends = true
		}

		// For easier iterating later, we trim off this first entry
		vals = vals[1:]
	}

	// Loop through all the chunks, adding them to the output buffer
	max := len(p)
	offset := 0
	for ix, chunk := range vals {
		size := len(chunk)

		// If we haven't written anything yet for the given chunk, this
		// will be signaled by a zero-length/nil chunk. We can stop looking
		// if we've gotten that
		if size == 0 {
			break
		}

		// Don't overflow the provided buffer
		if offset+size > max {
			if ix > 0 {
				// If we're over size, stop adding stuff to the buffer,
				// even if we retrieved more from Redis
				break
			}

			// If we can't even fit the first chunk, then we error out
			return 0, io.ErrShortBuffer
		}

		// Move the byte contents over
		copy(p[offset:offset+size], chunk)
		offset += size

		// Manage our place within the overall sequence of chunks
		r.next++
		if r.ends && r.next > r.last {
			break
		}
	}

	if offset == 0 {
		// At the exhortation of the io.Reader interface, we should
		// NOT send `0, nil`... We should return some signature of WHY we
		// are returning with size zero.
		return 0, ErrStarveEOF
	}

	return offset, nil
}

// A SyncReader is the implementation that reads from an underlying io.Reader,
// and will block then retry upon stimulus if the underlying Reader returned
// ErrStarveEOF.
type SyncReader struct {
	r         io.Reader
	ctx       context.Context
	cxl       context.CancelFunc
	wg        sync.WaitGroup
	stim      <-chan struct{}
	skipDrain bool
	starveDur time.Duration
	closers   []io.Closer
	channels  []interface{}
	subs      redis.Conn
}

// NewSyncReader creates an io.ReadCloser that reads bytes from an underlying
// io.Reader. However, if the underlying io.Reader returned an ErrStarveEOF,
// this implementation will block until receiving a Redis PubSub stimulus,
// whereupon it will attempt to read from the underlying io.Reader again.
//
// The intendend usage for SyncReader is to be used with a RedReader (or any
// io.Reader that sends the same ErrStarveEOF), but
// it would function as a simple pass through for any other io.Reader.
//
// This accepts a Context object, so a client can set a timeout, or cancel
// reading mid-stream.
//
// The passed-in Redis connection *MUST* be different the one used in the
// underlying RedReader, as this pub/sub subscription cannot also
// handle concurrent transactional needs.
//
// The client is expected to provide (at least) one pub/sub channel upon which
// this implementation will listen for syncronization events.
//
// Configuration is by functional options, as inspired by this blog post:
// http://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis
//
// See: SyncSub, SyncStdSub, SyncStarve
func NewSyncReader(
	parent context.Context,
	r io.Reader,
	subs redis.Conn,
	options ...func(*SyncReader) error,
) (io.ReadCloser, error) {
	ctx, cxl := context.WithCancel(parent)
	stim := make(chan struct{})
	result := &SyncReader{
		r:       r,
		ctx:     ctx,
		cxl:     cxl,
		stim:    stim,
		closers: []io.Closer{subs},
		subs:    subs,
	}
	if c, ok := r.(io.Closer); ok {
		result.closers = append(result.closers, c)
	}

	for _, option := range options {
		err := option(result)
		if err != nil {
			result.Close()
			return nil, err
		}
	}

	if len(result.channels) < 1 {
		result.Close()
		return nil, fmt.Errorf("no channels specified")
	}

	psc := redis.PubSubConn{Conn: subs}
	err := psc.Subscribe(result.channels...)
	if err != nil {
		result.Close()
		return nil, err
	}

	result.wg.Add(1)
	go result.pubSubStimulus(stim, psc)

	return result, nil
}

// SyncSub allows a client to add an arbitrary Redis PubSub channel
// to listen to for stimulus
func SyncSub(pubSubChan interface{}) func(*SyncReader) error {
	return func(sr *SyncReader) error {
		sr.channels = append(sr.channels, pubSubChan)
		return nil
	}
}

// SyncStdSub sets up the "standard" channel subscription. This is the
// Read-side counterpart to WriteStdPub
func SyncStdSub() func(*SyncReader) error {
	return func(sr *SyncReader) error {
		r, ok := sr.r.(*reader)
		if !ok {
			return fmt.Errorf("Expected `*rbs.reader`: %T", sr.r)
		}
		sr.channels = append(sr.channels, fmt.Sprintf(syncChannelPattern, r.name))
		return nil
	}
}

// SyncStarve sets the maximum amount of time to wait between stimulus/Read
// attempts. If this timeout is tripped, the reader will
// return io.ErrUnexpectedEOF
func SyncStarve(dur time.Duration) func(*SyncReader) error {
	return func(sr *SyncReader) error {
		sr.starveDur = dur
		return nil
	}
}

// Close conforms to the io.Closer interface
//
// This will close the passed in Redis connection AND the passed in
// Reader if it also implements io.Closer
func (sr *SyncReader) Close() error {
	sr.cxl()
	c := sr.subs
	if c != nil {
		c.Send("UNSUBSCRIBE")
		c.Flush()
	}
	sr.wg.Wait()
	for _, closer := range sr.closers {
		closer.Close()
	}
	return nil
}

func (sr *SyncReader) starveAfter() <-chan time.Time {
	if sr.starveDur == 0 {
		return nil
	}
	return time.After(sr.starveDur)
}

// Read conforms to the io.Reader interface
//
// This will pass through any results from the underlying Read, unless
// we recieved an ErrStarveEOF, whereupon it will block and re-attempt
// a Read when it receives pub/sub stimulus.
func (sr *SyncReader) Read(p []byte) (n int, err error) {
	if sr.ctx.Err() != nil {
		// Error if we're already closed
		return 0, io.ErrClosedPipe
	}
	// Don't need to re-assign the starvation window for each iteration
	starver := sr.starveAfter()
	starving := false
	for n == 0 && (err == nil || err == ErrStarveEOF) {
		n, err = sr.r.Read(p)

		// We only want to proceed on in this function if the underlying
		// Reader has returned the right error
		if err != ErrStarveEOF {
			continue
		}

		// If we've just done our last post-starve check, and there's
		// still nothing to deliver, then we can FULLY call starved.
		if starving {
			return 0, io.ErrUnexpectedEOF
		}

		select {
		case <-starver:
			// Go thru one more time, just to make sure we didn't
			// miss some stimulus
			starving = true
			continue
		case <-sr.ctx.Done():
			return 0, io.ErrClosedPipe
		case _, ok := <-sr.stim:
			if !ok {
				return 0, io.ErrClosedPipe
			}

			if !sr.skipDrain {
				// It's possible for stimulus items to pile up, and
				// in order to reduce the number of ineffective network
				// hits, we want to drain the queue.
				empty := false
				for !empty {
					select {
					case _, ok := <-sr.stim:
						if !ok {
							return 0, io.ErrClosedPipe
						}
					default:
						// There's no further stimulus waiting
						empty = true
					}
				}
			}
			// A positive stimululs tells us to pass through the loop again
			continue
		}
	}
	return n, err
}

type receiver interface {
	Receive() interface{}
}

func (sr *SyncReader) pubSubStimulus(stim chan<- struct{}, rec receiver) {
	defer close(stim)
	defer sr.wg.Done()
	for sr.ctx.Err() == nil {
		switch n := rec.Receive().(type) {
		case redis.Message:
			select {
			case stim <- struct{}{}:
				// pass
			case <-sr.ctx.Done():
				return
			}
		case redis.Subscription:
			if n.Count == 0 {
				return
			}
		case error:
			return
		}
	}
}


text:
package org.monarchinitiative.phenotefx.gui.logviewer;

/**
 * log4j levels,which are
 * TRACE < DEBUG < INFO < WARN < ERROR < FATAL
 */
public enum Level {
    TRACE(1), DEBUG(2), INFO(3), WARN(4), ERROR(5),FATAL(6);

    int val;

    Level(int l){val=l;}

    public int getVal() { return val; }

    /**
     * Convert from String to enum constant. We should never reach the
     * default case, but if we do just return TRACE
     * @param s A string representing the log level
     * @return corresponding enum constant.
     */
    public static Level string2level(String s) {
        switch (s) {
            case "TRACE": return TRACE;
            case "DEBUG": return DEBUG;
            case "INFO": return INFO;
            case "WARN": return WARN;
            case "ERROR": return ERROR;
            case "FATAL": return FATAL;
            default: return TRACE;
        }
    }
}


text:
define([
    'jquery',
    'underscore',
    'backbone',
    'app',
    'models/testrun/TestRunModel',
    'collections/testruns/TestRunsCollection',
    'views/testruns/TestRunsListView',
    'text!templates/testruns/testRunsTemplate.html'
], function($, _, Backbone, app, TestRunModel, TestRunsCollection, TestRunsListView, testRunsTemplate) {

    var TestRuns = Backbone.View.extend({
        el: $("#page"),

        initialize: function(options) {
            _.bindAll(this, 'setPage', 'setTestPlanId', 'render');
            this.page = 1;
            this.testPlanId = 0;
            // Collections
            this.testRunsCollection = new TestRunsCollection({ test_plan_id: options.test_plan_id });
            // Views
            this.testRunsListView = new TestRunsListView();
            // For GC
            this.subviews = new Object();
            this.subviews.testRunsListView = this.testRunsListView;
        },

        setPage: function(page) {
            this.page = page;
        },

        setTestPlanId: function(testPlanId) {
            this.testPlanId = testPlanId;
        },

        render: function() {
            $('.item').removeClass('active');
            $('.item a[href="#/execution"]').parent().addClass('active');
            var self = this;

            var data = {
                test_plan_id: this.testPlanId,
                _: _
            };
            var compiledTemplate = _.template(testRunsTemplate, data);
            this.$el.html(compiledTemplate);
            this.testRunsCollection.fetch({
                data: {
                    page: self.page,
                    test_plan_id: self.testPlanId
                },
                success: function() {
                    self.testRunsListView.render(self.testRunsCollection);
                },
                error: function() {
                    throw new Error("Failed to fetch executions");
                }
            });
        }

    });

    return TestRuns;

});


text:
package com.klaster.webstore.configuration;

import com.klaster.webstore.converter.RoleToUserProfileConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.format.FormatterRegistry;
import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.support.XmlWebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration;

/**
 * Created by MSI DRAGON on 2017-10-02.
 */
@Configuration
//@ComponentScan(basePackageClasses = { AppInitializer.class })
@ComponentScan(basePackages = "com.klaster.webstore")
public class AppInitializer extends WebMvcConfigurerAdapter implements WebApplicationInitializer {

    @Autowired
    RoleToUserProfileConverter roleToUserProfileConverter;

    @Override
    public void onStartup(ServletContext container) throws ServletException {
        XmlWebApplicationContext appContext = new XmlWebApplicationContext();
        appContext.setConfigLocation("/WEB-INF/spring/webcontext/DispatcherServlet-context.xml");

        ServletRegistration.Dynamic dispatcher = container.addServlet("dispatcher", new DispatcherServlet(appContext));
        dispatcher.setLoadOnStartup(1);
        dispatcher.addMapping("/");
    }
    @Override
    public void addFormatters(FormatterRegistry registry) {
        registry.addConverter(roleToUserProfileConverter);
    }

}


text: python assembler.py $@


text:
This is first test GitHub Repo...
### Test comments.


text:
package org.keycloak.cli;

import static org.keycloak.cli.Picocli.createCommandLine;
import static org.keycloak.cli.Picocli.error;
import static org.keycloak.cli.Picocli.getCliArgs;
import static org.keycloak.cli.Picocli.parseConfigArgs;
import static org.keycloak.util.Environment.getProfileOrDefault;

import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;

import io.quarkus.runtime.Quarkus;
import org.keycloak.common.Version;

import io.quarkus.runtime.annotations.QuarkusMain;
import org.keycloak.util.Environment;
import picocli.CommandLine;

/**
 *
The main entry point, responsible for initialize and run the CLI as well as start the server.
 *
 *
For optimal startup of the server, the server should be configured first by running the {@link MainCommand#reAugment(Boolean)}
 * command so that subsequent server starts, without any args, do not need to build the CLI, which is costly.
 */
@QuarkusMain(name = "keycloak")
public class KeycloakMain {

    public static void main(String cliArgs[]) {
        System.setProperty("kc.version", Version.VERSION_KEYCLOAK);

        if (cliArgs.length == 0) {
            // no arguments, just start the server
            start(Collections.emptyList(), new PrintWriter(System.err));
            System.exit(CommandLine.ExitCode.OK);
        }

        // parse arguments and execute any of the configured commands
        parseAndRun(cliArgs);
    }

    static void start(CommandLine cmd) {
        start(getCliArgs(cmd), cmd.getErr());
    }

    private static void start(List<String> cliArgs, PrintWriter errorWriter) {
        Quarkus.run(null, (integer, throwable) -> {
            error(cliArgs, errorWriter, String.format("Failed to start server using profile (%s).", getProfileOrDefault("none")), throwable.getCause());
        });
        Quarkus.waitForExit();
    }

    private static void parseAndRun(String[] args) {
        List<String> cliArgs = new LinkedList<>(Arrays.asList(args));
        CommandLine cmd = createCommandLine();

        // set the arguments as a system property so that arguments can be mapped to their respective configuration options
        System.setProperty("kc.config.args", parseConfigArgs(cliArgs));

        try {
            CommandLine.ParseResult result = cmd.parseArgs(cliArgs.toArray(new String[cliArgs.size()]));

            // if no command was set, the start command becomes the default
            if (!result.hasSubcommand() && (!result.isUsageHelpRequested() && !result.isVersionHelpRequested())) {
                cliArgs.add(0, "start");
            }
        } catch (CommandLine.UnmatchedArgumentException e) {
            // if no command was set but options were provided, the start command becomes the default
            if (!cmd.getParseResult().hasSubcommand() && cliArgs.get(0).startsWith("--")) {
                cliArgs.add(0, "start");
            } else {
                cmd.getErr().println(e.getMessage());
                System.exit(cmd.getCommandSpec().exitCodeOnInvalidInput());
            }
        } catch (Exception e) {
            cmd.getErr().println(e.getMessage());
            System.exit(cmd.getCommandSpec().exitCodeOnExecutionException());
        }

        System.exit(cmd.execute(cliArgs.toArray(new String[cliArgs.size()])));
    }
}


text:
package com.mysql.jdbc;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;

public class StandardLoadBalanceExceptionChecker implements
		LoadBalanceExceptionChecker {

	private List<String> sqlStateList;
	private List<Class<?>> sqlExClassList;

	public boolean shouldExceptionTriggerFailover(SQLException ex) {
		String sqlState = ex.getSQLState();

		if (sqlState != null) {
			if (sqlState.startsWith("08")) {
				// connection error
				return true;
			}
			if(this.sqlStateList != null){
				// check against SQLState list
				for(Iterator<String> i = sqlStateList.iterator(); i.hasNext(); ){
					if(sqlState.startsWith(i.next().toString())){
						return true;
					}
				}
			}
		}

		// always handle CommunicationException
		if(ex instanceof CommunicationsException){
			return true;
		}
		if(this.sqlExClassList != null){
			// check against configured class lists
			for(Iterator<Class<?>> i = sqlExClassList.iterator(); i.hasNext(); ){
				if(i.next().isInstance(ex)){
					return true;
				}
			}
		}
		// no matches
		return false;

	}

	public void destroy() {
		// TODO Auto-generated method stub

	}

	public void init(Connection conn, Properties props) throws SQLException {
		configureSQLStateList(props.getProperty("loadBalanceSQLStateFailover", null));
		configureSQLExceptionSubclassList(props.getProperty("loadBalanceSQLExceptionSubclassFailover", null));

	}

	private void configureSQLStateList(String sqlStates){
		if(sqlStates == null || "".equals(sqlStates)){
			return;
		}
		List<String> states = StringUtils.split(sqlStates, ",", true);
		List<String> newStates = new ArrayList<String>();

		for (String state : states){
			if(state.length() > 0){
				newStates.add(state);
			}
		}
		if(newStates.size() > 0){
			this.sqlStateList = newStates;
		}

	}
	private void configureSQLExceptionSubclassList(String sqlExClasses){
		if(sqlExClasses == null || "".equals(sqlExClasses)){
			return;
		}
		List<String> classes = StringUtils.split(sqlExClasses, ",", true);
		List<Class<?>> newClasses = new ArrayList<Class<?>>();

		for (String exClass : classes) {
			try{
				Class<?> c = Class.forName(exClass);
				newClasses.add(c);
			} catch (Exception e){
				// ignore and don't check, class doesn't exist
			}
		}
		if(newClasses.size() > 0){
			this.sqlExClassList = newClasses;
		}

	}

}


text:
{% extends 'teacher/teacher_personal_detail/base.html' %}

{% load i18n %}
{% load url from future %}

{% block filename %}
  /home/mur/testing/emis_d15/scafold/teacher/templates/teacher/teacher_personal_detail/teacher_personal_detail_archive_year.html
{% endblock %}

{% block breadcrumbs %}

        {% trans "Archive Index" %}

        /

        {% trans "Year Archive" %}

{% endblock %}

{% block header-link %}

    {% trans "Teacher_personal_detail Year Archive" %}

{% endblock %}
{% block header-description %}
  {% trans "A yearly archive page showing all available months in a given year." %}
{% endblock %}
{% block content %}

    {% trans "By Month" %}

    {% for date in date_list %}

          {{ date|date:"M Y" }}

    {% endfor %}

    {% blocktrans %}
      Teacher_personal_details created in the year {{ year }}
    {% endblocktrans %}

  {% include 'teacher/teacher_personal_detail/object_table_list.html' %}
  {% include 'teacher/teacher_personal_detail/pagination.html' %}
{% endblock %}


text:
<!doctype html>

    <title>Visualisering, analys i flera variabler</title>

    <link href="http://fonts.googleapis.com/css?family=Pacifico&subset=latin,latin-ext" rel="stylesheet" type="text/css">
    <link rel="stylesheet" type="text/css" href="css/main.css"></link>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">

Detta är en prototyp/demo av Continuous. Vi vill hjälpa universitetsstudenter att få en bättre förståelse för matematik. Läs om vår vision och om den tekniska utvecklingen.
English version
x


text:
/**
 * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
 */
package net.sourceforge.pmd.renderers;

import java.io.IOException;
import java.io.Writer;
import java.util.Iterator;
import java.util.Properties;

import net.sourceforge.pmd.RuleViolation;

/**
 * Renderer to GNU Emacs parsable format.
 */
public class EmacsRenderer extends AbstractIncrementingRenderer {

    public static final String NAME = "emacs";

    protected static final String EOL = System.getProperty("line.separator", "\n");

    public EmacsRenderer(Properties properties) {
    	super(NAME, "GNU Emacs integration.", properties);
    }

    public String defaultFileExtension() { return "emacs"; }

    /**
     * {@inheritDoc}
     */
    @Override
    public void renderFileViolations(Iterator<RuleViolation> violations) throws IOException {
		Writer writer = getWriter();
		StringBuilder buf = new StringBuilder();
		while (violations.hasNext()) {
		    RuleViolation rv = violations.next();
		    buf.setLength(0);
		    buf.append(rv.getFilename());
		    buf.append(':').append(Integer.toString(rv.getBeginLine()));
		    buf.append(": ").append(rv.getDescription()).append(EOL);
		    writer.write(buf.toString());
		}
    }
}


text:
@interface FSLineChart ()

@property (nonatomic, strong) NSMutableArray* data;
@property (nonatomic, strong) NSMutableArray* layers;

@property (nonatomic) CGFloat min;
@property (nonatomic) CGFloat max;
@property (nonatomic) CGMutablePathRef initialPath;
@property (nonatomic) CGMutablePathRef newPath;

@end

@implementation FSLineChart

#pragma mark - Initialisation

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self commonInit];
    }
    return self;
}

- (id)initWithCoder:(NSCoder *)aDecoder
{
    self = [super initWithCoder:aDecoder];
    if (self) {
        [self commonInit];
    }
    return self;
}

- (void)awakeFromNib
{
    [super awakeFromNib];
    [self commonInit];
}

- (void)commonInit
{
    _layers = [NSMutableArray array];
    self.backgroundColor = [UIColor whiteColor];
    [self setDefaultParameters];
}

- (void)setDefaultParameters
{
    _color = [UIColor fsLightBlue];
    _fillColor = [_color colorWithAlphaComponent:0.25];
    _verticalGridStep = 3;
    _horizontalGridStep = 3;
    _margin = 5.0f;
    _axisWidth = self.frame.size.width - 2 * _margin;
    _axisHeight = self.frame.size.height - 2 * _margin;
    _axisColor = [UIColor colorWithWhite:0.7 alpha:1.0];
    _innerGridColor = [UIColor colorWithWhite:0.9 alpha:1.0];
    _drawInnerGrid = YES;
    _bezierSmoothing = YES;
    _bezierSmoothingTension = 0.2;
    _lineWidth = 1;
    _innerGridLineWidth = 0.5;
    _axisLineWidth = 1;
    _animationDuration = 0.5;
    _displayDataPoint = NO;
    _dataPointRadius = 1;
    _dataPointColor = _color;
    _dataPointBackgroundColor = _color;

    // Labels attributes
    _indexLabelBackgroundColor = [UIColor clearColor];
    _indexLabelTextColor = [UIColor grayColor];
    _indexLabelFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:10];

    _valueLabelBackgroundColor = [UIColor colorWithWhite:1 alpha:0.75];
    _valueLabelTextColor = [UIColor grayColor];
    _valueLabelFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:11];
    _valueLabelPosition = ValueLabelRight;
}

- (void)layoutSubviews
{
    _axisWidth = self.frame.size.width - 2 * _margin;
    _axisHeight = self.frame.size.height - 2 * _margin;

    // Removing the old label views as well as the chart layers.
    [self.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        [obj removeFromSuperview];
    }];

    [self.layers enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        CALayer* layer = (CALayer*)obj;
        [layer removeFromSuperlayer];
    }];

    [self layoutChart];
    [super layoutSubviews];
}

- (void)layoutChart
{
    if(_data == nil) {
        return;
    }

    [self computeBounds];

    // No data
    if(isnan(_max)) {
        _max = 1;
    }

    [self strokeChart];

    if(_displayDataPoint) {
        [self strokeDataPoints];
    }

    if(_labelForValue) {
        for(int i=0;i<_verticalGridStep;i++) {
            UILabel* label = [self createLabelForValue:i];

            if(label) {
                [self addSubview:label];
            }
        }
    }

    if(_labelForIndex) {
        for(int i=0;i<_horizontalGridStep + 1;i++) {
            UILabel* label = [self createLabelForIndex:i];

            if(label) {
                [self addSubview:label];
            }
        }
    }

    [self setNeedsDisplay];
}

- (void)setChartData:(NSArray *)chartData
{
    if (chartData == nil || chartData.count == 0) {
        return;
    }

    _data = [NSMutableArray arrayWithArray:chartData];
    [self layoutChart];
}

#pragma mark - Labels creation

- (UILabel*)createLabelForValue: (NSUInteger)index
{
    CGFloat minBound = [self minVerticalBound];
    CGFloat maxBound = [self maxVerticalBound];

    CGPoint p = CGPointMake(_margin + (_valueLabelPosition == ValueLabelRight ? _axisWidth : 0), _axisHeight + _margin - (index + 1) * _axisHeight / _verticalGridStep);

    NSString* text = _labelForValue(minBound + (maxBound - minBound) / _verticalGridStep * (index + 1));

    if(!text)
    {
        return nil;
    }

    CGRect rect = CGRectMake(_margin, p.y + 2, self.frame.size.width - _margin * 2 - 4.0f, 14);

    float width = [text boundingRectWithSize:rect.size
                                     options:NSStringDrawingUsesLineFragmentOrigin
                                  attributes:@{ NSFontAttributeName:_valueLabelFont }
                                     context:nil].size.width;

    CGFloat xPadding = 6;
    CGFloat xOffset = width + xPadding;

    if (_valueLabelPosition == ValueLabelLeftMirrored) {
        xOffset = -xPadding;
    }

    UILabel* label = [[UILabel alloc] initWithFrame:CGRectMake(p.x - xOffset, p.y + 2, width + 2, 14)];
    label.text = text;
    label.font = _valueLabelFont;
    label.textColor = _valueLabelTextColor;
    label.textAlignment = NSTextAlignmentCenter;
    label.backgroundColor = _valueLabelBackgroundColor;

    return label;
}

- (UILabel*)createLabelForIndex: (NSUInteger)index
{
    CGFloat scale = [self horizontalScale];
    NSInteger q = (int)_data.count / _horizontalGridStep;
    NSInteger itemIndex = q * index;

    if(itemIndex >= _data.count)
    {
        itemIndex = _data.count - 1;
    }

    NSString* text = _labelForIndex(itemIndex);

    if(!text)
    {
        return nil;
    }

    CGPoint p = CGPointMake(_margin + index * (_axisWidth / _horizontalGridStep) * scale, _axisHeight + _margin);

    CGRect rect = CGRectMake(_margin, p.y + 2, self.frame.size.width - _margin * 2 - 4.0f, 14);

    float width = [text boundingRectWithSize:rect.size
                                     options:NSStringDrawingUsesLineFragmentOrigin
                                  attributes:@{ NSFontAttributeName:_indexLabelFont }
                                     context:nil].size.width;

    UILabel* label = [[UILabel alloc] initWithFrame:CGRectMake(p.x - 4.0f, p.y + 2, width + 2, 14)];
    label.text = text;
    label.font = _indexLabelFont;
    label.textColor = _indexLabelTextColor;
    label.backgroundColor = _indexLabelBackgroundColor;

    return label;
}

#pragma mark - Drawing

- (void)drawRect:(CGRect)rect
{
    if (_data.count > 0) {
        [self drawGrid];
    }
}

- (void)drawGrid
{
    CGContextRef ctx = UIGraphicsGetCurrentContext();
    UIGraphicsPushContext(ctx);
    CGContextSetLineWidth(ctx, _axisLineWidth);
    CGContextSetStrokeColorWithColor(ctx, [_axisColor CGColor]);

    // draw coordinate axis
    CGContextMoveToPoint(ctx, _margin, _margin);
    CGContextAddLineToPoint(ctx, _margin, _axisHeight + _margin + 3);
    CGContextStrokePath(ctx);

    CGFloat scale = [self horizontalScale];
    CGFloat minBound = [self minVerticalBound];
    CGFloat maxBound = [self maxVerticalBound];

    // draw grid
    if(_drawInnerGrid) {
        for(int i=0;i<_horizontalGridStep;i++) {
            CGContextSetStrokeColorWithColor(ctx, [_innerGridColor CGColor]);
            CGContextSetLineWidth(ctx, _innerGridLineWidth);

            CGPoint point = CGPointMake((1 + i) * _axisWidth / _horizontalGridStep * scale + _margin, _margin);

            CGContextMoveToPoint(ctx, point.x, point.y);
            CGContextAddLineToPoint(ctx, point.x, _axisHeight + _margin);
            CGContextStrokePath(ctx);

            CGContextSetStrokeColorWithColor(ctx, [_axisColor CGColor]);
            CGContextSetLineWidth(ctx, _axisLineWidth);
            CGContextMoveToPoint(ctx, point.x - 0.5f, _axisHeight + _margin);
            CGContextAddLineToPoint(ctx, point.x - 0.5f, _axisHeight + _margin + 3);
            CGContextStrokePath(ctx);
        }

        for(int i=0;i<_verticalGridStep + 1;i++) {
            // If the value is zero then we display the horizontal axis
            CGFloat v = maxBound - (maxBound - minBound) / _verticalGridStep * i;

            if(v == 0) {
                CGContextSetLineWidth(ctx, _axisLineWidth);
                CGContextSetStrokeColorWithColor(ctx, [_axisColor CGColor]);
            } else {
                CGContextSetStrokeColorWithColor(ctx, [_innerGridColor CGColor]);
                CGContextSetLineWidth(ctx, _innerGridLineWidth);
            }

            CGPoint point = CGPointMake(_margin, (i) * _axisHeight / _verticalGridStep + _margin);

            CGContextMoveToPoint(ctx, point.x, point.y);
            CGContextAddLineToPoint(ctx, _axisWidth + _margin, point.y);
            CGContextStrokePath(ctx);
        }
    }

    UIGraphicsPopContext();
}

- (void)clearChartData
{
    for (CAShapeLayer *layer in self.layers) {
        [layer removeFromSuperlayer];
    }
    [self.layers removeAllObjects];
}

- (void)strokeChart
{
    CGFloat minBound = [self minVerticalBound];
    CGFloat scale = [self verticalScale];

    UIBezierPath *noPath = [self getLinePath:0 withSmoothing:_bezierSmoothing close:NO];
    UIBezierPath *path = [self getLinePath:scale withSmoothing:_bezierSmoothing close:NO];

    UIBezierPath *noFill = [self getLinePath:0 withSmoothing:_bezierSmoothing close:YES];
    UIBezierPath *fill = [self getLinePath:scale withSmoothing:_bezierSmoothing close:YES];

    if(_fillColor) {
        CAShapeLayer* fillLayer = [CAShapeLayer layer];
        fillLayer.frame = CGRectMake(self.bounds.origin.x, self.bounds.origin.y + minBound * scale, self.bounds.size.width, self.bounds.size.height);
        fillLayer.bounds = self.bounds;
        fillLayer.path = fill.CGPath;
        fillLayer.strokeColor = nil;
        fillLayer.fillColor = _fillColor.CGColor;
        fillLayer.lineWidth = 0;
        fillLayer.lineJoin = kCALineJoinRound;

        [self.layer addSublayer:fillLayer];
        [self.layers addObject:fillLayer];

        CABasicAnimation *fillAnimation = [CABasicAnimation animationWithKeyPath:@"path"];
        fillAnimation.duration = _animationDuration;
        fillAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
        fillAnimation.fillMode = kCAFillModeForwards;
        fillAnimation.fromValue = (id)noFill.CGPath;
        fillAnimation.toValue = (id)fill.CGPath;
        [fillLayer addAnimation:fillAnimation forKey:@"path"];
    }

    CAShapeLayer *pathLayer = [CAShapeLayer layer];
    pathLayer.frame = CGRectMake(self.bounds.origin.x, self.bounds.origin.y + minBound * scale, self.bounds.size.width, self.bounds.size.height);
    pathLayer.bounds = self.bounds;
    pathLayer.path = path.CGPath;
    pathLayer.strokeColor = [_color CGColor];
    pathLayer.fillColor = nil;
    pathLayer.lineWidth = _lineWidth;
    pathLayer.lineJoin = kCALineJoinRound;

    [self.layer addSublayer:pathLayer];
    [self.layers addObject:pathLayer];

    if(_fillColor) {
        CABasicAnimation *pathAnimation = [CABasicAnimation animationWithKeyPath:@"path"];
        pathAnimation.duration = _animationDuration;
        pathAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
        pathAnimation.fromValue = (__bridge id)(noPath.CGPath);
        pathAnimation.toValue = (__bridge id)(path.CGPath);
        [pathLayer addAnimation:pathAnimation forKey:@"path"];
    } else {
        CABasicAnimation *pathAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];
        pathAnimation.duration = _animationDuration;
        pathAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
        pathAnimation.fromValue = [NSNumber numberWithFloat:0.0f];
        pathAnimation.toValue = [NSNumber numberWithFloat:1.0f];
        [pathLayer addAnimation:pathAnimation forKey:@"path"];
    }

}

- (void)strokeDataPoints
{
    CGFloat minBound = [self minVerticalBound];
    CGFloat scale = [self verticalScale];

    for(int i=0;i<_data.count;i++) {
        CGPoint p = [self getPointForIndex:i withScale:scale];
        p.y +=  minBound * scale;

        UIBezierPath* circle = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(p.x - _dataPointRadius, p.y - _dataPointRadius, _dataPointRadius * 2, _dataPointRadius * 2)];

        CAShapeLayer *fillLayer = [CAShapeLayer layer];
        fillLayer.frame = CGRectMake(p.x, p.y, _dataPointRadius, _dataPointRadius);
        fillLayer.bounds = CGRectMake(p.x, p.y, _dataPointRadius, _dataPointRadius);
        fillLayer.path = circle.CGPath;
        fillLayer.strokeColor = _dataPointColor.CGColor;
        fillLayer.fillColor = _dataPointBackgroundColor.CGColor;
        fillLayer.lineWidth = 1;
        fillLayer.lineJoin = kCALineJoinRound;

        [self.layer addSublayer:fillLayer];
        [self.layers addObject:fillLayer];
    }
}

#pragma mark - Chart scale & boundaries

- (CGFloat)horizontalScale
{
    CGFloat scale = 1.0f;
    NSInteger q = (int)_data.count / _horizontalGridStep;

    if(_data.count > 1) {
        scale = (CGFloat)(q * _horizontalGridStep) / (CGFloat)(_data.count - 1);
    }

    return scale;
}

- (CGFloat)verticalScale
{
    CGFloat minBound = [self minVerticalBound];
    CGFloat maxBound = [self maxVerticalBound];
    CGFloat spread = maxBound - minBound;
    CGFloat scale = 0;

    if (spread != 0) {
        scale = _axisHeight / spread;
    }

    return scale;
}

- (CGFloat)minVerticalBound
{
    return MIN(_min, 0);
}

- (CGFloat)maxVerticalBound
{
    return MAX(_max, 0);
}

- (void)computeBounds
{
    _min = MAXFLOAT;
    _max = -MAXFLOAT;

    for(int i=0;i<_data.count;i++) {
        NSNumber* number = _data[i];
        if([number floatValue] < _min)
            _min = [number floatValue];

        if([number floatValue] > _max)
            _max = [number floatValue];
    }

    // The idea is to adjust the minimun and the maximum value to display the whole chart in the view, and if possible with nice "round" steps.
    _max = [self getUpperRoundNumber:_max forGridStep:_verticalGridStep];

    if(_min < 0) {
        // If the minimum is negative then we want to have one of the step to be zero so that the chart is displayed nicely and more comprehensively
        float step;

        if(_verticalGridStep > 3) {
            step = fabs(_max - _min) / (float)(_verticalGridStep - 1);
        } else {
            step = MAX(fabs(_max - _min) / 2, MAX(fabs(_min), fabs(_max)));
        }

        step = [self getUpperRoundNumber:step forGridStep:_verticalGridStep];

        float newMin,newMax;

        if(fabs(_min) > fabs(_max)) {
            int m = ceilf(fabs(_min) / step);

            newMin = step * m * (_min > 0 ? 1 : -1);
            newMax = step * (_verticalGridStep - m) * (_max > 0 ? 1 : -1);

        } else {
            int m = ceilf(fabs(_max) / step);

            newMax = step * m * (_max > 0 ? 1 : -1);
            newMin = step * (_verticalGridStep - m) * (_min > 0 ? 1 : -1);
        }

        if(_min < newMin) {
            newMin -= step;
            newMax -=  step;
        }

        if(_max > newMax + step) {
            newMin += step;
            newMax +=  step;
        }

        _min = newMin;
        _max = newMax;

        if(_max < _min) {
            float tmp = _max;
            _max = _min;
            _min = tmp;
        }

    }
}

#pragma mark - Chart utils

- (CGFloat)getUpperRoundNumber:(CGFloat)value forGridStep:(int)gridStep
{
    if(value <= 0)
        return 0;

    // We consider a round number the following by 0.5 step instead of true round number (with step of 1)
    CGFloat logValue = log10f(value);
    CGFloat scale = powf(10, floorf(logValue));
    CGFloat n = ceilf(value / scale * 4);

    int tmp = (int)(n) % gridStep;

    if(tmp != 0) {
        n += gridStep - tmp;
    }

    return n * scale / 4.0f;
}

- (void)setGridStep:(int)gridStep
{
    _verticalGridStep = gridStep;
    _horizontalGridStep = gridStep;
}

- (CGPoint)getPointForIndex:(NSUInteger)idx withScale:(CGFloat)scale
{
    if(idx >= _data.count) {
        return CGPointZero;
    }

    // Compute the point position in the view from the data with a set scale value
    NSNumber* number = _data[idx];

    if(_data.count < 2) {
        return CGPointMake(_margin, _axisHeight + _margin - [number floatValue] * scale);
    } else {
        return CGPointMake(_margin + idx * (_axisWidth / (_data.count - 1)), _axisHeight + _margin - [number floatValue] * scale);
    }
}

- (UIBezierPath*)getLinePath:(float)scale withSmoothing:(BOOL)smoothed close:(BOOL)closed
{
    UIBezierPath* path = [UIBezierPath bezierPath];

    if(smoothed) {
        for(int i=0;i<_data.count - 1;i++) {
            CGPoint controlPoint[2];
            CGPoint p = [self getPointForIndex:i withScale:scale];

            // Start the path drawing
            if(i == 0)
                [path moveToPoint:p];

            CGPoint nextPoint, previousPoint, m;

            // First control point
            nextPoint = [self getPointForIndex:i + 1 withScale:scale];
            previousPoint = [self getPointForIndex:i - 1 withScale:scale];
            m = CGPointZero;

            if(i > 0) {
                m.x = (nextPoint.x - previousPoint.x) / 2;
                m.y = (nextPoint.y - previousPoint.y) / 2;
            } else {
                m.x = (nextPoint.x - p.x) / 2;
                m.y = (nextPoint.y - p.y) / 2;
            }

            controlPoint[0].x = p.x + m.x * _bezierSmoothingTension;
            controlPoint[0].y = p.y + m.y * _bezierSmoothingTension;

            // Second control point
            nextPoint = [self getPointForIndex:i + 2 withScale:scale];
            previousPoint = [self getPointForIndex:i withScale:scale];
            p = [self getPointForIndex:i + 1 withScale:scale];
            m = CGPointZero;

            if(i < _data.count - 2) {
                m.x = (nextPoint.x - previousPoint.x) / 2;
                m.y = (nextPoint.y - previousPoint.y) / 2;
            } else {
                m.x = (p.x - previousPoint.x) / 2;
                m.y = (p.y - previousPoint.y) / 2;
            }

            controlPoint[1].x = p.x - m.x * _bezierSmoothingTension;
            controlPoint[1].y = p.y - m.y * _bezierSmoothingTension;

            [path addCurveToPoint:p controlPoint1:controlPoint[0] controlPoint2:controlPoint[1]];
        }

    } else {
        for(int i=0;i<_data.count;i++) {
            if(i > 0) {
                [path addLineToPoint:[self getPointForIndex:i withScale:scale]];
            } else {
                [path moveToPoint:[self getPointForIndex:i withScale:scale]];
            }
        }
    }

    if(closed) {
        // Closing the path for the fill drawing
        [path addLineToPoint:[self getPointForIndex:_data.count - 1 withScale:scale]];
        [path addLineToPoint:[self getPointForIndex:_data.count - 1 withScale:0]];
        [path addLineToPoint:[self getPointForIndex:0 withScale:0]];
        [path addLineToPoint:[self getPointForIndex:0 withScale:scale]];
    }

    return path;
}

@end


text:
Spaz.ImageUploader = function() {

	var thisA = this;

	this.SFU = new SpazFileUploader();

	this.service_url = null;
	this.service = null;

	this.init = function() {

		var container = $('#imageUploadWindow');

		$('#imageupload-loading').hide();

		var target = $('.content', container).get(0);
		target.addEventListener("dragenter", thisA.dragEnterOverHandler);
		target.addEventListener("dragover", thisA.dragEnterOverHandler);
		target.addEventListener("drop", thisA.dropHandler);

		// get the pref
		thisA.service = Spaz.Prefs.get('file-uploader');
		thisA.service_url = thisA.SFU.apis[thisA.service].upload_url;
		sch.dump("service is "+ thisA.service);
		sch.dump("service url "+ thisA.service_url);

		var sharepass = Spaz.Prefs.get('services-twitpic-sharepassword');
		sch.dump("sharepass is "+ sharepass);

		/*
			populate the dropdown
		*/
		var labels = this.SFU.getAPILabels();

		for (var i=0; i < labels.length; i++) {
			var this_service = labels[i];
			if (this_service == thisA.service) {
				$('#imageupload-file-uploader').append('<option value="'+this_service+'" selected="selected">'+this_service+'</option>');
				$('#imageupload-extra-'+thisA.service).show();
			} else {
				$('#imageupload-file-uploader').append('<option value="'+this_service+'">'+this_service+'</option>');
				$('#imageupload-extra-'+thisA.service).hide();
			}
		};

		/*
			bind click on droplet
		*/
		$('#imageupload-droplet').click(function() {
			thisA.browseForImage();
		});

		/*
			bind service dropdown
		*/
		$('#file-uploader').bind('change', function() {
			thisA.service = $('#imageupload-file-uploader').val()
			Spaz.Prefs.set('file-uploader', thisA.service);

			thisA.service_url = thisA.SFU.apis[thisA.service].upload_url;
			sch.dump("service is "+ thisA.service);
			sch.dump("service url "+ thisA.service_url);

			$('.service-extras', thisA.container).fadeOut();
			$('#imageupload-extra-'+thisA.service).fadeIn();

		});

		// bind click to shorten action
		$('#imageupload-button').bind('click', function() {
			var fileUrl = $('#imageupload-file-url').val();
			if (fileUrl) {
				thisA.uploadDraggedImage(fileUrl);
			} else {
				thisA.browseForImage();
			}

			// var service = Spaz.Prefs.get('file-uploader');
			// sch.dump("service is "+ service);
			// Spaz.Upload[service]($('#shorten-original-link').val());
		});

		$('#imageupload-post-message').keyup(function(e) {
			if ($('#imageupload-post-message').val().length>110) {
				$('#imageupload-post-message').val( $('#imageupload-post-message').val().substr(0,110) );
			}
			sch.dump($('#imageupload-post-message').val().length);
		})

		// sch.dump(air.NativeApplication.nativeApplication.spazPrefs);
	};

	this.browseForImage = function() {
		var imageFilter = new air.FileFilter("Images", "*.jpg;*.jpeg;*.gif;*.png");
		var userFile = new air.File();
		userFile.browseForOpen("Choose an image file", [imageFilter]);

		userFile.addEventListener(air.Event.SELECT, function(event) {

			sch.dump('Chosen file: '+event.target.url);

			if (!Spaz.Prefs.get('services-twitpic-sharepassword') ) {
				if ( !confirm('Uploading requires that you share your Twitter username and password with the service. Are you sure you want to do this?') ) {
					return false;
				}
			}

			if (event.target.url.match(/^(.+)\.(jpg|jpeg|gif|png)$/i)<1) {
				alert("File must be one of the following:\n .jpg, .jpeg, .gif, .png");
				return;
			}
			thisA.handleDrop(event.target.url);
		})
	};

	/*
		Really a proxy for the Spaz.postPanel.prepPhotoPost method created in app initialization
	*/
	this.prepPhotoPost = function(url) {
	    if (url) {
	        var msg = $('#imageupload-post-message').val() + ' ' + url;

			Spaz.postPanel.prepPhotoPost(msg);

	        return true;
	    } else {
	        return false;
	    }
	};

	this.handleDrop = function(fileUrl) {
		$('#imageupload-droplet').html('<img src="'+fileUrl+'" />');
		$('#imageupload-droplet>img').css('width', $('#imageupload-droplet').width());
		$('#imageupload-droplet>img').css('height', $('#imageupload-droplet').height());
		$('#imageupload-file-url').val(fileUrl);
	};

	this.dragEnterOverHandler = function(event){
	    event.preventDefault();
	};

	this.dropHandler = function(event){

		event.preventDefault();

		if (!Spaz.Prefs.get('services-twitpic-sharepassword') ) {
			if ( !confirm('Uploading requires that you share your Twitter username and password with the service. Are you sure you want to do this?') ) {
				return false;
			}
		}

		var fileUrl = event.dataTransfer.getData("text/uri-list");

		sch.dump(fileUrl);

		if (fileUrl.match(/^(.+)\.(jpg|jpeg|gif|png)$/i)<1) {
			alert("File must be one of the following:\n .jpg, .jpeg, .gif, .png");
			return;
		}
		thisA.handleDrop(fileUrl);
		return;
	};

	/*
		Upload the dragged image to the service
	*/
	this.uploadDraggedImage = function(fileUrl) {
		sch.dump(fileUrl);

		Spaz.UI.showLoading();

		// upload the file
		Spaz.Data.uploadFile({
			'extra'  :{
				"username": Spaz.Prefs.getUser(),
				"password": Spaz.Prefs.getPass(),
				"source"  : Spaz.Prefs.get('twitter-source'),
				"message" : $('#imageupload-post-message').val()
			},
			'url'    :thisA.service_url,
			'fileUrl':fileUrl,
			'open'   : Spaz.UI.showLoading,
			'complete': function(event) {
				Spaz.UI.hideLoading();

				var loader = event.target;
			    sch.dump(loader.data);

				var parser=new DOMParser();
				xmldoc = parser.parseFromString(loader.data,"text/xml");

				//var mediaurl = $(xmldoc).find('mediaurl').text();
				//sch.dump(mediaurl);
				//prepPhotoPost(mediaurl);
				//$('#status-text').html('Complete');
				var rspAttr = xmldoc.getElementsByTagName("rsp")[0].attributes;
				if (rspAttr.getNamedItem("stat").nodeValue == 'ok')
				{
					var mediaurl = $(xmldoc).find('mediaurl').text();
					sch.dump(mediaurl);
					thisA.prepPhotoPost(mediaurl);
					$('#imageupload-status-text').html('Complete');
					closePopbox();
				}
				else
				{
					var errAttributes = xmldoc.getElementsByTagName("err")[0].attributes;
					sch.dump(errAttributes);
					errMsg = errAttributes.getNamedItem("msg").nodeValue;
					sch.dump(errMsg);
					$('#imageupload-status-text').html(errMsg);
				}
			}
		});
	};
}


text:
package com.amazonaws.services.mediaconvert.model.transform;

import javax.annotation.Generated;

import com.amazonaws.SdkClientException;
import com.amazonaws.services.mediaconvert.model.*;

import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;

/**
 * ColorCorrectorMarshaller
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class ColorCorrectorMarshaller {

    private static final MarshallingInfo<Integer> BRIGHTNESS_BINDING = MarshallingInfo.builder(MarshallingType.INTEGER)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("brightness").build();
    private static final MarshallingInfo<String> COLORSPACECONVERSION_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("colorSpaceConversion").build();
    private static final MarshallingInfo<Integer> CONTRAST_BINDING = MarshallingInfo.builder(MarshallingType.INTEGER)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("contrast").build();
    private static final MarshallingInfo<StructuredPojo> HDR10METADATA_BINDING = MarshallingInfo.builder(MarshallingType.STRUCTURED)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("hdr10Metadata").build();
    private static final MarshallingInfo<Integer> HUE_BINDING = MarshallingInfo.builder(MarshallingType.INTEGER).marshallLocation(MarshallLocation.PAYLOAD)
            .marshallLocationName("hue").build();
    private static final MarshallingInfo<Integer> SATURATION_BINDING = MarshallingInfo.builder(MarshallingType.INTEGER)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("saturation").build();

    private static final ColorCorrectorMarshaller instance = new ColorCorrectorMarshaller();

    public static ColorCorrectorMarshaller getInstance() {
        return instance;
    }

    /**
     * Marshall the given parameter object.
     */
    public void marshall(ColorCorrector colorCorrector, ProtocolMarshaller protocolMarshaller) {

        if (colorCorrector == null) {
            throw new SdkClientException("Invalid argument passed to marshall(...)");
        }

        try {
            protocolMarshaller.marshall(colorCorrector.getBrightness(), BRIGHTNESS_BINDING);
            protocolMarshaller.marshall(colorCorrector.getColorSpaceConversion(), COLORSPACECONVERSION_BINDING);
            protocolMarshaller.marshall(colorCorrector.getContrast(), CONTRAST_BINDING);
            protocolMarshaller.marshall(colorCorrector.getHdr10Metadata(), HDR10METADATA_BINDING);
            protocolMarshaller.marshall(colorCorrector.getHue(), HUE_BINDING);
            protocolMarshaller.marshall(colorCorrector.getSaturation(), SATURATION_BINDING);
        } catch (Exception e) {
            throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
        }
    }

}


text:
module Gitlab
  # An untrusted regular expression is any regexp containing patterns sourced
  # from user input.
  #
  # Ruby's built-in regular expression library allows patterns which complete in
  # exponential time, permitting denial-of-service attacks.
  #
  # Not all regular expression features are available in untrusted regexes, and
  # there is a strict limit on total execution time. See the RE2 documentation
  # at https://github.com/google/re2/wiki/Syntax for more details.
  class UntrustedRegexp
    require_dependency 're2'

    delegate :===, :source, to: :regexp

    def initialize(pattern, multiline: false)
      if multiline
        pattern = "(?m)#{pattern}"
      end

      @regexp = RE2::Regexp.new(pattern, log_errors: false)

      raise RegexpError.new(regexp.error) unless regexp.ok?
    end

    def replace_all(text, rewrite)
      RE2.GlobalReplace(text, regexp, rewrite)
    end

    def scan(text)
      matches = scan_regexp.scan(text).to_a
      matches.map!(&:first) if regexp.number_of_capturing_groups.zero?
      matches
    end

    def match?(text)
      text.present? && scan(text).present?
    end

    def replace(text, rewrite)
      RE2.Replace(text, regexp, rewrite)
    end

    def ==(other)
      self.source == other.source
    end

    private

    attr_reader :regexp

    # RE2 scan operates differently to Ruby scan when there are no capture
    # groups, so work around it
    def scan_regexp
      @scan_regexp ||=
        if regexp.number_of_capturing_groups.zero?
          RE2::Regexp.new('(' + regexp.source + ')')
        else
          regexp
        end
    end
  end
end


text:
enum {
	G_GEO_SUCCESS = 200,
	G_GEO_BAD_REQUEST = 400,
	G_GEO_SERVER_ERROR = 500,
	G_GEO_MISSING_QUERY = 601,
	G_GEO_UNKNOWN_ADDRESS = 602,
	G_GEO_UNAVAILABLE_ADDRESS = 603,
	G_GEO_UNKNOWN_DIRECTIONS = 604,
	G_GEO_BAD_KEY = 610,
	G_GEO_TOO_MANY_QUERIES = 620,
    G_GEO_NETWORK_ERROR = 900
};

#if NS_BLOCKS_AVAILABLE
typedef void (^BSForwardGeocoderSuccess) (NSArray* results);
typedef void (^BSForwardGeocoderFailed) (int status, NSString* errorMessage);
#endif

@class BSForwardGeocoder;

@protocol BSForwardGeocoderDelegate<NSObject>
@required
- (void)forwardGeocodingDidSucceed:(BSForwardGeocoder*)geocoder withResults:(NSArray *)results;
@optional
- (void)forwardGeocoderConnectionDidFail:(BSForwardGeocoder*)geocoder withErrorMessage:(NSString *)errorMessage;
- (void)forwardGeocodingDidFail:(BSForwardGeocoder*)geocoder withErrorCode:(int)errorCode andErrorMessage:(NSString *)errorMessage;
@end

@interface BSForwardGeocoder : NSObject <NSURLConnectionDataDelegate>
- (id)initWithDelegate:(id<BSForwardGeocoderDelegate>)aDelegate;
- (void)forwardGeocodeWithQuery:(NSString *)location regionBiasing:(NSString *)regionBiasing;

#if NS_BLOCKS_AVAILABLE
- (void)forwardGeocodeWithQuery:(NSString *)location regionBiasing:(NSString *)regionBiasing success:(BSForwardGeocoderSuccess)success failure:(BSForwardGeocoderFailed)failure;
#endif

@property (nonatomic, assign) id<BSForwardGeocoderDelegate> delegate;
@property (nonatomic, assign) BOOL useHTTP;

@end


text:
//     Copyright (c) Microsoft Corporation.  All rights reserved.

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Dash.Common.Utils;

namespace Microsoft.Dash.Server.Utils
{
    public class RequestUriParts
    {
        public const string ControllerAccount   = "account";
        public const string ControllerContainer = "container";
        public const string ControllerBlob      = "blob";

        public static RequestUriParts Create(string controller, IEnumerable<string> uriSegments, IEnumerable<string> originalSegments)
        {
            // URI format is:
            //  [/container[/blobseg1/blobseg2/.../blobsegn]]
            return new RequestUriParts
            {
                Controller = controller,
                Container = uriSegments.FirstOrDefault(),
                BlobName = PathUtils.CombinePathSegments(uriSegments.Skip(1)),
                OriginalContainer = originalSegments.FirstOrDefault(),
                OriginalBlobName = PathUtils.CombinePathSegments(originalSegments.Skip(1)),
            };
        }

        private RequestUriParts()
        {

        }

        public string Controller { get; private set; }
        public string Container { get; private set; }
        public string BlobName { get; private set; }
        public string OriginalContainer { get; private set; }
        public string OriginalBlobName { get; private set; }

        public bool IsAccountRequest
        {
            get
            {
                return String.Equals(this.Controller, ControllerAccount, StringComparison.OrdinalIgnoreCase) &&
                    String.IsNullOrWhiteSpace(this.Container);
            }
        }

        public bool IsContainerRequest
        {
            get
            {
                return String.Equals(this.Controller, ControllerContainer, StringComparison.OrdinalIgnoreCase) &&
                    !String.IsNullOrWhiteSpace(this.Container) &&
                    String.IsNullOrWhiteSpace(this.BlobName);
            }
        }

        public bool IsBlobRequest
        {
            get
            {
                return String.Equals(this.Controller, ControllerBlob, StringComparison.OrdinalIgnoreCase) &&
                    !String.IsNullOrWhiteSpace(this.BlobName);
            }
        }

        public string PublicUriPath
        {
            get { return GetPath(this.Container, this.BlobName); }
        }

        public string OriginalUriPath
        {
            get { return GetPath(this.OriginalContainer, this.OriginalBlobName); }
        }

        private static string GetPath(string container, string blobName)
        {
            return PathUtils.CombineContainerAndBlob(container, blobName, true);
        }
    }
}