Problem space: collections with varying items.
A contrived but valid bit of JSON data might look like:
[1, null, false, 2.0, "foo"]
Perhaps a more likely version of this problem is arrays of objects with varying fields:
Problem space: collections with varying items.
A contrived but valid bit of JSON data might look like:
[1, null, false, 2.0, "foo"]
Perhaps a more likely version of this problem is arrays of objects with varying fields:
/* automatically generated by rust-bindgen */ | |
pub const _STDINT_H: u32 = 1; | |
pub const _FEATURES_H: u32 = 1; | |
pub const _DEFAULT_SOURCE: u32 = 1; | |
pub const __USE_ISOC11: u32 = 1; | |
pub const __USE_ISOC99: u32 = 1; | |
pub const __USE_ISOC95: u32 = 1; | |
pub const __USE_POSIX_IMPLICITLY: u32 = 1; | |
pub const _POSIX_SOURCE: u32 = 1; |
These are some of the exact items I use.
Some of them are very specifically selected and I'll get into why, whereas others are just my preference and you could make whatever substitution you like.
https://www.amazon.com/registry/giftlist/1VRY39HN9O9GO/ref=cm_sw_r_cp_ep_ukn_.QVaCbAV0GZMQ
A notable omission from the list is a nice, comfortable pair of headphones. For my setup I use large-cup headphones with a standard 3.5mm jack.
I've been reading [Kubernetes Up and Running], and got excited when I saw that they include some instructions for configuring a cluster on Raspberry Pis, which I've been dying to play with for some time but never had a project to dig into.
I had been recording my progress in the form of a [twitter thread][thread], but I thought something easier to scan, and editable, might be a better way to record the outcomes and lessons learned.
As I started to dig in, I found the short guide to be different enough what I was seeing (in reality) that I decided to keep some notes about the tweaks I was required to make.
pub struct ChessGame { | |
model: Chess, | |
} | |
#[derive(Clone)] | |
struct Chess(u8); | |
impl ChessGame { | |
pub fn get(board_id: u8) -> ChessGame { | |
FROM ubuntu:16.04 | |
RUN apt-get update && apt-get install -y \ | |
# stuff in case I need to debug/rebuild parts of the program | |
cmake \ | |
build-essential \ | |
sudo \ | |
# runtime deps | |
libglu1-mesa \ | |
libglew1.13 \ |
FROM ubuntu:16.04 | |
RUN apt-get update && apt-get install -y \ | |
# stuff in case I need to debug/rebuild parts of the program | |
cmake \ | |
build-essential \ | |
sudo \ | |
# runtime deps | |
# TODO: either statically link these or wrap in a deb/rpm package to install these for the user | |
libglu1-mesa \ |
object Change { | |
def countChange(money: Int, coins: List[Int]): Int = { | |
def loop(goal: Int, xs: List[Int]): Int = { | |
if (goal == 0) 1 | |
else if (goal <= 0) 0 | |
else if (xs.isEmpty) 0 | |
else loop(goal, xs.tail) + loop(goal - xs.head, xs) | |
} | |
loop(money, coins) | |
} |
def users(): Future[List[User]] = { | |
val pl = Promise[List[User]]() | |
Future { | |
_roster.reloadAndWait() | |
val entries = _roster.getEntries().asScala.toList | |
val futures = entries map { entry => | |
val pu = Promise[User]() | |
Future { // wrap all this stuff in the future just so it doesn't block | |
val target = entry.getUser() | |
connection.sendIqWithResponseCallback(ProfileIQ(target), new StanzaListener() { |
object Infuse { | |
final case class InfuseResult(light: Int, marks: Int, steps: Seq[Int]) { | |
def pretty: String = { | |
s"Light: $light, Marks: $marks, Infusion: ${steps.mkString(" -> ")}" | |
} | |
} | |
val COST = 3 |