text:
package org.protobee.gnutella.messages.decoding;

import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;

import org.jboss.netty.buffer.ChannelBuffer;
import org.protobee.gnutella.extension.HUGEExtension;
import org.protobee.gnutella.util.URN;

import com.google.inject.Inject;

public class HUGEDecoder implements PartDecoder<HUGEExtension> {

  @Inject
  public HUGEDecoder() { }

  /*
   * @Precondition: should only be called buffer reader is located
   * at the beginning of a non-empty Huge Extension
   */
  @Override
  public HUGEExtension decode(ChannelBuffer buffer) throws DecodingException {
    List<URN> urns = new ArrayList<URN>();

    if (buffer.readableBytes() >= 4){

      String testForUrn = buffer.toString(buffer.readerIndex(), 4, Charset.forName("UTF-8"));

      while(testForUrn.equals("urn:")){
        int lengthURN = buffer.bytesBefore((byte) 0x1C);
        boolean isLast = (lengthURN == -1);

        if (isLast){
          int temp = buffer.bytesBefore((byte) 0x0);
          lengthURN = (temp == -1) ? buffer.readableBytes() : temp;
        }

        urns.add(new URN(buffer.toString(buffer.readerIndex(), lengthURN, Charset.forName("UTF-8"))));

        if (!isLast){
          buffer.readerIndex(buffer.readerIndex() + 1);
        }

        buffer.readerIndex(buffer.readerIndex() + lengthURN);

        // update tester string if possible. else set to empty to break loop
        testForUrn = (buffer.readableBytes() > 3) ? buffer.toString(buffer.readerIndex(), 4, Charset.forName("UTF-8")) : "";
      }
    }
    return new HUGEExtension(urns.toArray(new URN[urns.size()]));
  }

}

redpajama_set_name: RedPajamaGithub


text:
CKEDITOR.plugins.setLang( 'uploadwidget', 'es-mx', {
	abort: 'La carga ha sido abortada por el usuario.',
	doneOne: 'El archivo ha sido cargado completamente.',
	doneMany: '%1 archivos cargados completamente.',
	uploadOne: 'Cargando archivo ({percentage}%)...',
	uploadMany: 'Cargando archivos, {current} de {max} listo ({percentage}%)...'
} );


text:
\begin{figure}[H]
\centering
\includegraphics[width=6in]{figs/run_48/run_48_turb_visc_total_vs_r_meshscatter}
\caption{Scatter plot of non-equilibrium based $\nu_T$ vs radius at $z/c$=9.00, $V_{free}$=29.19, station 5.}
\label{fig:run_48_turb_visc_total_vs_r_meshscatter}
\end{figure}


text:
static NSString * const kAFGithubBaseURLString = @"https://api.github.com/";

@implementation AFGithubClientNoAuth

+ (void)checkForNewRelease
{
    NSUserNotificationCenter *defaultUserNotificationCenter = [NSUserNotificationCenter defaultUserNotificationCenter];
    NSArray *macNotifications = [defaultUserNotificationCenter deliveredNotifications];

    NSString *appVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
    [OonLog forLevel:OonLogDebug with:@"AppVersion: %@", appVersion];

    [[self sharedClient] getPath:@"repos/squaresurf/objective-octocat-notifications/tags" parameters:@{} success:^(AFHTTPRequestOperation *operation, id response) {
        [OonLog forLevel:OonLogDebug with:@"Response when checking for new Release: %@", response];

        NSUserNotification *newVersionNotification = nil;
        for (NSUserNotification *notification in macNotifications) {
            NSNumber *notificationType = [[notification userInfo] valueForKey:@"type"];

            if ([notificationType unsignedLongValue] == OonMacNotificationForAppVersionCheck) {
                newVersionNotification = notification;
                break;
            }
        }

        if ([response count] > 0) {
            NSString *latestVersion = response[0][@"name"];
            [OonLog forLevel:OonLogDebug with:@"latestVersion: %@", latestVersion];
            if ([appVersion compare:latestVersion options:NSNumericSearch] == NSOrderedAscending) {
                if (newVersionNotification == nil) {
                    NSString *latestUrl = @"https://github.com/squaresurf/objective-octocat-notifications/releases/latest";

                    NSUserNotification *macNotification = [[NSUserNotification alloc] init];
                    macNotification.title = @"New Release!";
                    macNotification.informativeText = @"Click here to download the latest release of Objective Octocat Notifications.";
                    macNotification.userInfo = @{@"url": latestUrl, @"type": [NSNumber numberWithUnsignedLong:OonMacNotificationForAppVersionCheck]};
                    [defaultUserNotificationCenter deliverNotification:macNotification];
                }
            } else if (newVersionNotification != nil) {
                [defaultUserNotificationCenter removeDeliveredNotification:newVersionNotification];
            }
        }
    } failure:^(AFHTTPRequestOperation *operation, id json) {
        [OonLog forLevel:OonLogError with:@"error: %@", json];
    }];

    // Check again in a day.
    [NSTimer scheduledTimerWithTimeInterval:kCheckForNewReleaseInterval
                                     target:self
                                   selector:@selector(checkForNewRelease)
                                   userInfo:nil
                                    repeats:NO];
}

