Archive

Archive for the ‘Tips’ Category

Built-in web server python 2.7

October 18, 2017 Leave a comment

The next command helps you to create a simple http server to test anything fast, or use that location and their resources with a different port.
Just navigate in the command line to the location and type the next:

python -m SimpleHTTPServer [port]
Advertisements
Categories: Beyond, Mini-tips, Python, Tips

Fixing: Error: Couldn’t find preset “latest” relative to directory

July 22, 2017 Leave a comment

Add the babel-preset-latest to the node_modules of the project directory with –save-dev option, in example:
npm install –save-dev babel-preset-latest

PD. This issue came up when configuring webpack on a project recently created from scratch, and configured the babel-loader with the latest as preset.

Command npm to check for installed packages

July 22, 2017 Leave a comment

npm list -g –depth=0

April 26, 2017 Leave a comment

Create a synonym in oracle database.
create or replace synonym my_schema_granted.my_db_object_synonym for schema_that_grants.db_object;
commit;

Categories: Mini-tips, Oracle, plsql, SQL

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:
                Arrays.fill(freq,0);
//than:
                freq = new int[256];
Categories: Java, Mini-tips, Programación

Read Java input

October 10, 2016 Leave a comment

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        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 :
———-
–MyString
–otherString
–lastOneStr

Categories: Beyond, Mini-tips, Oracle, SQL