text:
package org.apache.spark.streaming.kinesis

import scala.collection.mutable
import scala.concurrent.duration._
import scala.language.postfixOps
import scala.util.Random

import com.amazonaws.services.kinesis.clientlibrary.lib.worker.InitialPositionInStream
import com.amazonaws.services.kinesis.model.Record
import org.scalatest.{BeforeAndAfter, BeforeAndAfterAll}
import org.scalatest.Matchers._
import org.scalatest.concurrent.Eventually

import org.apache.spark.{SparkConf, SparkContext}
import org.apache.spark.network.util.JavaUtils
import org.apache.spark.rdd.RDD
import org.apache.spark.storage.{StorageLevel, StreamBlockId}
import org.apache.spark.streaming._
import org.apache.spark.streaming.dstream.ReceiverInputDStream
import org.apache.spark.streaming.kinesis.KinesisInitialPositions.Latest
import org.apache.spark.streaming.kinesis.KinesisReadConfigurations._
import org.apache.spark.streaming.kinesis.KinesisTestUtils._
import org.apache.spark.streaming.receiver.BlockManagerBasedStoreResult
import org.apache.spark.streaming.scheduler.ReceivedBlockInfo
import org.apache.spark.util.Utils

abstract class KinesisStreamTests(aggregateTestData: Boolean) extends KinesisFunSuite
  with Eventually with BeforeAndAfter with BeforeAndAfterAll {

  // This is the name that KCL will use to save metadata to DynamoDB
  private val appName = s"KinesisStreamSuite-${math.abs(Random.nextLong())}"
  private val batchDuration = Seconds(1)

  // Dummy parameters for API testing
  private val dummyEndpointUrl = defaultEndpointUrl
  private val dummyRegionName = KinesisTestUtils.getRegionNameByEndpoint(dummyEndpointUrl)
  private val dummyAWSAccessKey = "dummyAccessKey"
  private val dummyAWSSecretKey = "dummySecretKey"

  private var testUtils: KinesisTestUtils = null
  private var ssc: StreamingContext = null
  private var sc: SparkContext = null

  override def beforeAll(): Unit = {
    val conf = new SparkConf()
      .setMaster("local[4]")
      .setAppName("KinesisStreamSuite") // Setting Spark app name to Kinesis app name
    sc = new SparkContext(conf)

    runIfTestsEnabled("Prepare KinesisTestUtils") {
      testUtils = new KPLBasedKinesisTestUtils()
      testUtils.createStream()
    }
  }

  override def afterAll(): Unit = {
    try {
      if (ssc != null) {
        ssc.stop()
      }
      if (sc != null) {
        sc.stop()
      }
      if (testUtils != null) {
        // Delete the Kinesis stream as well as the DynamoDB table generated by
        // Kinesis Client Library when consuming the stream
        testUtils.deleteStream()
        testUtils.deleteDynamoDBTable(appName)
      }
    } finally {
      super.afterAll()
    }
  }

  before {
    ssc = new StreamingContext(sc, batchDuration)
  }

  after {
    if (ssc != null) {
      ssc.stop(stopSparkContext = false)
      ssc = null
    }
    if (testUtils != null) {
      testUtils.deleteDynamoDBTable(appName)
    }
  }

  test("KinesisUtils API") {
    val kinesisStream1 = KinesisUtils.createStream(ssc, "myAppName", "mySparkStream",
      dummyEndpointUrl, dummyRegionName,
      InitialPositionInStream.LATEST, Seconds(2), StorageLevel.MEMORY_AND_DISK_2)
    val kinesisStream2 = KinesisUtils.createStream(ssc, "myAppName", "mySparkStream",
      dummyEndpointUrl, dummyRegionName,
      InitialPositionInStream.LATEST, Seconds(2), StorageLevel.MEMORY_AND_DISK_2,
      dummyAWSAccessKey, dummyAWSSecretKey)
  }

  test("RDD generation") {
    val inputStream = KinesisUtils.createStream(ssc, appName, "dummyStream",
      dummyEndpointUrl, dummyRegionName, InitialPositionInStream.LATEST, Seconds(2),
      StorageLevel.MEMORY_AND_DISK_2, dummyAWSAccessKey, dummyAWSSecretKey)
    assert(inputStream.isInstanceOf[KinesisInputDStream[Array[Byte]]])

    val kinesisStream = inputStream.asInstanceOf[KinesisInputDStream[Array[Byte]]]
    val time = Time(1000)

    // Generate block info data for testing
    val seqNumRanges1 = SequenceNumberRanges(
      SequenceNumberRange("fakeStream", "fakeShardId", "xxx", "yyy", 67))
    val blockId1 = StreamBlockId(kinesisStream.id, 123)
    val blockInfo1 = ReceivedBlockInfo(
      0, None, Some(seqNumRanges1), new BlockManagerBasedStoreResult(blockId1, None))

    val seqNumRanges2 = SequenceNumberRanges(
      SequenceNumberRange("fakeStream", "fakeShardId", "aaa", "bbb", 89))
    val blockId2 = StreamBlockId(kinesisStream.id, 345)
    val blockInfo2 = ReceivedBlockInfo(
      0, None, Some(seqNumRanges2), new BlockManagerBasedStoreResult(blockId2, None))

    // Verify that the generated KinesisBackedBlockRDD has the all the right information
    val blockInfos = Seq(blockInfo1, blockInfo2)
    val nonEmptyRDD = kinesisStream.createBlockRDD(time, blockInfos)
    nonEmptyRDD shouldBe a [KinesisBackedBlockRDD[_]]
    val kinesisRDD = nonEmptyRDD.asInstanceOf[KinesisBackedBlockRDD[_]]
    assert(kinesisRDD.regionName === dummyRegionName)
    assert(kinesisRDD.endpointUrl === dummyEndpointUrl)
    assert(kinesisRDD.kinesisReadConfigs.retryTimeoutMs === batchDuration.milliseconds)
    assert(kinesisRDD.kinesisCreds === BasicCredentials(
      awsAccessKeyId = dummyAWSAccessKey,
      awsSecretKey = dummyAWSSecretKey))
    assert(nonEmptyRDD.partitions.size === blockInfos.size)
    nonEmptyRDD.partitions.foreach { _ shouldBe a [KinesisBackedBlockRDDPartition] }
    val partitions = nonEmptyRDD.partitions.map {
      _.asInstanceOf[KinesisBackedBlockRDDPartition] }.toSeq
    assert(partitions.map { _.seqNumberRanges } === Seq(seqNumRanges1, seqNumRanges2))
    assert(partitions.map { _.blockId } === Seq(blockId1, blockId2))
    assert(partitions.forall { _.isBlockIdValid === true })

    // Verify that KinesisBackedBlockRDD is generated even when there are no blocks
    val emptyRDD = kinesisStream.createBlockRDD(time, Seq.empty)
    // Verify it's KinesisBackedBlockRDD[_] rather than KinesisBackedBlockRDD[Array[Byte]], because
    // the type parameter will be erased at runtime
    emptyRDD shouldBe a [KinesisBackedBlockRDD[_]]
    emptyRDD.partitions shouldBe empty

    // Verify that the KinesisBackedBlockRDD has isBlockValid = false when blocks are invalid
    blockInfos.foreach { _.setBlockIdInvalid() }
    kinesisStream.createBlockRDD(time, blockInfos).partitions.foreach { partition =>
      assert(partition.asInstanceOf[KinesisBackedBlockRDDPartition].isBlockIdValid === false)
    }
  }

  /**
   * Test the stream by sending data to a Kinesis stream and receiving from it.
   * This test is not run by default as it requires AWS credentials that the test
   * environment may not have. Even if there is AWS credentials available, the user
   * may not want to run these tests to avoid the Kinesis costs. To enable this test,
   * you must have AWS credentials available through the default AWS provider chain,
   * and you have to set the system environment variable RUN_KINESIS_TESTS=1 .
   */
  testIfEnabled("basic operation") {
    val stream = KinesisInputDStream.builder.streamingContext(ssc)
      .checkpointAppName(appName)
      .streamName(testUtils.streamName)
      .endpointUrl(testUtils.endpointUrl)
      .regionName(testUtils.regionName)
      .initialPosition(new Latest())
      .checkpointInterval(Seconds(10))
      .storageLevel(StorageLevel.MEMORY_ONLY)
      .build()

    val collected = new mutable.HashSet[Int]
    stream.map { bytes => new String(bytes).toInt }.foreachRDD { rdd =>
      collected.synchronized {
        collected ++= rdd.collect()
        logInfo("Collected = " + collected.mkString(", "))
      }
    }
    ssc.start()

    val testData = 1 to 10
    eventually(timeout(120 seconds), interval(10 second)) {
      testUtils.pushData(testData, aggregateTestData)
      assert(collected.synchronized { collected === testData.toSet },
        "\nData received does not match data sent")
    }
    ssc.stop(stopSparkContext = false)
  }

  testIfEnabled("custom message handling") {
    def addFive(r: Record): Int = JavaUtils.bytesToString(r.getData).toInt + 5

    val stream = KinesisInputDStream.builder.streamingContext(ssc)
      .checkpointAppName(appName)
      .streamName(testUtils.streamName)
      .endpointUrl(testUtils.endpointUrl)
      .regionName(testUtils.regionName)
      .initialPosition(new Latest())
      .checkpointInterval(Seconds(10))
      .storageLevel(StorageLevel.MEMORY_ONLY)
      .buildWithMessageHandler(addFive(_))

    stream shouldBe a [ReceiverInputDStream[_]]

    val collected = new mutable.HashSet[Int]
    stream.foreachRDD { rdd =>
      collected.synchronized {
        collected ++= rdd.collect()
        logInfo("Collected = " + collected.mkString(", "))
      }
    }
    ssc.start()

    val testData = 1 to 10
    eventually(timeout(120 seconds), interval(10 second)) {
      testUtils.pushData(testData, aggregateTestData)
      val modData = testData.map(_ + 5)
      assert(collected.synchronized { collected === modData.toSet },
        "\nData received does not match data sent")
    }
    ssc.stop(stopSparkContext = false)
  }

  test("Kinesis read with custom configurations") {
    try {
      ssc.sc.conf.set(RETRY_WAIT_TIME_KEY, "2000ms")
      ssc.sc.conf.set(RETRY_MAX_ATTEMPTS_KEY, "5")

      val kinesisStream = KinesisInputDStream.builder.streamingContext(ssc)
      .checkpointAppName(appName)
      .streamName("dummyStream")
      .endpointUrl(dummyEndpointUrl)
      .regionName(dummyRegionName)
      .initialPosition(new Latest())
      .checkpointInterval(Seconds(10))
      .storageLevel(StorageLevel.MEMORY_ONLY)
      .build()
      .asInstanceOf[KinesisInputDStream[Array[Byte]]]

      val time = Time(1000)
      // Generate block info data for testing
      val seqNumRanges1 = SequenceNumberRanges(
        SequenceNumberRange("fakeStream", "fakeShardId", "xxx", "yyy", 67))
      val blockId1 = StreamBlockId(kinesisStream.id, 123)
      val blockInfo1 = ReceivedBlockInfo(
        0, None, Some(seqNumRanges1), new BlockManagerBasedStoreResult(blockId1, None))

      val seqNumRanges2 = SequenceNumberRanges(
        SequenceNumberRange("fakeStream", "fakeShardId", "aaa", "bbb", 89))
      val blockId2 = StreamBlockId(kinesisStream.id, 345)
      val blockInfo2 = ReceivedBlockInfo(
        0, None, Some(seqNumRanges2), new BlockManagerBasedStoreResult(blockId2, None))

      // Verify that the generated KinesisBackedBlockRDD has the all the right information
      val blockInfos = Seq(blockInfo1, blockInfo2)

      val kinesisRDD =
        kinesisStream.createBlockRDD(time, blockInfos).asInstanceOf[KinesisBackedBlockRDD[_]]

      assert(kinesisRDD.kinesisReadConfigs.retryWaitTimeMs === 2000)
      assert(kinesisRDD.kinesisReadConfigs.maxRetries === 5)
      assert(kinesisRDD.kinesisReadConfigs.retryTimeoutMs === batchDuration.milliseconds)
    } finally {
      ssc.sc.conf.remove(RETRY_WAIT_TIME_KEY)
      ssc.sc.conf.remove(RETRY_MAX_ATTEMPTS_KEY)
      ssc.stop(stopSparkContext = false)
    }
  }

  testIfEnabled("split and merge shards in a stream") {
    // Since this test tries to split and merge shards in a stream, we create another
    // temporary stream and then remove it when finished.
    val localAppName = s"KinesisStreamSuite-${math.abs(Random.nextLong())}"
    val localTestUtils = new KPLBasedKinesisTestUtils(1)
    localTestUtils.createStream()
    try {
      val stream = KinesisInputDStream.builder.streamingContext(ssc)
        .checkpointAppName(localAppName)
        .streamName(localTestUtils.streamName)
        .endpointUrl(localTestUtils.endpointUrl)
        .regionName(localTestUtils.regionName)
        .initialPosition(new Latest())
        .checkpointInterval(Seconds(10))
        .storageLevel(StorageLevel.MEMORY_ONLY)
        .build()

      val collected = new mutable.HashSet[Int]
      stream.map { bytes => new String(bytes).toInt }.foreachRDD { rdd =>
        collected.synchronized {
          collected ++= rdd.collect()
          logInfo("Collected = " + collected.mkString(", "))
        }
      }
      ssc.start()

      val testData1 = 1 to 10
      val testData2 = 11 to 20
      val testData3 = 21 to 30

      eventually(timeout(60 seconds), interval(10 second)) {
        localTestUtils.pushData(testData1, aggregateTestData)
        assert(collected.synchronized { collected === testData1.toSet },
          "\nData received does not match data sent")
      }

      val shardToSplit = localTestUtils.getShards().head
      localTestUtils.splitShard(shardToSplit.getShardId)
      val (splitOpenShards, splitCloseShards) = localTestUtils.getShards().partition { shard =>
        shard.getSequenceNumberRange.getEndingSequenceNumber == null
      }

      // We should have one closed shard and two open shards
      assert(splitCloseShards.size == 1)
      assert(splitOpenShards.size == 2)

      eventually(timeout(60 seconds), interval(10 second)) {
        localTestUtils.pushData(testData2, aggregateTestData)
        assert(collected.synchronized { collected === (testData1 ++ testData2).toSet },
          "\nData received does not match data sent after splitting a shard")
      }

      val Seq(shardToMerge, adjShard) = splitOpenShards
      localTestUtils.mergeShard(shardToMerge.getShardId, adjShard.getShardId)
      val (mergedOpenShards, mergedCloseShards) = localTestUtils.getShards().partition { shard =>
        shard.getSequenceNumberRange.getEndingSequenceNumber == null
      }

      // We should have three closed shards and one open shard
      assert(mergedCloseShards.size == 3)
      assert(mergedOpenShards.size == 1)

      eventually(timeout(60 seconds), interval(10 second)) {
        localTestUtils.pushData(testData3, aggregateTestData)
        assert(collected.synchronized { collected === (testData1 ++ testData2 ++ testData3).toSet },
          "\nData received does not match data sent after merging shards")
      }
    } finally {
      ssc.stop(stopSparkContext = false)
      localTestUtils.deleteStream()
      localTestUtils.deleteDynamoDBTable(localAppName)
    }
  }

  testIfEnabled("failure recovery") {
    val sparkConf = new SparkConf().setMaster("local[4]").setAppName(this.getClass.getSimpleName)
    val checkpointDir = Utils.createTempDir().getAbsolutePath

    ssc = new StreamingContext(sc, Milliseconds(1000))
    ssc.checkpoint(checkpointDir)

    val collectedData = new mutable.HashMap[Time, (Array[SequenceNumberRanges], Seq[Int])]

    val kinesisStream = KinesisInputDStream.builder.streamingContext(ssc)
      .checkpointAppName(appName)
      .streamName(testUtils.streamName)
      .endpointUrl(testUtils.endpointUrl)
      .regionName(testUtils.regionName)
      .initialPosition(new Latest())
      .checkpointInterval(Seconds(10))
      .storageLevel(StorageLevel.MEMORY_ONLY)
      .build()

    // Verify that the generated RDDs are KinesisBackedBlockRDDs, and collect the data in each batch
    kinesisStream.foreachRDD((rdd: RDD[Array[Byte]], time: Time) => {
      val kRdd = rdd.asInstanceOf[KinesisBackedBlockRDD[Array[Byte]]]
      val data = rdd.map { bytes => new String(bytes).toInt }.collect().toSeq
      collectedData.synchronized {
        collectedData(time) = (kRdd.arrayOfseqNumberRanges, data)
      }
    })

    ssc.remember(Minutes(60)) // remember all the batches so that they are all saved in checkpoint
    ssc.start()

    def numBatchesWithData: Int =
      collectedData.synchronized { collectedData.count(_._2._2.nonEmpty) }

    def isCheckpointPresent: Boolean = Checkpoint.getCheckpointFiles(checkpointDir).nonEmpty

    // Run until there are at least 10 batches with some data in them
    // If this times out because numBatchesWithData is empty, then its likely that foreachRDD
    // function failed with exceptions, and nothing got added to `collectedData`
    eventually(timeout(2 minutes), interval(1 seconds)) {
      testUtils.pushData(1 to 5, aggregateTestData)
      assert(isCheckpointPresent && numBatchesWithData > 10)
    }
    ssc.stop(stopSparkContext = true)  // stop the SparkContext so that the blocks are not reused

    // Restart the context from checkpoint and verify whether the
    logInfo("Restarting from checkpoint")
    ssc = new StreamingContext(checkpointDir)
    ssc.start()
    val recoveredKinesisStream = ssc.graph.getInputStreams().head

    // Verify that the recomputed RDDs are KinesisBackedBlockRDDs with the same sequence ranges
    // and return the same data
    collectedData.synchronized {
      val times = collectedData.keySet
      times.foreach { time =>
        val (arrayOfSeqNumRanges, data) = collectedData(time)
        val rdd = recoveredKinesisStream.getOrCompute(time).get.asInstanceOf[RDD[Array[Byte]]]
        rdd shouldBe a[KinesisBackedBlockRDD[_]]

        // Verify the recovered sequence ranges
        val kRdd = rdd.asInstanceOf[KinesisBackedBlockRDD[Array[Byte]]]
        assert(kRdd.arrayOfseqNumberRanges.size === arrayOfSeqNumRanges.size)
        arrayOfSeqNumRanges.zip(kRdd.arrayOfseqNumberRanges).foreach { case (expected, found) =>
          assert(expected.ranges.toSeq === found.ranges.toSeq)
        }

        // Verify the recovered data
        assert(rdd.map { bytes => new String(bytes).toInt }.collect().toSeq === data)
      }
    }
    ssc.stop()
  }
}

