Skip to content

Instantly share code, notes, and snippets.

View brunoborges's full-sized avatar
🏠
Working from home, as always

Bruno Borges brunoborges

🏠
Working from home, as always
View GitHub Profile
bruno@latitude: maven $> mvn.js -- samples/springboot/boot.mvn
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building nashorn-maven-temp-artifact 1.0-SNAPSHOT
18:09:57.192 [main] DEBUG o.s.boot.SpringApplication - Loading source class java.lang.Class,class org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration,class org.springframework.boot.autoconfigure.MessageSourceAutoConfiguration,class org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration,class org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration,class org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration,class org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration,class org.springframework.boot.autoconfigure.web.MultipartAutoConfiguration,class org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration,class org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration
18:09:57.206 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner - JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning
18:09:57.206 [main] DEBUG o.s.c.a.ClassPathBeanDef
var ClientBuilder = Packages.javax.ws.rs.client.ClientBuilder;
var client = ClientBuilder.newClient();
var target = client.target("http://ip.jsontest.com/");
var response = JSON.parse(target.request().get(java.lang.String.class));
print("Your IP address is ${response.ip}");
var maven = {
main: "jaxrs.js",
options: "-scripting",
dependencies: ["org.glassfish.jersey.core:jersey-client:2.17",
"org.glassfish.jersey.connectors:jersey-grizzly-connector:2.17"]
}
/*
* Como executar: jjs -fx post24DialogosEntradas.js
*/
load("fx:base.js");
load("fx:graphics.js");
load("fx:controls.js");
var nome, regiao, fazExe;
lblTitulo = new Label("Questionário Importante");
/*
* Como executar: jjs -fx post24DialogosMensagens.js
*/
load("fx:base.js");
load("fx:graphics.js");
load("fx:controls.js");
btnInfo = new Button("Mostrar diálogo de informação");
btnErro = new Button("Mostrar diálogo de error");
btnAviso = new Button("Mostrar diálogo de aviso");

Keybase proof

I hereby claim:

  • I am brunoborges on github.
  • I am brunoborges (https://keybase.io/brunoborges) on keybase.
  • I have a public key whose fingerprint is 4CCF 3CFD AC8D 937A B513 25BE C9E4 DBC6 FEC6 0415

To claim this, I am signing this object:

@brunoborges
brunoborges / JEP-Source-Bytecode-Mismatch-Detect-onDebug.md
Last active August 29, 2015 14:10
JEP: Enable debugger to detect when there is a mismatch between source code and class being debugged

Summary

Enable debugger to detect when there is a mismatch between source code and class being debugged

Goals

  • Detect mismatch between the source code and the class bytecode being debugged
  • Allow for IDEs to identify through Debugger API such mismatch, enabling development of extensions

Motivation

#!/bin/sh
# Util script to encrypt a password on a remote WebLogic domain through SSH
REMOTE_DOMAIN_HOME=/home/bruno/Work/tools/oracle/mw1212/user_projects/domains/base_domain
DIR="$( cd "$( dirname "$0" )" && pwd )"
PRIVATE_KEYFILE=~/.ssh/id_rsa
ssh bruno@localhost -i $PRIVATE_KEYFILE DOMAIN_HOME=$REMOTE_DOMAIN_HOME PASSWORD=$1 '/bin/bash -s' <<'ENDSSHSESSION'

CDI and JSR 356 WebSockets

Objective: Auto-connect WebSockets on client-side (Java SE) application with CDI and Interceptors.

Problem: Because CDI implementations may provide a proxied bean, some things may not work as expected. See below for code and explanations.

STEP 1: Define a ws client with @ClientEndpoint, and the server-endpoint location with an Interceptor annotation (value is @Nonbinding)

@Dependent