To create a new array or fill it? Java Array Performance

October 12, 2016 Leave a comment

Recently I needed to empty an array to use it later, and asked myself, what is the better option, to create a new one or fill it?
Maybe you have known this long ago, I didn’t. But now, we both know!

int freq[] = new int[256];
//This is better:
                freq = new int[256];
Categories: Java, Mini-tips, Programación

Configuration Errors on Spring + Wicket

October 11, 2016 Leave a comment

When facing error:
The matching wildcard is strict, but no declaration can be found for element ‘context:component-scan’.

Remember, is a typo somewhere!

If you face error:
No WebApplicationContext found: no ContextLoaderListener registered?

You need to set manually the applicationContext on the setUp() of your test.

public ServletContext getServletContext() {
                ServletContext sc = super.getServletContext();
                XmlWebApplicationContext appCont = new XmlWebApplicationContext();

                sc.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, appCont);

                return sc;

When error BeanDefinitionStoreException Failed to read candidate component class you got a pom.xml with spring dependencies in conflict.

Categories: Beyond, typo

Read Java input

October 10, 2016 Leave a comment

    public static void main(String[] args) {
        Scanner in = new Scanner(;
        int n = in.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        // all ints from 0 to N should be insie array a
Categories: Java, Mini-tips

Split string in sql query – oracle

October 3, 2016 Leave a comment

select regexp_substr(‘MyString,otherString,lastOneStr’,'[^,]+’, 1, level) from dual
connect by regexp_substr(‘MyString,otherString,lastOneStr’, ‘[^,]+’, 1, level) is not null;

–Result :

Categories: Beyond, Mini-tips, Oracle, SQL

Simple way to enable a job in oracle scheduler.

September 29, 2016 Leave a comment


Categories: Beyond, Mini-tips, Oracle, plsql

Get duplicates ints in array in 126 Characters with Java 8 and Streams

August 10, 2016 Leave a comment
*(excluding line breaks, and spaces)

int[] GetDuplicates(int[] n) {
        .filter(i -> {
            int c = 0;
            for(int x : n)
                c += x==i ? 1 : 0;
            return c>1;
Categories: Java, Mini-tips, Programación, Tips

Split string in oracle sql query

August 1, 2016 1 comment

select regexp_substr('MyString,otherString,lastOneStr','[^,]+', 1, 2) from dual; 
-- Returns 'otherString' String
Categories: Beyond, Mini-tips, Oracle, plsql, SQL, Tips