Skip to content

Instantly share code, notes, and snippets.

Rafael Ponte rponte

Block or report user

Report or block rponte

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rponte
rponte / ADFBeanValidator.java
Created Jun 17, 2019 — forked from donatasnicequestion/ADFBeanValidator.java
ADF Bean Validator for JSF303 integration with Oracle ADF
View ADFBeanValidator.java
package com.nicequestion.donatas.adf.validate;
import javax.el.ValueExpression;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.validator.BeanValidator;
import javax.faces.validator.FacesValidator;
import javax.faces.validator.ValidatorException;
@rponte
rponte / FilterField.java
Last active Jun 7, 2019
ADF 11G: extracting all fields from a query panel (af:query)
View FilterField.java
package br.com.rponte.view.utils.query;
import java.io.Serializable;
import java.math.BigDecimal;
import oracle.adf.view.rich.model.AttributeCriterion;
/**
* Representa um campo de filtro do componente af:query
*/
@rponte
rponte / docker-commands-to-run-on-host-machine.sh
Last active May 14, 2019
Docker: list of useful commands
View docker-commands-to-run-on-host-machine.sh
# executing htop in host machine
docker run --name "htop" --rm -it --pid host jess/htop
@rponte
rponte / virtualbox-port-forwarding.sh
Created Apr 30, 2019
VirtualBox: mapping a port forwarding via command line
View virtualbox-port-forwarding.sh
# Assuming your docker machine is called "default" and you want to map port 80 in your container to localhost:8888 you can run:
vboxmanage modifyvm default --natpf1 "name_for_mapping,tcp,,8888,,80"
# or if the VM is running:
vboxmanage controlvm default natpf1 "name_for_mapping,tcp,,8888,,80"
@rponte
rponte / TableRowsExtractor.java
Created Apr 30, 2019
ADF 11G: listing all selected rows from a table (af:table)
View TableRowsExtractor.java
package br.com.rponte.controller.utils;
import java.util.ArrayList;
import java.util.List;
import oracle.adf.view.rich.component.rich.data.RichTable;
import oracle.jbo.JboException;
import oracle.jbo.Row;
import org.apache.myfaces.trinidad.model.CollectionModel;
import org.apache.myfaces.trinidad.model.RowKeySet;
@rponte
rponte / Intervalo_t.sql
Last active Apr 15, 2019
PL/SQL: exemplo de Objeto com estado e comportamentos no Oracle - Intervalo (Date Range)
View Intervalo_t.sql
--------------------------------------------------------
-- Representa um Intervalo de datas (Date Range)
-- https://docs.oracle.com/cd/B10501_01/appdev.920/a96624/10_objs.htm
--------------------------------------------------------
create or replace type Intervalo_t FORCE as Object (
inicio Date
,fim Date
-- Construtores
,Constructor Function Intervalo_t(inicio Date, fim Date) Return Self as Result
-- Metodos
@rponte
rponte / avoid-distributed-transactions.md
Last active Mar 29, 2019
Distributed Transactions (like 2 Phase Commit) and why you should avoid them
View avoid-distributed-transactions.md

Distributed Transactions and why you should avoid them

  1. Modern technologies won't support it (RabbitMQ, Kafka, etc.);
  2. This is a form of using Inter-Process Communication in a synchronized way and this reduces availability;
  3. All participants of the distributed transaction need to be avaiable for a distributed commit, again: reduces availability.

Implementing business transactions that span multiple services is not straightforward. Distributed transactions are best avoided because of the CAP theorem. Moreover, many modern (NoSQL) databases don’t support them. The best solution is to use the Saga Pattern.

[...]

@rponte
rponte / MembershipHealthCheck.java
Created Mar 22, 2019
Example of a simple Health Checker for Database using MicroProfile
View MembershipHealthCheck.java
package com.github.phillipkruger.membership.health;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.SQLException;
import java.util.logging.Level;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.sql.DataSource;
import lombok.extern.java.Log;
@rponte
rponte / FaturaDoCliente.java
Last active Apr 11, 2019
Exemplo de uso de projections com JPA/Hibernate
View FaturaDoCliente.java
package br.com.rponte.modelo;
public class FaturaDoCliente {
private String nome;
private BigDecimal valor;
/**
* Construtor é importante para JPQL
*/
@rponte
rponte / json-response-jsend.md
Last active Mar 11, 2019
JSON responses with jSend Spec
View json-response-jsend.md

JsonResult when SUCCESS:

  • Default Status : HTTP OK 200
  • Supported Status : HTTP Family 2xx
  • JSON Result Spec :
{ 
	status: "SUCCESS",  // Required
	data: Any,          // optional
You can’t perform that action at this time.