class WithAggregationKinesisStreamSuite extends KinesisStreamTests(aggregateTestData = true)

class WithoutAggregationKinesisStreamSuite extends KinesisStreamTests(aggregateTestData = false)


text:
import {check} from 'meteor/check';

export default function ({Collections, Meteor}) {
  Meteor.methods({
    'response.select'(_id, sessionId, questionId, selected) {
      check(_id, String);
      check(sessionId, String);
      check(questionId, String);
      check(selected, Number);
      const owner = Meteor.userId();
      if (!owner) {
        throw new Meteor.Error('not-authorized');
      }
      const saving = true;
      const createdAt = new Date();
      const response = {sessionId, questionId, selected, createdAt, owner, saving};
      Collections.Responses.upsert(_id, { $set: response });
    }
  });
}

redpajama_set_name: RedPajamaGithub


text:
@extends('app')

@section('content')

Registrar establecimiento educativo

                    {!! Form::open(['method' => 'POST', 'route' => 'establecimientos.store', 'class' => 'form-horizontal col-md-6']) !!}

                    @include ('establecimientos.partials.form')

                        Cancelar
                        {!! Form::submit("Registrar", ['class' => 'btn btn-success']) !!}

                    {!! Form::close() !!}

@endsection
@section('scripts')

  @include('establecimientos.partials.scripts')

@endsection


text:
get_full_path(){
   echo $(cd $(dirname "$1") && pwd -P)/$(basename "$1")
}

get_osflavor(){
    if [[ -f "/etc/lsb-release" ]]
        then
            echo "ubuntu"
        elif [[ -f "/etc/redhat-release" ]]
        then
            echo "rpm"
        elif [[ -f "/etc/debian_version" ]]
        then
            echo "debian"
        else
            echo "ERROR: Cannot get the system type. Exiting."
            exit 1
    fi
}

install_daemon(){
    echo 'Attempting Daemon Installation'
    cd /tmp
    if [[ $1 == "debian" ]] || [[ "$1" == "ubuntu" ]]
        then
        wget -q https://github.com/terminalcloud/terminal-tools/raw/master/daemon_0.6.4-2_amd64.deb || exit -1
        dpkg -i daemon_0.6.4-2_amd64.deb
    else
        wget -q http://libslack.org/daemon/download/daemon-0.6.4-1.x86_64.rpm || exit -1
        rpm -i daemon-0.6.4-1.x86_64.rpm
    fi
}

install_upstart_init() {
    cat > /tmp/"$name" << END
description "Daemonized Test service -  Upstart script"

start on runlevel [2345]
stop on runlevel [!2345]
respawn

env name="$name"
env command="$command"
env command_args="$command_args"
env daemon="$daemon"
env daemon_start_args="--respawn"
env pidfiles="/var/run"
env user=""
env chroot=""
env chdir=""
env umask=""
env stdout="daemon.info"
env stderr="daemon.err"

pre-start script
[ -x "\$daemon" ] || exit 0
end script

exec "\$daemon"  "\$daemon_start_args" --name "\$name" --pidfiles "\$pidfiles" \
                \${user:+--user \$user} \${chroot:+--chroot \$chroot} \
                \${chdir:+--chdir \$chdir} \${umask:+--umask \$umask} \
                \${stdout:+--stdout \$stdout} \${stderr:+--stderr \$stderr} \
                -- "\$command" \$command_args

pre-stop script
"\$daemon" --stop --name "\$name" --pidfiles "\$pidfiles"
end script
END

    # We only replace the init script if the file does not already exists, and finally we enable it.
    if [[ -f /etc/init/"$name".conf ]]
        then
            echo "The file /etc/init/$name.conf already exist."
            echo "If you want to overwrite it execute \`cp /tmp/$name /etc/init/$name.conf \`"
        else
            cp /tmp/"$name" /etc/init/"$name".conf
            chmod +x /etc/init/"$name".conf
    fi
}

install_sysv_init(){
    cat > /tmp/"$name" << EOF
#!/bin/sh
#
### BEGIN INIT INFO
# Provides:          $name
# Required-Start:
# Required-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Should-Start:
# Should-Stop:
# Short-Description: Daemonized $name service.
### END INIT INFO
# chkconfig: 2345 90 60
name="$name"
command="$command"
command_args="$command_args"
daemon="$daemon"

[ -x "\$daemon" ] || exit 0

# This can be customized as needed
daemon_start_args="--respawn"
pidfiles="/var/run"
user=""
chroot=""
chdir=""
umask=""
stdout="daemon.info"
stderr="daemon.err"

case "\$1" in
    start)
        if "\$daemon" --running --name "\$name" --pidfiles "\$pidfiles"
        then
            echo "\$name is already running."
        else
            echo -n "Starting \$name..."
            "\$daemon" \$daemon_start_args --name "\$name" --pidfiles "\$pidfiles" \${user:+--user \$user} \${chroot:+--chroot \$chroot} \
                \${chdir:+--chdir \$chdir} \${umask:+--umask \$umask} \${stdout:+--stdout \$stdout} \${stderr:+--stderr \$stderr} -- "\$command" \$command_args
            echo done.
        fi
        ;;

    stop)
        if "\$daemon" --running --name "\$name" --pidfiles "\$pidfiles"
        then
            echo -n "Stopping \$name..."
            "\$daemon" --stop --name "\$name" --pidfiles "\$pidfiles"
            echo done.
        else
            echo "\$name is not running."
        fi
        ;;

    restart|reload)
        if "\$daemon" --running --name "\$name" --pidfiles "\$pidfiles"
        then
            echo -n "Restarting \$name..."
            "\$daemon" --restart --name "\$name" --pidfiles "\$pidfiles"
            echo done.
        else
            echo "\$name is not running."
            exit 1
        fi
        ;;

    status)
        "\$daemon" --running --name "\$name" --pidfiles "\$pidfiles" --verbose
        ;;

    *)
        echo "usage: \$0 <start|stop|restart|reload|status>" >&2
        exit 1
