Skip to content

Instantly share code, notes, and snippets.

View edenir-anschau's full-sized avatar

Edenir Norberto Anschau edenir-anschau

  • São Paulo, SP, Brazil
View GitHub Profile
@edenir-anschau
edenir-anschau / gist:915b70289ce6b68a5845
Last active August 29, 2015 14:26
Eclipse: convert upper case text to lower case and viceversa with a simple shortcut
Lower case: CTRL+SHIFT+Y
Upper case: CTRL+SHIFT+X
Source: http://www.daveoncode.com/2009/08/25/eclipse-shortcut-switch-convert-uppercase-text-cod-lowercase/
@edenir-anschau
edenir-anschau / gist:77a40c3ab15f1244e26f
Created August 8, 2015 22:06
Hibernate hbm2ddl.auto possible values
list of possible options are:
validate: validate the schema, makes no changes to the database.
update: update the schema.
create: creates the schema, destroying previous data.
create-drop: drop the schema at the end of the session.
Source: http://stackoverflow.com/a/1689769
@edenir-anschau
edenir-anschau / ignore_foreign_key.sql
Created August 9, 2015 02:31
Ignore foreign key constraints
set foreign_key_checks=0
-- Source: https://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#sysvar_foreign_key_checks
@edenir-anschau
edenir-anschau / HttpStatusCode.java
Last active August 29, 2015 14:27
HTTP Response Java Enumeration Type
// LICENSE GPL 3.0 Peter Pilgrim, Xenonique.co.uk, 2012
// http://www.gnu.org/licenses/gpl.html GNU PUBLIC LICENSE 3.0
//Source: http://www.xenonique.co.uk/blog/?p=1447
package uk.co.xenonique.http.net;
/**
* Implementation type HttpStatusCode
*
* (Only codes 400 to 417 and codes 500 to 524 implemented)
*
@edenir-anschau
edenir-anschau / mysqlbackup.sh
Last active August 29, 2015 14:28 — forked from nicdoye/mysqlbackup.sh
Backup your OpenShift MySQL database. My DB is only small so I didn't bother to compress it through a pipe. sftp it back from your local machine afterwards This is basically a quick hack from running "type mysql" on the OpenShift gear - hint: it's a bash function/alias
mkdir ~/app-root/data/tmp
mysqldump -h $OPENSHIFT_MYSQL_DB_HOST -P ${OPENSHIFT_MYSQL_DB_PORT:-3306} -u ${OPENSHIFT_MYSQL_DB_USERNAME:-'admin'} --password="$OPENSHIFT_MYSQL_DB_PASSWORD" --all-databases > ~/app-root/data/tmp//all.sql
@edenir-anschau
edenir-anschau / gist:5aea6bd3e827a1b58d73
Last active February 28, 2016 20:30
Solved: org.hsqldb.HsqlException: user lacks privilege or object not found: ENTITY_XPTO
@edenir-anschau
edenir-anschau / SemAcentoNemCedilha.java
Created February 10, 2016 02:02 — forked from yanaga/SemAcentoNemCedilha.java
Normalização de Strings em Java
import java.text.Normalizer;
public class SemAcentoNemCedilha {
public static String normalizar(String s) {
return Normalizer.normalize(value, Normalizer.Form.NFD).replaceAll("[^\\p{ASCII}]", "");
}
}
@edenir-anschau
edenir-anschau / mutiplesJasperPrint.java
Last active February 28, 2016 12:59
Merge multiple jasper prints
List<JasperPrint> jasperPrints = loadReports();
ByteArrayOutputStream out = new ByteArrayOutputStream();
JRPdfExporter exporter = new JRPdfExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT_LIST, jasperPrints);
exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, out);
exporter.exportReport();
//Source: http://stackoverflow.com/a/24117554
@edenir-anschau
edenir-anschau / banch_rename.bash
Last active February 28, 2016 21:15
Batch rename package in all .java files with find and sed
find . -type f -name "*.java" -exec sed -i "s/package oldPackage/package newPackage/" {} \;
@edenir-anschau
edenir-anschau / gist:e75af8d0c497370a94b8
Last active December 13, 2016 13:34
Git sees maven empty project
touch src/main/java/.gitignore src/main/resources/.gitignore src/test/java/.gitignore src/test/resources/.gitignore