Skip to content

Instantly share code, notes, and snippets.

Topic 1

Topic 2

Topic 3

What does this traffic sign require of you?

  • ✅ Reduction in speed
  • ✅ Greatest alertness
  • ✅ Readiness to brake

@danieltnaves
danieltnaves / theorie.md
Last active August 15, 2021 11:42
Theorieprüfung

Personal Qualifications; Human Risk Factor

What could cause the vehicle to leave the road?

  • ✅ Distraction
  • ✅ Inattention
  • ✅ Tiredness

Drivers often leave the road due to inattention or lack of concentration. Distractions, such as using a mobile phone, can also lead to such driving errors. A third reason for leaving the road is fatigue combined with microsleep.

How can you tell that you are getting tired while you are driving?

  • ✅ Frequent yawning
@danieltnaves
danieltnaves / callback-promise.js
Created July 7, 2019 08:04
Callback x Promise comparison
const sampleCallBack = (callback) => {
setTimeout(() => {
callback('This is an error', undefined)
}, 2000)
}
sampleCallBack((error, result) => {
if (error) {
return console.log(error)
}
@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"
@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 / 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 / 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 / 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 / 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 / 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>