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
/* | |
This is a simple Java verticle which receives `ping` messages on the event bus and sends back `pong` replies | |
*/ | |
public class PingVerticle extends Verticle { | |
public void start() { | |
vertx.eventBus().registerHandler("ping-address", new Handler<Message<String>>() { | |
@Override | |
public void handle(Message<String> message) { |
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 org.junit.Test; | |
import org.vertx.java.core.AsyncResult; | |
import org.vertx.java.core.AsyncResultHandler; | |
import org.vertx.java.core.Handler; | |
import org.vertx.java.core.eventbus.Message; | |
import org.vertx.java.core.http.HttpClientResponse; | |
import org.vertx.java.core.http.HttpServerRequest; | |
import org.vertx.testtools.TestVerticle; | |
import org.vertx.testtools.VertxAssert; |
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 main | |
import "fmt" | |
type State uint | |
const ( | |
StateCreated State = iota // 0 | |
StateInitialized // 1 | |
StateRunning // 2 |
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
type SettingID uint16 | |
const ( | |
SettingHeaderTableSize SettingID = 0x1 | |
SettingEnablePush SettingID = 0x2 | |
SettingMaxConcurrentStreams SettingID = 0x3 | |
SettingInitialWindowSize SettingID = 0x4 | |
SettingMaxFrameSize SettingID = 0x5 | |
SettingMaxHeaderListSize SettingID = 0x6 | |
) |
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
if state == StateStopped { | |
fmt.Println("Thingie has stopped.") | |
} |
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
type streamState int | |
const ( | |
stateIdle streamState = iota | |
stateOpen | |
stateHalfClosedLocal | |
stateHalfClosedRemote | |
stateResvLocal | |
stateResvRemote | |
stateClosed |
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
<div class="content container"> | |
<h1>{{ .Title }}</h1> | |
<ul class="posts"> | |
{{ range .Data.Pages }} | |
<li><span><a href="{{ .Permalink }}">{{ if .Draft }}[Draft]{{ end }} {{ .Title }}</a> <time class="pull-right post-list">{{ .Date.Format "Mon, Jan 2, 2006" }}</h4></time></span></span></li> | |
{{ end }} | |
</ul> | |
</div> |
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 thirdcomponent; | |
import java.math.BigDecimal; | |
import java.math.MathContext; | |
public class ExpectationsExample { | |
public static void main(String[] args) { | |
final BigDecimal one = BigDecimal.ONE; | |
final BigDecimal three = BigDecimal.valueOf(3L); |
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 thirdcomponent; | |
import java.math.BigDecimal; | |
import java.math.MathContext; | |
public class UtilWithStatics { | |
// Predefined math context for use in calculation. | |
private final static MathContext C = MathContext.DECIMAL32; |
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 thirdcomponent; | |
import java.math.BigDecimal; | |
import java.math.MathContext; | |
public class UtilNoState { | |
public static void main(String[] args) { | |
System.out.println(calculate(BigDecimal.ONE, | |
BigDecimal.valueOf(3L), MathContext.DECIMAL32)); |
OlderNewer