SpringBoot creating UserDetailsService authentication with login and signup form example

There are plenty of online tutorials showing how to create database-based authentication for Spring. Some of them use SQL query to authenticate user and retrieve its roles, some use DAO… but none of them worked well for me and all of them had some major problems, even like SQL Injection. So, in this post I […]

Setting up SonarQube for Android Gradle project to improve code quality

I’m working on a new Android project which I inherited. Well, I forked it because I didn’t feel welcomed to contribute to the project and I see a lot of places where improvements are needed. First, I need to improve the codebase. Previous developers didn’t care about any Java coding guidelines from Oracle, Google, CERT […]

[Java] – Regular expression to match IPv4 address

I saw such question on SO. There was no solution with RegEx so… I was bored I think. public static boolean isValid(String ip) { boolean isvalid;   isvalid = ip.matches( "(([0-9]|[0-9]{0,2}|1[0-9]*{0,2}|2[0-5][0-5]|0{0,3}).){3}" + "([0-9]|[0-9]{0,2}|1[0-9]*{0,2}|2[0-5][0-5]|0{0,3})" );   return isvalid; }public static boolean isValid(String ip) { boolean isvalid; isvalid = ip.matches( "(([0-9]|[0-9]{0,2}|1[0-9]*{0,2}|2[0-5][0-5]|0{0,3}).){3}" + "([0-9]|[0-9]{0,2}|1[0-9]*{0,2}|2[0-5][0-5]|0{0,3})" ); return isvalid; }

[Java] regular expression to match emails and domains works with gTLD

Recently we got many new top-level domains like .international, .berlin etc, so older regular expressions are no longer valid. Below you can see a list of valid domains; an address may contain . (dot), – (minus) and .subdomain (domain may contain many sub-domains). A domain must end with a letter, it cannot be . (dot) […]

Solution to SQLException: No suitable driver found for jdbc:mysql

Just a quick fix. Instead of: Connection con = null;   String url = "jdbc:mysql://localhost:3306/mysql"; String user = "user"; String password = "password"; con = DriverManager.getConnection(url, user, password);Connection con = null; String url = "jdbc:mysql://localhost:3306/mysql"; String user = "user"; String password = "password"; con = DriverManager.getConnection(url, user, password); You should have: Connection con = null; […]

[pl] Learn IT online – zestaw kursów do nauki informatyki

[pl] Gynvael Coldwind prowadzi swoje kursy na YT. RE, debugging, Asm, programowanie OO widziane z niska. Czekam na OpenGL. [pl] javastart.pl Kurs Javy, wstęp do programowania w Javie na Android i co nieco JEE. Autor ma dobre nawyki pisania w OO.

No suitable driver found for jdbc:mysql

Miałem dzisiaj bardzo dziwny problem z NetBeans7.2 z próbą stworzenia połączenia z bazą danych MySQL. Zaczęło się od niedoczytanej dokumentacji… czyli zamiast: Connection con = null;   String url = "jdbc:mysql://localhost:3306/mysql"; String user = "user"; String password = "password"; con = DriverManager.getConnection(url, user, password); Connection con = null; String url = "jdbc:mysql://localhost:3306/mysql"; String user = […]