Skip to content

Instantly share code, notes, and snippets.

alter system flush buffer_cache;
alter system flush shared_pool;
SELECT /*+ GATHER_PLAN_STATISTICS */ * FROM TODO;
SELECT * FROM table(DBMS_XPLAN.DISPLAY_CURSOR(FORMAT=>'ALLSTATS LAST'));
@Crydust
Crydust / arquillian-IE11.md
Last active August 29, 2015 14:17
configure arquillian to run with intenetExplorer 11
@Crydust
Crydust / install_git_on_centos_6.sh
Created March 18, 2015 13:54
install git on centos 6
#!/bin/sh
# see http://tecadmin.net/install-git-1-9-on-centos-rhel/
# see https://www.kernel.org/pub/software/scm/git/
# see https://www.kernel.org/signature.html
# see https://github.com/Homebrew/homebrew/blob/master/Library/Formula/git.rb
# wget can be subtituted by curl -O
ROOTUID='0'
@Crydust
Crydust / Git.java
Last active November 8, 2023 16:40
run git commands from java
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Objects;
@Crydust
Crydust / javaee7-maven-pom.xml
Last active August 29, 2015 14:15
javaee7 maven pom
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>be.crydust</groupId>
<artifactId>example</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>example</name>
@Crydust
Crydust / XmlDocument.java
Last active October 20, 2022 13:39
encapsulate org.w3c.dom.Document and javax.xml.xpath.XPath to parse a small xml document (needs more testing, not thread safe, ...)
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.xml.XMLConstants;
import java.io.PrintStream;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
public class MyConsoleProgressBar {
public static final long NANOS_PER_MILLISECOND = 1000000L;
public static final long NANOS_PER_SECOND = 1000L * NANOS_PER_MILLISECOND;
public static final long NANOS_PER_MINUTE = 60L * NANOS_PER_SECOND;
public class MyStopWatch {
public static final long NANOS_PER_MILLISECOND = 1000000L;
public static final long NANOS_PER_SECOND = 1000L * NANOS_PER_MILLISECOND;
public static final long NANOS_PER_MINUTE = 60L * NANOS_PER_SECOND;
public static final long NANOS_PER_HOUR = 60L * NANOS_PER_MINUTE;
public static final long NANOS_PER_DAY = 24L * NANOS_PER_HOUR;
private long startTime = -1L;
@Crydust
Crydust / jpaToHql.java
Last active March 26, 2024 10:11
convert jpa TypedQuery to hibernate hql (=jpql)
// @see http://antoniogoncalves.org/2012/05/24/how-to-get-the-jpqlsql-string-from-a-criteriaquery-in-jpa/
TypedQuery<X> q = entityManager.createQuery(cq);
try {
Class<?> hibernateQueryClass = Class.forName("org.hibernate.Query");
Object hibernateQuery = q.unwrap(hibernateQueryClass);
java.lang.reflect.Method getQueryStringMethod = hibernateQueryClass.getMethod("getQueryString");
Object hql = getQueryStringMethod.invoke(hibernateQuery);
LOGGER.warn("hql = {}", hql);
} catch (ClassNotFoundException | NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | java.lang.reflect.InvocationTargetException ex) {
ex.printStackTrace();
@Crydust
Crydust / build_archive.xml
Last active August 29, 2015 14:04
java applet security warning windows xp
<jar jarfile="example.jar">
<manifest>
<attribute name="Permissions" value="all-permissions" />
<attribute name="Application-Name" value="example" />
<attribute name="Application-Library-Allowable-Codebase" value="*" />
<attribute name="Caller-Allowable-Codebase" value="*" />
<attribute name="Codebase" value="*" />
</manifest>
<fileset dir="${cls}" />
</jar>