Posts

Showing posts from 2025

Apple MacOS Finder show hidden files and directories

MacOS Finder app has built-in ability to display hidden files and directories, but there is no UI options or settings to toggle the feature on/off. Instead we have to use keyboard shortcut or Terminal command to toggle the display of hidden files and directories. Toggle the display of hidden files or directory using the following shortcut in Finder : Command+Shift+.(dot) key To make the Finder to permanently display hidden files and directory, execute the following command in Terminal defaults write com.apple.Finder AppleShowAllFiles true && killall Finder To make the Finder to permanently hide hidden files and directory, execute the following command in Terminal defaults write com.apple.Finder AppleShowAllFiles false && killall Finder

Ubuntu (Linux) Desktop using RDP GUI with Windows WSL

This article explains the steps to setup Ubuntu virtual machine with Desktop environment on Windows using Window's Subsystem for Linux (WSL) and be able to connect to Ubuntu using Window's builtin Remote Desktop Protocol (RDP) app. Enable WSL on Windows: Enabling the features can be done only using administrator user. In corporate laptop or enterprises, this step is performed by Windows Administrator. Through GUI: Start -> Search -> Turn Windows feature on or off Virtual Machine Platform -> Tick Windows Hypervisor Platform -> Tick Window Subsystem for Linux -> Tick Click OK Wait for some installations to complete Restart Windows Through Terminal: dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart dism /online /enable-feature /featurename:HypervisorPlatform /all /norestart dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart Restart-Computer Install Ubuntu: Start -> Terminal and execut...

Install Java JDK on Linux or MacOS

This article explains the steps involved to install Java JDK on Linux or MacOS. Get the architecture of the Machine from Terminal using: uname -m Create a directory for installation: mkdir -p $HOME/tools/java Download latest java LTS binary: Download java 25 binary for Linux / Mac OS operating system with the correct architecture type to directory $HOME/tools/java Download URL https://adoptium.net/en-GB/temurin/releases?mode=filter&os=any&arch=any Extract and rename java binary: find $HOME/tools/java -type f -name OpenJDK25*.tar.gz | xargs -I {} mv {} $HOME/tools/java/OpenJDK25.tar.gz tar -xvzf $HOME/tools/java/OpenJDK25.tar.gz -C $HOME/tools/java find $HOME/tools/java -type d -name jdk-25* | xargs -I {} mv {} $HOME/tools/java/jdk-25 Make the extracted binaries as executables: chmod a+rwx -R $HOME/tools/java/* Identify the shell used in the Terminal using: echo $SHELL Configure PATH: Add the following lines to $HOME/.bash_profile or $HOME/.bashrc or $HOME/.zprofile based on ...

Maven - Manual installation on Linux or MacOS

This article explains the steps to manually install a specific version of maven downloaded directly from maven website or internal artificatory of an organisation. Create a directory for installation: mkdir -p $HOME/tools/maven Download the binary: From https://maven.apache.org/download.cgi download latest static binary eg: apache-maven-3.9.11-bin.tar.gz to $HOME/tools/maven directory Extract and rename the binary: find $HOME/tools/maven -type f -name apache-maven-*.tar.gz | xargs -I {} mv {} $HOME/tools/maven/apache-maven-bin.tar.gz tar -xvzf $HOME/tools/maven/apache-maven-bin.tar.gz -C $HOME/tools/maven find $HOME/tools/maven -type d -name apache-maven-* | xargs -I {} mv {} $HOME/tools/maven/apache-maven Make files executable: chmod a+rwx -R $HOME/tools/maven/* Identify the shell type: echo $SHELL Configure PATH: Add the following lines to $HOME/.bash_profile or $HOME/.bashrc  or  $HOME/.zprofile  and restart system for the changes to take effect export MAVEN_HOME=$...

UTM - Run Windows Virtual Machine on Mac

This blog is a step by step guide on how to run a Windows Virtual Machine on MacOS using UTM (Open Source Virtual Machine Tool). Also the settings needed to share Clipboard and Directory between Windows and MacOS. Download and Install UTM application on MacOS from https://mac.getutm.app/ Download Windows 11 iso file from Microsoft https://www.microsoft.com/en-us/software-download/windows11 Download Windows Guest tool iso file https://getutm.app/downloads/utm-guest-tools-latest.iso Steps to create Windows 11 Virtual Machine Click Create a New Virtual Machine Click Virtualize Select Windows Set memory as 12288 MiB Set CPU Cores as 3 Click Continue Tick Install Windows 10 or higher Click Browse and select Windows 11 iso file Tick Install drivers and SPICE tools Click Continue Set size at 64 GiB Click Continue Do not set Shared Directory Path now, we can do it after installation Click Continue Set Name as Windows Click Save Steps to install Windows 11 Click on Windows In first CD/DVD, sele...

UTM - Run Ubuntu Virtual Machine on Mac

This blog is a step by step guide on how to run a Ubuntu (Linux) Virtual Machine on MacOS using UTM (Open Source Virtual Machine Tool). Also the settings needed to share Clipboard and Directory between Ubuntu and MacOS. Youtube video: The video shows the step by step description of this blog https://youtu.be/pJeVoRndfz4?si=u5LUvctXZ9RDPQoJ Download UTM Download and Install UTM application on MacOS from https://mac.getutm.app/ Download Ubuntu ISO file Download Intel or AMD 64-bit architecture Ubuntu LTS iso file from https://ubuntu.com/download/desktop Create Ubuntu Virtual Machine Open UTM File Menu -> New Select Virtualize Select Linux Set Memory as 12288 MiB Set CPU Cores as 3 or higher Check Enable display output Uncheck Enable hardware OpenGL acceleration Click Continue Uncheck Use Apple Virtualization Select Boot Image Type as Boot from ISO image Click Browse and select the download Ubuntu LTS iso image Click Continue Set size of the drive as 64 GiB or higher Click Continue Do ...

Simple in memory cache with plain Java

The following example is simple in memory cache using plain java without using any third party cache libraries. The below implementation shows expiry time based cache eviction and setting maximum cache size. If used with Spring Framework, it is ideal to make this class as DisposableBean to safely execute the shutdown method during application shutdown event. As below @Component public class SimpleCache implements DisposableBean { @Override public void destroy () throws Exception { shutdown(); } } Full implementation: import java.time.Duration ; import java.time.Instant ; import java.util.Comparator ; import java.util.Objects ; import java.util.UUID ; import java.util.concurrent.ConcurrentHashMap ; import java.util.concurrent.Executors ; import java.util.concurrent.ScheduledExecutorService ; import java.util.concurrent.TimeUnit ; public class SimpleCache { public record HeavyObject ( UUID id , String firstName , String lastName ) { } private record CacheValue (...

Unix Essential Commands

This article explains the commands that I have learnt and used in my everyday programming life. chmod command (change a file mode) Symbol and its meaning u -> user g -> group o -> others a -> all r -> read w -> write (and delete) x -> execute (and access directory) + -> add permission - -> take away/remove permission  $ chmod go-rwx biglist To remove read write and execute permissions on the file/directory biglist for the group and others $ chmod a+rw biglist To give read and write permissions on the file/directory biglist to all, $ chmod u+rwx,g+rw,o-rwx test.file Set multiple permission in single command $ chmod a+rwx directory/* To give permission to all files in a directory $ chmod -R a+rwx directory/* To give permission to all files/directories in a directory and its sub directories cut command printf "Hello\tworld\nHi\tthere\n" | cut -f 2 Outputs the 2nd element after splitting the tab separated columns. -f value starts from 1 ech...