Skip to content

Instantly share code, notes, and snippets.

@Crydust
Crydust / findKeywordSubstitution.sh
Created February 18, 2014 09:08
Find keyword substitution
# Find keyword substitution
grep . -r -e '\$\(Author\|CVSHeader\|Date\|Header\|Id\|Name\|Locker\|Log\|RCSfile\|Revision\|Source\|State\):'
@Crydust
Crydust / CreateEntityGraphWithSetAttribute.java
Created July 14, 2014 09:05
EntityGraph with Set attribute
EntityGraph<A> graph = em.createEntityGraph(A.class);
Subgraph<Set<B>> bSubgraph = graph.addSubgraph(A_.b);
// ???
Subgraph<C> cSubgraph = bSubgraph.addSubgraph(B_.c);
public String foo(boolean p1, boolean p2, long p3) {
String result = "a";
if (p1) result += "b";
if (p2) result += "c";
if (p1 && p2 && p3 < 5L) result += "d";
if (p3 == 1L) result = "e" + result;
result = "f" + result;
return result;
}
private String bar1() {
@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>
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;
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;
@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 / arquillian-IE11.md
Last active August 29, 2015 14:17
configure arquillian to run with intenetExplorer 11
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 / select_date_from_epoch.sql
Last active August 29, 2015 14:21
select date from epoch in sql on oracle
SELECT name,
modifieddate,
(
(
(TIMESTAMP '1970-01-01 00:00:00 UTC')
+ NUMTODSINTERVAL(modifieddate/1000, 'SECOND')
) AT TIME ZONE 'Europe/Brussels'
) AS "Date",
TRUNC(
(