esac

exit 0
EOF

    # We only replace the init script if the file does not already exists, and finally we enable it.
    if [[ -f /etc/init.d/"$name" ]]
        then
            echo "The file /etc/init.d/$name already exist."
            echo "If you want to overwrite it execute \`cp /tmp/$name /etc/init.d/ \`"
        else
            cp /tmp/"$name" /etc/init.d/
            chmod +x /etc/init.d/"$name"

            chkconfig --add "$name"
    fi
}

chkconfig_install(){
    if [[ "$1" == "debian" ]]
        then
            echo "Installing chkconfig, please wait"
            apt-get update >> /dev/null
            apt-get -y install chkconfig >> /dev/null
        elif [[ "$1" == "rpm" ]]
            then
                echo "Installing chkconfig, please wait"
                yum -y install chkconfig >> /dev/null
        else
            echo "Cannot install chkconfig utility"
    fi
}

##### Main #####

[[ "$#" -gt 1 ]] || { echo "Usage: $0 service_name command 'command_parameters'"; exit 0 ; }

name=$1
command=$(get_full_path $2)
command_args=$3

# Check file permissions
[[ -e "$command" ]] || { echo "$command does not exist"; echo "Usage: $0 service_name command 'command_parameters'"; exit 1 ; }
[[ -x "$command" ]] || chmod +x "$command"

# Install 'Daemon' if needed
which daemon > /dev/null && echo "Daemon already installed" || install_daemon $(get_osflavor)

# Install SysV init script or Upstart according with the Linux Flavour
daemon=$(which daemon)
if [[ $(get_osflavor) == "ubuntu" ]]
    then
        echo "Installing Upstart Script"
        install_upstart_init
    elif [[ $(get_osflavor) == "debian" ]] || [[ $(get_osflavor) == "rpm" ]]
    then
        echo 'Checking if chkconfig is available'
        which chkconfig > /dev/null && echo "chkconfig installed" || chkconfig_install $(get_osflavor)
        echo "Installing SysV Init script"
        install_sysv_init
    else
        echo "Cannot get the OS Flavor. Exiting."
        exit 1
fi

# Starting the Daemonized service
service "$name" start


text:
This document contains miscellaneous resources, tips, and tricks that are available to PhET developers.

### Applets, extensions, and other Misc to assist in development
##### On Windows
* Ditto clipboard manager - helpful for keeping complex copy paste operation history

##### Chrome
* Lightshot (screenshot tool)
* Tenon Check (accessibility auditing)

### Github
Most of these can be found with simple google searches, but it is nice to have a list of resources that have been
helpful to PhET devs while learning how to superuse Github
* Mastering markdown: https://guides.github.com/features/mastering-markdown/
* Mastering search: https://help.github.com/en/articles/searching-code
* Referencing issues in commit messages can be done in the following ways:
  * If referencing the same repo as the commit, just use a hash: "I did a commit, see #32"
  * You can also use the full URL to the github issue: "The things I did in this commit are good, see https://github.com/phetsims/chipper/issues/32"
  * You can use github shorthand too: "This commit fixes a lot of stuff, see phetsims/chipper#32"

### Debugging iOS devices
##### On Mac
Mac users can use the Safari Web Inspector to debug a sim in mobile Safari. Once you device is connected to your Mac
through USB, you should be able to see your device listed under the "Develop" menu item in the Safari menu bar.
Make sure that "Show Develop in menu bar" is enabled in advanced Safari settings. For more detailed information, see
https://webdesign.tutsplus.com/articles/quick-tip-using-web-inspector-to-debug-mobile-safari--webdesign-8787

##### On Windows
There is nothing native in Windows that lets you debug mobile Apple platforms, but Weinre does a pretty good job. Weinre
is a debugger for web pages, and is designed to work remotely so you can debug mobile devices. It does not support
`debugger` breakpoints, but it allows you to inspect the DOM, print statements, and inspect the application with
JavaScript. Please see https://people.apache.org/~pmuellr/weinre/docs/latest/Home.html for detailed information on
how to install and run Weinre. The following is a quick list that may help get it up and running faster.

1) Weinre is deployed at https://npmjs.org/package/weinre, and you can install it with
  `sudo npm -g install weinre`
2) To run the debug server, run
  `weinre -httpPort [portNumber] -boundHost -all-`
where [portNumber] is your desired http port number. `-boundHost -all-` is required for remote debugging and tells
Weinre to allow all interfaces on the current machine rather than just localhost.
3) Navigate to http://localhost:[portNumber]/client/#anonymous once the Weinre server is running. This is the Weinre
debugging interface.
4) Add this snippet somewhere in the top level sim HTML file.
  `<script src="http://[portNumber]:/target/target-script-min.js#anonymous"></script>`
  This will inject the Weinre target code into the simulation.
5) Launch the simulation from the mobile device. You should see the sim top level HTML file listed under "Targets" in
the Weinre interface.
6) The interface has a similar look and feel to the Chrome dev tools. Have fun debugging!

You can go to `http://localhost:[portNumber]/` once Weinre server is up and running for additional quick help and
information.

Please beware of the following "Gotchyas" that I have encountered while using Weinre
  * HTML Elements in the "Elements" inspector sometimes never appear, especially those that are added later
  with document.createElement().
  * Sometimes elements in the tree navigation of the "Elements" inspector don't appear when you "open" a new level
  by clicking on the triangle next to a parent element. Opening/closing the level a few times sometimes makes the
  elements appear correctly.
  * When styles are removed from an element with the "Styles" panel on the right of the "Elements" inspector, sometimes
  they are removed for good if you click a checkbox, even if you try to add them back. Reloading is the only solution.

#### Getting crash logs
Crash logs are transferred to iTunes whenever the device is synced to another computer. Just plug in your device and
launch iTunes to complete the sync. The location of the crash logs will depend on whether you are using Mac or Windows.

##### On Mac
Logs are located at `~/Library/Logs/CrashReporter/MobileDevice/`. Open the folder with your device's name. Look for files starting with "Read It LaterPro". If you don't see any, try opening a file called "Retired".

##### On Windows.
Logs are located at `~/AppData/Roaming/Apple Computer/Logs/CrashReporter\MobileDevice`. Open the folder with your device's name.

### Accessibility Resources

