Found two good pages about Mockito verification:
https://www.javacodegeeks.com/2015/11/mockito-verification.html
https://www.baeldung.com/mockito-verify
Monday, November 26, 2018
Thursday, November 22, 2018
Encoding: a short resumé of a good article by Joel Spolsky
Résumé de l'article de Joel Spolsky
- unicode, ISO-8859-1, Windows-1252 sont des character sets
- Unicode can be implemented by different character encodings. UTF-8 implements unicode.
- En unicode, chaque caractère est représenté par un codepoint unique, p.ex "H" est : u+0048
- Les 256 codpoints de base sont identiques au charset ISO-8859-1
- L'application Windows charmap permet de visualiser le code d'un caractère dans unicode.
- Byte Order Mark: Trailing 00 or Ending 00
- In UTF-8: char. 0-127 are stored in a single byte, > 128 are stored in 2, 3, 4, 5 or 6 bytes
- Implémentations possibles de caractères unicode:
- 2 bytes: UCS-2 or UTF-16 (low endian, high endian)
- UTF-8: Store in 1-6 bytes
- unicode, ISO-8859-1, Windows-1252 sont des character sets
- Unicode can be implemented by different character encodings. UTF-8 implements unicode.
- En unicode, chaque caractère est représenté par un codepoint unique, p.ex "H" est : u+0048
- Les 256 codpoints de base sont identiques au charset ISO-8859-1
- L'application Windows charmap permet de visualiser le code d'un caractère dans unicode.
- Byte Order Mark: Trailing 00 or Ending 00
- In UTF-8: char. 0-127 are stored in a single byte, > 128 are stored in 2, 3, 4, 5 or 6 bytes
- Implémentations possibles de caractères unicode:
- 2 bytes: UCS-2 or UTF-16 (low endian, high endian)
- UTF-8: Store in 1-6 bytes
Monday, September 3, 2018
How to undo a Git commit that was not pushed
Whoops... I just commited my work while not noticing I was on the master.
From here, there are 3 options to undo that commit.
1. Undo commit and completely remove all changes
git reset --hard HEAD~;
From here, there are 3 options to undo that commit.
1. Undo commit and completely remove all changes
git reset --hard HEAD~;
2. Undo commit and unstage all files
git reset HEAD~;
or
or
git reset --mixed HEAD~;
3. Undo commit and keep all files staged
git reset --soft HEAD~;
Monday, August 13, 2018
What makes a good team?
Just read a useful comment on what are the usefule personalities that help building a good team:
- The analyst
- The socializer
- The sceptical
- The Enthusiast
Maybe true to some extend. That's certainly not all.
Friday, May 4, 2018
Why you should index foreign key columns (Oracle)
Foreign key columns should always be indexed (exception: see below).
This is one of the mantras of Tom Kyte (see this post on his site).
Here's a resume why:
First, table-level locks can occur when the primary key of the parent table is updated.
In addition to the table lock issue, an unindexed foreign key is bad in the following cases as well:
This is one of the mantras of Tom Kyte (see this post on his site).
Here's a resume why:
First, table-level locks can occur when the primary key of the parent table is updated.
In addition to the table lock issue, an unindexed foreign key is bad in the following cases as well:
- When you have an on delete cascade and have not indexed the child table. For example EMP is child of DEPT. Delete deptno = 10 should cascade to EMP. If deptno in emp is not indexed, you will get a full table scan of EMP. This full scan is probably undesirable and if you delete many rows from the parent table, the child table will be scanned once for each parent row deleted.
- When you query from the PARENT to the CHILD.
Consider the EMP, DEPT example again. It is very common to query the EMP table in the context of a deptno. If you frequently query:
select * from dept, emp
where emp.deptno = dept.deptno and dept.deptno = :X;
not having the index in place will slow down the queries.
So, when do you NOT need to index a foreign key? In general when the following conditions are met:
- you do NOT delete from the parent table. (especially with delete cascade)
- you do NOT update the parent tables unique/primary key value.
- you do NOT join from the PARENT to the CHILD (like DEPT->EMP).
Wednesday, February 21, 2018
Check if partitioning is enabled
This is a simple way to check if partitioning is enabled on a Oracle DB:
select decode(count(*), 0, 'No', 'Yes') Partitioning
from ( select 1
from dba_part_tables
where owner not in ('SYSMAN', 'SH', 'SYS', 'SYSTEM')
and rownum = 1 );
select decode(count(*), 0, 'No', 'Yes') Partitioning
from ( select 1
from dba_part_tables
where owner not in ('SYSMAN', 'SH', 'SYS', 'SYSTEM')
and rownum = 1 );
Subscribe to:
Comments (Atom)