Sunday, June 21, 2020

Oracle monitoring session

WITH blocked_resources AS (select id1 ,id2 ,SUM(ctime) as blocked_secs ,COUNT(1) as blocked_count ,type from v$lock where request > 0 group by type,id1,id2 ) ,blockers AS (select L.id1, L.id2, L.type, L.sid ,BR.blocked_secs ,BR.blocked_count from v$lock L ,blocked_resources BR where BR.type = L.type and BR.id1 = L.id1 and BR.id2 = L.id2 and L.lmode > 0 and L.block <> 0 ) select /*+ MERGE(@"SEL$22") MERGE(@"SEL$109DB78D") MERGE(@"SEL$5") MERGE(@"SEL$38") MERGE(@"SEL$470E2127") MERGE(@"SEL$7286615E") MERGE(@"SEL$62725911") MERGE(@"SEL$2EC965E0") MERGE(@"SEL$C8360722") MERGE(@"SEL$874CA85A") MERGE(@"SEL$74A24351") MERGE(@"SEL$71D7A081") MERGE(@"SEL$7") MERGE(@"SEL$24") CARDINALITY(@"SEL$AF73C875" "S"@"SEL$4" 1000) CARDINALITY(@"SEL$AF73C875" "R"@"SEL$4" 1000) */ B.id1||'_'||B.id2||'_'||S.sid||'_'||S.serial# as id ,'SID,SERIAL:'||S.sid||','||S.serial#||',LOCK_TYPE:'||B.type||',PROGRAM:'||S.program||',MODULE:'||S.module||',ACTION:'||S.action||',MACHINE:'||S.machine||',OSUSER:'||S.osuser||',USERNAME:'||S.username as info ,B.blocked_secs ,B.blocked_count from v$session S ,blockers B where B.sid = S.sid;

Recommended the use of TOAD for DBA (Database browser)

Saturday, May 23, 2020

Automating Keyboard and Mouse in Java

package org.pierre.robot;

import java.awt.*;
import java.awt.event.KeyEvent;

public class RobotSnapshot {
    public static void main(String[] args) throws AWTException {
        Robot robot = new Robot();
        for (int i = 0; i < 2000; i++) {

Sunday, April 26, 2020


I down load and extract the JDK 11 with dcevm hotswap agent, and I configure it as JDK in Intellij (Project Structure):

When I run my application, it's using:


HOTSWAP AGENT: 21:08:29.718 INFO (org.hotswap.agent.HotswapAgent) - Loading Hotswap agent {1.4.0} - unlimited runtime class redefinition.
HOTSWAP AGENT: 21:08:30.048 INFO (org.hotswap.agent.config.PluginRegistry) - Discovered plugins: [JdkPlugin, Hotswapper, WatchResources, ClassInitPlugin, AnonymousClassPatch, Hibernate, Hibernate3JPA, Hibernate3, Spring, Jersey1, Jersey2, Jetty, Tomcat, ZK, Logback, Log4j2, MyFaces, Mojarra, Omnifaces, ELResolver, WildFlyELResolver, OsgiEquinox, Owb, Proxy, WebObjects, Weld, JBossModules, ResteasyRegistry, Deltaspike, GlassFish, Vaadin, Wicket, CxfJAXRS, FreeMarker, Undertow, MyBatis]
Starting HotswapAgent 'D:\pierre\Java\dcevm-11.0.6+1\lib\hotswap\hotswap-agent.jar'

Spring Boot Web Security

Jetbrains excellent introduction here

Intro here

My demo code here

Saturday, March 21, 2020

Aspects to log enter and exit method

The idea is:

use @EnableAspectJAutoProxy in a @Configuration

create an annotation EntryExitLogger to mark the method(s) you want to be logged for entry/exit

have a @Component annotated with @Aspect and inside it you specify the aspects:

public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable{

That's all.

Detailed post on the topic

Doc of AspectJ here

Good Aspectj cookbock here

Wednesday, February 19, 2020

github and line separators " You can tell Git to convert CRLF to LF on commit but not the other way around by setting core.autocrlf to input:

$ git config --global core.autocrlf input " this one also helps

Per-repository settings

Optionally, you can configure a .gitattributes file to manage how Git reads line endings in a specific repository. When you commit this file to a repository, it overrides the core.autocrlf setting for all repository contributors. This ensures consistent behavior for all users, regardless of their Git settings and environment.

in Intellij there is an "Inconsistent line separators inspection", to check if the files have "line terminator" different from the default setup for the project
"This inspection detects files with line separators different from the project default. E.g. you set the line separator to "\n" in the Settings|Code Style|Line separator, and the file you are editing uses '\r\n' as a line separator"

Thursday, February 13, 2020

Spring Integration nice tutorial here

code is available at

Sunday, February 9, 2020

Activiti BPM

Activiti is related to Alfresco. wikipedia here the userguide here excellent Activiti BPM presentation based on Eclipse

The Intellij Activiti BPM plugin doesn't seem to work any more (last update 2014)

Activiti gitub is here

Friday, January 3, 2020

Lasse Koskela, Effective Unit Testing

I am really enjoying this book, the Author reflects about the STRATEGIC importance of well written Unit Tests as a way to DRIVE development.

It focuses also on the importance of writing SIMPLE CODE and avoid unnecessary complication:

"One of the worst offenders of code quality and a major contributor to
developers’ productivity crawling to a halt is accidental complexity.
Accidental complexity is unnecessary complexity. It’s complexity that could
be avoided by substituting a simpler design that still meets the requirements. Sometimes
we programmers like to demonstrate our mental capacity by producing such
complex designs that we have trouble understanding them ourselves. I will bet you
recognize that primal instinct in yourself, too. The problem with complex designs is
that complexity kills productivity and unnecessary complexity is, well, unnecessary
and counterproductive."