* The [Accessibility Developer Guide](https://www.accessibility-developer-guide.com/) is fairly comprehensive.


text:
<!DOCTYPE html>

  <title> Wine Fellows </title>
  <link rel="stylesheet" type="text/css" href="style.css" />
  <link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css?family=Arimo" rel="stylesheet">

 Wine Fellows

  <form id="login-form">
    <input name="login" type="text" placeholder="User Name" id="formLogin">
    <button type="submit"> Login </button>
  </form>

  <form id="createUser">

Sign up

      <input name="firstName" type="text" placeholder="First Name" />

      <input name="lastName" type="text" placeholder="Last Name" />

      <input name="userName" type="text" placeholder="Username" />

      <input type="text" name="profilePic" placeholder="Choose your Profile picture! ">

      <button type="submit" class="sign-up-submit"> Find your Winefellow! </button>
    </form>


text:
// This file is part of Hermes3D
//
// Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR).
// Email: hpfem-group@unr.edu, home page: http://hpfem.org/.
//
// This file was written by:
// - David Andrs
// - Pavel Kus
//
// Hermes3D 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.
//
// Hermes3D 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 Hermes3D; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

#ifdef COMMON_WITH_UMFPACK
extern "C" {
#include <umfpack.h>
}
#endif

#include "umfpack.h"
#include "common/trace.h"
#include "common/error.h"
#include "common/utils.h"
#include "common/callstack.h"
#include "common/timer.h"

UMFPackMatrix::UMFPackMatrix() {
	_F_
	Ap = NULL;
	Ai = NULL;
	Ax = NULL;
}

UMFPackMatrix::~UMFPackMatrix() {
	_F_
	free();
}

void UMFPackMatrix::alloc() {
	_F_
	assert(pages != NULL);

	// initialize the arrays Ap and Ai
	Ap = new int [size + 1];
	MEM_CHECK(Ap);
	int aisize = get_num_indices();
	Ai = new int [aisize];
	MEM_CHECK(Ai);

	// sort the indices and remove duplicities, insert into Ai
	int i, pos = 0;
	for (i = 0; i < size; i++) {
		Ap[i] = pos;
		pos += sort_and_store_indices(pages[i], Ai + pos, Ai + aisize);
	}
	Ap[i] = pos;

	delete [] pages;
	pages = NULL;

	Ax = new scalar [Ap[size]];
	MEM_CHECK(Ax);
	memset(Ax, 0, sizeof(scalar) * Ap[size]);
}

void UMFPackMatrix::free() {
	_F_
	delete [] Ap; Ap = NULL;
	delete [] Ai; Ai = NULL;
	delete [] Ax; Ax = NULL;
}

scalar UMFPackMatrix::get(int m, int n)
{
	_F_

	// bin search the value
	register int lo = Ap[m], hi = Ap[m + 1], mid;
	while (1) {
		mid = (lo + hi) >> 1;

		if (n < Ai[mid]) hi = mid - 1;
		else if (n > Ai[mid]) lo = mid + 1;
		else break;

		if (lo > hi) return 0.0;		// entry not set -> e.i. it is zero
	}

	return Ax[mid];
}

void UMFPackMatrix::zero() {
	_F_
	memset(Ax, 0, sizeof(scalar) * Ap[size]);
}

void UMFPackMatrix::add(int m, int n, scalar v) {
	_F_
	if (v != 0.0 && m != DIRICHLET_DOF && n != DIRICHLET_DOF)		// ignore dirichlet DOFs
		insert_value(Ai + Ap[n], Ax + Ap[n], Ap[n + 1] - Ap[n], m, v);
}

void UMFPackMatrix::add(int m, int n, scalar **mat, int *rows, int *cols) {
	_F_
	for (int i = 0; i < m; i++)				// rows
		for (int j = 0; j < n; j++)			// cols
			add(rows[i], cols[j], mat[i][j]);
}

/// dumping matrix and right-hand side
///
bool UMFPackMatrix::dump(FILE *file, const char *var_name, EMatrixDumpFormat fmt) {
	_F_
	switch (fmt) {
		case DF_MATLAB_SPARSE:
			fprintf(file, "%% Size: %dx%d\n%% Nonzeros: %d\ntemp = zeros(%d, 3);\ntemp = [\n", size, size, Ap[size], Ap[size]);
			for (int j = 0; j < size; j++)
				for (int i = Ap[j]; i < Ap[j + 1]; i++)
					fprintf(file, "%d %d " SCALAR_FMT "\n", Ai[i] + 1, j + 1, SCALAR(Ax[i]));
			fprintf(file, "];\n%s = spconvert(temp);\n", var_name);

			return true;

		case DF_HERMES_BIN: {
			hermes_fwrite("H2DX\001\000\000\000", 1, 8, file);
			int ssize = sizeof(scalar);
			int nnz = Ap[size];
			hermes_fwrite(&ssize, sizeof(int), 1, file);
			hermes_fwrite(&size, sizeof(int), 1, file);
			hermes_fwrite(&nnz, sizeof(int), 1, file);
			hermes_fwrite(Ap, sizeof(int), size + 1, file);
			hermes_fwrite(Ai, sizeof(int), nnz, file);
			hermes_fwrite(Ax, sizeof(scalar), nnz, file);
			return true;
		}

		case DF_PLAIN_ASCII:
			EXIT(ERR_NOT_IMPLEMENTED);
			return false;

		default:
			return false;
	}
}

int UMFPackMatrix::get_matrix_size() const {
	_F_
	assert(Ap != NULL);
	return (sizeof(int) + sizeof(scalar)) * (Ap[size] + size);
}

double UMFPackMatrix::get_fill_in() const {
	_F_
	return Ap[size] / (double) (size * size);
}

void UMFPackMatrix::insert_value(int *Ai, scalar *Ax, int Alen, int idx, scalar value) {
	_F_
	if (idx >= 0) {
		register int lo = 0, hi = Alen - 1, mid;

		while (1) {
			mid = (lo + hi) >> 1;

			if (idx < Ai[mid]) hi = mid - 1;
			else if (idx > Ai[mid]) lo = mid + 1;
			else break;

			if (lo > hi) EXIT("Sparse matrix entry not found.");
		}

		Ax[mid] += value;
	}
}

// UMFPackVector ///////

UMFPackVector::UMFPackVector() {
	_F_
	v = NULL;
	size = 0;
}

UMFPackVector::~UMFPackVector() {
	_F_
	free();
}

void UMFPackVector::alloc(int n) {
	_F_
	free();
	size = n;
	v = new scalar [n];
	MEM_CHECK(v);
	zero();
}

void UMFPackVector::zero() {
	_F_
	memset(v, 0, size * sizeof(scalar));
}

void UMFPackVector::free() {
	_F_
	delete [] v;
	v = NULL;
	size = 0;
}

void UMFPackVector::set(int idx, scalar y) {
	_F_
	if (idx >= 0) v[idx] = y;
}

void UMFPackVector::add(int idx, scalar y) {
	_F_
	if (idx >= 0) v[idx] += y;
}

void UMFPackVector::add(int n, int *idx, scalar *y) {
	_F_
	for (int i = 0; i < n; i++)
		if (idx[i] >= 0) v[idx[i]] += y[i];
}

bool UMFPackVector::dump(FILE *file, const char *var_name, EMatrixDumpFormat fmt) {
	_F_
	switch (fmt) {
		case DF_MATLAB_SPARSE:
			fprintf(file, "%% Size: %dx1\n%s = [\n", size, var_name);
			for (int i = 0; i < size; i++)
				fprintf(file, SCALAR_FMT "\n", SCALAR(v[i]));
			fprintf(file, " ];\n");
			return true;

		case DF_HERMES_BIN: {
			hermes_fwrite("H2DR\001\000\000\000", 1, 8, file);
			int ssize = sizeof(scalar);
			hermes_fwrite(&ssize, sizeof(int), 1, file);
			hermes_fwrite(&size, sizeof(int), 1, file);
			hermes_fwrite(v, sizeof(scalar), size, file);
			return true;
		}

		case DF_PLAIN_ASCII:
			EXIT(ERR_NOT_IMPLEMENTED);
			return false;

		default:
			return false;
	}
}

// UMFPack solver //////

#ifndef COMPLEX
// real case
#define umfpack_symbolic(m, n, Ap, Ai, Ax, S, C, I)		umfpack_di_symbolic(m, n, Ap, Ai, Ax, S, C, I)
#define umfpack_numeric(Ap, Ai, Ax, S, N, C, I)			umfpack_di_numeric(Ap, Ai, Ax, S, N, C, I)
#define umfpack_solve(sys, Ap, Ai, Ax, X, B, N, C, I)	umfpack_di_solve(sys, Ap, Ai, Ax, X, B, N, C, I)
#define umfpack_free_symbolic							umfpack_di_free_symbolic
#define umfpack_free_numeric							umfpack_di_free_numeric
#define umfpack_defaults								umfpack_di_defaults
#else
// macros for calling complex UMFPACK in packed-complex mode
#define umfpack_symbolic(m, n, Ap, Ai, Ax, S, C, I)		umfpack_zi_symbolic(m, n, Ap, Ai, (double *) (Ax), NULL, S, C, I)
#define umfpack_numeric(Ap, Ai, Ax, S, N, C, I)			umfpack_zi_numeric(Ap, Ai, (double *) (Ax), NULL, S, N, C, I)
#define umfpack_solve(sys, Ap, Ai, Ax, X, B, N, C, I)	umfpack_zi_solve(sys, Ap, Ai, (double *) (Ax), NULL, (double *) (X), NULL, (double *) (B), NULL, N, C, I)
#define umfpack_free_symbolic							umfpack_di_free_symbolic
#define umfpack_free_numeric							umfpack_zi_free_numeric
#define umfpack_defaults								umfpack_zi_defaults
#endif

UMFPackLinearSolver::UMFPackLinearSolver(UMFPackMatrix *m, UMFPackVector *rhs)
	: LinearSolver(), m(m), rhs(rhs)
{
	_F_
#ifdef COMMON_WITH_UMFPACK
#else
        std::runtime_error("hermes3d was not built with UMFPACK support.");
#endif
}

UMFPackLinearSolver::UMFPackLinearSolver(LinProblem *lp)
	: LinearSolver(lp)
{
	_F_
#ifdef COMMON_WITH_UMFPACK
	m = new UMFPackMatrix;
	rhs = new UMFPackVector;
#else
        std::runtime_error("hermes3d was not built with UMFPACK support.");
#endif
}

UMFPackLinearSolver::~UMFPackLinearSolver() {
	_F_
#ifdef COMMON_WITH_UMFPACK
	if (lp != NULL) {
		delete m;
		delete rhs;
	}
#endif
}

#ifdef COMMON_WITH_UMFPACK

static void check_status(const char *fn_name, int status) {
	_F_
	switch (status) {
		case UMFPACK_OK: break;
		case UMFPACK_WARNING_singular_matrix:       warning("%s: singular matrix!", fn_name); break;
		case UMFPACK_ERROR_out_of_memory:           warning("%s: out of memory!", fn_name); break;
		case UMFPACK_ERROR_argument_missing:        warning("%s: argument missing", fn_name); break;
		case UMFPACK_ERROR_invalid_Symbolic_object: warning("%s: invalid Symbolic object", fn_name); break;
		case UMFPACK_ERROR_invalid_Numeric_object:  warning("%s: invalid Numeric object", fn_name); break;
		case UMFPACK_ERROR_different_pattern:       warning("%s: different pattern", fn_name); break;
		case UMFPACK_ERROR_invalid_system:          warning("%s: invalid system", fn_name); break;
		case UMFPACK_ERROR_n_nonpositive:           warning("%s: n nonpositive", fn_name); break;
		case UMFPACK_ERROR_invalid_matrix:          warning("%s: invalid matrix", fn_name); break;
		case UMFPACK_ERROR_internal_error:          warning("%s: internal error", fn_name); break;
		default:                                    warning("%s: unknown error (%d)", fn_name, status); break;
	}
}

#endif

bool UMFPackLinearSolver::solve() {
	_F_
#ifdef COMMON_WITH_UMFPACK
	assert(m != NULL);
	assert(rhs != NULL);

        /*
	if (lp != NULL)
		lp->assemble(m, rhs);
        */
        assert(m->size == rhs->size);

	Timer tmr;
	tmr.start();

	void *symbolic, *numeric;
	int status;

	status = umfpack_symbolic(m->size, m->size, m->Ap, m->Ai, m->Ax, &symbolic, NULL, NULL);
	if (status != UMFPACK_OK) {
		check_status("umfpack_di_symbolic", status);
		return false;
	}
	if (symbolic == NULL) EXIT("umfpack_di_symbolic error: symbolic == NULL");

	status = umfpack_numeric(m->Ap, m->Ai, m->Ax, symbolic, &numeric, NULL, NULL);
	if (status != UMFPACK_OK) {
		check_status("umfpack_di_numeric", status);
		return false;
	}
	if (numeric == NULL) EXIT("umfpack_di_numeric error: numeric == NULL");

	delete [] sln;
	sln = new scalar[m->size];
	MEM_CHECK(sln);
	memset(sln, 0, m->size * sizeof(scalar));

	status = umfpack_solve(UMFPACK_A, m->Ap, m->Ai, m->Ax, sln, rhs->v, numeric, NULL, NULL);
	if (status != UMFPACK_OK) {
		check_status("umfpack_di_solve", status);
		return false;
	}

	tmr.stop();
	time = tmr.get_seconds();

	umfpack_free_symbolic(&symbolic);
	umfpack_free_numeric(&numeric);

	return true;
#else
	return false;
#endif
}


text:
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle 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 3 of the License, or
// (at your option) any later version.
//
// Moodle 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 Moodle.  If not, see <http://www.gnu.org/licenses/>.

define('AJAX_SCRIPT', true);
require(__DIR__.'/../../config.php');
require_once($CFG->dirroot . '/mod/forum/lib.php');

$forumid        = required_param('forumid', PARAM_INT);             // The forum to subscribe or unsubscribe.
$discussionid   = optional_param('discussionid', null, PARAM_INT);  // The discussionid to subscribe.
$includetext    = optional_param('includetext', false, PARAM_BOOL);

$forum          = $DB->get_record('forum', array('id' => $forumid), '*', MUST_EXIST);
$course         = $DB->get_record('course', array('id' => $forum->course), '*', MUST_EXIST);
if (!$discussion = $DB->get_record('forum_discussions', array('id' => $discussionid, 'forum' => $forumid))) {
    print_error('invaliddiscussionid', 'forum');
}
$cm             = get_coursemodule_from_instance('forum', $forum->id, $course->id, false, MUST_EXIST);
$context        = context_module::instance($cm->id);

require_sesskey();
require_login($course, false, $cm);
require_capability('mod/forum:viewdiscussion', $context);

$return = new stdClass();

if (is_guest($context, $USER)) {
    // is_guest should be used here as this also checks whether the user is a guest in the current course.
    // Guests and visitors cannot subscribe - only enrolled users.
    throw new moodle_exception('noguestsubscribe', 'mod_forum');
}

if (!\mod_forum\subscriptions::is_subscribable($forum)) {
    // Nothing to do. We won't actually output any content here though.
    echo json_encode($return);
    die;
}

if (\mod_forum\subscriptions::is_subscribed($USER->id, $forum, $discussion->id, $cm)) {
    // The user is subscribed, unsubscribe them.
    \mod_forum\subscriptions::unsubscribe_user_from_discussion($USER->id, $discussion, $context);
} else {
    // The user is unsubscribed, subscribe them.
    \mod_forum\subscriptions::subscribe_user_to_discussion($USER->id, $discussion, $context);
}

// Now return the updated subscription icon.
$return->icon = forum_get_discussion_subscription_icon($forum, $discussion->id, null, $includetext);
echo json_encode($return);
die;


text:
<page-menu></page-menu>

Non-Trivial AngularJS Made Easy

    Everything you need to kickstart AngularJS projects: a best-practice
    directory structure, an intelligent build system, and the best web design
    libraries around.

      Read the Docs

      Download

<page-footer></page-footer>


text:
package com.raibledesigns.webapp.controller;

import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mock.web.MockHttpSession;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.ResultActions;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.subethamail.wiser.Wiser;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

public class PasswordHintControllerTest extends BaseControllerTestCase {
    @Autowired
    private PasswordHintController controller;

    private MockMvc mockMvc;

    @Before
    public void setUp() {
        mockMvc = MockMvcBuilders.standaloneSetup(controller).build();
    }

    @Test
    public void testExecute() throws Exception {
       // start SMTP Server
        Wiser wiser = startWiser(getSmtpPort());

        ResultActions actions = mockMvc.perform(get("/passwordHint.html").param("username", "user"))
            .andExpect(status().is3xxRedirection());

        MvcResult result = actions.andReturn();
        MockHttpSession session = (MockHttpSession) result.getRequest().getSession();
        // verify that success messages are in the session
        assertNotNull(session.getAttribute(BaseFormController.MESSAGES_KEY));

        // verify an account information e-mail was sent
        wiser.stop();
        assertTrue(wiser.getMessages().size() == 1);
    }
}


text:
***
### Features
- Output to latex
- Draw Gate Diagrams
- Qudits
- Benchmarks
- Custom Programming Language / Parser
- Extra Gates (i.e. Swap, Toffoli)
- Quantum Functions (i.e. Grover Search)
- State Dump for debugging programs


text:
package org.nohope.validation;

/**
 * Unfortunately there is impossible to provide -javadoc.jar for aspectj project. We are terribly sorry about that.
 *
 * @author ketoth xupack
 * @since 9/19/13 5:47 PM
 */
public class ReadMe {
}


text:
import { Meteor } from 'meteor/meteor';
import _ from 'underscore';
import { IMAPIntercepter, POP3Helper } from '../lib/interceptDirectReplyEmails.js';

const startEmailIntercepter = _.debounce(Meteor.bindEnvironment(function() {
	console.log('Starting Email Intercepter...');

	if (RocketChat.settings.get('Direct_Reply_Enable') && RocketChat.settings.get('Direct_Reply_Protocol') && RocketChat.settings.get('Direct_Reply_Host') && RocketChat.settings.get('Direct_Reply_Port') && RocketChat.settings.get('Direct_Reply_Username') && RocketChat.settings.get('Direct_Reply_Password')) {
		if (RocketChat.settings.get('Direct_Reply_Protocol') === 'IMAP') {
			// stop already running IMAP instance
			if (RocketChat.IMAP && RocketChat.IMAP.isActive()) {
				console.log('Disconnecting already running IMAP instance...');
				RocketChat.IMAP.stop(Meteor.bindEnvironment(function() {
					console.log('Starting new IMAP instance......');
					RocketChat.IMAP = new IMAPIntercepter();
					RocketChat.IMAP.start();
					return true;
				}));
			} else if (RocketChat.POP3 && RocketChat.POP3Helper && RocketChat.POP3Helper.isActive()) {
				console.log('Disconnecting already running POP instance...');
				RocketChat.POP3Helper.stop(Meteor.bindEnvironment(function() {
					console.log('Starting new IMAP instance......');
					RocketChat.IMAP = new IMAPIntercepter();
					RocketChat.IMAP.start();
					return true;
				}));
			} else {
				console.log('Starting new IMAP instance......');
				RocketChat.IMAP = new IMAPIntercepter();
				RocketChat.IMAP.start();
				return true;
			}
		} else if (RocketChat.settings.get('Direct_Reply_Protocol') === 'POP') {
			// stop already running POP instance
			if (RocketChat.POP3 && RocketChat.POP3Helper && RocketChat.POP3Helper.isActive()) {
				console.log('Disconnecting already running POP instance...');
				RocketChat.POP3Helper.stop(Meteor.bindEnvironment(function() {
					console.log('Starting new POP instance......');
					RocketChat.POP3Helper = new POP3Helper();
					RocketChat.POP3Helper.start();
					return true;
				}));
			} else if (RocketChat.IMAP && RocketChat.IMAP.isActive()) {
				console.log('Disconnecting already running IMAP instance...');
				RocketChat.IMAP.stop(Meteor.bindEnvironment(function() {
					console.log('Starting new POP instance......');
					RocketChat.POP3Helper = new POP3Helper();
					RocketChat.POP3Helper.start();
					return true;
				}));
			} else {
				console.log('Starting new POP instance......');
				RocketChat.POP3Helper = new POP3Helper();
				RocketChat.POP3Helper.start();
				return true;
			}
		}
	} else if (RocketChat.IMAP && RocketChat.IMAP.isActive()) {
		// stop IMAP instance
		RocketChat.IMAP.stop();
	} else if (RocketChat.POP3 && RocketChat.POP3Helper.isActive()) {
		// stop POP3 instance
		RocketChat.POP3Helper.stop();
	}
}), 1000);

RocketChat.settings.onload(/^Direct_Reply_.+/, startEmailIntercepter);


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml.Data;

namespace Feels.Converters {
    public class WeatherIcon : IValueConverter {
        public object Convert(object value, Type targetType, object parameter, string language) {
            if (value == null) return null;
            var icon = (string)value;

            var path = "";
            switch (icon) {
                case "clear-day":
                    path = "ms-appx:///Assets/Icons/sun.png";
                    break;
                case "clear-night":
                    path = "ms-appx:///Assets/Icons/moon.png";
                    break;
                case "partly-cloudy-day":
                    path = "ms-appx:///Assets/Icons/partycloudy_day.png";
                    break;
                case "partly-cloudy-night":
                    path = "ms-appx:///Assets/Icons/partycloudy_night.png";
                    break;
                case "cloudy":
                    path = "ms-appx:///Assets/Icons/cloudy.png";
                    break;
                case "rain":
                    path = "ms-appx:///Assets/Icons/rain.png";
                    break;
                case "sleet": // neige fondu
                    path = "ms-appx:///Assets/Icons/sleet.png";
                    break;
                case "snow":
                    path = "ms-appx:///Assets/Icons/snow.png";
                    break;
                case "wind":
                    path = "ms-appx:///Assets/Icons/wind.png";
                    break;
                case "fog":
                    path = "ms-appx:///Assets/Icons/fog.png";
                    break;
                default:
                    path = "ms-appx:///Assets/Icons/sun.png";
                    break;
            }

            return new Uri(path);
        }

        public object ConvertBack(object value, Type targetType, object parameter, string language) {
            throw new NotImplementedException();
        }
    }
}


text:
package org.woehlke.twitterwall.backend.mq.users.endpoint.splitter.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.messaging.Message;
import org.springframework.social.RateLimitExceededException;
import org.springframework.social.twitter.api.TwitterProfile;
import org.springframework.stereotype.Component;
import org.woehlke.twitterwall.configuration.properties.TwitterProperties;
import org.woehlke.twitterwall.oodm.model.Task;
import org.woehlke.twitterwall.oodm.model.User;
import org.woehlke.twitterwall.oodm.model.parts.CountedEntities;
import org.woehlke.twitterwall.oodm.model.tasks.TaskType;
import org.woehlke.twitterwall.oodm.service.TaskService;
import org.woehlke.twitterwall.oodm.service.UserService;
import org.woehlke.twitterwall.backend.mq.users.endpoint.splitter.UpdateUsersSplitter;
import org.woehlke.twitterwall.backend.mq.tasks.TaskMessage;
import org.woehlke.twitterwall.backend.mq.users.msg.UserMessage;
import org.woehlke.twitterwall.backend.mq.users.msg.UserMessageBuilder;
import org.woehlke.twitterwall.backend.service.remote.TwitterApiService;
import org.woehlke.twitterwall.oodm.service.CountedEntitiesService;

import java.util.ArrayList;
import java.util.List;

import static org.woehlke.twitterwall.CronJobs.TWELVE_HOURS;
import static org.woehlke.twitterwall.frontend.content.ContentFactory.FIRST_PAGE_NUMBER;

@Component("mqUpdateUserSplitter")
public class UpdateUsersSplitterImpl implements UpdateUsersSplitter {

    private static final Logger log = LoggerFactory.getLogger(UpdateUsersSplitterImpl.class);

    private final TwitterProperties twitterProperties;

    private final TwitterApiService twitterApiService;

    private final TaskService taskService;

    private final UserService userService;

    private final CountedEntitiesService countedEntitiesService;

    private final UserMessageBuilder userMessageBuilder;

    @Autowired
    public UpdateUsersSplitterImpl(TwitterProperties twitterProperties, TwitterApiService twitterApiService, TaskService taskService, UserService userService, CountedEntitiesService countedEntitiesService, UserMessageBuilder userMessageBuilder) {
        this.twitterProperties = twitterProperties;
        this.twitterApiService = twitterApiService;
        this.taskService = taskService;
        this.userService = userService;
        this.countedEntitiesService = countedEntitiesService;
        this.userMessageBuilder = userMessageBuilder;
    }

    @Override
    public List<Message<UserMessage>> splitUserMessage(Message<TaskMessage> incomingTaskMessage) {
        String msg = "### mqUpdateUserProfiles.splitTweetMessage: ";
        log.debug(msg+ " START");
        CountedEntities countedEntities = countedEntitiesService.countAll();
        TaskMessage msgIn = incomingTaskMessage.getPayload();
        long id = msgIn.getTaskId();
        Task task = taskService.findById(id);
        task =  taskService.start(task,countedEntities);
        TaskType taskType = task.getTaskType();
        int loopId = 0;
        int loopAll = 0;
        boolean hasNext=true;
        List<Long> worklistProfileTwitterIds = new ArrayList<>();
        Pageable pageRequest = new PageRequest(FIRST_PAGE_NUMBER, twitterProperties.getPageSize());
        while (hasNext) {
            Page<User> userProfileTwitterIds = userService.getAll(pageRequest);
            for(User user:userProfileTwitterIds.getContent()){
                if(!user.getTaskBasedCaching().isCached(taskType, TWELVE_HOURS)){
                    loopId++;
                    loopAll++;
                    log.debug(msg+ "### userService.getAllTwitterIds: ("+loopId+")  "+user.getIdTwitter());
                    worklistProfileTwitterIds.add(user.getIdTwitter());
                    user = userService.store(user,task);
                }
            }
            hasNext = userProfileTwitterIds.hasNext();
            pageRequest = pageRequest.next();
        }
        long number = worklistProfileTwitterIds.size();
        loopId = 0;
        List<Message<UserMessage>> userProfileList = new ArrayList<>();
        for(Long userProfileTwitterId:worklistProfileTwitterIds){
            String counter = " ( " + loopId + " from " + number + " ) ";
            log.debug(msg + counter);
            TwitterProfile userProfile = null;
            loopId++;
            try {
                log.debug(msg+"### twitterApiService.getUserProfileForTwitterId("+userProfileTwitterId+") "+counter);
                userProfile = twitterApiService.getUserProfileForTwitterId(userProfileTwitterId);
            } catch (RateLimitExceededException e) {
                log.error(msg + "### ERROR: twitterApiService.getUserProfileForTwitterId("+userProfileTwitterId+") "+counter,e);
            }
            if(userProfile != null){
                Message<UserMessage> mqMessageOut = userMessageBuilder.buildUserMessage(incomingTaskMessage,userProfile,loopId,loopAll);
                userProfileList.add(mqMessageOut);
            }
        }
        log.debug(msg+ " DONE");
        return userProfileList;
    }
}


text:
layout:     post
title:      "Bajnokságszervező"
date:       2017-05-15 09:00:00
author:     "SzeLev"
header-img: "img/projektek/almasderes/szelevprojekt/header.jpg"
categories: projektek
tags: ["almasderes"]
---

# Bevezetés #

Kisebb házi bajnokságok esetén a verseny megszervezése, és az eredmények követése legtöbbször papíron történik, mely nehezíti a
 feldolgozást. Ezért készítettem egy alkalmazást, mellyel mobileszközünket használva tudjuk a mérkőzések eredményeit rögzíteni
és a szoftver segítségével azonnal megtudhatjuk a bajnokság aktuális állását.

# Technológia #

Az alkalmazás azért készült mobileszközre, mivel egy ilyen bajnokság helyszínén nem biztos, hogy van WiFi (pl. tengerparton),
valamint okostelefonja majdnem mindenkinek van.

A fejlesztés során [Android Studio][1]-t használtam, mely főleg java-t és xml-t használ.

# Funkciók #

A szoftver két fajta bajnokságot tud kezelni.

## Körmérkőzéses bajnokság ##

A játékosok/csapatok eredményeit táblázatba rögzíthetjük. A gyakoribb eredmények külön gombok segítségével elérhetőek. A
rögzítendő mérkőzésben játszó csapatokat kétféleképpen is kiválaszthatjuk: legördülő listából, vagy a mérkőzés eredményére
kattintva.

Az eredmények bevitele után/közben megtekinthető a verseny állása. A győzelemért, vereségért és döntetlenért kapható pontokat
menüben lehet állítani, az alapértelmezett beállítás 3, 0, 1.

## Egyeneskieséses bajnokság ##

A mérkőzésekre a sorsolás véletlenszerű. Ha egy páratlansok játékost/csapatot kell összesorsolni, akkor közülük az egyiknek nem
 kell játszani, automatikusan továbbjut (jelen esetben Józsi).

Miután az összes mérkőzés eredményét rögzítettük, a következő kör párosítását kisorsolhatjuk.

A projekt GitHub-ról [letölthető][2].

[1]: https://developer.android.com/studio/index.html
[2]: https://github.com/techtabor/Bajnoksag


text:
line_width = 60
puts( "Table of Contents".center(line_width))
puts( "Chapter 1: Getting Started".ljust(line_width/2) + "page  1".rjust(line_width/2))
puts( "Chapter 2: Numbers".ljust(line_width/2) + "page  9".rjust(line_width/2))
puts( "Chapter 3: Letters".ljust(line_width/2) + "page 13".rjust(line_width/2))


text:
namespace dp2Circulation
{
    partial class TestingForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.menuStrip1 = new System.Windows.Forms.MenuStrip();
            this.ToolStripMenuItem_test = new System.Windows.Forms.ToolStripMenuItem();
            this.ToolStripMenuItem_createAccessNo = new System.Windows.Forms.ToolStripMenuItem();
            this.ToolStripMenuItem_moveBiblioRecord = new System.Windows.Forms.ToolStripMenuItem();
            this.ToolStripMenuItem_compileAllProjects = new System.Windows.Forms.ToolStripMenuItem();
            this.ToolStripMenuItem_parsePriceUnit = new System.Windows.Forms.ToolStripMenuItem();
            this.ToolStripMenuItem_objectWriteRead = new System.Windows.Forms.ToolStripMenuItem();
            this.button1 = new System.Windows.Forms.Button();
            this.statusStrip1 = new System.Windows.Forms.StatusStrip();
            this.toolStrip1 = new System.Windows.Forms.ToolStrip();
            this.menuStrip2 = new System.Windows.Forms.MenuStrip();
            this.ToolStripMenuItem_logAndRecover = new System.Windows.Forms.ToolStripMenuItem();
            this.menuStrip1.SuspendLayout();
            this.SuspendLayout();
            //
            // menuStrip1
            //
            this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.ToolStripMenuItem_test});
            this.menuStrip1.Location = new System.Drawing.Point(0, 0);
            this.menuStrip1.Name = "menuStrip1";
            this.menuStrip1.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
            this.menuStrip1.Size = new System.Drawing.Size(284, 25);
            this.menuStrip1.TabIndex = 0;
            this.menuStrip1.Text = "menuStrip1";
            //
            // ToolStripMenuItem_test
            //
            this.ToolStripMenuItem_test.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.ToolStripMenuItem_createAccessNo,
            this.ToolStripMenuItem_moveBiblioRecord,
            this.ToolStripMenuItem_compileAllProjects,
            this.ToolStripMenuItem_parsePriceUnit,
            this.ToolStripMenuItem_objectWriteRead,
            this.ToolStripMenuItem_logAndRecover});
            this.ToolStripMenuItem_test.Name = "ToolStripMenuItem_test";
            this.ToolStripMenuItem_test.Size = new System.Drawing.Size(44, 21);
            this.ToolStripMenuItem_test.Text = "测试";
            //
            // ToolStripMenuItem_createAccessNo
            //
            this.ToolStripMenuItem_createAccessNo.Name = "ToolStripMenuItem_createAccessNo";
            this.ToolStripMenuItem_createAccessNo.Size = new System.Drawing.Size(220, 22);
            this.ToolStripMenuItem_createAccessNo.Text = "创建索取号(种次号)";
            this.ToolStripMenuItem_createAccessNo.Click += new System.EventHandler(this.ToolStripMenuItem_createAccessNo_Click);
            //
            // ToolStripMenuItem_moveBiblioRecord
            //
            this.ToolStripMenuItem_moveBiblioRecord.Name = "ToolStripMenuItem_moveBiblioRecord";
            this.ToolStripMenuItem_moveBiblioRecord.Size = new System.Drawing.Size(220, 22);
            this.ToolStripMenuItem_moveBiblioRecord.Text = "移动书目记录";
            this.ToolStripMenuItem_moveBiblioRecord.Click += new System.EventHandler(this.ToolStripMenuItem_moveBiblioRecord_Click);
            //
            // ToolStripMenuItem_compileAllProjects
            //
            this.ToolStripMenuItem_compileAllProjects.Name = "ToolStripMenuItem_compileAllProjects";
            this.ToolStripMenuItem_compileAllProjects.Size = new System.Drawing.Size(220, 22);
            this.ToolStripMenuItem_compileAllProjects.Text = "编译所有统计方案";
            this.ToolStripMenuItem_compileAllProjects.Click += new System.EventHandler(this.ToolStripMenuItem_compileAllProjects_Click);
            //
            // ToolStripMenuItem_parsePriceUnit
            //
            this.ToolStripMenuItem_parsePriceUnit.Name = "ToolStripMenuItem_parsePriceUnit";
            this.ToolStripMenuItem_parsePriceUnit.Size = new System.Drawing.Size(220, 22);
            this.ToolStripMenuItem_parsePriceUnit.Text = "ParsePriceUnit()";
            this.ToolStripMenuItem_parsePriceUnit.Click += new System.EventHandler(this.ToolStripMenuItem_parsePriceUnit_Click);
            //
            // ToolStripMenuItem_objectWriteRead
            //
            this.ToolStripMenuItem_objectWriteRead.Name = "ToolStripMenuItem_objectWriteRead";
            this.ToolStripMenuItem_objectWriteRead.Size = new System.Drawing.Size(220, 22);
            this.ToolStripMenuItem_objectWriteRead.Text = "元数据和对象的写入和读出";
            this.ToolStripMenuItem_objectWriteRead.Click += new System.EventHandler(this.ToolStripMenuItem_objectWriteRead_Click);
            //
            // button1
            //
            this.button1.Location = new System.Drawing.Point(22, 55);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(75, 23);
            this.button1.TabIndex = 3;
            this.button1.Text = "button1";
            this.button1.UseVisualStyleBackColor = true;
            //
            // statusStrip1
            //
            this.statusStrip1.Location = new System.Drawing.Point(0, 239);
            this.statusStrip1.Name = "statusStrip1";
            this.statusStrip1.Size = new System.Drawing.Size(284, 22);
            this.statusStrip1.TabIndex = 2;
            this.statusStrip1.Text = "statusStrip1";
            //
            // toolStrip1
            //
            this.toolStrip1.Location = new System.Drawing.Point(0, 25);
            this.toolStrip1.Name = "toolStrip1";
            this.toolStrip1.Size = new System.Drawing.Size(284, 25);
            this.toolStrip1.TabIndex = 1;
            this.toolStrip1.Text = "toolStrip1";
            //
            // menuStrip2
            //
            this.menuStrip2.Location = new System.Drawing.Point(0, 0);
            this.menuStrip2.Name = "menuStrip2";
            this.menuStrip2.Size = new System.Drawing.Size(284, 24);
            this.menuStrip2.TabIndex = 4;
            this.menuStrip2.Text = "menuStrip2";
            this.menuStrip2.Visible = false;
            //
            // ToolStripMenuItem_logAndRecover
            //
            this.ToolStripMenuItem_logAndRecover.Name = "ToolStripMenuItem_logAndRecover";
            this.ToolStripMenuItem_logAndRecover.Size = new System.Drawing.Size(220, 22);
            this.ToolStripMenuItem_logAndRecover.Text = "测试日志和恢复";
            this.ToolStripMenuItem_logAndRecover.Click += new System.EventHandler(this.ToolStripMenuItem_logAndRecover_Click);
            //
            // TestingForm
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 261);
            this.Controls.Add(this.toolStrip1);
            this.Controls.Add(this.statusStrip1);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.menuStrip1);
            this.Controls.Add(this.menuStrip2);
            this.MainMenuStrip = this.menuStrip1;
            this.Name = "TestingForm";
            this.Text = "TestingForm";
            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.TestingForm_FormClosing);
            this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.TestingForm_FormClosed);
            this.Load += new System.EventHandler(this.TestingForm_Load);
            this.menuStrip1.ResumeLayout(false);
            this.menuStrip1.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.MenuStrip menuStrip1;
        private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem_test;
        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.StatusStrip statusStrip1;
        private System.Windows.Forms.ToolStrip toolStrip1;
        private System.Windows.Forms.MenuStrip menuStrip2;
        private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem_createAccessNo;
        private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem_moveBiblioRecord;
        private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem_compileAllProjects;
        private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem_parsePriceUnit;
        private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem_objectWriteRead;
        private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem_logAndRecover;

    }
}


