text:
import java.util.Scanner;

/**
 * Created by Jeff Lazerus on 3/13/16.
 * Revised 5/7/2016
 * Exercise 10, CS4050 Spring 2016
 * Dr. Jerry Shultz
 *
 * This java program demonstrates Floyd's
 * algorithm for finding the shortest path
 * between any pair of distinct vertices.
 * The algorithm is a form of dynamic programming.
 *
 * I assumed there are no empty paths,
 * i.e., you can get to any vertex from
 * any other vertex, no dead ends.
 */
class Floyd {

    private static void displayTable(int[][] weights) {
        for (int[] weight : weights) {
            for (int aWeight : weight) {
                if (aWeight == -1) {
                    System.out.printf("%3s", "-");
                } else {
                    System.out.printf("%3d", aWeight);
                }
            }
            System.out.println();
        }
    }

    public static void main(String[] args) {

        Scanner keys = new Scanner(System.in);

        System.out.println("This program will find the shortest path\n" +
                "between any pair of distinct vertices\n" +
                "in a directed graph.\n\n" +
                "Enter the number of vertices in the graph:");

        Integer vertices = new Integer(keys.nextLine());
        int i = vertices;
        int j = vertices;

        int[][] weights = new int[i][j];

        System.out.println("Let's start assigning weights to the edges.\n" +
                "(unless there is no path, in which case enter \"-1\")");

        for (int row = 0; row < weights.length; row++) {
            for (int col = 0; col < weights[row].length; col++) {
                if (row == col) {
                    weights[row][col] = 0;
                    System.out.println("The weight of the edge from vertex " + (row + 1) + " to itself is 0");
                } else {
                    System.out.println("Enter a weight for the edge from v" + (row + 1) + " to v" + (col + 1));
                    int weightEntry = keys.nextInt();
                    if (weightEntry > 0 || weightEntry == -1) {
                        weights[row][col] = weightEntry;
                    } else {
                        System.out.println("Please enter \"-1\" or some weight greater than 0");
                        col -= col;
                    }
                }
            }
            System.out.println();
        }

        System.out.println("Table D^0");
        displayTable(weights);

        for (int k = 0; k < weights.length; k++) { //looping D^k
            for (int row = 0; row < weights.length; row++) {
                for (int col = 0; col < weights.length; col++) {

                    //No edge from a node to itself, skip this one
                    if (weights[row][col] == 0) {
                        weights[row][col] = 0;

                    //Conditions to make sure infinity isn't mistaken fo -1
                        // and keeping everyone positive
                    } else if ((weights[row][col] == -1)
                            && (weights[row][k] > 0)
                            && (weights[k][col] > 0)) {
                        weights[row][col] = weights[row][k] + weights[k][col];

                        // Stay positve!
                    } else if (weights[row][col] > weights[row][k] + weights[k][col]
                            && (weights[row][k] > 0)
                            && (weights[k][col] > 0)) {
                        weights[row][col] = (weights[row][k] + weights[k][col]);
                    }
                }
            }
            System.out.println("\nTable D^" + (k + 1));
            displayTable(weights);
        }
    }
}


text:
package org.wso2.siddhi.core.executor.condition;

import org.wso2.siddhi.core.event.stream.StreamEvent;
import org.wso2.siddhi.core.exception.OperationNotSupportedException;
import org.wso2.siddhi.core.executor.ExpressionExecutor;
import org.wso2.siddhi.query.api.definition.Attribute;

public class NotConditionExpressionExecutor extends ConditionExpressionExecutor {

    public ExpressionExecutor conditionExecutor;

    public NotConditionExpressionExecutor(ExpressionExecutor conditionExecutor) {
        if (conditionExecutor.getReturnType().equals(Attribute.Type.BOOL)) {
            this.conditionExecutor = conditionExecutor;
        } else {
            throw new OperationNotSupportedException("Return type of condition executor " + conditionExecutor.toString() + " should be of type BOOL. " +
                    "Actual Type: " + conditionExecutor.getReturnType().toString());
        }
    }

    public Boolean execute(StreamEvent event) {
        return !(Boolean) conditionExecutor.execute(event);
    }

}

redpajama_set_name: RedPajamaGithub


text:
namespace ErlSharp.Tests
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using ErlSharp.Compiler;
    using ErlSharp.Expressions;
    using ErlSharp.Language;
    using Microsoft.VisualStudio.TestTools.UnitTesting;

    [TestClass]
    public class MachineTests
    {
        [TestMethod]
        public void CreateMachineWithRootContext()
        {
            Machine machine = new Machine();

            Assert.IsNotNull(machine.RootContext);
            Assert.IsNotNull(machine.RootContext.GetValue("c/1"));
            Assert.IsNotNull(machine.RootContext.GetValue("spawn/1"));
            Assert.IsNotNull(machine.RootContext.GetValue("self/0"));

            Assert.IsNotNull(machine.TextWriter);
        }

        [TestMethod]
        public void MachineToString()
        {
            Assert.AreEqual("null", Machine.ToString(null));
            Assert.AreEqual("false", Machine.ToString(false));
            Assert.AreEqual("true", Machine.ToString(true));
            Assert.AreEqual("1", Machine.ToString(1));
            Assert.AreEqual("foo", Machine.ToString("foo"));
        }

        [TestMethod]
        public void CreateMachineWithInitialModules()
        {
            Machine machine = new Machine();

            Assert.IsNotNull(machine.RootContext);
            Assert.IsNotNull(machine.RootContext.GetValue("lists"));
            Assert.IsInstanceOfType(machine.RootContext.GetValue("lists"), typeof(Module));
            Assert.IsNotNull(machine.RootContext.GetValue("io"));
            Assert.IsInstanceOfType(machine.RootContext.GetValue("io"), typeof(Module));
        }

        [TestMethod]
        [DeploymentItem("Modules\\arith.erl")]
        public void LoadArithModule()
        {
            Machine machine = new Machine();

            var module = machine.LoadModule("arith");

            Assert.IsNotNull(module);
            Assert.IsNotNull(module.Context);
            Assert.AreEqual("arith", module.Name);

            Assert.IsNotNull(module.Context.GetValue("add/2"));
            Assert.IsInstanceOfType(module.Context.GetValue("add/2"), typeof(Function));

            Assert.IsNotNull(module.Context.GetValue("subtract/2"));
            Assert.IsInstanceOfType(module.Context.GetValue("subtract/2"), typeof(Function));

            Assert.IsNotNull(module.Context.GetValue("multiply/2"));
            Assert.IsInstanceOfType(module.Context.GetValue("multiply/2"), typeof(Function));

            Assert.IsNotNull(module.Context.GetValue("divide/2"));
            Assert.IsInstanceOfType(module.Context.GetValue("divide/2"), typeof(Function));
        }

        [TestMethod]
        [DeploymentItem("Modules\\fibo.erl")]
        public void LoadAndUseFiboModule()
        {
            Machine machine = new Machine();

            var module = machine.LoadModule("fibo");

            Assert.IsNotNull(module);
            Assert.IsNotNull(module.Context);
            Assert.AreEqual("fibo", module.Name);

            Assert.IsNotNull(module.Context.GetValue("fibo/1"));
            Assert.IsInstanceOfType(module.Context.GetValue("fibo/1"), typeof(MultiFunction));

            var ffunc = (MultiFunction)module.Context.GetValue("fibo/1");

            Assert.AreEqual(1, ffunc.Apply(null, new object[] { 0 }));
            Assert.AreEqual(1, ffunc.Apply(null, new object[] { 1 }));
            Assert.AreEqual(2, ffunc.Apply(null, new object[] { 2 }));
            Assert.AreEqual(3, ffunc.Apply(null, new object[] { 3 }));
            Assert.AreEqual(5, ffunc.Apply(null, new object[] { 4 }));
        }

        [TestMethod]
        [DeploymentItem("Modules\\tail.erl")]
        public void LoadAndUseTailModuleWithTailRecursion()
        {
            Machine machine = new Machine();

            var module = machine.LoadModule("tail");

            Assert.IsNotNull(module);
            Assert.IsNotNull(module.Context);
            Assert.AreEqual("tail", module.Name);

            Assert.IsNotNull(module.Context.GetValue("tail/2"));
            Assert.IsInstanceOfType(module.Context.GetValue("tail/2"), typeof(MultiFunction));

            var ffunc = (MultiFunction)module.Context.GetValue("tail/2");

            var result = ffunc.Apply(null, new object[] { 2, 1 });

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(DelayedCall));

            Assert.AreEqual(3, Machine.ExpandDelayedCall(result));
        }

        [TestMethod]
        [DeploymentItem("Modules\\area_server.erl")]
        public void LoadAreaServer()
        {
            Machine machine = new Machine();

            var module = machine.LoadModule("area_server");

            Assert.IsNotNull(module);
            Assert.IsNotNull(module.Context);
            Assert.AreEqual("area_server", module.Name);

            Assert.IsNotNull(module.Context.GetValue("loop/0"));

            machine.RootContext.SetValue(module.Name, module);

            this.EvaluateExpression("Pid = spawn(fun() -> area_server:loop() end).", machine.RootContext);

            Process process = new Process();
            Process.Current = process;

            this.EvaluateExpression("Pid ! {self(), rectangle, 6, 10}.", machine.RootContext);
            Assert.AreEqual(60, process.GetMessage());

            this.EvaluateExpression("Pid ! {self(), circle, 23}.", machine.RootContext);
            Assert.AreEqual(3.14159 * 23 * 23, process.GetMessage());

            this.EvaluateExpression("Pid ! stop.", machine.RootContext);
        }

        private object EvaluateExpression(string text, Context context)
        {
            Parser parser = new Parser(text);
            IExpression expression = parser.ParseExpression();
            return expression.Evaluate(context);
        }
    }
}


