14 January 2021

Java Copy Constructor

Sometimes we need to clone an object in Java, but not a reference (a junior developer may use). There are several ways to achieve this task; however, I recommend to use a copy-constructor (that comes from C++) and, in particular, using @Builder from Lombok (to avoid boilerplate code))


24 December 2020

curl cheat sheet

 Curl, the wget with steroids. https://curl.se/

1. response headers

curl -I http://localhost:8081/customers

HTTP/1.1 302
Set-Cookie: KC_REDIRECT=/customers; Path=/; HttpOnly
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Location: http://localhost:8081/sso/login
Transfer-Encoding: chunked
Date: Sun, 27 Dec 2020 15:38:57 GMT

2.  gzip call

curl -v -H "Content-Type: application/json" -H "Accept-Encoding: gzip" -I 

Content-Encoding: gzip
Content-Type: application/json

curl -v -H "Content-Type: application/json" -H "Accept-Encoding: gzip" -o four.json.gz

curl -v --compressed

3.  curl post

curl -k --max-time 30 -X GET ''
 --request GET

4. body:

curl -k --request POST '' --header 'Content-Type: application/json' --data-raw '{"user":{"user":"testuser","password":"welcome1","request-channel":1},"client-ID":"12345"}'

-d '{"query":{"match_all":{}}}'
-d, --data <data>

5. ssl


curl --cacert cacert.pem https://self-signed.badssl.com

6. cookie

--cookie "jsessionid=123"

7. timeout

--max-time 30

8. header

curl -H "Authorization: Basic YXBpdXNlcjphcGlwd2Q=" http://devweb.cl/status

9.  basic user?

--basic --user "redemption-br:GUkboMIZ"

07 December 2020

API Integrations Summary

The concept of API integrations is broad. This must consider a function and non-functional requirements (today called quality attributes).

There several ways to integrate to an API

One way that integrating with third-party, or partner, APIs can be easier is by using a client or SDK. API clients handle much of the overhead when interacting with an API. They can handle common tasks like:

  • Authentication
  • Error handling
  • Encoding requests and parsing responses
  • Simplifying requests
  • Offering a better user experience than direct usage
  1. API integration of workflow !
  2. different user story --> workflows !

Track performance

The work isn’t over once you set up your API integrations. While we all would like to “set and forget” an integration, the truth is that any dependency is also a liability. You can start by monitoring your API usage. Specifically, here are the metrics we think are the most important:

  •     Latency
  •     Response Time
  •     Availability
  •     Consumption
  •     Failure Rate
  •     Status Codes


  1. https://blog.cloud-elements.com/10-step-guide-designing-api-integration
  2. https://www.infoq.com/articles/api-first-integration/
  3. https://blog.bearer.sh/api-integration-best-practices/

Modern C for Absolute Beginners

Modern C for Absolute Beginners
A Friendly Introduction to the C Programming Language


Authors: Dmitrovic, Slobodan

05 December 2020

Posix Threads C11

simple example of Posix threads in C11, which doesn't have impl in gcc/clang. Remember to use -pthread as argument.

03 December 2020

Beginning C 6th edition

I am proud to participate as co-author in Beginning C - From Beginner to Pro, 6th Edition, press 2020.


Beginning C

From Beginner to Pro - 6th Edition

Authors: Gonzalez-Morris, German, Horton, Ivor
© 2020


05 November 2020


La apofenia (del griego ἀπό, apó, "separar, alejar", y φαίνειν, phaínein, "aparecer, manifestar(se) como fenómeno, fantasía") es la experiencia que consiste en ver patrones, conexiones o ambos en sucesos aleatorios o en datos sin sentido. 

Este término tiene acepciones diferentes en los ámbitos de la psicología y de la estadística, donde también suele utilizarse.[cita requerida]




En estadística, la apofenia suele estar relacionada con un error de tipo I, que puede llevar a conclusiones falsas en una investigación. La probabilidad de encontrar una asociación espuria o casual entre dos variables, y creer erróneamente que se ha encontrado una asociación real, se incrementa cuando en lugar de aplicar el método científico se realiza el hackeo estadístico de una base de datos (P-hacking). Esta mala práctica consiste en jugar con una base de datos y relacionar la variable dependiente con todas las posibles variables independientes hasta encontrar una asociación estadísticamente significativa, sin haber establecido previamente un marco conceptual y una hipótesis de investigación que justifiquen por qué se van a estudiar estas relaciones.2​ La publicación de estos resultados en revistas científicas es una de las causas de la pérdida de credibilidad y reproducibilidad de la ciencia, lo que ha llevado a muchos científicos a realizar manifiestos de alerta.3

30 October 2020



Del lat. sophisma, y este del gr. σόφισμα sóphisma.

1. m. Razón o argumento falso con apariencia de verdad.


23 October 2020


 Core dump of a lack of space at /tmp


Aborted (core dumped)
#   https://github.com/AdoptOpenJDK/openjdk-support/issues
# If you would like to submit a bug report, please visit:"
#  SIGBUS (0x7) at pc=0x00007f1240764eac, pid=6, tid=48#
# JRE version: OpenJDK Runtime Environment AdoptOpenJDK (11.0.8+10) (build 11.0.8+10)
# Java VM: OpenJDK 64-Bit Server VM AdoptOpenJDK (11.0.8+10, mixed mode, tiered, compressed oops, serial gc, linux-amd64)# C  [libc.so.6+0x18eeac]
# Problematic frame:
# Core dump will be written. Default location: /usr/app/core.6
# An error report file with more information is saved as:
# /usr/app/hs_err_pid6.log
# A fatal error has been detected by the Java Runtime Environment:

it is interesting that docker also has shared memory device configuration /dev/shm
through shm_size





My Blog List

Blog Archive


The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.