Skip to content

Instantly share code, notes, and snippets.

@danieltnaves
danieltnaves / sql-most-used.sql
Last active July 5, 2016 12:50
SQL - Most used commands.
-- Selecting Rows Where the Case of a Text Value Is Not Important
SELECT *
FROM MEMBER M
WHERE UPPER(M.MEMBERTYPE) = 'SENIOR'
-- Finding the Members with No Value for MemberType
SELECT *
FROM MEMBER M
WHERE M.MEMBERTYPE IS NULL
@danieltnaves
danieltnaves / golf-club-oracle.sql
Created June 24, 2016 02:12
Golf Club SQL script for Oracle Database
CREATE TABLE Type(
Type VARCHAR2(20) Primary Key,
Fee number);
CREATE TABLE Member(
MemberID NUMBER Primary Key,
LastName VARCHAR2(20),
FirstName VARCHAR2(20),
MemberType VARCHAR2(20) constraint fk1_member References type(type),
Phone VARCHAR2(20), Handicap NUMBER, JoinDate DATE, Coach NUMBER, Team
@danieltnaves
danieltnaves / scrum.txt
Last active July 1, 2016 01:26
Anotações sobre Scrum
Anotações sobre Scrum (prints em anexo).
@danieltnaves
danieltnaves / steps-tomcat8-datasource.xml
Created July 5, 2016 12:47
Settting up Tomcat 8 Data Source (Oracle)
<!-- 1) Add "Resource" entry in conf/context.xml -->
<Resource auth="Container"
driverClassName="oracle.jdbc.driver.OracleDriver"
maxActive="100" maxIdle="30" maxWait="-1"
name="jdbc/OracleDS" type="javax.sql.DataSource"
url="jdbc:oracle:thin:@host:1521:SIDNAME"
username="user" password="123" />
<!-- 2) Add "resource-ref" entry in conf/web.xml -->
<resource-ref>
@danieltnaves
danieltnaves / DSConn.java
Created July 5, 2016 12:49
Connecting Tomcat 8 Data Source (Oracle)
import java.sql.Connection;
import java.sql.SQLException;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
public class DSConn {
public static Connection getConnection() throws SQLException, ClassNotFoundException, NamingException {
@danieltnaves
danieltnaves / PowerMockPrivateMethods.java
Created July 18, 2016 03:36
Example of PowerMock usage for mocking private methods and attributes.
import java.util.ArrayList;
import java.util.List;
import org.junit.Assert;
import org.junit.Test;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.reflect.Whitebox;
/**
@danieltnaves
danieltnaves / Deadlock.java
Created September 14, 2016 03:43
Deadlock sample
package banco;
import java.io.File;
public class Deadlock {
public static File arquivo1 = new File("arquivo1.txt");
public static File arquivo2 = new File("arquivo2.txt");
@danieltnaves
danieltnaves / DevelopmentDatabaseManagerSwing
Created October 30, 2016 18:37
Expose DatabaseManagerSwing start via JMX
package br.com.naves.configuration.db;
import org.hsqldb.util.DatabaseManagerSwing;
import org.springframework.context.annotation.Profile;
import org.springframework.jmx.export.annotation.ManagedOperation;
import org.springframework.jmx.export.annotation.ManagedResource;
import org.springframework.stereotype.Component;
@Component
@ManagedResource(objectName="br.com.naves.configuration.db:name=DevelopmentDatabaseManager",
@danieltnaves
danieltnaves / remove-jdev.txt
Created December 4, 2016 12:05
How to remove JDeveloper
1 - Go to /utils/uninstall/uninstall
2 - Run uninstall.sh ou uninstall.exe
3 - Select the resources to be removed
4 - Finish
@danieltnaves
danieltnaves / bash
Created July 5, 2017 19:40 — forked from jonashackt/bash
Remote debugging Spring Boot
### java -jar
java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8001,suspend=y -jar target/cxf-boot-simple-0.0.1-SNAPSHOT.jar
### Maven
Debug Spring Boot app with Maven:
mvn spring-boot:run -Drun.jvmArguments="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8001"