text:
/* Do not modify this file. Changes will be overwritten.                      */
/* Generated automatically by the ASN.1 to Wireshark dissector compiler       */
/* packet-cdt.h                                                               */
/* ../../tools/asn2wrs.py -b -p cdt -c ./cdt.cnf -s ./packet-cdt-template -D . -O ../../epan/dissectors cdt.asn */

/* Input file: packet-cdt-template.h */

#line 1 "../../asn1/cdt/packet-cdt-template.h"
/* packet-cdt.h
 *
 * Routines for Compressed Data Type packet dissection.
 *
 * Copyright 2005, Stig Bjorlykke <stig@bjorlykke.org>, Thales Norway AS
 *
 * Wireshark - Network traffic analyzer
 * By Gerald Combs <gerald@wireshark.org>
 * Copyright 1998 Gerald Combs
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#ifndef PACKET_CDT_H
#define PACKET_CDT_H

void dissect_cdt (tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree);

/*--- Included file: packet-cdt-exp.h ---*/
#line 1 "../../asn1/cdt/packet-cdt-exp.h"
int dissect_cdt_CompressedData(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);

/*--- End of included file: packet-cdt-exp.h ---*/
#line 31 "../../asn1/cdt/packet-cdt-template.h"

#endif  /* PACKET_CDT_H */


text:
using GgpGrpc.Cloud;
using GgpGrpc.Models;
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.Debugger.Interop;
using Microsoft.VisualStudio.Threading;
using NSubstitute;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Metrics.Shared;
using YetiCommon;
using YetiVSI.PortSupplier;
using YetiVSITestsCommon;

namespace YetiVSI.Test.PortSupplier
{
    [TestFixture]
    class DebugPortSupplierTests
    {
        const string _testDebugSessionId = "abc123";

        IVsiMetrics _metrics;
        DebugPort.Factory _debugPortFactory;
        IGameletClient _gameletClient;
        IDialogUtil _dialogUtil;

        DebugPortSupplier _portSupplier;
        const string _reserver = "reserver@test.com";

        [SetUp]
        public void SetUp()
        {
            _debugPortFactory = Substitute.For<DebugPort.Factory>();
            _gameletClient = Substitute.For<IGameletClient>();
            var gameletClientFactory = Substitute.For<GameletClient.Factory>();
            gameletClientFactory.Create(Arg.Any<ICloudRunner>()).Returns(_gameletClient);
            _dialogUtil = Substitute.For<IDialogUtil>();

            var cancelableTaskRunnerFactory =
#pragma warning disable VSSDK005 // Avoid instantiating JoinableTaskContext
                FakeCancelableTask.CreateFactory(new JoinableTaskContext(), false);
#pragma warning restore VSSDK005 // Avoid instantiating JoinableTaskContext
            _metrics = Substitute.For<IVsiMetrics>();
            _metrics.NewDebugSessionId().Returns(_testDebugSessionId);

            var cloudRunner = Substitute.For<ICloudRunner>();

            _portSupplier = new DebugPortSupplier(_debugPortFactory, gameletClientFactory,
                                                  _dialogUtil, cancelableTaskRunnerFactory,
                                                  _metrics, cloudRunner, _reserver);
        }

        [Test]
        public void AddPort()
        {
            var request = Substitute.For<IDebugPortRequest2>();
            string portName = "Reserver: reserver-1; Instance: gamelet-1";
            request.GetPortName(out string _).Returns(x =>
            {
                x[0] = portName;
                return VSConstants.S_OK;
            });

            var gamelet = new Gamelet { Name = "gamelet-1" };
            _gameletClient.LoadByNameOrIdAsync(gamelet.Name).Returns(gamelet);

            var port = Substitute.For<IDebugPort2>();
            _debugPortFactory.Create(gamelet, _portSupplier, _testDebugSessionId).Returns(port);

            Assert.AreEqual(VSConstants.S_OK,
                            _portSupplier.AddPort(request, out IDebugPort2 debugPort));
            Assert.AreEqual(port, debugPort);
            AssertMetricRecorded(DeveloperEventType.Types.Type.VsiGameletsGet,
                                 DeveloperEventStatus.Types.Code.Success);
        }

        [Test]
        public void AddPortMultipleTimes()
        {
            var debugSessionIds = new[] { "session1", "session2" };

            _metrics.NewDebugSessionId().Returns(debugSessionIds[0], debugSessionIds[1]);

            var request = Substitute.For<IDebugPortRequest2>();
            string portName = "gamelet-1 [edge/123455]";
            request.GetPortName(out string _).Returns(x =>
            {
                x[0] = portName;
                return VSConstants.S_OK;
            });

            var gamelet = new Gamelet { Id = "edge/123455" };
            _gameletClient.LoadByNameOrIdAsync(gamelet.Id).Returns(gamelet);

            foreach (string sessionId in debugSessionIds)
            {
                var port = Substitute.For<IDebugPort2>();
                _debugPortFactory.Create(gamelet, _portSupplier, sessionId).Returns(port);

                Assert.AreEqual(VSConstants.S_OK,
                                _portSupplier.AddPort(request, out IDebugPort2 debugPort));
                Assert.AreSame(port, debugPort);
                AssertMetricRecorded(DeveloperEventType.Types.Type.VsiGameletsGet,
                                     DeveloperEventStatus.Types.Code.Success, sessionId);
            }
        }

        [Test]
        public void CanAddPort()
        {
            Assert.AreEqual(VSConstants.S_OK, _portSupplier.CanAddPort());
        }

        [Test]
        public void EnumPorts()
        {
            var gamelets = new List<Gamelet>
            {
                new Gamelet { Id = "test id1", DisplayName = "name1", ReserverEmail = _reserver },
                new Gamelet
                {
                    Id = "test id2", DisplayName = "name2",
                    ReserverEmail = "anotherReserver@test.com"
                },
                new Gamelet { Id = "test id3", DisplayName = "name3", ReserverEmail = _reserver },
            };
            _gameletClient.ListGameletsAsync(onlyOwned: false)
                .Returns(x => Task.FromResult(gamelets));

            var ownedInstancePort1 = Substitute.For<IDebugPort2>();
            _debugPortFactory.Create(gamelets[0], _portSupplier, _testDebugSessionId)
                .Returns(ownedInstancePort1);

            var projectInstancePort = Substitute.For<IDebugPort2>();
            _debugPortFactory.Create(gamelets[1], _portSupplier, _testDebugSessionId)
                .Returns(projectInstancePort);

            var ownedInstancePort2 = Substitute.For<IDebugPort2>();
            _debugPortFactory.Create(gamelets[2], _portSupplier, _testDebugSessionId)
                .Returns(ownedInstancePort2);

            Assert.AreEqual(VSConstants.S_OK,
                            _portSupplier.EnumPorts(out IEnumDebugPorts2 portsEnum));

            var ports = new IDebugPort2[3];
            uint numFetched = 0;
            Assert.AreEqual(VSConstants.S_OK,
                            portsEnum.Next((uint) ports.Length, ports, ref numFetched));
            CollectionAssert.AreEqual(
                new[] { projectInstancePort, ownedInstancePort2, ownedInstancePort1 }, ports);

            AssertMetricRecorded(DeveloperEventType.Types.Type.VsiGameletsList,
                                 DeveloperEventStatus.Types.Code.Success);
        }

        [Test]
        public void EnumPortsMultipleTimes()
        {
            var debugSessionIds = new[] { "session1", "session2" };

            _metrics.NewDebugSessionId().Returns(debugSessionIds[0], debugSessionIds[1]);

            var gamelet = new Gamelet { Id = "test id1" };
            _gameletClient.ListGameletsAsync(onlyOwned: false)
                .Returns(x => Task.FromResult(new List<Gamelet> { gamelet }));

            foreach (string sessionId in debugSessionIds)
            {
                var port = Substitute.For<IDebugPort2>();
                _debugPortFactory.Create(gamelet, _portSupplier, sessionId).Returns(port);

                Assert.AreEqual(VSConstants.S_OK,
                                _portSupplier.EnumPorts(out IEnumDebugPorts2 portsEnum));

                var ports = new IDebugPort2[1];
                uint numFetched = 0;
                Assert.AreEqual(VSConstants.S_OK,
                                portsEnum.Next((uint)ports.Length, ports, ref numFetched));
                Assert.AreEqual(1, numFetched);
                Assert.AreSame(ports[0], port);
                AssertMetricRecorded(DeveloperEventType.Types.Type.VsiGameletsList,
                                     DeveloperEventStatus.Types.Code.Success, sessionId);
            }
        }

        [Test]
        public void EnumPortsError()
        {
            _gameletClient.ListGameletsAsync(onlyOwned: false)
                .Returns<List<Gamelet>>(x => throw new CloudException("test exception"));

            Assert.AreEqual(VSConstants.S_OK,
                            _portSupplier.EnumPorts(out IEnumDebugPorts2 portsEnum));

            _dialogUtil.Received().ShowError("test exception");

            Assert.AreEqual(VSConstants.S_OK, portsEnum.GetCount(out uint count));
            Assert.AreEqual(0, count);
            AssertMetricRecorded(DeveloperEventType.Types.Type.VsiGameletsList,
                                 DeveloperEventStatus.Types.Code.InternalError);
        }

