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 / hibernate-oracle-tip.md
Last active Aug 12, 2019
Hibernate Tip when working with Oracle: favor dynamic update
View hibernate-oracle-tip.md

Full page logging in Postgres and Oracle (Oracle: sparse update)

The volume of undo and redo generated is only 15 MB here, including 6 MB of undo vectors. This is really optimized and this is one reason why you should update only the columns changed (and not use the default non-dynamic update of Hibernate for example).

@rponte
rponte / big-o-notation.md
Created Jul 28, 2019
Alternative Big O notations
View big-o-notation.md
  • O(1) = O(yeah)
  • O(log n) = O(nice)
  • O(nlogn) = O(k-ish)
  • O(n) = O(ok)
  • O(n²) = O(my)
  • O(2ⁿ) = O(no)
  • O(n^n) = O(fuck)
  • O(n!) = O(mg!)
@rponte
rponte / 01-memory-usage-for-each-user-session.sql
Last active Jul 2, 2019
Oracle: showing memory usage by user session/process
View 01-memory-usage-for-each-user-session.sql
select sess.username as username
,sess.sid as session_id
,sess.serial# as session_serial
,sess.program as session_program
,sess.server as session_mode
,round(stat.value/1024/1024, 2) as "current_UGA_memory (in MB)"
from v$session sess
,v$sesstat stat
,v$statname name
where sess.sid = stat.sid
@rponte
rponte / 00-create-table.sql
Last active Jul 1, 2019
Oracle: Playing a little bit with SELECT...FOR UPDATE SKIP LOCKED
View 00-create-table.sql
--
-- tabela JOB_QUEUE
--
CREATE SEQUENCE SEQ_JOB_QUEUE;
CREATE TABLE JOB_QUEUE (
ID NUMBER NOT NULL ENABLE,
CONTENT VARCHAR2(4000 CHAR) NOT NULL ENABLE,
STATUS VARCHAR2(20 CHAR) NOT NULL ENABLE,
THREAD_NAME VARCHAR2(60 CHAR),
@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 Jun 27, 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
You can’t perform that action at this time.