I hereby claim:
- I am tkellogg on github.
- I am kellogh (https://keybase.io/kellogh) on keybase.
- I have a public key whose fingerprint is 402D 2BD0 DEF8 57ED DFAA A221 A1B1 2838 7802 BD5E
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
implicit class BecauseFsharp[T](obj: T) { | |
/** | |
* This comes from OCaml/F#; very handy when used with partial function | |
* application. It's mainly useful for reducing parenthesis nesting. | |
* | |
* `foo(bar)` is same as `bar |> foo` | |
*/ | |
@inline def |>[U](function: T => U): U = function(obj) | |
} |
As for statements equating MQTT with CoAP style REST and why they're not complete or true:
CoAP URI path == MQTT topic
This appears to be true because they have a lot in common. In reality an MQTT topic is ephemeral (or you could say it's just a convention). You don't create it, you don't delete it, you just use it to synchronize where you're publishing and where you're subscribing.
A CoAP URI is material. Or at least it is with Californium, and I believe it has to be this way as long as CoAP is used in conjunction with CoRE link formats because all resources have to be enumerated so they can be described by the CoRE document.
I already have a ring of servers (message brokers, to be precise) that uses Cassandra to persist data needed to recover from a crash. We played with some configurations and realized that we get much better performance if we run Cassandra on the same box as the app. The row key is well distributed, so 1/n
chance that the IO operation can be performed locally. The traffic is also well distributed (it's a safe assumption) so the question is, why rely on the row key to distribute the rows around the ring? Why can't I just assume the local shard is the master that I want to write to? This would give me a 100% chance that the IO operation can be performed locally.
I assume this is a bit of a corner case, so there's probably nothing pre-boxed for my situation. But is there something that would function as a good starting point?
sealed trait ParseTree | |
sealed trait ValueNode extends ParseTree | |
sealed trait PrimitiveValueNode extends ValueNode | |
case class OrNode(left: ParseTree, right: ParseTree) extends ParseTree | |
case class AndNode(left: ParseTree, right: ParseTree) extends ParseTree | |
case class BoolNode(value: Boolean) extends PrimitiveValueNode | |
case class IntNode(value: Int) extends PrimitiveValueNode | |
case class StringNode(value: String) extends PrimitiveValueNode | |
// Use refined trait ValueNode to better describe what value can *actually* hold |
case class Fail(text: Option[String]) | |
object Main extends App { | |
import org.json4s._ | |
import org.json4s.native.Serialization | |
import org.json4s.native.Serialization.{read, write} | |
implicit val formats = org.json4s.DefaultFormats | |
read[Fail]("""{"notext":"foo"}""").text match { | |
case Some(txt) => // ClassCastException here when using json4s v3.1.0 |
object People { | |
implicit val columnFamily: ColumnFamily = getColumnFamily | |
def getPersonByName(name: String)(implicit cf: ColumnFamily) = ... | |
} | |
class ProdUsage { | |
// uses ColumnFamily from object People | |
def foo = People.getPersonByName("Jordan") | |
} |
#!/bin/sh | |
msg=$(git log -n 1 --format="%B") | |
git reset HEAD^ | |
git add -A | |
git commit -m "$msg" |
def bar(value: Int) = foo(Some(value / 3)) | |
def foo(value: Option[Int]): Option[Int] = value match { | |
case Some(v) if (v % 2 == 0) => bar(v) | |
case Some(v) => Some(v) | |
case None => None | |
} |
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css"> | |
<script src="http://cmx.io/v/0.1/cmx.js" charset="utf-8"></script> | |
<style>.cmx-user-scene4 .cmx-text-border .cmx-path {stroke: orange}</style> | |
<body> | |
<div style="max-width:900px; -webkit-transform:rotate(0deg)"> | |
<scene id="scene1"> | |
<label t="translate(0,346)"> |