text:
Epic.Vectors is a generic C# vector library.

## The problem

So what problem is Epic.Vectors trying to solve?

There are already C# libraries for vectors, like the OpenTK one. The problem with these libraries is that they are tied to a specific library. This library is deliberately library agnostic; the developer has no ties with any major code that uses Epic.Vectors.

## Thought process

This section describes the rationale for developing Epic.Vectors and how its design patterns were chosen.

Okay, so let's say we want to write a C# program that does a lot of vector math.

### Step 1: arrays

Initially, we try to write it with arrays of integers:

	// Array initialize syntax makes our code look awesome:
	int[] a = {0, 1, 0};
	int[] b = {1, 1};
	// However, we can't do a+b; instead we have to do this:
	int[] c = {a.X() + b.X(),
	           a.Y() + b.Y(),
	           a.Z() + 0};

Pros:
1. We get to use the array initializer syntax.

Cons:
1. We can't have vector operators.

### Step 2: array wrappers

Okay so now we decide to use a wrapper class for vectors.

    public class Vector<T>
    {
        public T[] Values { get; private set; }

        public Vector(T[] values)
        {
            Values = values;
        }

        public static Vector<T> operator +(Vector<T> v1, Vector<T> v2)
        {
            throw new NotImplementedException();
        }

        public override string ToString()
		{
		    return string.Join(", ", Values);
		}
    }

    public static class Extensions
    {
        public static Vector<T> ToVector<T>(this T[] array)
        {
            return new Vector<T>(array);
        }
    }

