Skip to content

Instantly share code, notes, and snippets.

public static void main(String[] args) {
SparkConf sparkConf = new SparkConf()
.setMaster("local[*]")
.setAppName("Example01");
JavaSparkContext sc = new JavaSparkContext(sparkConf);
sc.parallelize(IntStream.range(1, 100).boxed().collect(Collectors.toList())).map(x -> {
return (x % 15 == 0) ? "FizzBuzz"
: (x % 5 == 0) ? "Fizz"
: (x % 3 == 0) ? "Buzz"
: x.toString();
下記のエラーが発生
Successfully built 5a6d26f6b991
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.
The push refers to a repository [registry.heroku.com/secret-fjord-96615/web]
03c19e4bdde5: Preparing
5c331e8bd692: Preparing
d9bec0efee77: Preparing
d55a8cc45244: Preparing
52207ae120e6: Preparing
@koduki
koduki / file0.txt
Created September 5, 2016 19:00
Dockerを使ってJava9を超高速に試す ref: http://qiita.com/koduki/items/c4fb0276cc0d9a1a08c0
$ docker run marvambass/oracle-java9 java -version
java version "9-ea"
Java(TM) SE Runtime Environment (build 9-ea+130)
Java HotSpot(TM) 64-Bit Server VM (build 9-ea+130, mixed mode)
@koduki
koduki / file0.txt
Last active August 11, 2016 23:10
Windows Subsystem for Linux + Cmderで最強のCLI環境を作る ref: http://qiita.com/koduki/items/ab68b917b8dbc7d51af0
$ sudo apt-get install zsh
$(function(){
var host = "ws://localhost:8888/";
var socket = new WebSocket(host);
socket.onmessage = function(message){
console.log(socket.readyState + " " + message.data);
}
$("#sendBtn").on("click",function(){
message = $("#message").val()
while(true){
if(events.isNotEmpty()){
callback(events.pop())
}
}
#!/usr/local/bin/perl
print "Content-type: text/html\n";
print "\n";
print "<html>\n";
print "<head>\n";
print "<title>Hello World</title>\n";
print "</head>\n";
print "<body>\n";
print "Hello World.\n";
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cn.orz.pascal.sandbox</groupId>
<artifactId>sandbox2</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
Tuple2<String, Integer> x = new Tuple2<>("A", 10);
Tuple2<Integer, String> y = $(1, "B");
Map<Integer, String> xs = map($(1, "A"), $(2, "B"), $(3, "C"));
def saveAsTextFile(path: String): Unit = withScope {
// https://issues.apache.org/jira/browse/SPARK-2075
//
// NullWritable is a `Comparable` in Hadoop 1.+, so the compiler cannot find an implicit
// Ordering for it and will use the default `null`. However, it's a `Comparable[NullWritable]`
// in Hadoop 2.+, so the compiler will call the implicit `Ordering.ordered` method to create an
// Ordering for `NullWritable`. That's why the compiler will generate different anonymous
// classes for `saveAsTextFile` in Hadoop 1.+ and Hadoop 2.+.
//
// Therefore, here we provide an explicit Ordering `null` to make sure the compiler generate