tech

Floating point numbers

Posted on

You certainly heard people speaking about 32 bit  or 64 bit computers. Now what does it mean to store a number in a 32 bit representation? Instead of going very deep into it I am going to give an high level overview and some examples. There are enough websites out there with a lot of info […]

OCP

JDBC

Posted on

Java Database Connectivity I’ll start off with a small example and then give a couple of pointers regarding JDBC.   Example This example connects to a MySQL database. I’m querying the superhero database which originally contains 2 rows: id, name, first_name, last_name, good ‘1’,’Superman’,’Clark’,’Kent’,’1′ ‘2’,’Batman’,’Bruce’,’Wayne’,’1′ The code queries the database for all the names of […]

HowTo

Sql Server tips

Posted on

Here are some basic tips for the use of SQL SERVER:   1. NOCOUNT SET NOCOUNT = OFF Don’t count the number of rows affected for big queries with a lot of joins. This will significantly improve performance   2. DATEADD SELECT count(personId) FROM persons WHERE creationDate > DATEADD(DAY, -14, CURRENT_TIMESTAMP); SELECT count(personId) FROM persons […]

OCP

Java NIO.2

Posted on

Non blocking IO in Java, released with Java 7. Path Path represents a path on the storage system to a directory or file. Conceptually it is a replacement for the java.io.File class. Path path = Paths.get(/bla/bli/blu/blue.txt); Paths is the factory class for the interface Path. The  Paths class contains static factory methods that return a Path. […]

OCP

Java IO

Posted on

Yes, there are so many different Stream classes. (Now I am talking about IO Streaming) Here are some tips to keep them apart: All these classes inherit (in)directly from on of the following four abstract Classes InputStream OutputStream Reader Writer ! You cannot instantiate one of the above classes since they are all abstract If […]

OCP

Concurrency: threats or Threads

Posted on

In this post I go over the basis of concurrent execution in Java. I advise you to run the code snippets yourself to get the most out of it. This is an overview, not a tutorial. If you are able to explain the working of the example on the bottom yourself, you have a good […]

OCP

All is good.. except for Exceptions

Posted on

Point Out The Mistakes public class Mistakes { public static void main(String[] args) { try { throwException(); } catch (MissingResourceException e){ } catch (InputMismatchException e | FileNotFoundException e){ } catch (ParseException | ArrayIndexOutOfBoundsException e){ } catch (MissingResourceException | IllegalArgumentException e){ } catch (Throwable e){ } catch (IOException e){ } } private static void throwException() throws […]

OCP

It’s time..

Posted on

Did you know: Month.JANUARY is the same as Month.of(1) Month is an enum Month.JANUARY == 1 does not compile since Month is an enum and enums cannot be compared to an int Month.JANUARY.getValue() returns 1 because getValue is implemented as return ordinal() + 1 ZonedDateTimes can be created from a LocalDate, LocalTime and a ZoneId: LocalDate […]

OCP

Trick Question

Posted on

What is the output of the following code snippet: import java.time.*; public class DaylightSaving { public static void main(String[] args) { LocalDate date = LocalDate.of(2019, Month.MARCH, 31); LocalTime time = LocalTime.of(2,30); LocalDateTime dateTime = LocalDateTime.of(date, time); ZoneId zone = ZoneId.of(“Europe/Paris”); ZonedDateTime zonedDateTime = ZonedDateTime.of(dateTime, zone); System.out.println(zonedDateTime); } } Scroll down..           […]

tech

MongoDB Europe

Posted on

A few weeks ago I had the chance to visit MongoDB Europe. Read about all the features we learned more about in the following blogpost by me and my colleagues: https://ordina-jworks.github.io/development/2018/11/20/mongodb-europe-018.html