So now we can do this:

    var a = new [] {0, 1, 2}.ToVector();
    var b = new [] {9, 9, 9}.ToVector();
	var c = a+b;
    Console.WriteLine(c); // Output: 9, 10, 11

Pros:

1. We can still use the nice array initializer syntax, although there's a little boilerplate around it.
2. We can implement the + operator.
3. We now have generics
4. We have a ToString method

## Features

### Lots of ways to create vectors

	// You can use the friendly array initializer syntax with an extension method:
	var aVector = new[]{1,2,3}.ToVector();

    {
	    // You can use a generic method that doesn't require you to explicitly specify the type:
	    var v1 = Vector.Create(6, 7, 4);
		// Note: if you were required to specify the type,
		// the code would look like this:
	    //var v1 = Vector.Create<int>(6, 7, 4);

		// You can create vectors that require a certain number of components:
		var v2 = Vector3.Create(0, 0, 1);

	    // You can use the constructor:
	    var v3 = new Vector3<int>(0, 0, 1);
	}

### Combining vectors to create more vectors

    // Combining vectors is pretty easy:
    {
        var a = Vector3.Create(0, 1, 2);
        var b = Vector4.Create(-1, a);
		var a = Vector4.Create(a.Xy, b.Zw);
        Console.WriteLine(b);
        Console.ReadKey();
    }

	// You can also use extension methods to combine vectors:
	{
	    var a = Vector3.Create(0, 2, 3);
	    var b = a.ToVector4(6); // b = 0, 2, 3, 6
	    var c = b.Yx.ToVector3(9); // c = 2, 0, 9
	}

### Implements IEnumerable

    // Implements IEnumerable:
	foreach(var element in aVector)
    {
        Console.WriteLine(element);
    }

### Implements IReadOnlyList

	// Implements IReadOnlyList:
    for(var i = 0; i < aVector.Count; i++)
    {
        Console.WriteLine(aVector[i]);
    }

### Supports operators like *, +, /, -

	// Supports operators:
    {
        var a = new[] { 0, 1, 2 }.ToVector();
        var b = new[] { 0, 1, 2 }.ToVector();
        var c = a*b;
		Console.WriteLine(c);
    }