        [Test]
        public void GetPortNotFound()
        {
            var guid = new Guid();
            Assert.AreEqual(YetiVSI.DebugEngine.AD7Constants.E_PORTSUPPLIER_NO_PORT,
                            _portSupplier.GetPort(ref guid, out IDebugPort2 _));
        }

        [Test]
        public void GetPortSupplierId()
        {
            Assert.AreEqual(VSConstants.S_OK, _portSupplier.GetPortSupplierId(out Guid guid));
            Assert.AreEqual(YetiConstants.PortSupplierGuid, guid);
        }

        [Test]
        public void GetPortSupplierName()
        {
            Assert.AreEqual(VSConstants.S_OK, _portSupplier.GetPortSupplierName(out string name));
            Assert.AreEqual(YetiConstants.YetiTitle, name);
        }

        [Test]
        public void RemovePort()
        {
            var port = Substitute.For<IDebugPort2>();
            Assert.AreEqual(VSConstants.E_NOTIMPL, _portSupplier.RemovePort(port));
        }

        [Test]
        public void GetDescription()
        {
            var flags = new enum_PORT_SUPPLIER_DESCRIPTION_FLAGS[1];
            Assert.AreEqual(VSConstants.S_OK, _portSupplier.GetDescription(flags, out string text));
            Assert.AreEqual(
                "The Stadia transport lets you select an instance from the Qualifier drop-down " +
                    "menu and remotely attach to an existing process on that instance",
                text);
        }

        void AssertMetricRecorded(DeveloperEventType.Types.Type type,
                                  DeveloperEventStatus.Types.Code status,
                                  string debugSessionId = _testDebugSessionId)
        {
            _metrics.Received().RecordEvent(
                type, Arg.Is<DeveloperLogEvent>(p => p.StatusCode == status &&
                                                     p.DebugSessionIdStr == debugSessionId));
        }
    }
}


text:
package vultura.factor

import java.lang.management.{ThreadMXBean, ManagementFactory}

import scala.language.reflectiveCalls
import scala.util.Random
import vultura.factor
import vultura.util.stats._

/**
 * @author Thomas Geier <thomas.geier@uni-ulm.de>
 */
object Benchmarks {

  case class SPTask(problem: Problem, retain: Array[Int], ring: Ring[Double], name: String)

  //one inner crossing of a grid problem
  val grids = Seq(
    "grid-D2" -> generators.grid(3,3,2,factor.generators.expGauss(0.3),new Random(0)).filter(_.variables.contains(4)),
    "grid-D4" -> generators.grid(3,3,4,factor.generators.expGauss(0.3),new Random(0)).filter(_.variables.contains(4)),
    "grid-D6" -> generators.grid(3,3,6,factor.generators.expGauss(0.3),new Random(0)).filter(_.variables.contains(4))
  )

  def ringName(r: Ring[Double]): String = if(r == NormalD) "n" else if(r == LogD) "l" else sys.error("unknown ring")
  def partitionTask(p: Problem, name: String, ring: Ring[Double]): SPTask = SPTask(p, Array(),ring,name + s":part:${ringName(ring)}")
  def flattenTask(p: Problem, name: String, ring: Ring[Double]): SPTask = SPTask(p,p.variables.toArray,ring,name + s":flat:${ringName(ring)}")

  def runTaskClassic(task: SPTask)(times: Int = 100): Unit = {
    val numValues = Factor.mapMultiply(task.retain,task.problem.domains)
    val values = new Array[Double](numValues)
    val factors = task.problem.factors
    val fvars: Array[Array[Int]] = factors.map(_.variables)(collection.breakOut)
    val fVals: Array[Array[Double]] = factors.map(_.values)(collection.breakOut): Array[Array[Double]]

    var i = 0
    while(i < times){
      Factor.sumProduct(task.retain, task.problem.domains, fvars, fVals, task.ring,values)
      i += 1
    }
  }

  def runTaskCompiled(task: SPTask)(times: Int = 100): Unit = {
    val numValues = Factor.mapMultiply(task.retain,task.problem.domains)
    val values = new Array[Double](numValues)
    val factors = task.problem.factors
    val fvars: Array[Array[Int]] = factors.map(_.variables)(collection.breakOut)
    val fVals: Array[Array[Double]] = factors.map(_.values)(collection.breakOut): Array[Array[Double]]

    val compiledTask = SumProductTask(task.retain,task.problem.domains,fvars,task.ring)

    var i = 0
    while(i < times){
      compiledTask.sumProduct(fVals,values)
      i += 1
    }
  }

  def benchmark(task: () => Unit, name: String = "anonymous benchmark", repeats: Int = 5, warmup: Boolean = true): Unit = {
    if(warmup) this.warmup(task)
    val times = Seq.fill(repeats)(measure(task()))
    println(f"$name\tmean: ${times.mean}%.6fs\tsd: ${times.sd}%.6f")
  }

  def warmup(task: () => Unit): Unit = {
    var times: Seq[Double] = null
    val begin = System.nanoTime()
    do{
      times = Seq.fill(5)(measure(task()))
    } while(times.sd/times.mean > 0.02 && System.nanoTime() - begin < 5e9)
  }

  def measure(task: => Unit): Double = {
    val start = System.nanoTime()
    task
    (System.nanoTime() - start) * 1e-9
  }

  def times(n: Int)(task: () => Unit): () => Unit = () => {
    var i = 0
    while(i < n){
      task()
      i += 1
    }
  }

  def benchmarkTask(t: SPTask): Unit = {
    benchmark(() => runTaskClassic(t)(500),  "classic:\t" + t.name)
    benchmark(() => runTaskCompiled(t)(500), "compile:\t" + t.name)
  }

  val tasks = for{
    (name,prob) <- grids
    r <- Seq(NormalD,LogD)
    task <- Seq(partitionTask(prob,name,r),flattenTask(prob,name,r))
  } yield task

  def main(args: Array[String]) {
    for(t <- tasks){
      benchmarkTask(t)
    }
  }

  def printCPUTime[A](f: => A, label: String = ""): A = {
    val bean: ThreadMXBean = ManagementFactory.getThreadMXBean
    if(bean.isCurrentThreadCpuTimeSupported){
      val now = bean.getCurrentThreadCpuTime
      val r = f
      val t = (bean.getCurrentThreadCpuTime - now).toDouble * 1e-9
      println(s"$label took ${t}s")
      r
    } else {
      println("no thread cpu time support")
      f
    }
  }
}


text:
About

JSON, glTF and OBJ file viewer.

Created by Josh Staples (
            blog |
            Git |
            LinkedIn
            ) to demonstrate a couple of AngularJS/three.js patterns

There are many ways to work with Angular.  That being said, I've kept this project
            intentionally simple for those of us who are still learning.

First Approach

Uses most common Angular coding patterns

Minify with Grunt.  Use ng-annotate.

