Thread pools on the JVM should usually be divided into the following three categories:
- CPU-bound
- Blocking IO
- Non-blocking IO polling
Each of these categories has a different optimal configuration and usage pattern.
object Main extends App { | |
AvoidLosingGenericType.run() | |
AvoidMatchingOnGenericTypeParams.run() | |
TypeableExample.run() | |
TypeTagExample.run() | |
} | |
class Funky[A, B](val foo: A, val bar: B) { | |
override def toString: String = s"Funky($foo, $bar)" | |
} |
task compileGwt (dependsOn: classes, type: JavaExec) { | |
buildDir = "${project.buildDir}/gwt" | |
extraDir = "${project.buildDir}/extra" | |
inputs.source sourceSets.main.java.srcDirs | |
inputs.dir sourceSets.main.output.resourcesDir | |
outputs.dir buildDir | |
// Workaround for incremental build (GRADLE-1483) | |
outputs.upToDateSpec = new org.gradle.api.specs.AndSpec() |
package fpmax | |
import scala.util.Try | |
import scala.io.StdIn.readLine | |
object App0 { | |
def main: Unit = { | |
println("What is your name?") | |
val name = readLine() |
import scala.reflect.macros.whitebox | |
import scala.language.experimental.macros | |
def symbolic_impl(c: whitebox.Context)(f: c.Expr[String]): c.Expr[scala.Symbol] = { | |
import c.universe._ | |
c.Expr(q"""scala.Symbol(${c.eval[String](f)})""") | |
} | |
def symbolic(f: String): scala.Symbol = macro symbolic_impl |
import cats.implicits._ | |
//https://stackoverflow.com/questions/48744146/stacking-m-either-and-writer | |
object SafeLogWriter { | |
type FutureErrorOr[A] = EitherT[Future, Error, A] | |
type ErrorOr[A] = Either[Error, A] | |
type MyWriter[A] = WriterT[Future, Vector[String], A] | |
type MyStack[A] = EitherT[MyWriter, Error, A] |
-- View pg_stat_activity with temporary files informations (file list and total file size) | |
-- version 0.3 | |
SELECT | |
pg_stat_activity.pid AS pid, | |
CASE WHEN LENGTH(pg_stat_activity.datname) > 16 | |
THEN SUBSTRING(pg_stat_activity.datname FROM 0 FOR 6)||'...'||SUBSTRING(pg_stat_activity.datname FROM '........$') | |
ELSE pg_stat_activity.datname | |
END | |
AS database, |
#!/bin/bash | |
SOURCE="$1" | |
if [ "${SOURCE}" == "" ]; then | |
echo "Must specify a source url" | |
exit 1 | |
fi | |
DEST="$2" | |
if [ "${DEST}" == "" ]; then |