Skip to content

Instantly share code, notes, and snippets.

View maikelsperandio's full-sized avatar

Maikel Sperandio maikelsperandio

  • Goiânia, GO, Brazil
View GitHub Profile
@maikelsperandio
maikelsperandio / c3p0.xml
Created October 2, 2013 14:58
C3P0 hibernate config
<property name="hibernate.c3p0.min_size" value="5"/>
<property name="hibernate.c3p0.max_size" value="20"/>
<property name="hibernate.c3p0.timeout" value="300"/>
<property name="hibernate.c3p0.max_statements" value="50"/>
<property name="hibernate.c3p0.idle_test_period" value="3000"/>
@maikelsperandio
maikelsperandio / eclipse.ini
Last active December 24, 2015 21:39
eclipse.ini configuration
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20130807-1835
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
-vm
E:/desenv/java/jdk1.7.0_21/bin/javaw.exe
@maikelsperandio
maikelsperandio / pom.xml
Created October 8, 2013 17:49
maven build plugins
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${compiler.version}</source>
<target>1.7</target>
</configuration>
</plugin>
@maikelsperandio
maikelsperandio / unproxy.java
Created October 8, 2013 18:21
Method to unproxy an object from hibernate proxy
@SuppressWarnings("unchecked")
protected T unproxy(T entity){
if (entity == null) {
return null;
}
if (entity instanceof HibernateProxy) {
try {
Hibernate.initialize(entity);
} catch (ObjectNotFoundException e) {
@maikelsperandio
maikelsperandio / GenericEnumUserType.java
Created October 16, 2013 14:50
GenericEnumUserType to work with Enum on Hibernate
package br.com.datatraffic.imagemweb.dominio.enumerator;
import java.io.Serializable;
import java.lang.reflect.Method;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Properties;
import org.hibernate.HibernateException;
@maikelsperandio
maikelsperandio / howToInstallRedmineCentos
Last active December 28, 2015 19:29
How to install redmine 2.4.0 on centos 6.4
# Prepare the centos installing these packages:
yum install make gcc gcc-c++
# Install gem and passenger dependencies:
yum -y install zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel mysql-devel
# Go to ftp.ruby-lang.org and make the download of ruby, in this case: ruby-2.0.0-p247.tar.gz
# After download you have to untar it
tar zxvf ruby-2.0.0-p247.tar.gz
package com.maikelsperandio.ssltest;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.security.KeyStore;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLSession;
package br.com.mcde.sistema.utils;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.WritableByteChannel;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.Map;
import javax.faces.context.FacesContext;
import javax.servlet.ServletContext;
import net.sf.jasperreports.engine.JRDataSource;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperFillManager;
public class EntregaController extends ControllerBase {
private String retornoIndex = "/pages/entregas/index?faces-redirect=true";
private @Getter @Setter Date data;
private @Getter @Setter Entregador entregador;
private @Getter @Setter String periodoInicial;
private @Getter @Setter String periodoFinal;
private StreamedContent relatorio;