Skip to content

Instantly share code, notes, and snippets.

Avatar

Edenir Norberto Anschau edenir-anschau

  • São Paulo, SP, Brazil
View GitHub Profile
@edenir-anschau
edenir-anschau / gist:915b70289ce6b68a5845
Last active Aug 29, 2015
Eclipse: convert upper case text to lower case and viceversa with a simple shortcut
View gist:915b70289ce6b68a5845
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 Aug 8, 2015
Hibernate hbm2ddl.auto possible values
View gist:77a40c3ab15f1244e26f
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 Aug 9, 2015
Ignore foreign key constraints
View ignore_foreign_key.sql
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 Aug 29, 2015
HTTP Response Java Enumeration Type
View HttpStatusCode.java
// 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 Aug 29, 2015 — 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
View mysqlbackup.sh
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 / SemAcentoNemCedilha.java
Created Feb 10, 2016 — forked from yanaga/SemAcentoNemCedilha.java
Normalização de Strings em Java
View SemAcentoNemCedilha.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 Feb 28, 2016
Merge multiple jasper prints
View mutiplesJasperPrint.java
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 / gist:5aea6bd3e827a1b58d73
Last active Feb 28, 2016
Solved: org.hsqldb.HsqlException: user lacks privilege or object not found: ENTITY_XPTO
View gist:5aea6bd3e827a1b58d73
@edenir-anschau
edenir-anschau / banch_rename.bash
Last active Feb 28, 2016
Batch rename package in all .java files with find and sed
View banch_rename.bash
find . -type f -name "*.java" -exec sed -i "s/package oldPackage/package newPackage/" {} \;
@edenir-anschau
edenir-anschau / .gitignore
Created Mar 19, 2016
.gitignore for Java + Eclipse + Maven
View .gitignore
#Eclipse
.classpath
.project
.settings
*.class
#Maven
target
test-output