+ (AFGithubClientNoAuth *)sharedClient {
    static AFGithubClientNoAuth *_sharedClient = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        _sharedClient = [[AFGithubClientNoAuth alloc] initWithBaseURL:[NSURL URLWithString:kAFGithubBaseURLString]];
    });

    return _sharedClient;
}

- (id)initWithBaseURL:(NSURL *)url {
    self = [super initWithBaseURL:url];
    if (!self) {
        return nil;
    }

    [self registerHTTPOperationClass:[AFJSONRequestOperation class]];

	[self setDefaultHeader:@"Accept" value:@"application/json"];

    return self;
}

@end


text: export { default } from "./../../_gen/openfl/display/Tileset";


text:
A container with Python for use with Ansible, AWSCLI

To build:

` docker build -t docker-python  -  < Dockerfile `


text:
<!DOCTYPE html>
<html>
<head>
    <title>LearningApp</title>

    <script type="text/javascript" src="/apps/2.0rc1/sdk.js"></script>

    <script type="text/javascript">
        Rally.onReady(function () {
                Ext.define('CustomApp', {
    extend: 'Rally.app.App',
    componentCls: 'app',

    launch: function() {
        //Write app code here
    }
});

            Rally.launchApp('CustomApp', {
                name:"LearningApp",
	            parentRepos:""
            });

        });
    </script>

    <style type="text/css">
        .app {
     /* Add app styles here */
}

    </style>
</head>
<body></body>
</html>


text:
	stack
	<
	S
	T
	C

<form class='write' method='post' action='./save'>
	<input type='hidden' id='id' name='id' value='<?=$model->id?>' />
	<input type='hidden' id='parentId' name='parentId' value='<?=$model->parentId?>' />

		image
		<input type='text' name='image' id='image' value='<?=$model->image?>' required />

		<fieldset id='type'>
			<legend for='type'>type</legend>
			<? foreach( $model->getSetting('type')->options as $row ): ?>
			<input type='radio' name='type' id='type<?=$row->id?>' value='<?=$row->id?>'  <?=($row->id==$model->type)?"checked='checked'":'';?> />
			<label for='type<?=$row->id?>'><?=$row->label?>
			<? endforeach; ?>
		</fieldset>

		scale
		<input type='number' name='scale' id='scale' value='<?=$model->scale?>' required pattern='[1-4]' />

		tie
		<input type='number' name='tie' id='tie' value='<?=$model->tie?>' required pattern='[0-3]' />

		float
		<input type='text' name='float' id='float' value='<?=$model->float?>' required pattern='(left|right)' />

	title
	<input type='text' name='title' id='title' value='<?=$model->title?>' required />

	contents
	<textarea name='contents' id='contents' required><?=$model->contents?></textarea>

	<button>create</button>
</form>


text:
package juju.testkit.infrastructure

