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 / oracle-and-read_uncommited-isolation-level.md
Last active Oct 2, 2019
Oracle does NOT support dirty reads AT ALL by design (aka READ_UNCOMMITED Isolation level)
View oracle-and-read_uncommited-isolation-level.md

By design, Oracle does NOT support dirty reads AT ALL (aka READ_UNCOMMITED Isolation level)

Stackoverflow: Does oracle allow the uncommitted read option?

Tom provides a great answer to this: On Transaction Isolation Levels

The READ UNCOMMITTED isolation level allows dirty reads. Oracle Database doesn't use dirty reads, nor does it even allow them. The basic goal of a READ UNCOMMITTED isolation level is to provide a standards-based definition that allows for nonblocking reads.

...

@rponte
rponte / git-revert-multiple-commits.sh
Created Sep 25, 2019
Git: reverting a range of commits
View git-revert-multiple-commits.sh
##
# Reverting a range of commits
#
# git --pretty=oneline --abbrev-commit older_commit..newer_commit # not includes the oldest commit
# git --pretty=oneline --abbrev-commit older_commit^..newer_commit # includes the oldest commit
##
# just to be sure about the commits, list them
git log --pretty=oneline --abbrev-commit 1f80548^..4b293d5
@rponte
rponte / plsql-clean-code.md
Last active Sep 13, 2019
TechDay: Aplicando Clean Code em código PL/SQL
View plsql-clean-code.md

Aplicando Clean Code em código PLSQL

Tech-talk semanal, no estilo hands-on, apresentado para equipe de desenvolvimento na empresa MDIAS BRANCO. O código utilizado na talk foi de uma package PL/SQL utilizada em produção.

Pre-Requisitos: O código PL/SQL deve estar coberto por testes automatizados;

Passo a Passo:

@rponte
rponte / robust-bash.sh
Created Aug 29, 2019 — forked from TimothyJones/robust-bash.sh
These are (currently) the only functions I recommend porting around when writing bash scripts
View robust-bash.sh
#!/bin/bash -eu
if [ -z "${LIB_ROBUST_BASH_SH:-}" ]; then
LIB_ROBUST_BASH_SH=included
function error {
echo "Error: ${1:-}"
}
# Check to see that we have a required binary on the path
function require_binary {
@rponte
rponte / export-html-to-csv.js
Last active Aug 28, 2019
JavaScript: exportando table HTML para CSV - Projeto de MDB Medidas da MDIAS
View export-html-to-csv.js
/**
* Para rodar, basta:
* 1. executar este script no console da pagina;
* 2. clicar no botão "Exportar" no inicio da página;
* 3. apos download, abrir arquivo .csv;
* 4. abrir arquivo no Excel;
*/
$(document).ready(function() {
// cria link "exportar" no inicio da pagina
@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;
You can’t perform that action at this time.