### Vector types can specify how many elements

	// Includes types that force a specific number of elements in a vector:
	{
		var a = new[] {0, 1, 2}.ToVector3();

		// The following line compiles, but crashes
		// at runtime because only two coordinates
		// were passed in
		var b = new[] {0, 1}.ToVector3();

		var c = new[] {0, 1}.ToVector2();

		var d = new[] {0, 1, 9, 10}.ToVector4();
	}

### X, Y, Z, and W access

	// Supports X, Y, Z, and W access:
	{
		var ex1 = aVector.X + aVector.Y;
	}

	// Supports combinations of X, Y, Z, and W access, in any order:
	{
		var ex2 = aVector.Xyz;
		var ex3 = aVector.Xy;
		var ex3 = aVector.Zyx;
		var ex3 = aVector.Zywx;
	}

### Reactive Extensions

    // Supports any operations supported by Epic.Numbers.
	// Here, we're adding two event streams of integers.
    {
        Numbers.Arithmetic.Plus.PlusUtil<IObservable<int>, IObservable<int>, IObservable<int>>.Plus = Add;

        var a = Vectors.Create(new CustomSubject<int>(0), new CustomSubject<int>(3));
        var b = Vectors.Create(new CustomSubject<int>(0), new CustomSubject<int>(8));

        var aObs = a.Select(subj => subj.AsObservable()).ToVector();
        var bObs = b.Select(subj => subj.AsObservable()).ToVector();

        var c = aObs + bObs;

        c.X.Subscribe(Console.WriteLine);

        a.X.OnNext(9);
        b.X.OnNext(7);

        Console.ReadKey();
    }

    private static IObservable<int> Add(IObservable<int> arg1, IObservable<int> arg2)
    {
        return arg1.CombineLatest(arg2, (a, b) => a + b);
    }

	// Here, we're adding two vectors, where each element
	// of each vector is an event stream of integers.
    {
        Numbers.Arithmetic.Plus.PlusUtil<IObservable<Vector3<int>>, IObservable<Vector3<int>>, IObservable<Vector3<int>>>.Plus = Add;

        var a = Vectors.Create(new CustomSubject<Vector3<int>>(Vector3.Default<int>()), new CustomSubject<Vector3<int>>(Vector3.Create(4, 4, 4)));
        var b = Vectors.Create(new CustomSubject<Vector3<int>>(Vector3.Create(0, 0, 0)), new CustomSubject<Vector3<int>>(Vector3.Create(8, 8, 8)));

        var aObs = a.Select(subj => subj.AsObservable()).ToVector();
        var bObs = b.Select(subj => subj.AsObservable()).ToVector();

        var c = aObs + bObs;

        c.X.Subscribe(Console.WriteLine);

        a.X.OnNext(Vector3.Create(0, 3, 2));
        b.X.OnNext(Vector3.Create(0, 3, 2));

        Console.ReadKey();
    }

    private static IObservable<Vector3<int>> Add(IObservable<Vector3<int>> arg1, IObservable<Vector3<int>> arg2)
    {
        return arg1.CombineLatest(arg2, (a, b) => a + b);
    }

## Limitations

### No interface types