import akka.actor.Props
import akka.testkit.TestProbe
import juju.domain.AggregateRoot.{AggregateHandlersResolution, AggregateIdResolution}
import juju.domain.Saga.{SagaCorrelationIdResolution, SagaHandlersResolution}
import juju.domain._
import juju.domain.resolvers.ByConventions
import juju.infrastructure.{HandlersRegistered, RegisterHandlers, _}
import juju.messages.Command
import juju.sample.ColorAggregate.HeavyChanged
import juju.sample.ColorPriorityAggregate.{AssignColor, ColorAssigned}
import juju.sample.PersonAggregate.{WeightChanged, CreatePerson, PostcardDelivered, SendPostcard}
import juju.sample.PriorityAggregate.{PriorityCreated, _}
import juju.sample.{AveragePersonWeightActivate, PriorityAggregate, _}
import juju.testkit.AkkaSpec

import scala.language.existentials
import scala.reflect.ClassTag

trait EventBusSpec extends AkkaSpec {
  var _tenant = ""
  override def tenant = _tenant

  it should "be able to publish an event after a command send" in {
    _tenant = "t1"
    val probe = TestProbe()

    probe.ignoreMsg {
      case _ : HandlersRegistered => false
      case _ : PriorityCreated => false
      case _ => true
    }
    withEventBus(probe.ref, Seq(classOf[PriorityCreated])) { bus =>
      probe.send(bus, RegisterHandlers[PriorityAggregate])
      probe.expectMsgType[HandlersRegistered](timeout.duration)

      probe.send(bus, CreatePriority("fake"))
      probe.expectMsg(timeout.duration, PriorityCreated("fake"))
    }
  }

  it should "be able to register handlers" in {
    _tenant = "t2"

    val probe = TestProbe()
    probe.ignoreMsg {
      case _ : HandlersRegistered => false
      case _ => true
    }

    withEventBus(probe.ref) { bus =>
      probe.send(bus, RegisterHandlers[PriorityAggregate])

      probe.expectMsgPF(timeout.duration) {
        case HandlersRegistered(handlers) =>
          handlers should contain(classOf[CreatePriority])
          handlers should contain(classOf[IncreasePriority])
      }
    }
  }

  it should "not able to send a message with no registered handler" in {
    _tenant = "t3"

    val probe = TestProbe()
    probe.ignoreMsg {
      case akka.actor.Status.Failure(HandlerNotDefinedException) => false
      case _ => true
    }

    withEventBus(probe.ref) { bus =>
      probe.send(bus, CreatePriority("fake"))
      probe.expectMsg(akka.actor.Status.Failure(HandlerNotDefinedException))
    }
  }

  it should "send an Ack when a successful command send" in {
    _tenant = "t4"
    if (test == "KafkaEventBus") pending //this test make some other tests failure in case of Kafka

    val probe = TestProbe()
    probe.ignoreNoMsg()
    probe.ignoreMsg {
      case _ : HandlersRegistered => false
      case akka.actor.Status.Success(_) => false
      case _ => true
    }
    withEventBus(probe.ref, Seq(classOf[PriorityCreated])) { bus =>
      probe.send(bus, RegisterHandlers[PriorityAggregate])
      probe.expectMsgType[HandlersRegistered](timeout.duration)

      probe.send(bus, CreatePriority("fake"))
      probe.expectMsg(timeout.duration, akka.actor.Status.Success(CreatePriority("fake")))
    }
  }

  it should "be able to delivery messages between aggregates" in {
    _tenant = "t5"

    val probe = TestProbe()
    probe.ignoreMsg {
      case _ : HandlersRegistered => false
      case _ : PostcardDelivered => false
      case _ => true
    }

    implicit def idResolution[A <: AggregateRoot[_] : ClassTag]: AggregateIdResolution[A] = ByConventions.aggregateIdResolution[A]()
    implicit def factory[A <: AggregateRoot[_] : ClassTag]: AggregateRootFactory[A] = ByConventions.aggregateFactory[A]()
    implicit def handlersResolution[A <: AggregateRoot[_] : ClassTag]: AggregateHandlersResolution[A] = ByConventions.aggregateHandlersResolution[A]()

    withEventBus(probe.ref, Seq(classOf[PostcardDelivered])) { bus =>
      probe.send(bus, RegisterHandlers[PersonAggregate])
      probe.expectMsgType[HandlersRegistered](timeout.duration)

      probe.send(bus, CreatePerson("pippo"))
      probe.send(bus, CreatePerson("pluto"))
      probe.send(bus, SendPostcard("pluto", "pippo", "bau bau"))

      probe.expectMsg(timeout.duration, PostcardDelivered("pluto", "pippo", "bau bau"))
    }
  }

