Author Archives: cyberaka

About cyberaka

I am an experienced Senior Solution Architect with proven history of designing robust and highly available Java based solutions. I am skilled in architecting designing and developing scalable, highly available, fault tolerant and concurrent systems which can serve high volume traffic. I have hands on experience in designing RESTful MicroServices architecture using Spring Boot, Spring Cloud, MongoDB, Java 8, Redis and Kafka. I like TDD (JUnit), BDD (Cucumber) and DDD based development as required for my projects. I have used AWS primarily for cloud based deployment and I like developing cloud enabled POC as a hobby in my spare time. I have deigned and developed CI/CD pipeline using Jenkins and leveraged Docker, Kubernetes for containerizing and deploying some of my applications. I am highly experienced in creating high performing technical teams from scratch. As an ex-entrepreneur I am very much involved in the business side of the IT industry. I love interacting with clients to understand their requirements and get the job done.

Detecting Java Processes listening on local ports

We can use the jps command that is part of JDK to find out which Java processes are running in the current user’s session. We can further find out which network ports have been opened by a particular java process.

Use the follwing command to list all java processes:
jps -l

If you want more details about a process you can execute the following command:
jps -v | findstr <process id>

The following variant of netstat command lists all the listening as well as established socket connection in a system:
netstat -ano

This command can be further used to find out what sockets are opened by a specific process
netstat -ano | findstr <process id>

Subversion Branch and Trunk Sync – Hands On

Subversion has got concept of branches and trunk. Usually the accepted approach is to keep the trunk stable and do all unstable work on the branch. I am going to document how you can create a branch from a workspace using the trunk of a subversion repository. Further I will show how to pull changes done on the branch back into the trunk and vice-versa.

Please replace the localhost:8443 with your subversion URL, the /svn/cjpcs_repo/trunk with your trunk folder and the /svn/cjpc_repo/branches/temp/abhinav with your intended branch folder.

First we create a branch from a workspace checked out to trunk. In this snippet we are creating a shallow copy of the trunk into a branch.
svn copy https://localhost:8443/svn/cjpc_repo/trunk https://localhost:8443/svn/cjpc_repo/branches/temp/abhinav -m "Created a personal branch for abhinav"

In order to start using the branch we need to checkout the branch into a workspace. In this snippet are checking out the branch into the current folder.
svn checkout https://localhost:8443/svn/cjpc_repo/branches/temp/abhinav .

Now you can make some changes on the branch workspace and commit it. Now we need to merge the changes done on branch into the trunk. So go to the trunk workspace and execute the following command. The first command updates the trunk. The second command pulls in all the changes from the branch into the current workspace. If the merge causes some conflicts you need to resolve it manually.
svn update
svn merge https://localhost:8443/svn/cjpc_repo/branches/temp/abhinav

Now commit the merged changes into the trunk. The first command commits the merges done into the trunk and the second command basically confirms the merge.
svn commit -m "Merging changes from the branch"
svn log

That’s it. Your trunk is updated with the changes done on the branch. The same approach can be applied for updating the branch with all the changes on the trunk. The following short snippet summarizes the commands you should execute in your branch workspace to achieve a sync with trunk. If there are conflicts in the merge you need to resolve that manually.
svn update
svn merge https://localhost:8443/svn/cjpc_repo/trunk
svn commit -m "Merging changes from the trunk"

See hidden files in Mac OS Finder

I like to see all the files in the project folder where I am working. So it is inconvenient not being able to see “.gitignore” and “.git” inside the folder where I have git repository. On a brief lookup of the internet I found this article which proposes two approach of making hidden files visible in finder.

Approach #1: Using Terminal

To show hidden files
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder

To turn off showing of hidden files
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder

Approach #2: Using an App
Funter is a small app which allows the user to toggle the hidden file visibility on and off at the click of a button which is quite convenient.

What I used?
I preferred the terminal approach as I am fairly comfortable with it and I didn’t want to add a new application into my mac’s start-up and menu bar.

How to find Linux distribution and kernel version

In order find out what version of Linux you are running you can execute either of the following commands:

  • cat /etc/*-release
  • lsb_release -a
  • cat /proc/version
  • dmesg | head -1

To find out the kernel version of Linux you can execute either of the following commands:

  • uname -a
  • uname -mrs

Disclaimer: These commands worked for me on Debian Linux.

Update for Oracle Linux

The following commands gave accurate information about OS and release numbers on Oracle Linux.

rpm -qf /etc/redhat-release

oraclelinux-release-6Server-8.0.3.x86_64
cat /etc/issue.net | head -1

Oracle Linux Server release 6.8

 

Multi tabbed windows explorer

In this world of multi-tabbed browsing I find it inconvenient that Windows Explorer has no multi tabbed support. I did some search and found out Clover. I downloaded and installed this tool and voila my Windows Explorer has got tabs. The tool itself is simple and integrates seamlessly with Windows Explorer in Windows 8. I have not had time to check it on my Windows 7 laptop, maybe sometime soon I will post an update.

Creating console based applications in Java

Writing a console based app might sound strange to some Java programmers but for some specific purposes writing a console based application is a necessity. For example let’s say I have write an application which needs to be monitored via SSH. In that either we have to come up with some elaborate command line arguments or special purpose log files. However another approach is write the application and give it a text based GUI which is accessible via textual console like putty, konsole, xterm, gnome-terminal etc. The closes thing that comes to mind is ncurses coming from the C world. We have something similar for Java also available and based on some reports I feel that they are stable enough to be used in any production environment which have need for a light weight, low bandwidth textual client.

  1. Lanterna – 100% Java solution. Very interesting.
  2. Blacken – Not a curses library an has it’s own renderer. The API is however curses-like.
  3. Java Curses Library – It’s built upon the Unix curses windowing system.
  4. Charva – A reliable tool that allows rapid building of UI using OOP approach. Existing UI programmers will definitely like it. It however uses JNI.

 

Production helper utility for Java team

I have been thinking about going through some of these tools to get more productive in deploying / delivering Java based web apps to the team:

Drop Jar is a helpful tool to share jar files.

Drop Wizard is a helpful tool for delivering production read jar files.

Spring Boot allows developers to create web apps easily using convention over configuration.

Shade Plugin allows a Maven based build to overcome duplicate / incompatible versions of libraries. If you have been bitten by incompatible log files you know what I mean.

Open IoT Stack (Internet of Things)

I came across this article on DZone which talks about Open IoT Stack for Java. This stack is envisioned to allow developers to make apps on light weight devices to build IoT solutions. This press release from Eclipse drives home the point as to why IoT is no longer a hype and much more of an imminent reality in the near future. Another report from Vision Mobile talks about how a network of app entrepreneurs might push IoT to unprecedented heights.