Sekai 🌐 🗺

Sekai (世界) is the kanji for “the world”. That’s a great word because of the scale that it designates.

Start Oracle From Git Bash

Goal To run Oracle SQL in Git Bash. Assumption You have sqlplus added to your PATH. export PATH=${PATH}:/c/oraclexe/app/oracle/product/11.2.0/server/bin/ Problem The option /nolog doesn’t work as expected. $ sqlplus /nolog SQL*Plus: Release 11.2.0.2.0 Production on Mer. Juin 7 09:43:47 2023 Copyright (c) 1982, 2014, Oracle. All rights reserved. … When SQL*Plus starts, and after CONNECT commands, the site profile (e.g. $ORACLE_HOME/sqlplus/admin/glogin.sql) and the user profile (e.g. login.sql in the working directory) are run. [Read More]

Closer Look into ArrayList Iterator

Background Given an ArrayList of Integers from 0 (inclusive) to 10 (exclusive) with step size 1. We use a while-loop and an Iterator<Integer> to check if this ArrayList hasNext() element, before we remove() the current element. Problem The code below throws an IllegalStateException. import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class UnderstandArrayListIterator { public static void main(String[] args) { List<Integer> a = new ArrayList<>(); for (int i = 0; i < 10; i++) { a. [Read More]
Java 

Notes du Jour

Plus importante que les techno

Dans le classique schéma pour la gestion du projet, on met le besoin du client d’abord. C’est important de l’entendre avant de commencer le traf. Sinon, on risque de perdre des heures (ou pire des jours) sur une chose que le client ne valide pas. Avant d’y mettre l’effort, il est bon de lui montrer idée générale et de lui demander un avis, afin d’éviter de lui délivrer un produit qu’il ne veut pas. [Read More]

Passed Codingame Java Certification Test

A note to some forgotten methods

String regex replace using capture groups

Since Java SE 9, java.util.regex.Matcher’s replaceAll() method supports lambda expressions.

// import java.util.regex.*;
String varName = "random_string";
Pattern pattern = Pattern.compile("_([a-z])");
Matcher matcher = pattern.matcher(varName);
String result = matcher.replaceAll(m -> m.group(1).toUpperCase());

Source: Arvind Kumar Avinash’s answer on Stack Overflow

Check characters properties using Character’s static methods

The Character class provides some static predicates like

  • isAlphabetic(char c)
  • isDigit(char c)
  • isLowerCase(char c)

Source: Java Character isAlphabetic() Method on Javapoint

Fixed Archetype Error for This Site

Background In Customized Archetype for This Site, I was using {{ slicestr .Name 11 | humanize | title }} in the title attribute in my site’s archetypes/default.md, so that the first 11 characters (YYYY-MM-DD-) would be taken out if I type this command. $ hugo new post/$(date -I)-<MY_POST_TITLE>.md In practice, <MY_POST_TITLE> can be replaced to any title, like my-post-title. Problem I wanted to create my IntelliJ cheatsheet, so I typed this command. [Read More]
Hugo 

Exploration of My First IntelliJ Project

We’ll try to stay in the project root if possible. Find all non-hidden files to know the file structure. $ find -path './.*' -prune -o -type f -print ./Algo-init.iml ./out/production/Algo-init/fr/eql/ai114/algo/init/demo/_1_HelloWorld.class ./src/fr/eql/ai114/algo/init/demo/_1_HelloWorld.java -prune returns true for the chosen path and prevents find from descending. -o means OR, so the paths matching -prune won’t pass through -o. -type f selects files, not folders. By default, AND is used to connect different conditions. [Read More]

Reuse Commands with Shell Arguments

My arguments for arguments, functions and alias

Background We often want to test the output with different values for a parameter. Here’s an example: we have a parameter that pandoc uses to / compile source code files to PDF / M$ Word / etc. rm output.html; param=0; pandoc input$param.txt -o output.html; \ echo param = $param In practice, a parameter can be a font, the font size, etc, and there can be multiple parameters. Problem To change the value in the parameter (e. [Read More]
linux  tcsh