On Mac, Homebrew is the de-facto package manager, and Homebrew Cask is the app manager. I’m going to use Cask to install Java 7 and 8.
Install Homebrew Cask first if you haven’t:
brew update
brew tap caskroom/cask
| // build.sbt | |
| val slick = Seq( | |
| "com.typesafe.slick" %% "slick" % "3.2.1", | |
| "org.slf4j" % "slf4j-nop" % "1.6.4", | |
| "com.typesafe.slick" %% "slick-hikaricp" % "3.2.1", | |
| "com.h2database" % "h2" % "1.4.196" | |
| ) | |
| val scalaz = Seq( | |
| "org.scalaz" %% "scalaz-core" % "7.2.17" | |
| ) |
| val (recycleQueue, recycleSource) = | |
| Source | |
| .queue[SoilStateReading](100, OverflowStrategy.dropTail) | |
| .prefixAndTail(0) | |
| .map(_._2) | |
| .toMat(Sink.head)(Keep.both) | |
| .run() | |
| StreamConverters.fromInputStream(() => this.getClass.getClassLoader.getResourceAsStream("sensors.log")) | |
| .via(SoilStateReading.csvParser) | |
| .merge(Source.fromFutureSource(recycleSource)) |
| package sample.eventdriven.scala | |
| import akka.actor.{Actor, ActorRef, ActorSystem, Inbox, Props} | |
| import akka.persistence.PersistentActor | |
| import scala.concurrent.ExecutionContext.Implicits._ | |
| import scala.concurrent.duration._ | |
| // =============================================================== | |
| // Demo of an Event-driven Architecture in Akka and Scala. |
| object Example { | |
| import cats._, implicits._ | |
| import cats.effect._ | |
| import fs2._ | |
| import scala.concurrent.ExecutionContext | |
| // start N streams concurrently, and stream their results in order | |
| // e.g. download a file from a server in N parts concurrently, and stream it | |
| abstract class Channel[F[_], A] { |
Balaji Sivaraman @balajisivaraman_twitter
Hi all, I need some help understanding a piece of Doobie code from the examples. It is the StreamingCopy one: (https://github.com/tpolecat/doobie/blob/series/0.4.x/yax/example/src/main/scala/example/StreamingCopy.scala). I am using a modified version of the fuseMap2 example from that file. Here’s how I’ve modified it for my requirements:
def fuseMap[F[_]: Catchable: Monad, A, B](
source: Process[ConnectionIO, A],
sink: Vector[A] => ConnectionIO[B],
delete: ConnectionIO[Unit]
)(
sourceXA: Transactor[F],| /** | |
| * Copyright (C) 2009-2017 Lightbend Inc. <http://www.lightbend.com> | |
| */ | |
| package http | |
| import java.util.concurrent.atomic.AtomicInteger | |
| import akka.actor.{Actor, ActorRef, ActorSystem, Props} | |
| import akka.http.scaladsl.Http | |
| import akka.http.scaladsl.model.{HttpResponse, StatusCodes, Uri} |
| scalaVersion := "2.11.8" | |
| scalaOrganization := "org.typelevel" | |
| libraryDependencies ++= Seq( | |
| "org.typelevel" %% "cats" % "0.9.0", | |
| "org.atnos" %% "eff" % "4.0.0" | |
| ) | |
| addCompilerPlugin("org.spire-math" %% "kind-projector" % "0.9.3") |
| import monix.eval.Task | |
| import java.util.concurrent.TimeUnit | |
| import scala.concurrent.duration._ | |
| /** Request limiter for APIs that have quotas per second, minute, hour, etc. | |
| * | |
| * {{{ | |
| * // Rate-limits to 100 requests per second | |
| * val limiter = TaskLimiter(TimeUnit.SECONDS, limit = 100) | |
| * |