  it should "be able to register saga" in {
    _tenant = "t6"

    val probe = TestProbe()
    probe.ignoreMsg {
      case _ : DomainEventsSubscribed => false
      case _ => true
    }
    withEventBus(probe.ref) { bus =>
      probe.send(bus, RegisterSaga[PriorityActivitiesSaga]())
      probe.expectMsgPF(timeout.duration) {
        case DomainEventsSubscribed(events) =>
          events should contain(classOf[PriorityIncreased])
          events should contain(classOf[PriorityDecreased])
          events should contain(classOf[ColorAssigned])
      }
    }
  }

  it should "be able to execute saga workflow" in {
    _tenant = "t7"

    val probe = TestProbe()
    probe.ignoreMsg {
      case _ : HandlersRegistered => false
      case _ : DomainEventsSubscribed => false
      case _ : HeavyChanged => false
      case _ => true
    }

    withEventBus(probe.ref, Seq(classOf[HeavyChanged])) { bus =>

      probe.send(bus, RegisterHandlers[PriorityAggregate])
      probe.expectMsgType[HandlersRegistered](timeout.duration)

      probe.send(bus, RegisterHandlers[ColorAggregate])
      probe.expectMsgType[HandlersRegistered](timeout.duration)

      probe.send(bus,  RegisterHandlers[ColorPriorityAggregate])
      probe.expectMsgType[HandlersRegistered](timeout.duration)

      probe.send(bus, RegisterSaga[PriorityActivitiesSaga])
      probe.expectMsgType[DomainEventsSubscribed](timeout.duration)

      probe.send(bus, CreatePriority("x"))
      probe.send(bus, IncreasePriority("x"))
      probe.send(bus, AssignColor(1, "red"))

      probe.expectMsgPF(timeout.duration) {
        case HeavyChanged("red", _) =>
      }
    }
  }

  it should "be idempotent when register handlers" in {
    _tenant = "t8"
    val probe = TestProbe()
    probe.ignoreMsg {
      case _ : HandlersRegistered => false
      case _ : PriorityCreated => false
      case _ => true
    }
    withEventBus(probe.ref, Seq(classOf[PriorityCreated])) { bus =>
      probe.send(bus, RegisterHandlers[PriorityAggregate])
      probe.expectMsgType[HandlersRegistered](timeout.duration)

      probe.send(bus, RegisterHandlers[PriorityAggregate])
      probe.expectMsgType[HandlersRegistered](timeout.duration)
    }
  }

  it should "be idempotent when register saga" in {
    _tenant = "t9"
    val probe = TestProbe()
    probe.ignoreMsg {
      case _: DomainEventsSubscribed => false
      case _ => true
    }
    withEventBus(probe.ref) { bus =>
      probe.send(bus, RegisterSaga[PriorityActivitiesSaga]())
      probe.expectMsgPF(timeout.duration) {
        case DomainEventsSubscribed(events) =>
      }

      probe.send(bus, RegisterSaga[PriorityActivitiesSaga]())
      probe.expectMsgPF(timeout.duration) {
        case DomainEventsSubscribed(events) =>
      }
    }
  }

