この記事は Scala Advent Calendar 2016(Adventar) 10日目の記事です。
今は 12/10 の 625時です。年明けなんて無かった。いいね?
さてさて、sbt の依存jarのダウンロードが遅い、というのは割とよく言われる事であります。
で、この原因の一旦に、sbtが Apache Ivy を使っている、という点があります。
import processing.core._ | |
import processing.serial._ | |
import cc.arduino._ | |
class FirmataApp extends PApplet { | |
var ard: Arduino = null | |
override def settings() { | |
size(300, 300) | |
} |
package example | |
import java.net._ | |
import java.io._ | |
object ScalaNativeHttpGetExample { | |
def using[A <: Closeable, B] (a: A)(f: A => B): B = | |
try { | |
f(a) | |
} finally { |
trait Memorized[T,R] { | |
import scala.collection.mutable._ | |
val cache = new HashMap[T,R] | |
def cacheOrApply( t:T )( f: => R ):R = cache get(t) getOrElse{ | |
val rv = f | |
cache += t -> rv | |
println("do %s:%s" format(t, rv)) | |
rv | |
} |
import cv2 | |
import numpy as np | |
#動画ファイルパス | |
ESC_KEY = 27 # Escキー | |
INTERVAL= 33 # インターバル | |
FRAME_RATE = 30 # fps | |
#ウインドウ名の定義 |
import numpy as np | |
import cv2 | |
FILE_ORG = "calibrated_output_background2.m4v" | |
WINDOW_ORG = "Orginal_frame" | |
FRAME_RATE = 30 # fps | |
class LocationDetector: | |
def __init__(self, |
この記事は Scala Advent Calendar 2016(Adventar) 10日目の記事です。
今は 12/10 の 625時です。年明けなんて無かった。いいね?
さてさて、sbt の依存jarのダウンロードが遅い、というのは割とよく言われる事であります。
で、この原因の一旦に、sbtが Apache Ivy を使っている、という点があります。
サマーウォーズのアレです。
// MDN: https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/AsyncFunction | |
// 参考:https://javascript.developreference.com/article/14715429/ES+2017%3A+async+function+vs+AsyncFunction(object)+vs+async+function+expression | |
// Q何しようとしたの? | |
// A友人が話していたAsyncFunctionオブジェクトを触ってみる | |
// async function が利用するPromiseはグローバルではなくその場でのスコープ変数らしい。 | |
// AsyncFunctionがスコープ変数を参照できなくしているのってPromiseが動的に書き換えられると面倒だからじゃない?って思ったので実験した | |
// 結果はまあよくわからなかった。 |
Promise.prototype.then = (()=> { | |
const _then = Promise.prototype.then; | |
return function(...args) { | |
_then.call(this, (res) => { | |
promiseResultMap.set(this, res); | |
}) | |
this.then = _then; | |
return _then.apply(this, args); | |
} | |
})(); |
import akka.actor.ActorSystem | |
import akka.http.scaladsl.Http | |
import akka.stream.ActorMaterializer | |
object Boot extends App with Service with CorsSupport { | |
override implicit val system = ActorSystem() | |
override implicit val executor = system.dispatcher | |
override implicit val materializer = ActorMaterializer() | |
Http().bindAndHandle(corsHandler(routes), "0.0.0.0", 1337) |