/**
* Created by Hierro on 4/18/16.
*/
public class Recursion {
public static void main(String[] args) {
int[] array = {1,2,3};
int sum = getSum(array);
int sum2 = getSum2(array);
Build.sbt
Defaults.itSettings
sourceDirectory in IntegrationTest := baseDirectory.value / "test-integration"
libraryDependencies +=
"com.typesafe.play" %% "play-test" % play.core.PlayVersion.current % "it" //makes this available to integration tests
parallelExecution in IntegrationTest := false //Singleton Mongo Client not thread-safe for parallel tests. NullPointer being thrown because 1 test closed the connection while the other test needed it
def mapValue[T]( f: Future[T] ): Future[Try[T]] = {
val prom = Promise[Try[T]]()
f onComplete prom.success
prom.future
}
def traverseFilteringErrors[A, B](seq: Seq[A])(f: A => Future[B]): Future[Seq[B]] = {
Future.traverse( seq )( f andThen mapValue ) map ( _ collect{ case Success( x ) => x } )
}
/** Check that the XMLs are the same, ignoring empty text nodes (whitespace). */
private def assertEqual(actual: xml.Node, expected: xml.Node) {
def recurse(actual: xml.Node, expected: xml.Node) {
// depth-first checks, to get specific failures
for ((actualChild, expectedChild) <- actual.child zip expected.child) {
recurse(actualChild, expectedChild)
}
actual should be (expected)
class RingBuffer[T] {
val array = new Array[T](5)
var count = 0
override def toString: String = array.mkString(",")
def add(value: T): RingBuffer[T] = {
if (count < array.length) {
array(count) = value
#gzip
#compress
tar czvf testZipFile.tar.gz myDir/
#decompress
tar xzvf testZipFile.tar.gz
#view files without decompressing
package magnetpattern
import scala.language.implicitConversions
sealed trait Magnet {
type Result
def apply(): Result
}
package free
import free.FunctorTransformer.{Id, ~>}
import scala.language.higherKinds
/**************************** Boilerplate ********************************/
trait Functor[F[_]] {
def map[A, B](a: F[A])(fn: A => B): F[B]
}
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
_complete_ssh_hosts () | |
{ | |
COMPREPLY=() | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
comp_ssh_hosts=`cat ~/.ssh/known_hosts | \ | |
cut -f 1 -d ' ' | \ | |
sed -e s/,.*//g | \ | |
grep -v ^# | \ | |
uniq | \ | |
grep -v "\[" ; |
Cause: java.io.IOException: Too many open files in system
[info] at sun.nio.ch.KQueueArrayWrapper.init(Native Method)
[info] at sun.nio.ch.KQueueArrayWrapper.<init>(KQueueArrayWrapper.java:98)
[info] at sun.nio.ch.KQueueSelectorImpl.<init>(KQueueSelectorImpl.java:88)
[info] at sun.nio.ch.KQueueSelectorProvider.openSelector(KQueueSelectorProvider.java:42)
[info] at io.netty.channel.nio.NioEventLoop.openSelector(NioEventLoop.java:156)
[info] at io.netty.channel.nio.NioEventLoop.(NioEventLoop.java:149)
OlderNewer