  it should "receive an Ack after activate a saga" in {
    _tenant = "t10"

    implicit def sagaFactory[S <: Saga : ClassTag]: SagaFactory[S] = ByConventions.sagaFactory[S]()
    implicit def sagaHandlersResolution[S <: Saga : ClassTag]: SagaHandlersResolution[S] = ByConventions.sagaHandlersResolution[S]()
    implicit def correlationIdResolution[S <: Saga : ClassTag]: SagaCorrelationIdResolution[S] = ByConventions.correlationIdResolution[S]()

    val probe = TestProbe()
    probe.ignoreNoMsg()
    withEventBus(probe.ref) { bus =>
      probe.send(bus, RegisterSaga[AveragePersonWeightSaga]())
      probe.expectMsgPF(timeout.duration) {
        case DomainEventsSubscribed(events) =>
      }
      probe.send(bus, AveragePersonWeightActivate("fake"))
      probe.expectMsg(timeout.duration, akka.actor.Status.Success(AveragePersonWeightActivate("fake")))
    }
  }

  it should "receive an Ack after wakeup a saga" in {
    _tenant = "t11"
    implicit def sagaFactory[S <: Saga : ClassTag]: SagaFactory[S] = ByConventions.sagaFactory[S]()
    implicit def sagaHandlersResolution[S <: Saga : ClassTag]: SagaHandlersResolution[S] = ByConventions.sagaHandlersResolution[S]()
    implicit def correlationIdResolution[S <: Saga : ClassTag]: SagaCorrelationIdResolution[S] = ByConventions.correlationIdResolution[S]()

    val probe = TestProbe()
    probe.ignoreNoMsg()
    withEventBus(probe.ref) { bus =>
      probe.send(bus, RegisterSaga[AveragePersonWeightSaga]())
      probe.expectMsgPF(timeout.duration) {
        case DomainEventsSubscribed(events) =>
      }
      probe.send(bus, PublishWakeUp())
      probe.expectMsg(timeout.duration, akka.actor.Status.Success(PublishWakeUp()))
    }
  }

  it should "be able to route a wakeup message to a saga" in {
    _tenant = "t12"

    class PublisherAggregate extends AggregateRoot[EmptyState] {
      override val factory: AggregateStateFactory = {
        case _ => EmptyState()
      }

      def handle(command: PublishAverageWeight): Unit = command match {
        case _ => raise(WeightChanged("xxx", command.weight))
      }
    }

    implicit def idResolution[A] = new AggregateIdResolution[PublisherAggregate] {
      override def resolve(command: Command): String =  "fake"
    }

    implicit def factory[A] = new AggregateRootFactory[PublisherAggregate] {
      override def props: Props = Props(new PublisherAggregate())
    }

    implicit def handlersResolution[A] = new AggregateHandlersResolution[PublisherAggregate] {
      override def resolve(): Seq[Class[_ <: Command]] = Seq(classOf[PublishAverageWeight])
    }

    implicit def sagaFactory[S <: Saga : ClassTag]: SagaFactory[S] = ByConventions.sagaFactory[S]()
    implicit def sagaHandlersResolution[S <: Saga : ClassTag]: SagaHandlersResolution[S] = ByConventions.sagaHandlersResolution[S]()
    implicit def correlationIdResolution[S <: Saga : ClassTag]: SagaCorrelationIdResolution[S] = ByConventions.correlationIdResolution[S]()

    val probe = TestProbe()
    probe.ignoreNoMsg()

    withEventBus(probe.ref, Seq(classOf[WeightChanged])) { bus =>
      probe.send(bus, RegisterHandlers[PublisherAggregate]())
      probe.expectMsgPF(timeout.duration) {
        case HandlersRegistered(_) =>
      }
      probe.send(bus, RegisterSaga[AveragePersonWeightSaga]())
      probe.expectMsgPF(timeout.duration) {
        case DomainEventsSubscribed(events) =>
      }

      probe.send(bus, AveragePersonWeightActivate("xxx"))
      probe.expectMsg(timeout.duration, akka.actor.Status.Success(AveragePersonWeightActivate("xxx")))

      probe.ignoreMsg {
        case _: WeightChanged => false
        case _ => true
      }

      probe.send(bus, PublishWakeUp())
      probe.expectMsg(timeout.duration, WeightChanged("xxx", 0))
    }
  }

  //TODO: Add tests to check recovery of office and sagarouter after termination

  it should "be able supervisor offices" in {
    pending
    assert(false, "not yet implemented")
  }

  it should "be able supervisor routers" in {
    pending
    assert(false, "not yet implemented")
  }

}