View lib.rs
let (complete_sender, complete_receiver) = oneshot::channel::<()>();
ctrlc::set_handler(move || {
complete_sender.send(());
}).expect("Error setting Ctrl-C handler");
error[E0507]: cannot move out of captured outer variable in an `Fn` closure
--> src/lib.rs:30:13
|
View legacy.java
@Override
public String hash(final NodeInfo info, final int repetition) {
String hostname = info.hostname().getHostAddress();
if (hostname.startsWith("/")) {
hostname = hostname.substring(1);
}
int port = info.services().get(ServiceType.BINARY);
return hostname + ":" + port + "-" + repetition;
}
View gist:b4f87ae707ecff297a1602135f3f940b
$ rustc --target mips-unknown-linux-uclibc hello.rs
error[E0514]: found crate `std` compiled by an incompatible version of rustc
|
= help: please recompile that crate using this compiler (rustc 1.16.0-nightly (4ecc85beb 2016-12-28))
= note: crate `std` path #1: /home/vagrant/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/mips-unknown-linux-uclibc/lib/libstd_unicode-ce2437639102870c.rlib compiled by "rustc 1.16.0-dev (4ecc85beb 2016-12-28)"
= note: crate `std` path #2: /home/vagrant/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/mips-unknown-linux-uclibc/lib/libstd_shim-ce5875b2d5be2087.rlib compiled by "rustc 1.16.0-dev (4ecc85beb 2016-12-28)"
= note: crate `std` path #3: /home/vagrant/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/mips-unknown-linux-uclibc/lib/libstd-5e6fea6a0efe07f7.rlib compiled by "rustc 1.16.0-dev (4ecc85beb 2016-12-28)"
= note: crate `std` path #4: /home/vagrant/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustli
View OnSubscribeDeferAndWatch.java
/*
* Copyright (c) 2016 Couchbase, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
View ByteJsonDocument.java
/*
* Copyright (c) 2016 Couchbase, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
View streamsink.scala
val spark = SparkSession
.builder
.master("local[*]")
.appName("StructuredWordCount")
.getOrCreate()
import spark.implicits._
val lines = spark.readStream
.format("socket")
View structuredstream.scala
val schema = StructType(
StructField("META_ID", StringType) ::
StructField("type", StringType) ::
StructField("name", StringType) :: Nil
)
// The SparkSession is the main entry point into spark
val spark = SparkSession
.builder()
.appName("N1QLExample")
View defaultschema.scala
StructType(
StructField("META_ID", StringType) ::
StructField("value", BinaryType) :: Nil
)
View sparkstream.scala
// Create the Spark Config and instruct to use the travel-sample bucket
// with no password.
val conf = new SparkConf()
.setMaster("local[*]")
.setAppName("StreamingExample")
.set("com.couchbase.bucket.travel-sample", "")
// Initialize StreamingContext with a Batch interval of 5 seconds
val ssc = new StreamingContext(conf, Seconds(5))
View arithmetic.py
import tensorflow as tf
a = tf.placeholder(tf.int32, name = 'a')
b = tf.placeholder(tf.int32, name = 'b')
add = tf.add(a, b, name = 'add')
tf.initialize_variables(tf.all_variables(), name = 'init')
definition = tf.Session().graph_def
tf.train.write_graph(definition, 'models', 'arithmetic.pb', as_text=False)