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
@RunWith(classOf[JUnitRunner]) | |
class Example1Test extends FunSuite with ShouldMatchers { | |
// Services that return Futures | |
def serviceA() = Future { 7 } | |
def serviceC(x : Int) = Future { 2 * x } | |
def serviceB() = Future { 9} | |
def serviceD(x : Int) = Future { 5 * x} | |
def serviceE(x : Int) = Future { 4 * x} |
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
@RunWith(classOf[JUnitRunner]) | |
class VideoGridTest extends FunSuite with ShouldMatchers { | |
// Make scalaz work with futures | |
implicit object FutureFunctor extends Functor[Future] { | |
def fmap[A, B](r : Future[A], f : scala.Function1[A, B]) : Future[B] = r.map(f) | |
} | |
implicit object FutureApply extends Apply[Future] { |
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
var when = require("when"); | |
function makePromiseCallback(label, callback) { | |
var deferred = when.defer(); | |
function actualCallback(err, data) { | |
if (err) | |
console.log(label || "some label", {err: err, data: data}); | |
if (err) | |
deferred.reject(err); |
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 net.chrisrichardson.microservices.restfulspringboot | |
import org.springframework.cloud.netflix.eureka.EnableEurekaClient | |
import org.springframework.context.annotation._ | |
import org.springframework.boot.autoconfigure.EnableAutoConfiguration | |
import net.chrisrichardson.microservices.restfulspringboot.backend.ScalaObjectMapper | |
import net.chrisrichardson.microservices.restfulspringboot.dustview.DustViewResolver | |
import org.springframework.web.client.{ResponseErrorHandler, RestTemplate} | |
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter | |
import scala.collection.JavaConversions._ |
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
val children = Set("a", "b", "c") | |
var knownChildren = Map[String, String]() | |
val newChildren = Map[String, String]() | |
for (i <- 1 to 1000*1000) { | |
if (i % 1000 == 0) println(knownChildren.size) | |
knownChildren = knownChildren.filterKeys(children.contains) ++ newChildren | |
} |
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
When files are uploaded to CrashPlan, a checksum is generated for the file, but is not verified immediately upon receipt. | |
These checksum values are logged and checked when archive maintenance is performed on the archive, every 7 days. | |
If CrashPlan were to verify the checksum for each file upon receipt, this would cause each file's upload to take considerably more time to complete, relatively speaking. | |
Plus, if the drive that the source data was being backed up from was failing, this could potentially cause the drive to fail much more quickly, as there would be a great deal more disk I/O, caused by the file block verification occurring on a per-file basis, while being backed up. | |
By default, CrashPlan gathers the data that has been collected by a process known as a file verification scan on a daily basis, and then uses this file block information to analyze the files that exist in the backup archive. | |
If CrashPlan runs into any files that do not match the checksum, it attempts to self-heal the archive, usually |
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 net.chrisrichardson.getataxi.dispatcher.services; | |
import net.chrisrichardson.getataxi.dispatcher.domain.DispatcherDriver; | |
import net.chrisrichardson.getataxi.dispatcher.domain.DriverMother; | |
import net.chrisrichardson.getataxi.dispatcher.domain.DriverRepository; | |
import net.chrisrichardson.getataxi.domain.Location; | |
import net.chrisrichardson.getataxi.domain.events.DriverAcceptedTripEvent; | |
import net.chrisrichardson.getataxi.domain.events.TripCreatedEvent; | |
import net.chrisrichardson.getataxi.domain.events.TripOfferedToDriver; |
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
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>io.eventuate.examples.mavenexample</groupId> | |
<version>0.1.0-SNAPSHOT</version> | |
<artifactId>Maven-Example</artifactId> | |
<packaging>jar</packaging> | |
<name>maven example</name> | |
<repositories> | |
<repository> |
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 org.springframework.core.io.buffer.DefaultDataBufferFactory; | |
import org.springframework.http.MediaType; | |
import org.springframework.http.server.reactive.ServerHttpRequest; | |
import org.springframework.http.server.reactive.ServerHttpResponse; | |
import org.springframework.stereotype.Controller; | |
import org.springframework.util.Assert; | |
import org.springframework.web.bind.annotation.RequestMapping; | |
import org.springframework.web.bind.annotation.RequestMethod; | |
import org.springframework.web.bind.annotation.ResponseBody; | |
import org.springframework.web.reactive.function.client.WebClient; |
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/bash -e | |
grep eventuate gradle.properties | |
fixVersion() { | |
name=${1?} | |
version=${2?} | |
sed -i "" -e "s/${name}=.*/${name}=${version}/" gradle.properties | |
} |
OlderNewer