There are no interface types that represent vectors. This is required because of [this](http://stackoverflow.com/questions/7664790/why-does-the-c-sharp-compiler-complain-that-types-may-unify-when-they-derive-f) error in C#.

### Vectors with different dimensions

You can't add a `Vector2<T>` and a `Vector3<T>`; you have to convert one of them to the other type first (e.g., add a zero at the end of the 2D vector). This applies to any differing vector types (`Vector<T>`, `Vector4<T>`, `Vector3<T>`, or `Vector2<T>`). Example:

	var v1 = Vector2.Create(1, 1);
	var v2 = Vector3.Create(2, 2, 2);
	var v3 = v1 + v2; // this causes a compile-time error.

To add a zero at the end of `v1`, you could do this:

	var v1 = Vector2.Create(1, 1);
	var v1_3 = v1.ToVector3(0);
	var v2 = Vector3.Create(2, 2, 2);
	var v3 = v1 + v2; // this causes a compile-time error.

You *can*, however, add a `Vector<T>` and a `Vector<T>` of course; and `Vector<T>` objects can have arbitrary dimensions. Like this:

	var v1 = Vector.Create(1, 1);
	var v2 = Vector.Create(2, 2, 2);
	var v3 = v1 + v2; // this compiles and results in v3 = 3, 3, 2

### Vectors with different types for each component

You can't have a Vector where the X value is a `double` and the Y value is an `int` for example.

### Interacting between two vectors with different generic types

You can't use operators on two vectors with differing generic type parameters:

	var doubles = Vector.Create(1.0, 2.0);
	var ints = Vector.Create(1, 2);
	var result = doubles + ints; // this causes a compile-time error

Instead, you should convert them to be the same type, like this:

	var doubles = Vector.Create(1.0, 2.0);
	var ints = Vector.Create(1, 2);
	var result = doubles + ints.Cast<double>().ToVector(); // this does NOT cause a compile-time error

### Does not support vectors with unknown sizes

Because the Vector classes implement IReadOnlyList, it is impossible for them to have an unknown size. This means that vectors of infinite size are not supported, as would be possible if the Vector class used IEnumerable only.


text:
class EEEPROM
{
	private:
	public:
		EEEPROM();
		void i2c_eeprom_write_byte( int deviceaddress, unsigned int eeaddress, byte data );
		void i2c_eeprom_write_page( int deviceaddress, unsigned int eeaddresspage, byte* data, byte length );
		byte i2c_eeprom_read_byte( int deviceaddress, unsigned int eeaddress );
		void i2c_eeprom_read_buffer( int deviceaddress, unsigned int eeaddress, byte *buffer, int length );
};

#endif


text:
package org.locke.biokit.chemistry.molecule.compounds.polymers.analysis.motif.greedy;

import org.locke.biokit.chemistry.molecule.compounds.polymers.analysis.motif.MotifFinder;
import org.locke.biokit.chemistry.molecule.compounds.polymers.analysis.motif.MotifMatrix;
import org.locke.biokit.chemistry.molecule.compounds.polymers.collections.PolymerArrayList;
import org.locke.superkit.language.objects.MutableValue;
import org.locke.superkit.language.scalars.numbers.count.Count;

public class GreedyMotifFinder implements MotifFinder
{
	private final Count k;

	public GreedyMotifFinder(final Count k)
	{
		this.k = k;
	}

	@Override
	public MotifMatrix find(final PolymerArrayList polymers)
	{
		final MutableValue<MotifMatrix> best = new MutableValue<>();
		polymers.head().kmers(k, kmer -> {
			final MotifMatrix motifs = new MotifMatrix(kmer.dictionary(), k);
			motifs.add(kmer);
			polymers.tail().polymers().forEach(polymer -> {
				motifs.add(polymer.mostProbableKmer(motifs.profile()));
			});
			best.set(motifs.betterOf(best.get()));
		});
		return best.get();
	}
}


text:
Ray
===

.. raw:: html

  <embed>

  </embed>

*Ray is a fast and simple framework for building and running distributed applications.*

Ray is easy to install: ``pip install ray``

Example Use
-----------

+------------------------------------------------+----------------------------------------------------+
| **Basic Python**                               | **Distributed with Ray**                           |
+------------------------------------------------+----------------------------------------------------+
|.. code-block:: python                          |.. code-block:: python                              |
|                                                |                                                    |
|  # Execute f serially.                         |  # Execute f in parallel.                          |
|                                                |                                                    |
|                                                |  @ray.remote                                       |
|  def f():                                      |  def f():                                          |
|      time.sleep(1)                             |      time.sleep(1)                                 |
|      return 1                                  |      return 1                                      |
|                                                |                                                    |
|                                                |                                                    |
|                                                |  ray.init()                                        |
|  results = [f() for i in range(4)]             |  results = ray.get([f.remote() for i in range(4)]) |
+------------------------------------------------+----------------------------------------------------+

To launch a Ray cluster, either privately, on AWS, or on GCP, `follow these instructions <autoscaling.html>`_.

View the `codebase on GitHub`_.

.. _`codebase on GitHub`: https://github.com/ray-project/ray

Ray comes with libraries that accelerate deep learning and reinforcement learning development:

- `Tune`_: Scalable Hyperparameter Search
- `RLlib`_: Scalable Reinforcement Learning
- `Distributed Training <distributed_training.html>`__

.. _`Tune`: tune.html
.. _`RLlib`: rllib.html

.. toctree::
   :maxdepth: 1
   :caption: Installation

   installation.rst
   deploy-on-kubernetes.rst
   install-on-docker.rst
   installation-troubleshooting.rst

.. toctree::
   :maxdepth: 1
   :caption: Getting Started

   tutorial.rst
   api.rst
   actors.rst
   using-ray-with-gpus.rst
   signals.rst
   async_api.rst

.. toctree::
   :maxdepth: 1
   :caption: Cluster Usage

   autoscaling.rst
   using-ray-on-a-cluster.rst

.. toctree::
   :maxdepth: 1
   :caption: Tune

   tune.rst
   tune-usage.rst
   tune-schedulers.rst
   tune-searchalg.rst
   tune-package-ref.rst
   tune-design.rst
   tune-examples.rst
   tune-contrib.rst

.. toctree::
   :maxdepth: 1
   :caption: RLlib

   rllib.rst
   rllib-training.rst
   rllib-env.rst
   rllib-models.rst
   rllib-algorithms.rst
   rllib-offline.rst
   rllib-concepts.rst
   rllib-examples.rst
   rllib-dev.rst
   rllib-package-ref.rst

.. toctree::
   :maxdepth: 1
   :caption: Other Libraries

   distributed_training.rst
   distributed_sgd.rst
   pandas_on_ray.rst

.. toctree::
   :maxdepth: 1
   :caption: Examples

   example-rl-pong.rst
   example-policy-gradient.rst
   example-parameter-server.rst
   example-newsreader.rst
   example-resnet.rst
   example-a3c.rst
   example-lbfgs.rst
   example-evolution-strategies.rst
   example-cython.rst
   example-streaming.rst
   using-ray-with-tensorflow.rst

.. toctree::
   :maxdepth: 1
   :caption: Design

   internals-overview.rst
   serialization.rst
   fault-tolerance.rst
   plasma-object-store.rst
   resources.rst
   tempfile.rst

.. toctree::
   :maxdepth: 1
   :caption: Help

   troubleshooting.rst
   user-profiling.rst
   security.rst
   development.rst
   profiling.rst
   contact.rst


text:
This sample is a simple proxy that uses a Java Callout policy. The Java callout converts the API proxy response content and headers to uppercase. This sample is designed to be used with the Apigee Edge doc topic [Convert the response to uppercase with a Java callout](http://docs.apigee.com/api-services/cookbook/use-java-customize-api). Please refer to that topic to about building and deploying this sample.

>Note: This example `pom.xml` and related build files are intended as examples only. If you create a Java callout project, you may need to add dependencies or make other modifications that are beyond the scope of this example.

# Ask the community

[![alt text](../../images/apigee-community.png "Apigee Community is a great place to ask questions and find answers about developing API proxies. ")](https://community.apigee.com?via=github)

---

Copyright © 2017 Apigee Corporation

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

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

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

http://docs.apigee.com/api-services/reference/supported-software


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

<TITLE>
Uses of Class javax.xml.rpc.holders.IntHolder (Axis API)
</TITLE>

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Uses of Class
javax.xml.rpc.holders.IntHolder

Packages that use IntHolder

org.apache.axis.providers.java

org.apache.axis.wsdl.symbolTable

Uses of IntHolder in org.apache.axis.providers.java

Methods in org.apache.axis.providers.java with parameters of type IntHolder

 java.lang.Object
JavaProvider.getServiceObject(MessageContext msgContext,
                 Handler service,
                 java.lang.String clsName,
                 IntHolder scopeHolder)

          Get the service object whose method actually provides the service.

Uses of IntHolder in org.apache.axis.wsdl.symbolTable

Methods in org.apache.axis.wsdl.symbolTable with parameters of type IntHolder

static QName
SchemaUtils.getArrayComponentQName(org.w3c.dom.Node node,
                       IntHolder dims,
                       BooleanHolder underlTypeNillable,
                       QNameHolder itemQName,
                       BooleanHolder forElement,
                       SymbolTable symbolTable)

          If the specified node represents an array encoding of one of the following
 forms, then return the qname repesenting the element type of the array.

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Copyright © 2005 Apache Web Services Project. All Rights Reserved.


text:
package com.labdogstudio.tutorial.tut11;

import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.InputMultiplexer;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.PerspectiveCamera;
import com.badlogic.gdx.graphics.VertexAttributes.Usage;
import com.badlogic.gdx.graphics.g3d.Environment;
import com.badlogic.gdx.graphics.g3d.Material;
import com.badlogic.gdx.graphics.g3d.Model;
import com.badlogic.gdx.graphics.g3d.ModelBatch;
import com.badlogic.gdx.graphics.g3d.ModelInstance;
import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute;
import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight;
import com.badlogic.gdx.graphics.g3d.utils.CameraInputController;
import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder;
import com.badlogic.gdx.graphics.g3d.utils.shapebuilders.BoxShapeBuilder;
import com.badlogic.gdx.graphics.g3d.utils.shapebuilders.CapsuleShapeBuilder;
import com.badlogic.gdx.graphics.g3d.utils.shapebuilders.ConeShapeBuilder;
import com.badlogic.gdx.graphics.g3d.utils.shapebuilders.SphereShapeBuilder;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.physics.bullet.Bullet;
import com.badlogic.gdx.physics.bullet.collision.CollisionObjectWrapper;
import com.badlogic.gdx.physics.bullet.collision.ContactListener;
import com.badlogic.gdx.physics.bullet.collision.btBoxShape;
import com.badlogic.gdx.physics.bullet.collision.btCapsuleShape;
import com.badlogic.gdx.physics.bullet.collision.btCollisionAlgorithm;
import com.badlogic.gdx.physics.bullet.collision.btCollisionConfiguration;
import com.badlogic.gdx.physics.bullet.collision.btCollisionDispatcher;
import com.badlogic.gdx.physics.bullet.collision.btCollisionObject;
import com.badlogic.gdx.physics.bullet.collision.btCollisionObjectWrapper;
import com.badlogic.gdx.physics.bullet.collision.btCollisionShape;
import com.badlogic.gdx.physics.bullet.collision.btConeShape;
import com.badlogic.gdx.physics.bullet.collision.btCylinderShape;
import com.badlogic.gdx.physics.bullet.collision.btDefaultCollisionConfiguration;
import com.badlogic.gdx.physics.bullet.collision.btDispatcher;
import com.badlogic.gdx.physics.bullet.collision.btDispatcherInfo;
import com.badlogic.gdx.physics.bullet.collision.btManifoldPoint;
import com.badlogic.gdx.physics.bullet.collision.btManifoldResult;
import com.badlogic.gdx.physics.bullet.collision.btSphereShape;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.ArrayMap;
import com.badlogic.gdx.utils.Disposable;
import com.labdogstudio.tutorial.BaseScreen;
import com.labdogstudio.tutorial.MenuScreen;

public class BulletTest2 extends BaseScreen {

    class MyContactListener extends ContactListener {
        @Override
        public boolean onContactAdded (btManifoldPoint cp, btCollisionObjectWrapper colObj0Wrap, int partId0, int index0,
            btCollisionObjectWrapper colObj1Wrap, int partId1, int index1) {
            instances.get(colObj0Wrap.getCollisionObject().getUserValue()).moving = false;
            instances.get(colObj1Wrap.getCollisionObject().getUserValue()).moving = false;
            return true;
        }
    }

	static class GameObject extends ModelInstance implements Disposable {
        public final btCollisionObject body;
        public boolean moving;
        public GameObject(Model model, String node, btCollisionShape shape) {
            super(model, node);
            body = new btCollisionObject();
            body.setCollisionShape(shape);
        }

        @Override
        public void dispose () {
            body.dispose();
        }
		static class Constructor implements Disposable {
			public final Model model;
			public final String node;
			public final btCollisionShape shape;

			public Constructor(Model model, String node, btCollisionShape shape) {
				this.model = model;
				this.node = node;
				this.shape = shape;
			}

			public GameObject construct() {
				return new GameObject(model, node, shape);
			}

			@Override
			public void dispose() {
				shape.dispose();
			}
		}
	}

	PerspectiveCamera cam;
	CameraInputController camController;
	ModelBatch modelBatch;

	Model model;
	Array<GameObject> instances;
	ArrayMap<String, GameObject.Constructor> constructors;

	Environment environment;

	btCollisionConfiguration collisionConfig;
	btDispatcher dispatcher;

	MyContactListener contactListener;

	float spawnTimer;

	public BulletTest2(Game game) {
		super(game);
	}

	@Override
	public void show() {
		super.show();

		Bullet.init();

		modelBatch = new ModelBatch();

		environment = new Environment();
		environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.4f, 0.4f, 0.4f, 1f));
		environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f));

		cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
		cam.position.set(3f, 7f, 10f);
		cam.lookAt(0, 4f, 0);
		cam.update();

		camController = new CameraInputController(cam);
		Gdx.input.setInputProcessor(new InputMultiplexer(this, camController));

		ModelBuilder mb = new ModelBuilder();
		mb.begin();
		mb.node().id = "ground";
		BoxShapeBuilder.build(mb.part("ground", GL20.GL_TRIANGLES, Usage.Position | Usage.Normal,
				new Material(ColorAttribute.createDiffuse(Color.RED))), 5f, 1f, 5f);
		mb.node().id = "sphere";
		SphereShapeBuilder.build(mb.part("sphere", GL20.GL_TRIANGLES, Usage.Position | Usage.Normal,
				new Material(ColorAttribute.createDiffuse(Color.GREEN))), 1f, 1f, 1f, 10, 10);
		mb.node().id = "box";
		BoxShapeBuilder.build(mb.part("box", GL20.GL_TRIANGLES, Usage.Position | Usage.Normal,
				new Material(ColorAttribute.createDiffuse(Color.BLUE))), 1f, 1f, 1f);
		mb.node().id = "cone";
		ConeShapeBuilder.build(mb.part("cone", GL20.GL_TRIANGLES, Usage.Position | Usage.Normal,
				new Material(ColorAttribute.createDiffuse(Color.YELLOW))), 1f, 2f, 1f, 10);
		mb.node().id = "capsule";
		CapsuleShapeBuilder.build(mb.part("capsule", GL20.GL_TRIANGLES, Usage.Position | Usage.Normal,
				new Material(ColorAttribute.createDiffuse(Color.CYAN))), 0.5f, 2f, 10);
		mb.node().id = "cylinder";
		ConeShapeBuilder.build(mb.part("cylinder", GL20.GL_TRIANGLES, Usage.Position | Usage.Normal,
				new Material(ColorAttribute.createDiffuse(Color.MAGENTA))), 1f, 2f, 1f, 10);
		model = mb.end();

		constructors = new ArrayMap<String, GameObject.Constructor>(String.class, GameObject.Constructor.class);
		constructors.put("ground",
				new GameObject.Constructor(model, "ground", new btBoxShape(new Vector3(2.5f, 0.5f, 2.5f))));
		constructors.put("sphere", new GameObject.Constructor(model, "sphere", new btSphereShape(0.5f)));
		constructors.put("box",
				new GameObject.Constructor(model, "box", new btBoxShape(new Vector3(0.5f, 0.5f, 0.5f))));
		constructors.put("cone", new GameObject.Constructor(model, "cone", new btConeShape(0.5f, 2f)));
		constructors.put("capsule", new GameObject.Constructor(model, "capsule", new btCapsuleShape(.5f, 1f)));
		constructors.put("cylinder",
				new GameObject.Constructor(model, "cylinder", new btCylinderShape(new Vector3(.5f, 1f, .5f))));

		instances = new Array<GameObject>();
		instances.add(constructors.get("ground").construct());

		collisionConfig = new btDefaultCollisionConfiguration();
		dispatcher = new btCollisionDispatcher(collisionConfig);

		contactListener = new MyContactListener();
	}

	@Override
	public void render(float xdelta) {
		super.render(xdelta);

		camController.update();

		final float delta = Math.min(1f / 30f, Gdx.graphics.getDeltaTime());

        for (GameObject obj : instances) {
            if (obj.moving) {
                obj.transform.trn(0f, -delta, 0f);
                obj.body.setWorldTransform(obj.transform);
                checkCollision(obj.body, instances.get(0).body);
            }
        }

        if ((spawnTimer -= delta) < 0) {
            spawn();
            spawnTimer = 1.5f;
        }

		Gdx.gl.glClearColor(0.3f, 0.3f, 0.3f, 1.f);
		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);

		modelBatch.begin(cam);
		modelBatch.render(instances, environment);
		modelBatch.end();
	}

    public void spawn() {
        GameObject obj = constructors.values[1+MathUtils.random(constructors.size-2)].construct();
        obj.moving = true;
        obj.transform.setFromEulerAngles(MathUtils.random(360f), MathUtils.random(360f), MathUtils.random(360f));
        obj.transform.trn(MathUtils.random(-2.5f, 2.5f), 9f, MathUtils.random(-2.5f, 2.5f));
        obj.body.setWorldTransform(obj.transform);
        obj.body.setUserValue(instances.size);
        obj.body.setCollisionFlags(obj.body.getCollisionFlags() | btCollisionObject.CollisionFlags.CF_CUSTOM_MATERIAL_CALLBACK);
        instances.add(obj);
    }

	boolean checkCollision(btCollisionObject obj0, btCollisionObject obj1) {
		CollisionObjectWrapper co0 = new CollisionObjectWrapper(obj0);
		CollisionObjectWrapper co1 = new CollisionObjectWrapper(obj1);

		btCollisionAlgorithm algorithm = dispatcher.findAlgorithm(co0.wrapper, co1.wrapper);

		btDispatcherInfo info = new btDispatcherInfo();
		btManifoldResult result = new btManifoldResult(co0.wrapper, co1.wrapper);

		algorithm.processCollision(co0.wrapper, co1.wrapper, info, result);

		boolean r = result.getPersistentManifold().getNumContacts() > 0;

		dispatcher.freeCollisionAlgorithm(algorithm.getCPointer());
		result.dispose();
		info.dispose();
		co1.dispose();
		co0.dispose();

		return r;
	}

	@Override
	public boolean keyUp(int keycode) {
		if (keycode == Keys.BACK || keycode == Keys.ESCAPE) {
			game.setScreen(new MenuScreen(game));
			return true;
		}
		return false;
	}

	@Override
	public void hide() {
		super.hide();

		for (GameObject obj : instances)
			obj.dispose();
		instances.clear();

		for (GameObject.Constructor ctor : constructors.values())
			ctor.dispose();
		constructors.clear();

		dispatcher.dispose();
		collisionConfig.dispose();

		modelBatch.dispose();
		model.dispose();

		contactListener.dispose();
	}

}


text:
@protocol RZWebViewControllerDelegate;

@interface RZWebViewController : UIViewController

@property (weak, nonatomic) id<RZWebViewControllerDelegate> delegate;

// Should the webview be alloud to open additional links
@property (nonatomic, assign) BOOL allowsWebNavigation;

// Allows sharing of the website.
@property (nonatomic, assign) BOOL allowsSharing;
@property (nonatomic, strong) NSArray *sharingItems;
@property (nonatomic, strong) NSArray *excludedActivityTypes;

// These will return nil until the VC is loaded. DO NOT change the delegate on the webview.
@property (nonatomic, strong, readonly) UIWebView *webView;
@property (nonatomic, strong, readonly) UIActivityIndicatorView *activityIndicator;

// Intialize the webview with a localFile in the bundle
- (id)initWithPathForResource:(NSString*)resource
                      toolbar:(BOOL)showToolbar
               scalePageToFit:(BOOL)scalePageToFit;

// Intialize the webview with a remote Website URL
- (id)initWithRemoteURL:(NSURL*)webURL
                toolbar:(BOOL)showToolbar
         scalePageToFit:(BOOL)scalePageToFit;

@end

@protocol RZWebViewControllerDelegate <NSObject>

@optional
- (void)webViewControllerDidFinishLoad:(RZWebViewController *)webVC;

@end