Skip to content

Instantly share code, notes, and snippets.

@jronal
jronal / web.xml
Created May 7, 2019 20:14
Filter for integrate filter jee with spring context
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
package pe.gob.reniec.renovacion.util;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;
import org.springframework.web.servlet.HandlerMapping;
@jronal
jronal / java
Created July 6, 2017 03:37
sudoku codefights
boolean sudoku2(char[][] grid) {
int n = grid.length;
int[] filaVerifica = new int[n];
int[] columnaVerfica = new int[n];
int[] escaque = new int[n];
for (int i = 0; i < n; i++) {
Arrays.fill(filaVerifica, 0);
Arrays.fill(columnaVerfica, 0);
Arrays.fill(escaque, 0);
@jronal
jronal / gist:8729407687e36adc6fa7
Created June 17, 2015 00:36
Importar webservice
>wsimport -verbose -keep -d clases -s sources -p edu.cibertec.jaad.ws calcws.wsdl
package com.danielme.demo.jaxws.cxf.client;
import java.security.AlgorithmParameters;
import java.security.SecureRandom;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.IvParameterSpec;
package com.danielme.demo.jaxws.cxf.client;
/**
* Created by Jose on 18/12/14.
*/
public class Test {
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
@jronal
jronal / underscore to camelCase
Created July 8, 2014 23:21
convert underscore to camelCase
var camelCase = string.replace(/_([a-z])/g, function (g) { return g[1].toUpperCase(); });
@jronal
jronal / install jar in maven local
Created February 6, 2014 15:42
Install jar in maven local
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging> -DgeneratedPom=true
@jronal
jronal / export_blob.sql
Created December 15, 2013 18:54
export BLOB oracle
DECLARE
l_file UTL_FILE.FILE_TYPE;
l_buffer RAW(32767);
l_amount BINARY_INTEGER := 32767;
l_pos INTEGER := 1;
l_blob BLOB;
l_blob_len INTEGER;
BEGIN
-- Get LOB locator
SELECT column2