This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package de.javakaffee.web.msm.serializer.kryo; | |
import static org.testng.Assert.assertEquals; | |
import static org.testng.Assert.assertNotNull; | |
import java.util.HashMap; | |
import java.util.Map; | |
import java.util.concurrent.ConcurrentHashMap; | |
import org.testng.annotations.Test; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def multipartParser[A](partHandler: Map[String, String] => Iteratee[Array[Byte], A]): | |
BodyParser[Seq[A]] = parse.using { request => | |
val maybeBoundary = for { | |
mt <- request.mediaType | |
(_, value) <- mt.parameters.find(_._1.equalsIgnoreCase("boundary")) | |
boundary <- value | |
} yield ("\r\n--" + boundary).getBytes("utf-8") | |
maybeBoundary.map { boundary => |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import play.api.libs.iteratee._ | |
def fromStream(stream: OutputStream): Iteratee[Array[Byte], Unit] = Cont { | |
case e@Input.EOF => | |
stream.close() | |
Done((), e) | |
case Input.El(data) => | |
stream.write(data) | |
fromStream(stream) | |
case Input.Empty => |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package wsmultipart | |
import play.api.libs.ws.WSResponseHeaders | |
import play.api.libs.iteratee._ | |
import play.api.libs.iteratee.Parsing.MatchInfo | |
import play.api.http.{MediaType, HeaderNames} | |
import scala.concurrent.ExecutionContext.Implicits.global | |
object WSMultipartHandler { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package wsmultipart | |
import org.scalatestplus.play.{PlaySpec, OneServerPerSuite} | |
import org.scalatest.EitherValues | |
import play.api.mvc.Action | |
import play.api.mvc.Results._ | |
import play.api.libs.iteratee.{Done, Input, Cont, Iteratee, Enumerator} | |
import play.api.test.Helpers._ | |
import scala.concurrent.ExecutionContext.Implicits.global | |
import scala.collection.mutable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object CassandraTracing { | |
def traceSegment(res: Future[ResultSet]): Future[ResultSet] = { | |
TraceRecorder.withTraceContextAndSystem { (ctx, system) => | |
// Because we don't know the actual table that was queried for now we | |
// use a general name for the segment, it's renamed once we have the result | |
val segment = ctx.startSegment("db", "cassandra-client", "datastax") | |
res.onComplete { | |
case Success(rs) => | |
// Get the table name from the result so that we can give the segment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.ino.solrs | |
import java.util.Arrays._ | |
import java.util.concurrent.atomic.{AtomicBoolean, AtomicInteger} | |
import java.util.concurrent.{Executors, TimeUnit} | |
import io.ino.solrs.SolrUtils._ | |
import org.apache.curator.test.TestingServer | |
import org.apache.solr.client.solrj.SolrQuery | |
import org.apache.solr.client.solrj.impl.CloudSolrClient |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package hello.mongodb; | |
import java.net.UnknownHostException; | |
import com.mongodb.BasicDBObject; | |
import com.mongodb.BasicDBObjectBuilder; | |
import com.mongodb.DB; | |
import com.mongodb.DBCollection; | |
import com.mongodb.DBObject; | |
import com.mongodb.MapReduceOutput; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Installs sun/oracle jdk stuff as alternatives, tested for fedora (14) 64bit. | |
# See also http://www.javakaffee.de/blog/2010/12/26/installing-java-on-fedora-using-alternatives/ | |
# Author: martin(dot)grotzke(at)googlemail(dot)com | |
if [ $# -ne 3 ]; then | |
echo 1>&2 "Usage: $0 <major-version> <minor-version> <priority>" | |
echo "E.g. $0 1.6.0 2 20000" | |
exit 127 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Locale; | |
import java.util.Map; | |
import java.util.Timer; | |
import java.util.TimerTask; | |
import java.util.concurrent.atomic.AtomicReference; |
OlderNewer