This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hazelcast.mapred.test; | |
import com.hazelcast.core.CompletableFuture; | |
import com.hazelcast.core.HazelcastInstance; | |
import com.hazelcast.core.IMap; | |
import com.hazelcast.mapred.*; | |
import java.util.List; | |
import java.util.Map; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import javax.script.*; | |
import org.python.core.PySystemState; | |
import org.python.core.PyString; | |
import org.python.util.PythonInterpreter; | |
/** | |
* This class executes the AsciiDoc python scripts (asciidoc.py and a2x.py) from | |
* Java using the Jython interpreter. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import javax.script.*; | |
import org.python.core.PySystemState; | |
import org.python.core.PyString; | |
import org.python.util.PythonInterpreter; | |
/** | |
* This class executes the AsciiDoc python scripts (asciidoc.py and a2x.py) from | |
* Java using the Jython interpreter. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.invoke.CallSite; | |
import java.lang.invoke.ConstantCallSite; | |
import java.lang.invoke.MethodHandle; | |
import java.lang.invoke.MethodHandles; | |
import java.lang.invoke.MethodHandles.Lookup; | |
import java.lang.invoke.MethodType; | |
import java.util.HashMap; | |
import java.util.Map; | |
import java.util.concurrent.atomic.AtomicInteger; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MacBook-Pro:cc-arm-none-eabi noctarius$ ls -la | |
total 32 | |
drwxr-xr-x 5 noctarius staff 170 Nov 8 13:48 . | |
drwxr-xr-x 145 noctarius staff 4930 Nov 7 10:03 .. | |
drwxr-xr-x 14 noctarius staff 476 Nov 8 13:26 .git | |
-rw-r--r-- 1 noctarius staff 20 Nov 7 10:04 .gitignore | |
-rwxr-xr-x 1 noctarius staff 10732 Nov 8 13:48 toolchain-build.sh | |
MacBook-Pro:cc-arm-none-eabi noctarius$ ./toolchain-build.sh | |
Checking for necessary tools... | |
Checking for 'git'... success. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
StreamWriter streamWriter = StreamWriter.newBuilder().build(); | |
ByteArrayOutputStream baos = new ByteArrayOutputStream(); | |
StreamGraphBuilder graphBuilder = streamWriter.newStreamGraphBuilder(Output.toOutputStream(baos)); | |
graphBuilder.putNumber(100).putNumber(101).putNumber(102).putNumber(103).putNumber(104).finishStream(); | |
Parser parser = Parser.newBuilder().build(); | |
Input input = Input.fromByteArray(baos.toByteArray()); | |
// Dictionary, inner dictionary, inner sequence |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void test_exception_flow_control() { | |
Calendar calendar = Calendar.getInstance(); | |
calendar.set(2003, 11, 13, 18, 30, 02); | |
calendar.setTimeZone(TimeZone.getTimeZone("UTC")); | |
calendar.set(Calendar.MILLISECOND, 250); | |
Instant expected = calendar.toInstant(); | |
ZoneId UTC = ZoneId.of("UTC"); | |
DateTimeFormatter fractionFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX", Locale.US); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Found this awesome way in Java code once and had | |
// the strong feeling I need to port it to Javascript | |
// for the sake of all NodeJS developers! | |
var EvenOrOdd = function() { | |
function EvenOrOdd() {} | |
EvenOrOdd.prototype.isEven = function(value) { | |
var even = "02468"; | |
var v = String(value); | |
var w = v.charAt(v.length - 1); | |
return even.indexOf(w) != -1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
java: | |
import io.vertx.core.*; | |
import io.vertx.core.http.*; | |
import io.vertx.core.shareddata.AsyncMap; | |
import io.vertx.core.spi.cluster.ClusterManager; | |
import io.vertx.spi.cluster.hazelcast.HazelcastClusterManager; | |
import java.util.Optional; | |
import java.util.function.Consumer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Parser parser = Parser.newBuilder().build(); | |
// extracts id into mid, internalDate into date, payload/headers into headers, returns the new object | |
// Query query = "(mid: #{'id'}, date: #{'internalDate'}, headers: #{'payload'}{'headers'})"; | |
// alternative version to define it | |
Query query = parser.newQueryBuilder().asDictionary() | |
.putEntry("mid").stream(0).dictionary("id").endEntry() | |
.putEntry("date").stream(0).dictionary("internalDate").endEntry() | |
.putEntry("headers").stream(0).dictionary("payload").dictionary("headers").endEntry() |
OlderNewer