Uses ['$scope', function($scope){...

Second Approach

Uses prototypal pattern for, well, everything.

Uses Angular services instead of factories.

Uses closure compiler to link and compile code.

References:

Angular

Three.js

Grunt

Hammer

Closure Compiler

3D Models

Female Model by Reallusion

Male Model by Reallusion

COLLADA duck by Sony


text:
package main

import (
	"container/heap"
	"fmt"
	"reflect"
	"strconv"
	"sync/atomic"
	"time"
	"unsafe"

	"github.com/hashicorp/go-immutable-radix"
	"github.com/relab/raft/commonpb"
	"github.com/relab/rkv/rkvpb"
)

// SnapTick is the time between finishing taking a snapshot and starting to take
// a new one. TODO Config.
const SnapTick = 20 * time.Second

// Store is an implementation of raft.StateMachine. It holds client session
// information, and a key-value store.
type Store struct {
	kvs         *iradix.Tree
	sessions    *iradix.Tree
	pendingCmds map[uint64]*Cmds

	snapTimer  *time.Timer
	snapshot   unsafe.Pointer // *commonpb.Snapshot
	snapshotCh chan *commonpb.Snapshot
	newSnap    int32
}

// NewStore initializes and returns a *Store.
func NewStore() *Store {
	return &Store{
		kvs:         iradix.New(),
		sessions:    iradix.New(),
		pendingCmds: make(map[uint64]*Cmds),
		snapTimer:   time.NewTimer(SnapTick),
		snapshot:    unsafe.Pointer(&commonpb.Snapshot{}),
		snapshotCh:  make(chan *commonpb.Snapshot),
		newSnap:     1, // TODO Enable snapshots again
	}
}

// Apply implements raft.StateMachine.
func (s *Store) Apply(entry *commonpb.Entry) interface{} {
	switch entry.EntryType {
	case commonpb.EntryInternal:
		// Ignore internal messages, Raft will never read the response
		// for an internal message.
		return nil
	case commonpb.EntryNormal:
		var cmd rkvpb.Cmd
		err := cmd.Unmarshal(entry.Data)

		if err != nil {
			panic(fmt.Sprintf("could not unmarshal %v: %v", entry.Data, err))
		}

		res, mutated := s.applyStore(entry.Index, &cmd)

		// We can only snapshot if the state was mutated, i.e., on write
		// requests. This is because we currently don't set entry.Index
		// for read requests.
		if mutated {
			s.maybeSnapshot(entry)
		}

		return res
	case commonpb.EntryReconf:
		// TODO s.snapshotMaybe(entry)? Raft should never read the
		// result from a reconfiguration. It is merely sent to inform
		// the state machine.
		return nil
	default:
		panic(fmt.Sprintf("got unknown entry type: %v", entry.EntryType))
	}
}

func (s *Store) maybeSnapshot(entry *commonpb.Entry) {
	select {
	case <-s.snapTimer.C:
		s.snapTimer = time.NewTimer(SnapTick)
		if atomic.CompareAndSwapInt32(&s.newSnap, 0, 1) {
			go s.takeSnapshot(
				atomic.LoadPointer(&s.snapshot),
				entry.Term, entry.Index,
				s.kvs.Root().Iterator(),
				s.sessions.Root().Iterator(),
			)
		}
	default:
	}
}

func (s *Store) applyStore(i uint64, cmd *rkvpb.Cmd) (interface{}, bool) {
	switch cmd.CmdType {
	case rkvpb.Register:
		id := []byte(strconv.FormatUint(i, 10))
		s.sessions, _, _ = s.sessions.Insert(id, uint64(0))

		var pending Cmds
		heap.Init(&pending)
		s.pendingCmds[i] = &pending

		return i, true
	case rkvpb.Insert:
		var req rkvpb.InsertRequest
		err := req.Unmarshal(cmd.Data)
		if err != nil {
			panic(fmt.Sprintf("could not unmarshal %v: %v", cmd.Data, err))
		}

		id := []byte(strconv.FormatUint(req.ClientID, 10))
		raw, found := s.sessions.Get(id)

		if !found {
			panic(fmt.Sprintf("clientID %v not found", req.ClientID))
		}

		oldSeq, ok := raw.(uint64)

		if !ok {
			panic(fmt.Sprintf("expected uint64 got %s", reflect.TypeOf(raw)))
		}

		nextSeq := oldSeq

		txn := s.kvs.Txn()

		switch {
		// Request is next to be applied.
		case req.ClientSeq == nextSeq+1:
			txn.Insert([]byte(req.Key), req.Value)
			nextSeq++

		// Already applied, ignore.
		case req.ClientSeq < nextSeq+1:
			// We could return here, but we would need to commit the
			// txn anyways. And we should return true, even though
			// the state machine was not actually mutated, the
			// requests index is set.

		// Future request, queue it.
		default:
			s.PushCmd(req.ClientID, &req)
		}

		for s.HasCmd(req.ClientID, nextSeq+1) {
			nextReq := s.PopCmd(req.ClientID)
			txn.Insert([]byte(nextReq.Key), nextReq.Value)
			nextSeq++
		}

		s.kvs = txn.CommitOnly()

		if oldSeq != nextSeq {
			s.sessions, _, _ = s.sessions.Insert(id, nextSeq)
		}

		return true, true
	case rkvpb.Lookup:
		var req rkvpb.LookupRequest
		err := req.Unmarshal(cmd.Data)
		if err != nil {
			panic(err)
		}

		raw, found := s.kvs.Get([]byte(req.Key))

		if !found {
			return "(none)", false
		}

		val, ok := raw.(string)

		if !ok {
			panic(fmt.Sprintf("expected string got %s", reflect.TypeOf(raw)))
		}

		return val, false
	default:
		panic(fmt.Sprintf("got unknown cmd type: %v", cmd.CmdType))
	}
}

// Snapshot implements raft.StateMachine.
func (s *Store) Snapshot() <-chan *commonpb.Snapshot {
	return s.snapshotCh
}

func (s *Store) takeSnapshot(old unsafe.Pointer, term, index uint64, iterKvs, iterSessions *iradix.Iterator) {
	start := time.Now()
	defer func() {
		fmt.Println("Snapshot took:", time.Since(start))
	}()

	var kvs []*rkvpb.KeyValue
	k, v, more := iterKvs.Next()

	for more {
		kvs = append(kvs, &rkvpb.KeyValue{
			Key:   k,
			Value: v.(string),
		})
		k, v, more = iterKvs.Next()
	}

	var sessions []*rkvpb.Session
	k, v, more = iterSessions.Next()

	for more {
		sessions = append(sessions, &rkvpb.Session{
			ClientID:  k,
			ClientSeq: v.(uint64),
		})
		k, v, more = iterSessions.Next()
	}

	snap := &rkvpb.Snapshot{
		Kvs:      kvs,
		Sessions: sessions,
	}

	b, err := snap.Marshal()
	if err != nil {
		panic(fmt.Sprintf("could not marshal %v: %v", snap, err))
	}

	fmt.Println("Snapshot size:", len(b), "bytes")

	snapshot := &commonpb.Snapshot{
		LastIncludedIndex: index,
		LastIncludedTerm:  term,
		Data:              b,
	}

	// This is supposed to prevent a snapshot in progress from overwriting a
	// call to Restore.
	ok := atomic.CompareAndSwapPointer(&s.snapshot, old, unsafe.Pointer(snapshot))

	if ok {
		s.snapshotCh <- snapshot
	}

	atomic.StoreInt32(&s.newSnap, 0)
}

// Restore implements raft.StateMachine.
func (s *Store) Restore(snapshot *commonpb.Snapshot) {
	// Replace current snapshot.
	atomic.StorePointer(&s.snapshot, unsafe.Pointer(snapshot))

	s.pendingCmds = make(map[uint64]*Cmds)

	// Return if we received the empty snapshot.
	if snapshot.Data == nil {
		return
	}

	var snap rkvpb.Snapshot
	err := snap.Unmarshal(snapshot.Data)
	if err != nil {
		panic(fmt.Sprintf("could not unmarshal %v: %v", snapshot.Data, err))
	}

	txn := s.kvs.Txn()
	for _, kv := range snap.Kvs {
		txn.Insert(kv.Key, kv.Value)
	}
	s.kvs = txn.CommitOnly()

	txn = s.sessions.Txn()
	for _, session := range snap.Sessions {
		txn.Insert(session.ClientID, session.ClientSeq)
		var pending Cmds
		heap.Init(&pending)
		id, _ := strconv.Atoi(string(session.ClientID))
		s.pendingCmds[uint64(id)] = &pending
	}
	s.sessions = txn.CommitOnly()
}


text:
#import <Foundation/Foundation.h>
#import "alljoyn/controlpanel/Action.h"
#import "AJCPSWidget.h"

/**
 * AJCPSAction Class is used to display a Button.
 */
@interface AJCPSAction : AJCPSWidget

- (id)initWithHandle:(ajn ::services ::Action *)handle;

/**
 * Call to execute this Action remotely
 * @return ER_OK if successful.
 */
- (QStatus)executeAction;

@end


text:
package org.apache.jackrabbit.vault.cli;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;

import javax.jcr.RepositoryException;

import org.apache.jackrabbit.vault.fs.api.Aggregate;
import org.apache.jackrabbit.vault.util.console.ConsoleFile;

/**
 * {@code JcrCWO}...
 *
 */
public class AggregateCFile implements ConsoleFile {

    private final Aggregate aggregate;

    public AggregateCFile(Aggregate file) {
        this.aggregate = file;
    }

    public Object unwrap() {
        return aggregate;
    }

    public String getPath() {
        return aggregate.getPath();
    }

    public ConsoleFile getFile(String path, boolean mustExist)
            throws IOException {
        try {
            Aggregate node = aggregate.getManager().getRoot();
            if (!path.equals("/")) {
                node = this.aggregate.getAggregate(path);
                if (node == null) {
                    throw new FileNotFoundException(path);
                }
            }
            return new AggregateCFile(node);
        } catch (RepositoryException e) {
            throw new IOException("Error while retrieving file: " + e.toString());
        }
    }

    public ConsoleFile[] listFiles() throws IOException {
        try {
            List<? extends Aggregate> files = aggregate.getLeaves();
            if (files == null || files.isEmpty()) {
                return ConsoleFile.EMPTY_ARRAY;
            }
            AggregateCFile[] ret = new AggregateCFile[files.size()];
            int i=0;
            for (Aggregate node: files) {
                ret[i++] = new AggregateCFile(node);
            }
            return ret;
        } catch (RepositoryException e) {
            throw new IOException(e.toString());
        }
    }

    public boolean allowsChildren() {
        return aggregate.allowsChildren();
    }

    public String getName() {
        return aggregate.getRelPath();
    }
}


text:
package net.iaeste.iws.api.dtos;

import net.iaeste.iws.api.constants.IWSConstants;
import net.iaeste.iws.api.enums.Privacy;
import net.iaeste.iws.api.util.Verifications;
import net.iaeste.iws.api.util.Date;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

/**
 * @author  Kim Jensen / last $Author:$
 * @version $Revision:$ / $Date:$
 * @since   IWS 1.0
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "file", propOrder = { "fileId", "privacy", "group", "user", "folderId", "filename", "filedata", "filesize", "mimetype", "description", "keywords", "checksum", "modified", "created" })
public final class File extends Verifications {

    /** {@link IWSConstants#SERIAL_VERSION_UID}. */
    private static final long serialVersionUID = IWSConstants.SERIAL_VERSION_UID;

    @XmlElement(required = true, nillable = true) private String fileId = null;
    @XmlElement(required = true)                  private Privacy privacy = Privacy.PROTECTED;
    @XmlElement(required = true, nillable = true) private Group group = null;
    @XmlElement(required = true, nillable = true) private User user = null;
    @XmlElement(required = true, nillable = true) private String folderId = null;
    @XmlElement(required = true)                  private String filename = null;
    @XmlElement(required = true, nillable = true) private byte[] filedata = null;
    @XmlElement(required = true, nillable = true) private Integer filesize = null;
    @XmlElement(required = true, nillable = true) private String mimetype = null;
    @XmlElement(required = true, nillable = true) private String description = null;
    @XmlElement(required = true, nillable = true) private String keywords = null;
    @XmlElement(required = true, nillable = true) private Long checksum = null;
    @XmlElement(required = true, nillable = true) private Date modified = new Date();
    @XmlElement(required = true, nillable = true) private Date created = new Date();

    // =========================================================================
    // Object Constructors
    // =========================================================================

    /**
     * Empty Constructor, to use if the setters are invoked. This is required
     * for WebServices to work properly.
     */
    public File() {
        // Required for WebServices to work. Comment added to please Sonar.
    }

    /**
     * Copy Constructor.
     *
     * @param file File Object to copy
     */
    public File(final File file) {
        if (file != null) {
            fileId = file.fileId;
            privacy = file.privacy;
            group = new Group(file.group);
            user = new User(file.user);
            folderId = file.folderId;
            filename = file.filename;
            filedata = file.filedata;
            filesize = file.filesize;
            mimetype = file.mimetype;
            description = file.description;
            keywords = file.keywords;
            checksum = file.checksum;
            modified = file.modified;
            created = file.created;
        }
    }

    // =========================================================================
    // Standard Setters & Getters
    // =========================================================================

    /**
     *
Sets the File Id for this File Object. The Id is generated by the IWS
     * upon saving the File.

     *
     *
Note, that if the value is invalid, then the method will thrown an
     * {@code IllegalArgumentException}.

     *
     * @param fileId File Id
     * @throws IllegalArgumentException if the File Id is invalid
     */
    public void setFileId(final String fileId) {
        ensureValidId("fileId", fileId);
        this.fileId = fileId;
    }

    public String getFileId() {
        return fileId;
    }

    /**
     *
Sets the files privacy level. Files marked Public can be read by
     * anyone but only processed by the owning Group, files marked Protected can
     * only be viewed or processed by by the owning Group, and files marked
     * Private can be viewed by the Group, but only processed by the owning
     * User.

     *
     *
Note, that if the privacy information must be set, if set to null, the
     * method will throw an {@code IllegalArgumentException}.

     *
     * @param privacy The File's privacy setting
     */
    public void setPrivacy(final Privacy privacy) {
        ensureNotNull("privacy", privacy);
        this.privacy = privacy;
    }

    public Privacy getPrivacy() {
        return privacy;
    }

    /**
     *
The owning group for this file. All file management is handled via the
     * Group, and this this is a mandatory field.

     *
     *
The method will throw an {@code IllegalArgumentException} if the Group
     * is either null or invalid.

     *
     * @param group Group
     * @throws IllegalArgumentException if null or not verifiable
     */
    public void setGroup(final Group group) {
        ensureNotNullAndVerifiable("group", group);
        this.group = group;
    }

    public Group getGroup() {
        return group;
    }

    /**
     * Sets the User who uploaded the file. The field is mandatory, which means
     * that the method will thrown an {@code IllegalArgumentException} if the
     * value is either null or not verifiable.
     *
     * @param user User who uploaded the File
     * @throws IllegalArgumentException if null or not verifiable
     */
    public void setUser(final User user) {
        ensureNotNullAndVerifiable("user", user);
        this.user = user;
    }

    public User getUser() {
        return user;
    }

    /**
     *
Sets the FolderId for the File, i.e. the location where the file can
     * be viewed from.

     *
     *
If set, then the folder must be a valid folder, otherwise the method
     * will throw an {@code IllegalArgumentException}.

     *
     * @param folderId FolderId for the File
     */
    public void setFolderId(final String folderId) {
        ensureValidId("folderId", folderId);
        this.folderId = folderId;
    }

    public String getFolderId() {
        return folderId;
    }

    /**
     * The fileName is mandatory in the IWS, and if not set or too long, the
     * method will throw an {@code IllegalArgumentException}.
     *
     * @param filename Name of the File
     * @throws IllegalArgumentException if null, empty or too long
     */
    public void setFilename(final String filename) {
        ensureNotNullOrEmptyOrTooLong("filename", filename, 100);
        this.filename = filename;
    }

    public String getFilename() {
        return filename;
    }

    /**
     * Sets the data for the File Object. The data is read as a raw byte array,
     * and stored as such internally. However, the byte array may not exceed
     * 25MB, if it exceeds this length, then the method will thrown an
     * {@code IllegalArgumentException}.
     *
     * @param filedata Raw file data
     * @throws IllegalArgumentException if the byte array is too long
     */
    public void setFiledata(final byte[] filedata) {
        ensureNotTooLong("filedata", filedata, 26214400);
        this.filedata = Arrays.copyOf(filedata, filedata.length);
    }

    public byte[] getFiledata() {
        return Arrays.copyOf(filedata, filedata.length);
    }

    /**
     * The filesize is set by the IWS internally, and simply matches the size of
     * the file data upon creation.
     *
     * @param filesize Size of the File
     */
    public void setFilesize(final Integer filesize) {
        this.filesize = filesize;
    }

    public Integer getFilesize() {
        return filesize;
    }

    /**
     *
The file MIME Type, which is used for Clients to determine what
     * Application should be used to handle the file.

     *
     *
The method will throw an {@code IllegalArgumentException} if the
     * MIME Type is too long.

     *
     * @param mimetype File MIME Type
     * @throws IllegalArgumentException if the MIME Type value exceeds 50 characters
     */
    public void setMimetype(final String mimetype) {
        ensureNotTooLong("mimetype", mimetype, 50);
        this.mimetype = mimetype;
    }

    public String getMimetype() {
        return mimetype;
    }

    /**
     *
Sets the description of the File, the Description can be anything as long
     * as the length does not exceed the maximum allowed length of 250
     * characters.

     *
     *
The method will throw an {@code IllegalArgumentException} if the length
     * of the description exceeds 250 characters.

     *
     * @param description File Description
     * @throws IllegalArgumentException if the length exceeds 250 characters
     */
    public void setDescription(final String description) {
        ensureNotTooLong("description", description, 250);
        this.description = description;
    }

    public String getDescription() {
        return description;
    }

    /**
     *
Sets the Keywords for the File, meaning a list of words used for
     * indexing the file. The Keywords are not used by the IWS, but is purely
     * for client side usage, and is thus an optional value.

     *
     *
The method will throw an {@code IllegalArgumentException} if the
     * length of the Keywords exceeds 250 characters.

     *
     * @param keywords File Keywords
     * @throws IllegalArgumentException if the length exceeds 250 characters.
     */
    public void setKeywords(final String keywords) {
        ensureNotTooLong("keywords", keywords, 250);
        this.keywords = keywords;
    }

    public String getKeywords() {
        return keywords;
    }

    /**
     * The File Checksum, used for validation of the file, to ensure that the
     * data is not corrupted. The value is set by the IWS upon saving the File.
     *
     * @param checksum File Checksum
     */
    public void setChecksum(final Long checksum) {
        this.checksum = checksum;
    }

    public Long getChecksum() {
        return checksum;
    }

    /**
     * Sets the last time the file was modified. Note, that this value is
     * controlled by the IWS, so any changes to it will be ignored.
     *
     * @param modified Date of last modification
     */
    public void setModified(final Date modified) {
        this.modified = modified;
    }

    public Date getModified() {
        return modified;
    }

    /**
     * Sets the time the file was created. Note, that this value is controlled
     * by the IWS, so any changes to it will be ignored.
     *
     * @param created Date of creation
     */
    public void setCreated(final Date created) {
        this.created = created;
    }

    public Date getCreated() {
        return created;
    }

    // =========================================================================
    // DTO required methods
    // =========================================================================

    /**
     * {@inheritDoc}
     */
    @Override
    public Map<String, String> validate() {
        final Map<String, String> validation = new HashMap<>(0);

        isNotNull(validation, "filename", filename);
        isNotNull(validation, "privacy", privacy);

        return validation;
    }
}


text:
package com.simpligility.maven.plugins.android.configuration;

/**
 * Configuration for the Android Emulator. This class is only the definition of the parameters that are shadowed in
 * {@link com.simpligility.maven.plugins.android.AbstractAndroidMojo} and used there.
 *
 * @author Manfred Moser <manfred@simpligility.com>
 */
public class Emulator
{
    /**
     * Mirror of {@link com.simpligility.maven.plugins.android.AbstractEmulatorMojo#emulatorAvd}
     */
    private String avd;

    /**
     * Mirror of {@link com.simpligility.maven.plugins.android.AbstractEmulatorMojo#emulatorWait}
     */
    private String wait;

    /**
     * Mirror of {@link com.simpligility.maven.plugins.android.AbstractEmulatorMojo#emulatorOptions}
     */
    private String options;

    /**
     * Override default emulator executable
     */
    private String executable;

    public String getAvd()
    {
        return avd;
    }

    public String getWait()
    {
        return wait;
    }

    public String getOptions()
    {
        return options;
    }

    public String getExecutable()
    {
        return executable;
    }
}


text:
<!DOCTYPE html>

    <title>component-boilerplate-redux example</title>
    <meta charset="utf-8">
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <link rel="stylesheet" type="text/css" href="css/component-boilerplate-redux.css" />
    <link rel="stylesheet" type="text/css" href="https://rawgit.com/sdellis/toolbar-component-redux/master/dist/toolbar-component-redux.css" />

Components in this app:


text:
Stompize is a java [STOMP][1] framework, it could help you build or enhance your [STOMP][1] application more easier and readable.

For example, suppose your [STOMP][1] specification has defined two command: `SEND` and `RECEIPT`, you can write java code like below without any document:

```java
public interface Stomp extends Specification {
    @Command(optionals = {Transaction.class, Receipt.class})
    void send(Destination destination, Text content, Header... optionals);

    @Command
    void receipt(ReceiptId receiptId);

    class Text extends Content<String> { ... }

    class Destination extends Header { ... }

    class Transaction extends Header { ... }

    class Receipt extends Header { ... }

    class ReceiptId extends Header { ... }
}
```

Then, you can code the `Client`:

```java
public abstract class Client extends Stompizeble implements Stomp {

    private final Function channel; // channel to communicate with server.

    protected Client(Function channel) { this.channel = channel; }

    @Override
    public void receipt(@Optional("receipt-id") String id) {
        channel.apply(join("RECEIPT", receiptId)); // receive receipt from server.
    }

    @Override
    protected  void out(String command, Iterable<Header> headers, Content<?> content) {
        channel.apply(...); // send a frame to server
    }

}
```

Caution, `Client` is `abstract`, because Stompize will help you override abstract methods declared at `Stomp`, eg: send(...).

A simple unit test could let you figure it out:

```java
    @Test
    public void shouldOutputFrameWithContent() throws Exception {
        Function<String, Void> output = mock(Function.class);
        Stomp client = Stompize.create(Stomp.class, Client.class, output);

        Destination d = new Destination("d");
        client.send(d, new Stomp.Text("content"));

        verify(output).apply("[SEND, [[\ndestination:d], \n\ncontent\u0000]]");
    }

    @Test
    public void shouldCallbackCommand() throws Exception {
        Function<String, Void> output = mock(Function.class);
        Stompizeble stompizeble = (Stompizeble) Stompize.create(Stomp.class, Client.class, output);

        stompizeble.apply("RECEIPT", Collections.singletonMap("receipt-id","1"), null);

        verify(output).apply("[RECEIPT, 1]");
    }

```

Easy right?! So let's stompize your application!

You can get more help from unit test cases:

- [core](https://github.com/zhongl/stompize/tree/master/core/src/test/java/com/github/zhongl/stompize)
- [stomp](https://github.com/zhongl/stompize/tree/master/stomp/src/test/java/com/github/zhongl/stompize)

[1]:http://stomp.github.com/index.html


text:
title: Blockquote
---

[Insert description here]


text:
@interface MMCalendarViewCell(){
    UILabel* _titleLabel;
}

@end

@implementation MMCalendarViewCell

-(void)setTitleLabel:(UILabel *)titleLabel{
    _titleLabel = titleLabel;
}

-(UILabel *)titleLabel{
    if (_titleLabel) {
        return _titleLabel;
    }
    _titleLabel = [[UILabel alloc] initWithFrame:self.bounds];
    _titleLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
    _titleLabel.textAlignment = NSTextAlignmentCenter;
    _titleLabel.userInteractionEnabled = NO;
    [self.contentView addSubview:_titleLabel];
    return _titleLabel;

}

@end


text:
package demo;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.util.Collection;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.IntegrationTest;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.TestRestTemplate;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.web.client.RestTemplate;

import eu.teamtool.Application;
import eu.teamtool.domain.User;
import eu.teamtool.repository.UserRepository;

@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = Application.class)
@WebAppConfiguration
@IntegrationTest("server.port:0")
public class ApplicationTests {

	@Autowired
	private UserRepository userRepo;

	@Value("${local.server.port}")
	private int port;

	private RestTemplate template = new TestRestTemplate();

	@Test
	public void testUserRepo() {
		assertEquals(1, userRepo.count());
		User user = userRepo.findOneByUsername("user");
		assertEquals("password", user.getPassword());

		Collection<SimpleGrantedAuthority> authorities = user.getAuthorities();
		assertTrue(authorities.contains(new SimpleGrantedAuthority("ROLE_ADMIN")));
		assertTrue(authorities.contains(new SimpleGrantedAuthority("ROLE_USER")));
		assertEquals(2, authorities.size());
	}

	@Test
	public void homePageLoads() {
		ResponseEntity<String> response = template.getForEntity("http://localhost:"
				+ port + "/", String.class);
		assertEquals(HttpStatus.OK, response.getStatusCode());
	}

	@Test
	public void userEndpointProtected() {
		ResponseEntity<String> response = template.getForEntity("http://localhost:"
				+ port + "/user", String.class);
		assertEquals(HttpStatus.UNAUTHORIZED, response.getStatusCode());
	}

	@Test
	public void resourceEndpointProtected() {
		ResponseEntity<String> response = template.getForEntity("http://localhost:"
				+ port + "/resource", String.class);
		assertEquals(HttpStatus.UNAUTHORIZED, response.getStatusCode());
	}

	@Test
	public void loginSucceeds() {
		RestTemplate template = new TestRestTemplate("user", "password");
		ResponseEntity<String> response = template.getForEntity("http://localhost:" + port
				+ "/user", String.class);
		assertEquals(HttpStatus.OK, response.getStatusCode());
	}

}


text:
[jvm]
Content
@[JvmField](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.jvm/-jvm-field/index.html)()

val [COLLECTIONS3](-c-o-l-l-e-c-t-i-o-n-s3.md): [LoadedKoresType](../../com.github.jonathanxd.kores.type/-loaded-kores-type/index.md)<Collections3>


text:
<?php
/**
 * The template for displaying product content in the single-product.php template
 *
 * This template can be overridden by copying it to yourtheme/woocommerce/content-single-product.php.
 *
 * HOWEVER, on occasion WooCommerce will need to update template files and you
 * (the theme developer) will need to copy the new files to your theme to
 * maintain compatibility. We try to do this as little as possible, but it does
 * happen. When this occurs the version of the template file will be bumped and
 * the readme will list any important changes.
 *
 * @see 	    https://docs.woocommerce.com/document/template-structure/
 * @author 		WooThemes
 * @package 	WooCommerce/Templates
 * @version     3.0.0
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}

?>

<?php
	/**
	 * woocommerce_before_single_product hook.
	 *
	 * @hooked wc_print_notices - 10
	 */
	 do_action( 'woocommerce_before_single_product' );

	 if ( post_password_required() ) {
	 	echo get_the_password_form();
	 	return;
	 }
?>

<div id="product-<?php the_ID(); ?>" <?php post_class(); ?>>

	      <div class="single-banner item text-center active" style="background-image: url(<?php the_post_thumbnail_url( 'blog-banner' ); ?>)">

<?php the_title(); ?>

	<?php
		/**
		 * woocommerce_before_single_product_summary hook.
		 *
		 * @hooked woocommerce_show_product_sale_flash - 10
		 * @hooked woocommerce_show_product_images - 20
		 */
		//do_action( 'woocommerce_before_single_product_summary' );
	?>

					<?php
						/**
						 * woocommerce_single_product_summary hook.
						 *
						 * @hooked woocommerce_template_single_title - 5
						 * @hooked woocommerce_template_single_rating - 10
						 * @hooked woocommerce_template_single_price - 10
						 * @hooked woocommerce_template_single_excerpt - 20
						 * @hooked woocommerce_template_single_add_to_cart - 30
						 * @hooked woocommerce_template_single_meta - 40
						 * @hooked woocommerce_template_single_sharing - 50
						 * @hooked WC_Structured_Data::generate_product_data() - 60
						 */
						do_action( 'woocommerce_single_product_summary' );
					?>

Booking is currently scheduled through MassageBook.

						Check Availability

				<?php
					/**
					 * woocommerce_after_single_product_summary hook.
					 *
					 * @hooked woocommerce_output_product_data_tabs - 10
					 * @hooked woocommerce_upsell_display - 15
					 * @hooked woocommerce_output_related_products - 20
					 */
					do_action( 'woocommerce_after_single_product_summary' );
				?>

<?php do_action( 'woocommerce_after_single_product' ); ?>


text:
package ru.test.struts2.entity;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * @author artem.pronchakov@calisto.email
 */
@Entity
@Table(name = "transfer")
@NamedQueries({
        @NamedQuery(name = "Transfer.findAll", query = "SELECT t FROM Transfer t")})
public class Transfer implements Serializable, AbstractEntity {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Long id;
    @Column(name = "amount", nullable = false)
    private BigDecimal amount;
    @Column(name = "comment", length = 1000)
    private String comment;
    @JoinColumn(name = "senders_account", referencedColumnName = "id")
    @ManyToOne(fetch = FetchType.LAZY)
    private Account sendersAccount;
    @JoinColumn(name = "recievers_account", referencedColumnName = "id")
    @ManyToOne(fetch = FetchType.LAZY)
    private Account recieversAccount;

    public Transfer() {
    }

    public Transfer(Long id) {
        this.id = id;
    }

    public Transfer(Long id, BigDecimal amount, String comment) {
        this.id = id;
        this.amount = amount;
        this.comment = comment;
    }

    @Override
    public Long getId() {
        return id;
    }

    @Override
    public void setId(Long id) {
        this.id = id;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public Account getSendersAccount() {
        return sendersAccount;
    }

    public void setSendersAccount(Account sendersAccount) {
        this.sendersAccount = sendersAccount;
    }

    public Account getRecieversAccount() {
        return recieversAccount;
    }

    public void setRecieversAccount(Account recieversAccount) {
        this.recieversAccount = recieversAccount;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Transfer)) {
            return false;
        }
        Transfer other = (Transfer) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ru.test.struts2.entity.Transfer[ id=" + id + " ]";
    }

}


text:
set -o errexit

if [ ! "$#" -eq "1" ]; then
    echo "$0 builds a gziped Ubuntu OpenStack install"
    echo "usage: $0 dest"
    exit 1
fi

# Clean up any resources that may be in use
cleanup() {
    set +o errexit

    # Mop up temporary files
    if [ -n "$MNTDIR" -a -d "$MNTDIR" ]; then
        umount $MNTDIR
        rmdir $MNTDIR
    fi
    if [ -n "$DEV_FILE_TMP" -a -e "$DEV_FILE_TMP" ]; then
        rm -f $DEV_FILE_TMP
    fi
    if [ -n "$IMG_FILE_TMP" -a -e "$IMG_FILE_TMP" ]; then
        rm -f $IMG_FILE_TMP
    fi

    # Release NBD devices
    if [ -n "$NBD" ]; then
        qemu-nbd -d $NBD
    fi

    # Kill ourselves to signal any calling process
    trap 2; kill -2 $$
}

trap cleanup SIGHUP SIGINT SIGTERM

# Set up nbd
modprobe nbd max_part=63

# Echo commands
set -o xtrace

IMG_FILE=$1

# Keep track of the current directory
TOOLS_DIR=$(cd $(dirname "$0") && pwd)
TOP_DIR=$(cd $TOOLS_DIR/..; pwd)

# Import common functions
. $TOP_DIR/functions

# Store cwd
CWD=`pwd`

cd $TOP_DIR

# Source params
source ./stackrc

CACHEDIR=${CACHEDIR:-/opt/stack/cache}

DEST=${DEST:-/opt/stack}

# Configure the root password of the vm to be the same as ``ADMIN_PASSWORD``
ROOT_PASSWORD=${ADMIN_PASSWORD:-password}

# Base image (natty by default)
DIST_NAME=${DIST_NAME:-natty}

# Param string to pass to stack.sh.  Like "EC2_DMZ_HOST=192.168.1.1 MYSQL_USER=nova"
STACKSH_PARAMS=${STACKSH_PARAMS:-}

# Option to use the version of devstack on which we are currently working
USE_CURRENT_DEVSTACK=${USE_CURRENT_DEVSTACK:-1}

# clean install
if [ ! -r $CACHEDIR/$DIST_NAME-base.img ]; then
    $TOOLS_DIR/get_uec_image.sh $DIST_NAME $CACHEDIR/$DIST_NAME-base.img
fi

# Finds and returns full device path for the next available NBD device.
# Exits script if error connecting or none free.
# map_nbd image
function map_nbd() {
    for i in `seq 0 15`; do
        if [ ! -e /sys/block/nbd$i/pid ]; then
            NBD=/dev/nbd$i
            # Connect to nbd and wait till it is ready
            qemu-nbd -c $NBD $1
            if ! timeout 60 sh -c "while ! [ -e ${NBD}p1 ]; do sleep 1; done"; then
                echo "Couldn't connect $NBD"
                exit 1
            fi
            break
        fi
    done
    if [ -z "$NBD" ]; then
        echo "No free NBD slots"
        exit 1
    fi
    echo $NBD
}

# Prime image with as many apt as we can
DEV_FILE=$CACHEDIR/$DIST_NAME-dev.img
DEV_FILE_TMP=`mktemp $DEV_FILE.XXXXXX`
if [ ! -r $DEV_FILE ]; then
    cp -p $CACHEDIR/$DIST_NAME-base.img $DEV_FILE_TMP

    NBD=`map_nbd $DEV_FILE_TMP`
    MNTDIR=`mktemp -d --tmpdir mntXXXXXXXX`
    mount -t ext4 ${NBD}p1 $MNTDIR
    cp -p /etc/resolv.conf $MNTDIR/etc/resolv.conf

    chroot $MNTDIR apt-get install -y --download-only `cat files/apts/* | grep NOPRIME | cut -d\# -f1`
    chroot $MNTDIR apt-get install -y --force-yes `cat files/apts/* | grep -v NOPRIME | cut -d\# -f1`

    # Create a stack user that is a member of the libvirtd group so that stack
    # is able to interact with libvirt.
    chroot $MNTDIR groupadd libvirtd
    chroot $MNTDIR useradd $STACK_USER -s /bin/bash -d $DEST -G libvirtd
    mkdir -p $MNTDIR/$DEST
    chroot $MNTDIR chown $STACK_USER $DEST

    # A simple password - pass
    echo $STACK_USER:pass | chroot $MNTDIR chpasswd
    echo root:$ROOT_PASSWORD | chroot $MNTDIR chpasswd

    # And has sudo ability (in the future this should be limited to only what
    # stack requires)
    echo "$STACK_USER ALL=(ALL) NOPASSWD: ALL" >> $MNTDIR/etc/sudoers

    umount $MNTDIR
    rmdir $MNTDIR
    qemu-nbd -d $NBD
    NBD=""
    mv $DEV_FILE_TMP $DEV_FILE
fi
rm -f $DEV_FILE_TMP

# Clone git repositories onto the system
# ======================================

IMG_FILE_TMP=`mktemp $IMG_FILE.XXXXXX`

if [ ! -r $IMG_FILE ]; then
    NBD=`map_nbd $DEV_FILE`

    # Pre-create the image file
    # FIXME(dt): This should really get the partition size to
    # pre-create the image file
    dd if=/dev/zero of=$IMG_FILE_TMP bs=1 count=1 seek=$((2*1024*1024*1024))
    # Create filesystem image for RAM disk
    dd if=${NBD}p1 of=$IMG_FILE_TMP bs=1M

    qemu-nbd -d $NBD
    NBD=""
    mv $IMG_FILE_TMP $IMG_FILE
fi
rm -f $IMG_FILE_TMP

MNTDIR=`mktemp -d --tmpdir mntXXXXXXXX`
mount -t ext4 -o loop $IMG_FILE $MNTDIR
cp -p /etc/resolv.conf $MNTDIR/etc/resolv.conf

# We need to install a non-virtual kernel and modules to boot from
if [ ! -r "`ls $MNTDIR/boot/vmlinuz-*-generic | head -1`" ]; then
    chroot $MNTDIR apt-get install -y linux-generic
fi

git_clone $NOVA_REPO $DEST/nova $NOVA_BRANCH
git_clone $GLANCE_REPO $DEST/glance $GLANCE_BRANCH
git_clone $KEYSTONE_REPO $DEST/keystone $KEYSTONE_BRANCH
git_clone $NOVNC_REPO $DEST/novnc $NOVNC_BRANCH
git_clone $HORIZON_REPO $DEST/horizon $HORIZON_BRANCH
git_clone $NOVACLIENT_REPO $DEST/python-novaclient $NOVACLIENT_BRANCH
git_clone $OPENSTACKX_REPO $DEST/openstackx $OPENSTACKX_BRANCH

# Use this version of devstack
rm -rf $MNTDIR/$DEST/devstack
cp -pr $CWD $MNTDIR/$DEST/devstack
chroot $MNTDIR chown -R $STACK_USER $DEST/devstack

# Configure host network for DHCP
mkdir -p $MNTDIR/etc/network
cat > $MNTDIR/etc/network/interfaces <<EOF
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
EOF

# Set hostname
echo "ramstack" >$MNTDIR/etc/hostname
echo "127.0.0.1		localhost	ramstack" >$MNTDIR/etc/hosts

# Configure the runner
RUN_SH=$MNTDIR/$DEST/run.sh
cat > $RUN_SH <<EOF
#!/usr/bin/env bash

# Get IP range
set \`ip addr show dev eth0 | grep inet\`
PREFIX=\`echo \$2 | cut -d. -f1,2,3\`
export FLOATING_RANGE="\$PREFIX.224/27"

# Kill any existing screens
killall screen

# Run stack.sh
cd $DEST/devstack && \$STACKSH_PARAMS ./stack.sh > $DEST/run.sh.log
echo >> $DEST/run.sh.log
echo >> $DEST/run.sh.log
echo "All done! Time to start clicking." >> $DEST/run.sh.log
EOF

# Make the run.sh executable
chmod 755 $RUN_SH
chroot $MNTDIR chown $STACK_USER $DEST/run.sh

umount $MNTDIR
rmdir $MNTDIR


text:
/*
 *   CrissCross
 *   A multi-purpose cross-platform library.
 *
 *   A product of Uplink Laboratories.
 *
 *   (c) 2006-2022 Steven Noonan.
 *   Licensed under the New BSD License.
 *
 */

#include "header.h"
#include "stree.h"
#include "testutils.h"

#include <cstdio>

#include <crisscross/stree.h>

using namespace CrissCross::Data;
using namespace CrissCross::System;

int TestSTree_CString()
{
	STree<const char *, const char *> *stree = new STree<const char *, const char *>();
	char *strings[TREE_ITEMS], *tmp;

	/* Make sure allocation worked */
	TEST_ASSERT(stree != nullptr);

	/* Make sure the size starts at 0 */
	TEST_ASSERT(stree->size() == 0);

	memset(strings, 0, sizeof(strings));

	/* Make sure the tree encapsulates keys properly */
	tmp = cc_strdup("testkey");
	stree->insert(tmp, "encapsulation test");
	free(tmp); tmp = nullptr;
	TEST_ASSERT(stree->size() == 1);
	TEST_ASSERT(stree->exists("testkey"));
	TEST_ASSERT(stree->erase("testkey"));
	TEST_ASSERT(!stree->exists("testkey"));
	TEST_ASSERT(!stree->erase("testkey"));
	TEST_ASSERT(stree->size() == 0);

	/* Simplest sanity checks done, now create some random data */
	for (unsigned int i = 0; i < TREE_ITEMS; i++)
	{
		TEST_ASSERT(strings[i] == nullptr);
		strings[i] = new char[20];
		TEST_ASSERT(strings[i] != nullptr);
		memset(strings[i], 0, 20);
		TEST_ASSERT(strlen(strings[i]) == 0);
		sprintf(strings[i], "%08x", i);
		TEST_ASSERT(strlen(strings[i]) > 0);
	}

	/* Fill the tree */
	for (size_t i = 0; i < TREE_ITEMS; i++)
	{
		TEST_ASSERT(stree->insert(strings[i], strings[(TREE_ITEMS - 1) - i]));
	}

	/* Verify existence of all the added data */
	for (size_t i = 0; i < TREE_ITEMS; i++)
	{
		const char *val = nullptr;
		TEST_ASSERT(stree->exists(strings[i]));
		TEST_ASSERT((val = stree->find(strings[i])) != nullptr);
		TEST_ASSERT(Compare(val, (const char *)strings[(TREE_ITEMS - 1) - i]) == 0);
	}

	/* Verify existence of all the added data, in a different order */
	for (size_t i = TREE_ITEMS - 1; i < TREE_ITEMS; i--)
	{
		TEST_ASSERT(stree->exists(strings[i]));
	}

	/* Try to remove all the data */
	for (size_t i = 0; i < TREE_ITEMS; i++)
	{
		TEST_ASSERT(stree->erase(strings[i]));
		TEST_ASSERT(!stree->exists(strings[i]));
	}

	/* Clean up the random data */
	for (size_t i = 0; i < TREE_ITEMS; i++)
	{
		delete [] strings[i];
		strings[i] = nullptr;
	}

	/* And finally, clear the tree */
	delete stree;

	return 0;
}

int TestSTree_String()
{
	STree<std::string, std::string> *stree = new STree<std::string, std::string>();
	std::string strings[TREE_ITEMS], tmp;

	/* Make sure allocation worked */
	TEST_ASSERT(stree != nullptr);

	/* Make sure the size starts at 0 */
	TEST_ASSERT(stree->size() == 0);

	/* Make sure the tree encapsulates keys properly */
	tmp = std::string("testkey");
	stree->insert(tmp, std::string("encapsulation test"));
	tmp = std::string("");
	TEST_ASSERT(stree->size() == 1);
	TEST_ASSERT(stree->exists("testkey"));
	TEST_ASSERT(stree->erase("testkey"));
	TEST_ASSERT(!stree->exists("testkey"));
	TEST_ASSERT(!stree->erase("testkey"));
	TEST_ASSERT(stree->size() == 0);

	/* Simplest sanity checks done, now create some random data */
	for (unsigned int i = 0; i < TREE_ITEMS; i++)
	{
		char buf[20];
		buf[0] = (char)0;
		TEST_ASSERT(strlen(buf) == 0);
		sprintf(buf, "%08x", i);
		strings[i] = std::string(buf);
		TEST_ASSERT(strings[i].length() > 0);
	}

	/* Fill the tree */
	for (size_t i = 0; i < TREE_ITEMS; i++)
	{
		TEST_ASSERT(stree->insert(strings[i], strings[(TREE_ITEMS - 1) - i]));
	}

	/* Verify existence of all the added data */
	for (size_t i = 0; i < TREE_ITEMS; i++)
	{
		std::string val;
		val.clear();
		TEST_ASSERT(val.length() == 0);
		TEST_ASSERT(stree->exists(strings[i]));
		TEST_ASSERT((val = stree->find<std::string>(strings[i], "")) != std::string(""));
		TEST_ASSERT(val.length() > 0);
		TEST_ASSERT(Compare(val, strings[(TREE_ITEMS - 1) - i]) == 0);
	}

	/* Verify existence of all the added data, in a different order */
	for (size_t i = TREE_ITEMS - 1; i < TREE_ITEMS; i--)
	{
		TEST_ASSERT(stree->exists(strings[i]));
	}

	/* Try to remove all the data */
	for (size_t i = 0; i < TREE_ITEMS; i++)
	{
		TEST_ASSERT(stree->erase(strings[i]));
		TEST_ASSERT(!stree->exists(strings[i]));
	}

	/* And finally, clear the tree */
	delete stree;

	return 0;
}

int TestSTree_Int()
{
	STree<int, int> *stree = new STree<int, int>();
	int data[TREE_ITEMS], tmp;

	/* Make sure allocation worked */
	TEST_ASSERT(stree != nullptr);

	/* Make sure the size starts at 0 */
	TEST_ASSERT(stree->size() == 0);

	/* Make sure the tree encapsulates keys properly */
	tmp = 256;
	stree->insert(tmp, RandomNumber());
	tmp = 0;
	TEST_ASSERT(stree->size() == 1);
	TEST_ASSERT(stree->exists(256));
	TEST_ASSERT(stree->erase(256));
	TEST_ASSERT(!stree->exists(256));
	TEST_ASSERT(!stree->erase(256));
	TEST_ASSERT(stree->size() == 0);

	/* Simplest sanity checks done, now create some random data */
	for (size_t i = 0; i < TREE_ITEMS; i++)
	{
		data[i] = i;
	}

	/* Fill the tree */
	for (size_t i = 0; i < TREE_ITEMS; i++)
	{
		TEST_ASSERT(stree->insert(data[i], data[TREE_ITEMS - 1 - i]));
	}

	/* Verify existence of all the added data */
	for (size_t i = 0; i < TREE_ITEMS; i++)
	{
		int val;
		TEST_ASSERT(stree->exists(data[i]));
		TEST_ASSERT((val = stree->find(data[i], -1)) != -1);
		TEST_ASSERT(Compare(val, data[TREE_ITEMS - 1 - i]) == 0);
	}

	/* Verify existence of all the added data, in a different order */
	for (size_t i = TREE_ITEMS - 1; i < TREE_ITEMS; i--)
	{
		TEST_ASSERT(stree->exists(data[i]));
	}

	/* Try to remove all the data */
	for (size_t i = 0; i < TREE_ITEMS; i++)
	{
		TEST_ASSERT(stree->erase(data[i]));
		TEST_ASSERT(!stree->exists(data[i]));
	}

	/* And finally, clear the tree */
	delete stree;

	return 0;
}


text:
title: Opera Desktop 17 Released
authors:
- bruce-lawson
intro: '[Opera 17 for desktop is released](http://my.opera.com/desktopteam/blog/opera-17-final), and installs are being autoupdated as you read this. Opera 17 is based on Chromium/Blink 30, which means that [Canvas blend modes](http://codepen.io/adobe/pen/gbzmE) are now supported.'
tags:
- extensions
- opera
- opera-17
- canvas
- api
- odin
license: cc-by-3.0
---

[Opera 17 for desktop is released][1], and installs are being autoupdated as you read this.

[1]: http://my.opera.com/desktopteam/blog/opera-17-final

Opera 17 is based on Chromium/Blink 30, which means that [Canvas blend modes][2] are now supported.

[2]: http://codepen.io/adobe/pen/gbzmE

In addition, we've added support for a number of new extension APIs, which you now can safely use in your extensions:

* `chrome.bookmarks`: [API docs][3], [tutorial][4]
* `chrome.commands`: [API docs][5], [tutorial][6]
* `chrome.webNavigation`: [API docs][7], [tutorial][8]

[3]: https://dev.opera.com/extension-docs/bookmarks.html
[4]: https://dev.opera.com/extension-docs/tut_bookmarks.html
[5]: https://dev.opera.com/extension-docs/commands.html
[6]: https://dev.opera.com/extension-docs/tut_commands.html
[7]: https://dev.opera.com/extension-docs/webNavigation.html
[8]: https://dev.opera.com/extension-docs/tut_webnavigation.html

Consumer highlights are the ability to add custom searches, configure startup options, pinned tabs and (behind opera:flags) a new Quick Access Bar to house bookmarklets and bookmarks, powered by the chrome.bookmarks API.

If you are interested in experimenting with features that are in the pipeline for future versions of the product, we recommend following our [Opera Developer stream][9].

[9]: http://www.opera.com/developer


text:
package com.noveogroup.clap.service.revision;

import com.noveogroup.clap.model.request.revision.CreateRevisionVariantRequest;
import com.noveogroup.clap.model.revision.ApplicationFile;
import com.noveogroup.clap.model.revision.Revision;
import com.noveogroup.clap.model.revision.RevisionType;
import com.noveogroup.clap.model.revision.RevisionVariantWithApkStructure;
import com.noveogroup.clap.model.user.User;

import javax.validation.constraints.NotNull;
import java.util.Set;

/**
 * @author Mikhail Demidov
 */
public interface RevisionService {

    /**
     * @param request
     * @return true if new created
     */
    boolean createRevisionVariant(@NotNull CreateRevisionVariantRequest request);

    void updateRevisionData(@NotNull Revision revision);

    ApplicationFile getApplication(Long revId, Long variantId);

    Revision getRevision(Long revisionId);

    void deleteRevision(Long id);

    Set<RevisionType> getAvailableTypesToChange(User user, Revision revision);

    RevisionVariantWithApkStructure getRevisionVariantWithApkStructure(Long variantId);

    RevisionVariantWithApkStructure getRevisionVariantWithApkStructureByMessageId(Long messageId);

    boolean checkRevisionVariantRandom(String variantHash, String random);
}


text:
/******************************************************
* LAYOUT.SCSS
*	Main site layout styles go in this file.
*	Iclude styles for the site header and footer,
*	main body and sidebars, etc.
*	All styles for components/sections that are used
*	site wide.
\******************************************************/


text:
package ch.bisi.jicon.colorfinder;

/**
 * Exception indicating that an image cannot be correctly processed because empty.
 */
public class EmptyImageException extends Exception {
  public EmptyImageException(final String message) {
    super(message);
  }
}